diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/code/application.js b/code/application.js new file mode 100644 index 0000000..5e0e199 --- /dev/null +++ b/code/application.js @@ -0,0 +1,61 @@ +System.register([], function (_export, _context) { + "use strict"; + + var cc, Application; + function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } + function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } + function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } + return { + setters: [], + execute: function () { + _export("Application", Application = /*#__PURE__*/function () { + function Application() { + _classCallCheck(this, Application); + this.settingsPath = 'src/settings.json'; + this.showFPS = false; + } + _createClass(Application, [{ + key: "init", + value: function init(engine) { + cc = engine; + cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this)); + cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this)); + } + }, { + key: "onPostInitBase", + value: function onPostInitBase() { + // cc.settings.overrideSettings('assets', 'server', ''); + // do custom logic + } + }, { + key: "onPostSystemInit", + value: function onPostSystemInit() { + // do custom logic + } + }, { + key: "start", + value: function start() { + return cc.game.init({ + debugMode: false ? cc.DebugMode.INFO : cc.DebugMode.ERROR, + settingsPath: this.settingsPath, + overrideSettings: { + // assets: { + // preloadBundles: [{ bundle: 'main', version: 'xxx' }], + // } + profiling: { + showFPS: this.showFPS + } + } + }).then(function () { + return cc.game.run(); + }); + } + }]); + return Application; + }()); + } + }; +}); \ No newline at end of file diff --git a/code/assets/3d_models/config.json b/code/assets/3d_models/config.json new file mode 100644 index 0000000..3d27b2a --- /dev/null +++ b/code/assets/3d_models/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"3d_models","deps":["main"],"uuids":["0a53ee950","0c0a498a0","e2Y/hxG/5JJ4f+EuJgfHP4@63096","e2Y/hxG/5JJ4f+EuJgfHP4@b811d","e2Y/hxG/5JJ4f+EuJgfHP4@cd189","e4sZyu/AFCepU5HK+e0zbc@006bd","e4sZyu/AFCepU5HK+e0zbc@0089c","e4sZyu/AFCepU5HK+e0zbc@01feb","e4sZyu/AFCepU5HK+e0zbc@03ec6","e4sZyu/AFCepU5HK+e0zbc@04761","e4sZyu/AFCepU5HK+e0zbc@067c6","e4sZyu/AFCepU5HK+e0zbc@07f2f","e4sZyu/AFCepU5HK+e0zbc@0af0b","e4sZyu/AFCepU5HK+e0zbc@0c6f1","e4sZyu/AFCepU5HK+e0zbc@0c93e","e4sZyu/AFCepU5HK+e0zbc@0dd94","e4sZyu/AFCepU5HK+e0zbc@0f9a3","e4sZyu/AFCepU5HK+e0zbc@0fa64","e4sZyu/AFCepU5HK+e0zbc@101c7","e4sZyu/AFCepU5HK+e0zbc@10486","e4sZyu/AFCepU5HK+e0zbc@14738","e4sZyu/AFCepU5HK+e0zbc@161ec","e4sZyu/AFCepU5HK+e0zbc@1827c","e4sZyu/AFCepU5HK+e0zbc@1ca10","e4sZyu/AFCepU5HK+e0zbc@1d105","e4sZyu/AFCepU5HK+e0zbc@1eaad","e4sZyu/AFCepU5HK+e0zbc@1f444","e4sZyu/AFCepU5HK+e0zbc@221a5","e4sZyu/AFCepU5HK+e0zbc@23859","e4sZyu/AFCepU5HK+e0zbc@240d8","e4sZyu/AFCepU5HK+e0zbc@2a682","e4sZyu/AFCepU5HK+e0zbc@2a87f","e4sZyu/AFCepU5HK+e0zbc@2bc87","e4sZyu/AFCepU5HK+e0zbc@2cd19","e4sZyu/AFCepU5HK+e0zbc@2e76e","e4sZyu/AFCepU5HK+e0zbc@2e78d","e4sZyu/AFCepU5HK+e0zbc@2f00a","e4sZyu/AFCepU5HK+e0zbc@2f6d1","e4sZyu/AFCepU5HK+e0zbc@31c60","e4sZyu/AFCepU5HK+e0zbc@35e77","e4sZyu/AFCepU5HK+e0zbc@3693d","e4sZyu/AFCepU5HK+e0zbc@39e53","e4sZyu/AFCepU5HK+e0zbc@3bc15","e4sZyu/AFCepU5HK+e0zbc@3c999","e4sZyu/AFCepU5HK+e0zbc@3d208","e4sZyu/AFCepU5HK+e0zbc@3e076","e4sZyu/AFCepU5HK+e0zbc@3e23d","e4sZyu/AFCepU5HK+e0zbc@3effa","e4sZyu/AFCepU5HK+e0zbc@3f608","e4sZyu/AFCepU5HK+e0zbc@3f79a","e4sZyu/AFCepU5HK+e0zbc@404ea","e4sZyu/AFCepU5HK+e0zbc@41791","e4sZyu/AFCepU5HK+e0zbc@422fc","e4sZyu/AFCepU5HK+e0zbc@4275b","e4sZyu/AFCepU5HK+e0zbc@48729","e4sZyu/AFCepU5HK+e0zbc@49b18","e4sZyu/AFCepU5HK+e0zbc@4affa","e4sZyu/AFCepU5HK+e0zbc@4c2f7","e4sZyu/AFCepU5HK+e0zbc@4f501","e4sZyu/AFCepU5HK+e0zbc@4f540","e4sZyu/AFCepU5HK+e0zbc@50743","e4sZyu/AFCepU5HK+e0zbc@50f7f","e4sZyu/AFCepU5HK+e0zbc@51278","e4sZyu/AFCepU5HK+e0zbc@51c5c","e4sZyu/AFCepU5HK+e0zbc@52127","e4sZyu/AFCepU5HK+e0zbc@531b0","e4sZyu/AFCepU5HK+e0zbc@54d9f","e4sZyu/AFCepU5HK+e0zbc@5501b","e4sZyu/AFCepU5HK+e0zbc@55257","e4sZyu/AFCepU5HK+e0zbc@56552","e4sZyu/AFCepU5HK+e0zbc@58994","e4sZyu/AFCepU5HK+e0zbc@59be8","e4sZyu/AFCepU5HK+e0zbc@5c5bd","e4sZyu/AFCepU5HK+e0zbc@5f29a","e4sZyu/AFCepU5HK+e0zbc@5f893","e4sZyu/AFCepU5HK+e0zbc@60a81","e4sZyu/AFCepU5HK+e0zbc@65e4a","e4sZyu/AFCepU5HK+e0zbc@69af2","e4sZyu/AFCepU5HK+e0zbc@6af60","e4sZyu/AFCepU5HK+e0zbc@6cae0","e4sZyu/AFCepU5HK+e0zbc@6ee89","e4sZyu/AFCepU5HK+e0zbc@6fe55","e4sZyu/AFCepU5HK+e0zbc@72311","e4sZyu/AFCepU5HK+e0zbc@72c32","e4sZyu/AFCepU5HK+e0zbc@73f47","e4sZyu/AFCepU5HK+e0zbc@742df","e4sZyu/AFCepU5HK+e0zbc@7597f","e4sZyu/AFCepU5HK+e0zbc@781f0","e4sZyu/AFCepU5HK+e0zbc@78ea3","e4sZyu/AFCepU5HK+e0zbc@7b290","e4sZyu/AFCepU5HK+e0zbc@7eb92","e4sZyu/AFCepU5HK+e0zbc@809b5","e4sZyu/AFCepU5HK+e0zbc@809d9","e4sZyu/AFCepU5HK+e0zbc@8222a","e4sZyu/AFCepU5HK+e0zbc@8229f","e4sZyu/AFCepU5HK+e0zbc@8598a","e4sZyu/AFCepU5HK+e0zbc@87329","e4sZyu/AFCepU5HK+e0zbc@89667","e4sZyu/AFCepU5HK+e0zbc@8c06b","e4sZyu/AFCepU5HK+e0zbc@8f420","e4sZyu/AFCepU5HK+e0zbc@90288","e4sZyu/AFCepU5HK+e0zbc@90611","e4sZyu/AFCepU5HK+e0zbc@9333c","e4sZyu/AFCepU5HK+e0zbc@935b9","e4sZyu/AFCepU5HK+e0zbc@9395b","e4sZyu/AFCepU5HK+e0zbc@95418","e4sZyu/AFCepU5HK+e0zbc@96cab","e4sZyu/AFCepU5HK+e0zbc@98962","e4sZyu/AFCepU5HK+e0zbc@98d72","e4sZyu/AFCepU5HK+e0zbc@99ea5","e4sZyu/AFCepU5HK+e0zbc@9b633","e4sZyu/AFCepU5HK+e0zbc@9b782","e4sZyu/AFCepU5HK+e0zbc@9c3d2","e4sZyu/AFCepU5HK+e0zbc@9d0a2","e4sZyu/AFCepU5HK+e0zbc@9faa0","e4sZyu/AFCepU5HK+e0zbc@a0c07","e4sZyu/AFCepU5HK+e0zbc@a1f5c","e4sZyu/AFCepU5HK+e0zbc@a21ca","e4sZyu/AFCepU5HK+e0zbc@a27a5","e4sZyu/AFCepU5HK+e0zbc@a2905","e4sZyu/AFCepU5HK+e0zbc@a2999","e4sZyu/AFCepU5HK+e0zbc@a3985","e4sZyu/AFCepU5HK+e0zbc@a4654","e4sZyu/AFCepU5HK+e0zbc@a4688","e4sZyu/AFCepU5HK+e0zbc@a61a2","e4sZyu/AFCepU5HK+e0zbc@a6a64","e4sZyu/AFCepU5HK+e0zbc@a6b6e","e4sZyu/AFCepU5HK+e0zbc@a87a2","e4sZyu/AFCepU5HK+e0zbc@ab0a9","e4sZyu/AFCepU5HK+e0zbc@af523","e4sZyu/AFCepU5HK+e0zbc@b20c6","e4sZyu/AFCepU5HK+e0zbc@b2533","e4sZyu/AFCepU5HK+e0zbc@b36a3","e4sZyu/AFCepU5HK+e0zbc@b4805","e4sZyu/AFCepU5HK+e0zbc@b4841","e4sZyu/AFCepU5HK+e0zbc@b5f0d","e4sZyu/AFCepU5HK+e0zbc@b719f","e4sZyu/AFCepU5HK+e0zbc@b8e05","e4sZyu/AFCepU5HK+e0zbc@b9514","e4sZyu/AFCepU5HK+e0zbc@bc876","e4sZyu/AFCepU5HK+e0zbc@bcb27","e4sZyu/AFCepU5HK+e0zbc@bf0b5","e4sZyu/AFCepU5HK+e0zbc@c1860","e4sZyu/AFCepU5HK+e0zbc@c5910","e4sZyu/AFCepU5HK+e0zbc@c7100","e4sZyu/AFCepU5HK+e0zbc@c8890","e4sZyu/AFCepU5HK+e0zbc@ca748","e4sZyu/AFCepU5HK+e0zbc@cbac6","e4sZyu/AFCepU5HK+e0zbc@cdec0","e4sZyu/AFCepU5HK+e0zbc@d0968","e4sZyu/AFCepU5HK+e0zbc@d0c04","e4sZyu/AFCepU5HK+e0zbc@d4524","e4sZyu/AFCepU5HK+e0zbc@d5b5e","e4sZyu/AFCepU5HK+e0zbc@d5db4","e4sZyu/AFCepU5HK+e0zbc@d932b","e4sZyu/AFCepU5HK+e0zbc@daa6a","e4sZyu/AFCepU5HK+e0zbc@db620","e4sZyu/AFCepU5HK+e0zbc@dd038","e4sZyu/AFCepU5HK+e0zbc@ddf8f","e4sZyu/AFCepU5HK+e0zbc@df4b3","e4sZyu/AFCepU5HK+e0zbc@e0fe4","e4sZyu/AFCepU5HK+e0zbc@e1124","e4sZyu/AFCepU5HK+e0zbc@e3218","e4sZyu/AFCepU5HK+e0zbc@e461a","e4sZyu/AFCepU5HK+e0zbc@e5ade","e4sZyu/AFCepU5HK+e0zbc@e5e90","e4sZyu/AFCepU5HK+e0zbc@e6790","e4sZyu/AFCepU5HK+e0zbc@e73c6","e4sZyu/AFCepU5HK+e0zbc@eb942","e4sZyu/AFCepU5HK+e0zbc@ec5f7","e4sZyu/AFCepU5HK+e0zbc@efc56","e4sZyu/AFCepU5HK+e0zbc@f2d5a","e4sZyu/AFCepU5HK+e0zbc@f319c","e4sZyu/AFCepU5HK+e0zbc@f3c0a","e4sZyu/AFCepU5HK+e0zbc@f4010","e4sZyu/AFCepU5HK+e0zbc@f7e17","e4sZyu/AFCepU5HK+e0zbc@f9ec9","e4sZyu/AFCepU5HK+e0zbc@fc0b8","c89m0XNRpI2qEsAhLShXXE","e4sZyu/AFCepU5HK+e0zbc@0ef36","e4sZyu/AFCepU5HK+e0zbc@1f3c6","e4sZyu/AFCepU5HK+e0zbc@9d8cd","e4sZyu/AFCepU5HK+e0zbc@caddf","e4sZyu/AFCepU5HK+e0zbc@d8bd3","e4sZyu/AFCepU5HK+e0zbc@f1375"],"paths":{"2":["73_collider/UBX_DefaultRootName_001",0,1],"3":["73_collider/CT MATERIAL_A",1,1],"4":["73_collider/73_collider",2,1],"5":["zavod/UnnamedTexture-7",3,1],"6":["zavod/UnnamedTexture-2",3,1],"7":["zavod/UnnamedTexture-46",3,1],"8":["zavod/build.001",0,1],"9":["zavod/73.001",0,1],"10":["zavod/UnnamedTexture-32",3,1],"11":["zavod/bump_reticular_05k-40",4,1],"12":["zavod/ground",0,1],"13":["zavod/Concrete-30",1,1],"14":["zavod/UnnamedTexture-21",3,1],"15":["zavod/UnnamedTexture-24",3,1],"16":["zavod/koj.004",0,1],"17":["zavod/scratched_metal_normal_opengl-30",4,1],"18":["zavod/UnnamedTexture-42",3,1],"19":["zavod/UnnamedTexture-16",3,1],"20":["zavod/UnnamedTexture-20",3,1],"21":["zavod/blue.025-20",1,1],"22":["zavod/ground.004-17",1,1],"23":["zavod/Green.011-8",1,1],"24":["zavod/UnnamedTexture-35",3,1],"25":["zavod/Green painted lightly scratched metal-23",1,1],"26":["zavod/Metal_normal-18",4,1],"27":["zavod/UnnamedTexture-1",3,1],"28":["zavod/koj.003",0,1],"29":["zavod/UnnamedTexture-26",3,1],"30":["zavod/UnnamedTexture-47",3,1],"31":["zavod/UnnamedTexture-27",3,1],"32":["zavod/13",0,1],"33":["zavod/same",0,1],"34":["zavod/plane",0,1],"35":["zavod/Metal_basecolor-19",4,1],"36":["zavod/scratched_metal_metallic-scratched_metal_glossiness-32",4,1],"37":["zavod/Cube",0,1],"38":["zavod/scratches-2.jpg-metal-smudge-smoothness-3.jpg-7",4,1],"39":["zavod/build.006",0,1],"40":["zavod/UnnamedTexture-43",3,1],"41":["zavod/betonambientocclusion-34",4,1],"42":["zavod/Сортировка АР",0,1],"43":["zavod/UnnamedTexture-15",3,1],"44":["zavod/UnnamedTexture-52",3,1],"45":["zavod/12",0,1],"46":["zavod/build.005",0,1],"47":["zavod/UnnamedTexture-0",3,1],"48":["zavod/pol",0,1],"49":["zavod/metal floor_ao-17",4,1],"50":["zavod/UnnamedTexture-37",3,1],"51":["zavod/Edge Wear Dull Blue-26",1,1],"52":["zavod/Scratched Rusted Painted Metal Edge Wear-28",1,1],"53":["zavod/bp",0,1],"54":["zavod/metal_yellow_diffuse-14",4,1],"55":["zavod/1",0,1],"56":["zavod/ground.007-21",1,1],"57":["zavod/ground.001",0,1],"58":["zavod/pol.002",0,1],"59":["zavod/build.004",0,1],"60":["zavod/UnnamedTexture-5",3,1],"61":["zavod/UnnamedTexture-22",3,1],"62":["zavod/UnnamedTexture-28",3,1],"63":["zavod/UnnamedTexture-38",3,1],"64":["zavod/Green.009-6",1,1],"65":["zavod/UnnamedTexture-8",3,1],"66":["zavod/Matal_solid_paint_white_Base Color-23",4,1],"67":["zavod/metal_metallic.jpg-metal_glossiness.jpg-3",4,1],"68":["zavod/UnnamedTexture-12",3,1],"69":["zavod/4",0,1],"70":["zavod/Purple painted lightly scratched metal-7",1,1],"71":["zavod/UnnamedTexture-45",3,1],"72":["zavod/metal pomalowany_Albedo-26",4,1],"73":["zavod/Metal mesh 1_Emissive-43",4,1],"74":["zavod/metal_normal_opengl-37",4,1],"75":["zavod/Scratched red metal-4",1,1],"76":["zavod/Scratched Rusted Painted Metal Edge Wear-11",1,1],"77":["zavod/Scratched red metal-5",1,1],"78":["zavod/Matal_solid_paint_white_Normal-22",4,1],"79":["zavod/Metal mesh 1_BaseColor-Metal mesh 1_Alpha-45",4,1],"80":["zavod/metal floor_diffuseOriginal-16",4,1],"81":["zavod/scratches-2-6",4,1],"82":["zavod/UnnamedTexture-29",3,1],"83":["zavod/9",0,1],"84":["zavod/UnnamedTexture-48",3,1],"85":["zavod/Material.021-13",1,1],"86":["zavod/metal02_diffuse-38",4,1],"87":["zavod/Edge Wear Orange-3",1,1],"88":["zavod/UnnamedTexture-50",3,1],"89":["zavod/blue.001-34",1,1],"90":["zavod/Damaged painted metal-22",1,1],"91":["zavod/koj.005",0,1],"92":["zavod/UnnamedTexture-13",3,1],"93":["zavod/Metal mesh 1_Normal-44",4,1],"94":["zavod/build.008",0,1],"95":["zavod/Yellow painted lightly scratched metal-12",1,1],"96":["zavod/rock-10_diffuse-41",4,1],"97":["zavod/Green.013-9",1,1],"98":["zavod/metal_normal_opengl-1",4,1],"99":["zavod/scratches-1-13",4,1],"100":["zavod/UnnamedTexture-40",3,1],"101":["zavod/metal_metallic.jpg-metal_glossiness.jpg-39",4,1],"102":["zavod/scratches-1-12",4,1],"103":["zavod/koj.001",0,1],"104":["zavod/build.003",0,1],"105":["zavod/betonnormal-33",4,1],"106":["zavod/UnnamedTexture-30",3,1],"107":["zavod/UnnamedTexture-19",3,1],"108":["zavod/Edge Wear Dull Blue-25",1,1],"109":["zavod/UnnamedTexture-6",3,1],"110":["zavod/UnnamedTexture-3",3,1],"111":["zavod/UnnamedTexture-4",3,1],"112":["zavod/UnnamedTexture-9",3,1],"113":["zavod/UnnamedTexture-49",3,1],"114":["zavod/Ограда",0,1],"115":["zavod/metal_purple_diffuse-4",4,1],"116":["zavod/Matal_solid_paint_white_Metallic-Matal_solid_paint_white_Roughness-24",4,1],"117":["zavod/19",0,1],"118":["zavod/Brown scratched brushed metal-27",1,1],"119":["zavod/UnnamedTexture-11",3,1],"120":["zavod/UnnamedTexture-31",3,1],"121":["zavod/blue.013-1",1,1],"122":["zavod/UnnamedTexture-51",3,1],"123":["zavod/UnnamedTexture-41",3,1],"124":["zavod/build",0,1],"125":["zavod/koj.006",0,1],"126":["zavod/name",0,1],"127":["zavod/koj",0,1],"128":["zavod/14",0,1],"129":["zavod/Purple painted lightly scratched metal-2",1,1],"130":["zavod/74",0,1],"131":["zavod/kj",0,1],"132":["zavod/UnnamedTexture-33",3,1],"133":["zavod/Metal_roughness-20",4,1],"134":["zavod/UnnamedTexture-14",3,1],"135":["zavod/Metal mesh-33",1,1],"136":["zavod/UnnamedTexture-36",3,1],"137":["zavod/Matal solid paint white-16",1,1],"138":["zavod/pol.003",0,1],"139":["zavod/UnnamedTexture-44",3,1],"140":["zavod/UnnamedTexture-25",3,1],"141":["zavod/betonroughness-35",4,1],"142":["zavod/Green.014-10",1,1],"143":["zavod/Edge Wear Orange-24",1,1],"144":["zavod/Metal-15",1,1],"145":["zavod/UnnamedTexture-39",3,1],"146":["zavod/Rock Ground Texture-32",1,1],"147":["zavod/yellow-19",1,1],"148":["zavod/Material.020-18",1,1],"149":["zavod/UnnamedTexture-23",3,1],"150":["zavod/rock-10_roughness-42",4,1],"151":["zavod/UnnamedTexture-17",3,1],"152":["zavod/build.007",0,1],"153":["zavod/metal pomalowany_Metalness-metal pomalowany_Roughness-27",4,1],"154":["zavod/UnnamedTexture-18",3,1],"155":["zavod/koj.002",0,1],"156":["zavod/Metal mesh 1_Metallic-Metal mesh 1_Roughness-46",4,1],"157":["zavod/pol.001",0,1],"158":["zavod/8",0,1],"159":["zavod/ground.002",0,1],"160":["zavod/Blue painted damaged metal-31",1,1],"161":["zavod/steel06_basecolor-10",4,1],"162":["zavod/build.002",0,1],"163":["zavod/scratched_metal08_diffuse-31",4,1],"164":["zavod/scratches-2-metal-smudge-smoothness-3.jpg-28",4,1],"165":["zavod/metal_metallic-metal_glossiness-5",4,1],"166":["zavod/steel_metallic-steel_glossiness-11",4,1],"167":["zavod/metal_green_diffuse-2",4,1],"168":["zavod/steel_normal_opengl-9",4,1],"169":["zavod/Concrete-29",1,1],"170":["zavod/Green painted lightly scratched metal-0",1,1],"171":["zavod/metal pomalowany_Normal-25",4,1],"172":["zavod/UnnamedTexture-34",3,1],"173":["zavod/ugol",0,1],"174":["zavod/GK_korp",0,1],"175":["zavod/UnnamedTexture-10",3,1],"176":["zavod/metal floor_normal-15",4,1],"177":["zavod/Metal floor-14",1,1],"179":["zavod/Matal_solid_paint_white_Specular-21",4,1],"180":["zavod/scratched_metal_specular-29",4,1],"181":["zavod/zavod",2,1],"182":["zavod/metal_specular-36",4,1],"183":["zavod/steel_specular-8",4,1],"184":["zavod/metal_specular-0",4,1]},"scenes":{},"packs":{"0a53ee950":[3,4],"0c0a498a0":[24,47,111,18,29,19,175]},"versions":{"import":[],"native":[]},"redirect":[178,"0",2,"0",5,"0",6,"0",7,"0",8,"0",9,"0",10,"0",11,"0",12,"0",13,"0",14,"0",15,"0",16,"0",17,"0",20,"0",21,"0",22,"0",23,"0",25,"0",26,"0",27,"0",28,"0",30,"0",31,"0",32,"0",33,"0",34,"0",35,"0",36,"0",37,"0",38,"0",39,"0",40,"0",41,"0",42,"0",43,"0",44,"0",45,"0",46,"0",48,"0",49,"0",50,"0",51,"0",52,"0",53,"0",54,"0",55,"0",56,"0",57,"0",58,"0",59,"0",60,"0",61,"0",62,"0",63,"0",64,"0",65,"0",66,"0",67,"0",68,"0",69,"0",70,"0",71,"0",72,"0",73,"0",74,"0",75,"0",76,"0",77,"0",78,"0",79,"0",80,"0",81,"0",82,"0",83,"0",84,"0",85,"0",86,"0",87,"0",88,"0",89,"0",90,"0",91,"0",92,"0",93,"0",94,"0",95,"0",96,"0",97,"0",98,"0",99,"0",100,"0",101,"0",102,"0",103,"0",104,"0",105,"0",106,"0",107,"0",108,"0",109,"0",110,"0",112,"0",113,"0",114,"0",115,"0",116,"0",117,"0",118,"0",119,"0",120,"0",121,"0",122,"0",123,"0",124,"0",125,"0",126,"0",127,"0",128,"0",129,"0",130,"0",131,"0",132,"0",133,"0",134,"0",135,"0",136,"0",137,"0",138,"0",139,"0",140,"0",141,"0",142,"0",143,"0",144,"0",145,"0",146,"0",147,"0",148,"0",149,"0",150,"0",151,"0",152,"0",153,"0",154,"0",155,"0",156,"0",157,"0",158,"0",159,"0",160,"0",161,"0",162,"0",163,"0",164,"0",165,"0",166,"0",167,"0",168,"0",169,"0",170,"0",171,"0",172,"0",173,"0",174,"0",176,"0",177,"0"],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.Mesh","cc.Material","cc.Prefab","cc.Texture2D","cc.ImageAsset"]} \ No newline at end of file diff --git a/code/assets/3d_models/import/0a/0a53ee950.json b/code/assets/3d_models/import/0a/0a53ee950.json new file mode 100644 index 0000000..e07d895 --- /dev/null +++ b/code/assets/3d_models/import/0a/0a53ee950.json @@ -0,0 +1 @@ +[1,["c89m0XNRpI2qEsAhLShXXE","e2Y/hxG/5JJ4f+EuJgfHP4@b811d","e2Y/hxG/5JJ4f+EuJgfHP4@63096"],["_effectAsset","root","node","data","_mesh"],[["cc.Node",["_name","_prefab","_children","_parent","_components","_lpos"],2,4,2,1,9,5],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Prefab",["_name"],2],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.MeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_mesh"],2,1,4,3,4,6],["cc.CompPrefabInfo",["fileId"],2],["cc.ModelBakeSettings",["_castShadow","_receiveShadow"],1]],[[3,0,1,2,3,4,5,5],[1,0,1,2,3,5],[2,0,2],[0,0,2,1,2],[0,0,3,4,1,5,2],[4,0,1,2,3,4,5,2],[5,0,2],[6,0,1,3]],[[[[1,"CT MATERIAL_A",[{"occlusion":0}],[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}]]],0,0,[0],[0],[0]],[[[2,"73_collider"],[3,"73_collider",[-2],[0,"2awJwomwZV7Z9gTNZCgeTQ",null,null,null,-1,0]],[4,"UBX_DefaultRootName_001",1,[[5,1,-3,[6,"b6yTklyuVWYbY63yitocOd"],[0],[7,true,true],1]],[0,"5ctwZDSiVb26shLHihHeGy",null,null,null,1,0],[1,72.18412780761719,22.281278610229492,-38.93197250366211]]],0,[0,1,1,0,-1,2,0,2,2,0,3,1,3],[0,0],[-1,4],[1,2]]]] diff --git a/code/assets/3d_models/import/0c/0c0a498a0.json b/code/assets/3d_models/import/0c/0c0a498a0.json new file mode 100644 index 0000000..4eac204 --- /dev/null +++ b/code/assets/3d_models/import/0c/0c0a498a0.json @@ -0,0 +1 @@ +{"type":"cc.Texture2D","data":[["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@1f3c6"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@caddf"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@0ef36"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d8bd3"]]]} diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9d8cd.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9d8cd.json new file mode 100644 index 0000000..e67b0f5 --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9d8cd.json @@ -0,0 +1 @@ +[1,["e4sZyu/AFCepU5HK+e0zbc@742df","e4sZyu/AFCepU5HK+e0zbc@fc0b8","e4sZyu/AFCepU5HK+e0zbc@0c6f1","e4sZyu/AFCepU5HK+e0zbc@af523","e4sZyu/AFCepU5HK+e0zbc@60a81","e4sZyu/AFCepU5HK+e0zbc@efc56","e4sZyu/AFCepU5HK+e0zbc@04761","e4sZyu/AFCepU5HK+e0zbc@a3985","e4sZyu/AFCepU5HK+e0zbc@49b18","e4sZyu/AFCepU5HK+e0zbc@56552","e4sZyu/AFCepU5HK+e0zbc@781f0","e4sZyu/AFCepU5HK+e0zbc@ddf8f","e4sZyu/AFCepU5HK+e0zbc@72c32","e4sZyu/AFCepU5HK+e0zbc@69af2","e4sZyu/AFCepU5HK+e0zbc@3e076","e4sZyu/AFCepU5HK+e0zbc@52127","e4sZyu/AFCepU5HK+e0zbc@58994","e4sZyu/AFCepU5HK+e0zbc@1ca10","e4sZyu/AFCepU5HK+e0zbc@2bc87","e4sZyu/AFCepU5HK+e0zbc@89667","e4sZyu/AFCepU5HK+e0zbc@c1860","e4sZyu/AFCepU5HK+e0zbc@ab0a9","e4sZyu/AFCepU5HK+e0zbc@65e4a","e4sZyu/AFCepU5HK+e0zbc@a21ca","e4sZyu/AFCepU5HK+e0zbc@8598a","e4sZyu/AFCepU5HK+e0zbc@b20c6","e4sZyu/AFCepU5HK+e0zbc@4275b","e4sZyu/AFCepU5HK+e0zbc@a61a2","e4sZyu/AFCepU5HK+e0zbc@03ec6","e4sZyu/AFCepU5HK+e0zbc@e3218","e4sZyu/AFCepU5HK+e0zbc@9395b","e4sZyu/AFCepU5HK+e0zbc@4f540","e4sZyu/AFCepU5HK+e0zbc@3e23d","e4sZyu/AFCepU5HK+e0zbc@c7100","e4sZyu/AFCepU5HK+e0zbc@35e77","e4sZyu/AFCepU5HK+e0zbc@d5b5e","e4sZyu/AFCepU5HK+e0zbc@b8e05","e4sZyu/AFCepU5HK+e0zbc@8229f","e4sZyu/AFCepU5HK+e0zbc@1827c","e4sZyu/AFCepU5HK+e0zbc@2f6d1","e4sZyu/AFCepU5HK+e0zbc@cdec0","e4sZyu/AFCepU5HK+e0zbc@f4010","e4sZyu/AFCepU5HK+e0zbc@cbac6","e4sZyu/AFCepU5HK+e0zbc@0af0b","e4sZyu/AFCepU5HK+e0zbc@161ec","e4sZyu/AFCepU5HK+e0zbc@4c2f7","e4sZyu/AFCepU5HK+e0zbc@4affa","e4sZyu/AFCepU5HK+e0zbc@df4b3","e4sZyu/AFCepU5HK+e0zbc@b2533","e4sZyu/AFCepU5HK+e0zbc@7eb92","e4sZyu/AFCepU5HK+e0zbc@a87a2","e4sZyu/AFCepU5HK+e0zbc@1eaad","e4sZyu/AFCepU5HK+e0zbc@935b9","e4sZyu/AFCepU5HK+e0zbc@c5910","e4sZyu/AFCepU5HK+e0zbc@daa6a","e4sZyu/AFCepU5HK+e0zbc@98d72","e4sZyu/AFCepU5HK+e0zbc@23859","e4sZyu/AFCepU5HK+e0zbc@41791","e4sZyu/AFCepU5HK+e0zbc@0f9a3","e4sZyu/AFCepU5HK+e0zbc@a27a5","e4sZyu/AFCepU5HK+e0zbc@809b5","e4sZyu/AFCepU5HK+e0zbc@a6a64","e4sZyu/AFCepU5HK+e0zbc@422fc","e4sZyu/AFCepU5HK+e0zbc@a6b6e","e4sZyu/AFCepU5HK+e0zbc@2e76e","e4sZyu/AFCepU5HK+e0zbc@ec5f7","e4sZyu/AFCepU5HK+e0zbc@3f608","e4sZyu/AFCepU5HK+e0zbc@dd038","e4sZyu/AFCepU5HK+e0zbc@4f501","e4sZyu/AFCepU5HK+e0zbc@b9514","e4sZyu/AFCepU5HK+e0zbc@e0fe4","e4sZyu/AFCepU5HK+e0zbc@2cd19","e4sZyu/AFCepU5HK+e0zbc@ca748","e4sZyu/AFCepU5HK+e0zbc@f3c0a","e4sZyu/AFCepU5HK+e0zbc@b5f0d","e4sZyu/AFCepU5HK+e0zbc@9faa0","e4sZyu/AFCepU5HK+e0zbc@7b290","e4sZyu/AFCepU5HK+e0zbc@3bc15"],["_mesh","node","root","_parent","data"],[["cc.Node",["_name","_prefab","_parent","_lpos","_children","_components"],2,4,1,5,12,9],["cc.Prefab",["_name"],2],["cc.MeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_mesh"],2,1,4,3,4,6],["cc.MeshRenderer",["_shadowCastingMode","_materials","node","__prefab","bakeSettings","_mesh"],1,1,4,4,6],["cc.CompPrefabInfo",["fileId"],2],["cc.ModelBakeSettings",["_castShadow","_receiveShadow"],1],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1]],[[6,0,1,2,3,4,5,5],[0,0,2,5,1,3,2],[4,0,2],[5,0,1,3],[2,0,1,2,3,4,5,2],[1,0,2],[0,0,4,1,2],[0,0,2,1,3,2],[3,0,1,2,3,4,5,3]],[[5,"zavod"],[6,"zavod",[[-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,[7,"Group001",-28,[0,"e58rxkXaBXPJ3rqR68bD11",null,null,null,-27,0],[1,2.104769706726074,0.44777339696884155,-0.8474392890930176]],-29,-30,-31,-32,-33,-34,-35,-36,-37,-38,-39,-40,-41,-42,-43,-44,-45,-46],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[0,"e3qj6EstFbTLanhkHAHI3H",null,null,null,-1,0]],[1,"73",1,[[4,1,-47,[2,"abO34lNjlc0bg8e5DQNvC0"],[0],[3,true,true],1]],[0,"62IzWi/pxZqbEJIRRiU/Yt",null,null,null,1,0],[1,72.18412780761719,22.281278610229492,-38.93197250366211]],[1,"1",1,[[4,1,-48,[2,"41FDUsNgNR84SfTnJ2w6a7"],[2],[3,true,true],3]],[0,"0b9OI7zAlbzoHzTSg0zVSW",null,null,null,1,0],[1,71.40684509277344,31.60773277282715,-121.69174194335938]],[1,"4",1,[[4,1,-49,[2,"502Y24iNJa6LB0gcoBVU8C"],[4],[3,true,true],5]],[0,"4f4VLLUM5d8ZxCNfks+KIc",null,null,null,1,0],[1,71.44066619873047,31.17104721069336,-79.49864959716797]],[1,"8",1,[[4,1,-50,[2,"05ZW/yV0dVL4YQgV6t4i8P"],[6],[3,true,true],7]],[0,"8bTYN7MUxcppMMDhC/7shi",null,null,null,1,0],[1,71.9390640258789,29.753206253051758,-39.202293395996094]],[1,"9",1,[[4,1,-51,[2,"bcHGECYBpQHa6hs/IFWnCh"],[8],[3,true,true],9]],[0,"eaUvytxBRd2ZkPcaPWSIhh",null,null,null,1,0],[1,69.706787109375,24.642227172851562,-39.36470413208008]],[1,"12",1,[[4,1,-52,[2,"1axNN4Os9XGKvDa3MzoH01"],[10],[3,true,true],11]],[0,"fdtySNsyBceaHN8tFRVK2X",null,null,null,1,0],[1,67.10316467285156,18.235525131225586,-39.104305267333984]],[1,"13",1,[[4,1,-53,[2,"25o8H5Vw9Rf4USABtVEtC6"],[12,13,14],[3,true,true],15]],[0,"8f3PG5o+5elrSTC1/hHdA0",null,null,null,1,0],[1,68.34968566894531,12.088397026062012,-18.31235122680664]],[1,"14",1,[[4,1,-54,[2,"81Ad4CP25YIInRsILAI0nV"],[16,17,18],[3,true,true],19]],[0,"f1sHrOZdFZ/qBZItaRp/PP",null,null,null,1,0],[1,63.00178146362305,11.668142318725586,-50.533321380615234]],[1,"19",1,[[4,1,-55,[2,"35hZHfHNhZrpEskw6N2MpC"],[20],[3,true,true],21]],[0,"2c5UjPcL9cAbV5dxRxgnkQ",null,null,null,1,0],[1,71.25702667236328,26.897775650024414,-38.52577209472656]],[1,"74",1,[[4,1,-56,[2,"bchfecHSxVt7kaPYbXyRHf"],[22],[3,true,true],23]],[0,"b9sFG4fupWSZJ6UtmEl0ia",null,null,null,1,0],[1,72.9434814453125,14.0764799118042,-44.194095611572266]],[1,"bp",1,[[4,1,-57,[2,"7d1NPwweZfQLwO5x9544wZ"],[24],[3,true,true],25]],[0,"f5WV8BLlhZt714cvMSaWEr",null,null,null,1,0],[1,-41.28068542480469,9.053261756896973,-51.24772644042969]],[1,"build",1,[[4,1,-58,[2,"bd02/+M7hRT407qDmd5bfb"],[26],[3,true,true],27]],[0,"04CtQN471b2IbjsPaaHDnc",null,null,null,1,0],[1,-8.16953182220459,3.108523368835449,-11.284934997558594]],[1,"build.001",1,[[4,1,-59,[2,"d57oBtIPtQHbZwR2NC3SY7"],[28],[3,true,true],29]],[0,"86bErrQqpRBozwzghR2mKx",null,null,null,1,0],[1,68.33491516113281,5.609694004058838,-6.6616973876953125]],[1,"build.002",1,[[4,1,-60,[2,"10vKbYCaVWNJ+LXLODU96N"],[30],[3,true,true],31]],[0,"c7WDLTDWxeKaeT+VaoDv0M",null,null,null,1,0],[1,71.392333984375,21.2194881439209,-80.8216552734375]],[1,"build.003",1,[[4,1,-61,[2,"edt41dyGJZVYLUv4RpMern"],[32],[3,true,true],33]],[0,"639Wny+s9QLZ/XMOuLyRYv",null,null,null,1,0],[1,-30.94754409790039,7.4964704513549805,-51.320213317871094]],[1,"build.004",1,[[4,1,-62,[2,"0bAknRPFJSL6hAb7HYxuo2"],[34],[3,true,true],35]],[0,"10kyIO5BpaxahkeIfRVLF0",null,null,null,1,0],[1,38.069969177246094,9.563444137573242,-50.7181510925293]],[1,"build.005",1,[[4,1,-63,[2,"ccixHB8BVTG5kDYS8BOSlz"],[36],[3,true,true],37]],[0,"91uixU5SFSSLhbAqwxzY9W",null,null,null,1,0],[1,-30.420194625854492,12.006189346313477,-51.327430725097656]],[1,"build.006",1,[[4,1,-64,[2,"62oP6J4y9d9pG2fYNDAQva"],[38],[3,true,true],39]],[0,"7e0P1Qa8BWqZybSQ004ETy",null,null,null,1,0],[1,68.3364028930664,13.129583358764648,-10.267422676086426]],[1,"build.007",1,[[4,1,-65,[2,"68jkt0+FdWNJdGRClBfUrn"],[40],[3,true,true],41]],[0,"89pOIwER5RK5N/JfAuzsjL",null,null,null,1,0],[1,71.39132690429688,32.06319808959961,-87.59060668945312]],[1,"build.008",1,[[4,1,-66,[2,"a0bEysznxfMIhLMm4IjW5k"],[42],[3,true,true],43]],[0,"f5UqMqOvxVQJVVZ3frS+Na",null,null,null,1,0],[1,-40.366851806640625,10.663442611694336,-50.897499084472656]],[1,"Cube",1,[[4,1,-67,[2,"23xPTyRtxf0qtui8hOWUun"],[44],[3,true,true],45]],[0,"34BzqK6sZf/ZYvYPGeZpPM",null,null,null,1,0],[1,81.5244140625,6.118722438812256,-174.61048889160156]],[1,"GK_korp",1,[[4,1,-68,[2,"8cJ3CVU01bdZRmKro/4ehm"],[46],[3,true,true],47]],[0,"f0iKZ6Lx1QHqIDCqrYZ3dH",null,null,null,1,0],[1,-4.459189414978027,8.340529441833496,-48.872779846191406]],[1,"ground",1,[[4,1,-69,[2,"51PWnp5RlblqVDCfMARg5R"],[48],[3,true,true],49]],[0,"3awT0fMfRchoYB08nxxzcQ",null,null,null,1,0],[1,141.58145141601562,1.745630145072937,-51.681217193603516]],[1,"ground.001",1,[[4,1,-70,[2,"15CfI++qpXq4h4EhJm+wZY"],[50],[3,true,true],51]],[0,"5aPGDYEYdU45FuGqU0ra8U",null,null,null,1,0],[1,-16.347625732421875,21.996192932128906,-61.460262298583984]],[1,"ground.002",1,[[4,1,-71,[2,"cbeJgbow9ahabK6h1AjcUl"],[52],[3,true,true],53]],[0,"63jMQjtc9akZ8YkBtxXaaa",null,null,null,1,0],[1,17.372573852539062,4.302250862121582,-3.331378698348999]],[1,"kj",1,[[4,1,-72,[2,"0dKy9bZ0hcbbu809ovvPrq"],[54],[3,true,true],55]],[0,"e54FZETsRbFJkpFFh6r18V",null,null,null,1,0],[1,-8.167387008666992,6.861529350280762,-11.300395965576172]],[1,"koj",1,[[4,1,-73,[2,"948f7QiIJeoovoLIO5CJz4"],[56],[3,true,true],57]],[0,"edbrtF3ZZbxJn8i3WNIIb2",null,null,null,1,0],[1,72.49209594726562,27.17462730407715,-41.11946105957031]],[1,"koj.001",1,[[4,1,-74,[2,"45+xjqpKVR3oF96hFsV9GA"],[58],[3,true,true],59]],[0,"5diO5RFzlaNYUw8s0jnSsp",null,null,null,1,0],[1,68.35987854003906,26.326915740966797,-38.748714447021484]],[1,"koj.002",1,[[4,1,-75,[2,"aaFC2CAoJXh4h3J0bYIy77"],[60],[3,true,true],61]],[0,"a8TWuvl1RalIgh0rOncnO3",null,null,null,1,0],[1,69.19572448730469,23.85663604736328,-39.173492431640625]],[1,"koj.003",1,[[4,1,-76,[2,"b0dtSx4HJb6qDfq0BiIBTf"],[62],[3,true,true],63]],[0,"03A/FjArFclZ4YGgw6Qwz7",null,null,null,1,0],[1,71.55332946777344,22.994470596313477,-41.216407775878906]],[1,"koj.004",1,[[4,1,-77,[2,"8dN5IHvmFfeJZPAayAEHNk"],[64],[3,true,true],65]],[0,"77Fd0HQ6tXyYtYUNtJlAGe",null,null,null,1,0],[1,68.6732177734375,20.75161361694336,-39.07102584838867]],[1,"koj.005",1,[[4,1,-78,[2,"8fxBDbNWRRNJ0tO0JcPqR6"],[66],[3,true,true],67]],[0,"bbA9pGQsZVsZcG3j/Qf3ZE",null,null,null,1,0],[1,72.79012298583984,17.926029205322266,-40.42891311645508]],[1,"koj.006",1,[[4,1,-79,[2,"75P08A2MNToqoju1+mU+6o"],[68],[3,true,true],69]],[0,"d60TrdSQ1Zh45CN+CQ3pAO",null,null,null,1,0],[1,72.54381561279297,12.524746894836426,-50.5303840637207]],[1,"name",1,[[4,1,-80,[2,"28IEvH9RJTUbPNGhHcl20O"],[70],[3,true,true],71]],[0,"7fkE9VHO1Sf4yIxlUIF4ea",null,null,null,1,0],[1,119.40760040283203,27.5914363861084,-113.83114624023438]],[1,"plane",1,[[8,1,[null],-81,[2,"4f6qv2XaNR6LcehYas+bET"],[3,true,true],72]],[0,"ffgv+cL7xVWLP6EikUVnjg",null,null,null,1,0],[1,-40.87005615234375,7.068157196044922,-50.63288879394531]],[1,"pol",1,[[4,1,-82,[2,"2aHRpwLY9feKBioDCJhuZ+"],[73],[3,true,true],74]],[0,"1c7Ua8EMRdmKPAr4fewkkA",null,null,null,1,0],[1,1.6638832092285156,-0.5337653160095215,-45.85536193847656]],[1,"pol.001",1,[[4,1,-83,[2,"e31LjCEQxUZbEaE7XXhP3F"],[75],[3,true,true],76]],[0,"8678o1u5pU2JuKtdZFgoGB",null,null,null,1,0],[1,-1.2395868301391602,-0.10000111907720566,-51.1351432800293]],[1,"pol.002",1,[[4,1,-84,[2,"a1fwL2S8FaSIvGPpagg8CI"],[77],[3,true,true],78]],[0,"5fEaYKX3FTOq7Kfkf5qb09",null,null,null,1,0],[1,70.86576843261719,9.545680046081543,-44.04548263549805]],[1,"pol.003",1,[[4,1,-85,[2,"00PNWErRZToY6zzShz0MT/"],[79],[3,true,true],80]],[0,"edc25NhmpYmrnTCzlSlRrf",null,null,null,1,0],[1,-19.068384170532227,-0.5333344340324402,-48.52812957763672]],[1,"same",1,[[4,1,-86,[2,"e0WRcDtC1Uar8kiJS/mB2G"],[81],[3,true,true],82]],[0,"8epqEoDzpSSY9TnNpaNsXg",null,null,null,1,0],[1,72.23786163330078,25.28400421142578,-41.2019157409668]],[1,"ugol",1,[[4,1,-87,[2,"7378CT0O1ZvasuTOx8Y9p4"],[83],[3,true,true],84]],[0,"51jcgxXEta2qYzIcKpJ6vk",null,null,null,1,0],[1,61.87797546386719,33.92856979370117,-98.65628814697266]],[1,"Ограда",1,[[4,1,-88,[2,"6eFxeQwNlfz7uTtJd4GO2L"],[85],[3,true,true],86]],[0,"7bSa6k+Ahb7qGdCkdhBA4X",null,null,null,1,0],[1,91.36193084716797,41.094356536865234,-139.72804260253906]],[1,"Сортировка АР",1,[[4,1,-89,[2,"89BSSdZ4pVgbZpWJNfDQT8"],[87],[3,true,true],88]],[0,"3c0Nooyt1WsYnCKx1/j8bT",null,null,null,1,0],[1,69.86260223388672,22.458049774169922,-43.68870544433594]]],0,[0,2,1,0,-1,2,0,-2,3,0,-3,4,0,-4,5,0,-5,6,0,-6,7,0,-7,8,0,-8,9,0,-9,10,0,-10,11,0,-11,12,0,-12,13,0,-13,14,0,-14,15,0,-15,16,0,-16,17,0,-17,18,0,-18,19,0,-19,20,0,-20,21,0,-21,22,0,-22,23,0,-23,24,0,-24,25,0,-25,26,0,2,1,0,3,1,0,-27,27,0,-28,28,0,-29,29,0,-30,30,0,-31,31,0,-32,32,0,-33,33,0,-34,34,0,-35,35,0,-36,36,0,-37,37,0,-38,38,0,-39,39,0,-40,40,0,-41,41,0,-42,42,0,-43,43,0,-44,44,0,1,2,0,1,3,0,1,4,0,1,5,0,1,6,0,1,7,0,1,8,0,1,9,0,1,10,0,1,11,0,1,12,0,1,13,0,1,14,0,1,15,0,1,16,0,1,17,0,1,18,0,1,19,0,1,20,0,1,21,0,1,22,0,1,23,0,1,24,0,1,25,0,1,26,0,1,27,0,1,28,0,1,29,0,1,30,0,1,31,0,1,32,0,1,33,0,1,34,0,1,35,0,1,36,0,1,37,0,1,38,0,1,39,0,1,40,0,1,41,0,1,42,0,1,43,0,1,44,0,4,1,89],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,-2,-3,0,-1,-2,-3,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0],[5,6,7,8,3,9,10,11,4,12,13,14,15,16,17,18,3,19,20,21,22,23,24,25,0,26,0,27,0,28,0,29,0,30,0,31,1,32,33,34,1,35,36,37,38,39,40,41,42,43,44,45,46,47,1,48,49,50,51,52,53,54,55,56,57,58,59,60,4,61,62,63,64,65,66,2,67,2,68,2,69,70,71,72,73,74,75,76,77]] diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.json b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/3d_models/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/3d_models/index.js b/code/assets/3d_models/index.js new file mode 100644 index 0000000..6ef706a --- /dev/null +++ b/code/assets/3d_models/index.js @@ -0,0 +1,20 @@ +System.register("chunks:///_virtual/3d_models",[],(function(){return{execute:function(){}}})); + +(function(r) { + r('virtual:///prerequisite-imports/3d_models', 'chunks:///_virtual/3d_models'); +})(function(mid, cid) { + System.register(mid, [cid], function (_export, _context) { + return { + setters: [function(_m) { + var _exportObj = {}; + + for (var _key in _m) { + if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; + } + + _export(_exportObj); + }], + execute: function () { } + }; + }); +}); \ No newline at end of file diff --git a/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.png b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.png new file mode 100644 index 0000000..21aec33 Binary files /dev/null and b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0ef36.png differ diff --git a/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.jpg b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.jpg new file mode 100644 index 0000000..fdd0427 Binary files /dev/null and b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f3c6.jpg differ diff --git a/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.jpg b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.jpg new file mode 100644 index 0000000..b58a16d Binary files /dev/null and b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@caddf.jpg differ diff --git a/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.jpg b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.jpg new file mode 100644 index 0000000..24cdca5 Binary files /dev/null and b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d8bd3.jpg differ diff --git a/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.jpg b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.jpg new file mode 100644 index 0000000..23587df Binary files /dev/null and b/code/assets/3d_models/native/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f1375.jpg differ diff --git a/code/assets/Materials/config.json b/code/assets/Materials/config.json new file mode 100644 index 0000000..33a244e --- /dev/null +++ b/code/assets/Materials/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"Materials","deps":["main"],"uuids":["0by2OqhTtD6KVmY6y0fvqN","87cJVYNlpFCqZOYVSlxe8Y"],"paths":{"0":["YellowPulseMaterial",0,1],"1":["RedPulseMaterial",0,1]},"scenes":{},"packs":{},"versions":{"import":[],"native":[]},"redirect":[0,"0",1,"0"],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.Material"]} \ No newline at end of file diff --git a/code/assets/Materials/index.js b/code/assets/Materials/index.js new file mode 100644 index 0000000..a162161 --- /dev/null +++ b/code/assets/Materials/index.js @@ -0,0 +1,20 @@ +System.register("chunks:///_virtual/Materials",[],(function(){return{execute:function(){}}})); + +(function(r) { + r('virtual:///prerequisite-imports/Materials', 'chunks:///_virtual/Materials'); +})(function(mid, cid) { + System.register(mid, [cid], function (_export, _context) { + return { + setters: [function(_m) { + var _exportObj = {}; + + for (var _key in _m) { + if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; + } + + _export(_exportObj); + }], + execute: function () { } + }; + }); +}); \ No newline at end of file diff --git a/code/assets/internal/config.json b/code/assets/internal/config.json new file mode 100644 index 0000000..c249363 --- /dev/null +++ b/code/assets/internal/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"internal","deps":[],"uuids":["08HKsx3M1CjoZS8kBMyBxH","0fcbd05f8","142hclxMJCtKsI7grraJiz","173rzDCmtLirAL3Fi4hVge","1cAq5vRJJJFbj4dJKjseTN","1dCO9ipQNM4ouaRskIc/fT","509DSLyINOL48RziM7hZ+h","51HSYzCadL3axC93gDISSz","5dRaoA4GRJOLMUQmXwwiWM","609xlc7CpF67qUiVX2DoHQ","6aLQc0vZ5N35RuyqUkmMt1","71Hr4R9nNM2ZqDY8YLpUxb","784FhKQ0NHJ4834U5lwqLb","81Dpbk5FZEaJtZ9OjzlzLA","87HDtsc3lBnb2jeUsjmrkN","8bvbzdXNRBALbVt8liW2EH","93Yf2QulJPhKqTboeP1XbK","97CwWYvLBHFJH7LoFEDczY","97G9sjP/ZD67QiHDAWWjZj","a3zQCfCrBCDZJ4uf2rk5u8","b51hFfA3BNfKrTwZTMcc+Y","baIUdvKGZPgZxNbjWTFuRI","bc1kzGLdlD9qu+ZjGNMyAy","c0FDkGmu1EfpQ2KuhRLRtu","c2chXYaDVLaL+7verGEAwE","d1NGQ2rJZCcbhjH0/erZWw","d9MFkNu5JMyIvRI80Cf57f","ddOhRNq39B8IK4LkOgkNSW","e9qpo+WytKx6LHBz3isrJP","ef6OKj6s5Ce7Txy4qTfsd9","f0QW5oAgBLd6kmT50W5JTa","f9KAbXF2hEP6/oErzehNDw","fdoJXLgx1GAa2UhGATlj3o"],"paths":{"0":["db:/internal/default_materials/default-trail-material",1,1],"2":["db:/internal/default_materials/default-particle-gpu-material",1,1],"3":["db:/internal/effects/particles/builtin-particle-trail",0,1],"4":["db:/internal/effects/internal/builtin-graphics",0,1],"5":["db:/internal/effects/legacy/terrain",0,1],"6":["db:/internal/default_materials/ui-alpha-test-material",1,1],"7":["db:/internal/effects/pipeline/skybox",0,1],"8":["db:/internal/effects/pipeline/deferred-lighting",0,1],"9":["db:/internal/effects/for2d/builtin-sprite",0,1],"10":["db:/internal/effects/pipeline/post-process/tone-mapping",0,1],"11":["db:/internal/effects/particles/builtin-billboard",0,1],"12":["db:/internal/default_materials/default-billboard-material",1,1],"13":["db:/internal/effects/internal/builtin-clear-stencil",0,1],"14":["db:/internal/effects/util/profiler",0,1],"15":["db:/internal/default_materials/default-clear-stencil",1,1],"16":["db:/internal/effects/pipeline/planar-shadow",0,1],"17":["db:/internal/effects/util/splash-screen",0,1],"18":["db:/internal/effects/particles/builtin-particle-gpu",0,1],"19":["db:/internal/effects/builtin-unlit",0,1],"20":["db:/internal/default_materials/default-spine-material",1,1],"21":["db:/internal/physics/default-physics-material",2,1],"22":["db:/internal/default_materials/missing-effect-material",1,1],"23":["db:/internal/default_materials/default-particle-material",1,1],"24":["db:/internal/effects/for2d/builtin-spine",0,1],"25":["db:/internal/effects/particles/builtin-particle",0,1],"26":["db:/internal/default_materials/missing-material",1,1],"27":["db:/internal/default_materials/ui-sprite-gray-alpha-sep-material",1,1],"28":["db:/internal/default_materials/ui-base-material",1,1],"29":["db:/internal/default_materials/ui-sprite-gray-material",1,1],"30":["db:/internal/default_materials/ui-graphics-material",1,1],"31":["db:/internal/default_materials/ui-sprite-alpha-sep-material",1,1],"32":["db:/internal/default_materials/ui-sprite-material",1,1]},"scenes":{},"packs":{"0fcbd05f8":[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.EffectAsset","cc.Material","cc.PhysicsMaterial"]} \ No newline at end of file diff --git a/code/assets/internal/import/0f/0fcbd05f8.json b/code/assets/internal/import/0f/0fcbd05f8.json new file mode 100644 index 0000000..3c86dec --- /dev/null +++ b/code/assets/internal/import/0f/0fcbd05f8.json @@ -0,0 +1 @@ +[1,["609xlc7CpF67qUiVX2DoHQ","a3zQCfCrBCDZJ4uf2rk5u8","173rzDCmtLirAL3Fi4hVge","97G9sjP/ZD67QiHDAWWjZj","71Hr4R9nNM2ZqDY8YLpUxb","81Dpbk5FZEaJtZ9OjzlzLA","c2chXYaDVLaL+7verGEAwE","d1NGQ2rJZCcbhjH0/erZWw","1cAq5vRJJJFbj4dJKjseTN"],["_effectAsset"],[["cc.EffectAsset",["_name","shaders","techniques","combinations"],-1],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Material",["_name","_states","_defines","_props"],0,12],["cc.PhysicsMaterial",["_name","_friction","_rollingFriction","_spinningFriction","_restitution"],-2]],[[0,0,1,2,4],[1,0,1,2,3,5],[2,0,1,2,3,4],[0,0,3,1,2,5],[3,0,1,2,3,4,6]],[[[[1,"default-trail-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[2]],[[[1,"default-particle-gpu-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[3]],[[[0,"particles/builtin-particle-trail",[{"hash":2100859085,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n layout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n in vec2 uv;\n in vec4 color;\n #if CC_DRAW_WIRE_FRAME\n in vec3 vBarycentric;\n #endif\n uniform sampler2D mainTexture;\n layout(std140) uniform FragConstants {\n vec4 tintColor;\n };\n vec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., 1.);\n }\n#endif\n return CCFragOutput(col);\n }\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"glsl1":{"vert":"\nprecision mediump float;\n uniform vec4 mainTiling_Offset;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n varying vec2 uv;\n varying vec4 color;\n #if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n #endif\n uniform sampler2D mainTexture;\n uniform vec4 tintColor;\n vec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., 1.);\n }\n#endif\n return CCFragOutput(col);\n }\nvoid main() { gl_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":3093758986,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n layout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n in vec2 uv;\n in vec4 color;\n #if CC_DRAW_WIRE_FRAME\n in vec3 vBarycentric;\n #endif\n uniform sampler2D mainTexture;\n layout(std140) uniform FragConstants {\n vec4 tintColor;\n };\n vec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., col.a);\n }\n#endif\n return CCFragOutput(col);\n }\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"glsl1":{"vert":"\nprecision mediump float;\n uniform vec4 mainTiling_Offset;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\n precision mediump float;\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n varying vec2 uv;\n varying vec4 color;\n #if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n #endif\n uniform sampler2D mainTexture;\n uniform vec4 tintColor;\n vec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n#if CC_DRAW_WIRE_FRAME\n if (any(lessThan(vBarycentric, vec3(0.02)))) {\n col = vec4(0., 1., 1., col.a);\n }\n#endif\n return CCFragOutput(col);\n }\nvoid main() { gl_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":915995403,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"glsl1":{"vert":"\nprecision mediump float;\n uniform vec4 mainTiling_Offset;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":2435723114,"name":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":44,"location":1,"defines":[]},{"name":"a_texCoord1","format":32,"location":2,"defines":[]},{"name":"a_texCoord2","format":32,"location":3,"defines":[]},{"name":"a_color","format":44,"location":4,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nin vec3 a_position;\nin vec4 a_texCoord;\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n out vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"glsl1":{"vert":"\nprecision mediump float;\n uniform vec4 mainTiling_Offset;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nattribute vec3 a_position;\nattribute vec4 a_texCoord;\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\n#if CC_DRAW_WIRE_FRAME\n varying vec3 vBarycentric;\n#endif\nvec4 vs_main() {\n highp vec4 pos = vec4(a_position, 1);\n vec4 velocity = vec4(a_texCoord1.xyz, 0);\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n velocity = cc_matWorld * velocity;\n #endif\n float vertOffset = (a_texCoord.x - 0.5) * a_texCoord.y;\n vec3 camUp = normalize(cross(pos.xyz - cc_cameraPos.xyz, velocity.xyz));\n pos.xyz += camUp * vertOffset;\n pos = cc_matViewProj * pos;\n uv = a_texCoord.zw * mainTiling_Offset.xy + mainTiling_Offset.zw;;\n color = a_color;\n #if CC_DRAW_WIRE_FRAME\n vBarycentric = a_texCoord2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_DRAW_WIRE_FRAME","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"frameTile_velLenScale":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-trail|builtin/internal/particle-trail:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"internal/builtin-graphics",[{"hash":586721616,"name":"internal/builtin-graphics|vs:vert|fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dist","format":11,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\nin float a_dist;\nout float v_dist;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nin vec4 v_color;\nin float v_dist;\nvec4 frag () {\n vec4 o = v_color;\n float aa = fwidth(v_dist);\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nattribute float a_dist;\nvarying float v_dist;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\nprecision highp float;\nvarying vec4 v_color;\nvarying float v_dist;\nvec4 frag () {\n vec4 o = v_color;\n #ifdef GL_OES_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"internal/builtin-graphics|vs:vert|fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"legacy/terrain",[{"hash":2756574121,"name":"legacy/terrain|terrain-vs|terrain-fs","blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"UVScale","type":16,"count":1},{"name":"lightMapUVParam","type":16,"count":1}],"defines":[]},{"name":"PbrParams","stageFlags":16,"binding":1,"members":[{"name":"metallic","type":16,"count":1},{"name":"roughness","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"weightMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"detailMap0","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]},{"name":"detailMap1","type":28,"count":1,"stageFlags":16,"binding":4,"defines":[]},{"name":"detailMap2","type":28,"count":1,"stageFlags":16,"binding":5,"defines":[]},{"name":"detailMap3","type":28,"count":1,"stageFlags":16,"binding":6,"defines":[]},{"name":"normalMap0","type":28,"count":1,"stageFlags":16,"binding":7,"defines":[]},{"name":"normalMap1","type":28,"count":1,"stageFlags":16,"binding":8,"defines":[]},{"name":"normalMap2","type":28,"count":1,"stageFlags":16,"binding":9,"defines":[]},{"name":"normalMap3","type":28,"count":1,"stageFlags":16,"binding":10,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":11,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":12,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":13,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":["CC_FORWARD_ADD"]},{"name":"albedoOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":1,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"emissiveOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":2,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]},{"name":"normalOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":3,"defines":["CC_FORWARD_ADD","CC_PIPELINE_TYPE"]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"UVScale","type":16,"count":1},{"name":"lightMapUVParam","type":16,"count":1}],"defines":[]},{"name":"PbrParams","stageFlags":16,"binding":1,"members":[{"name":"metallic","type":16,"count":1},{"name":"roughness","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"weightMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"detailMap0","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]},{"name":"detailMap1","type":28,"count":1,"stageFlags":16,"binding":4,"defines":[]},{"name":"detailMap2","type":28,"count":1,"stageFlags":16,"binding":5,"defines":[]},{"name":"detailMap3","type":28,"count":1,"stageFlags":16,"binding":6,"defines":[]},{"name":"normalMap0","type":28,"count":1,"stageFlags":16,"binding":7,"defines":[]},{"name":"normalMap1","type":28,"count":1,"stageFlags":16,"binding":8,"defines":[]},{"name":"normalMap2","type":28,"count":1,"stageFlags":16,"binding":9,"defines":[]},{"name":"normalMap3","type":28,"count":1,"stageFlags":16,"binding":10,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":11,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":12,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":13,"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":17,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nout mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nout highp vec4 v_shadowPos;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\n#endif\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_RECEIVE_SHADOW\n out vec2 v_shadowBias;\n#endif\nout highp vec3 v_position;\nout mediump vec3 v_normal;\nout mediump vec2 uvw;\nout mediump vec2 uv0;\nout mediump vec2 uv1;\nout mediump vec2 uv2;\nout mediump vec2 uv3;\nout mediump vec3 luv;\nout mediump vec3 diffuse;\nlayout(std140) uniform TexCoords {\n vec4 UVScale;\n vec4 lightMapUVParam;\n};\nvoid main () {\n vec3 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n vec4 pos = vec4(worldPos, 1.0);\n pos = cc_matViewProj * pos;\n uvw = a_texCoord;\n uv0 = a_position.xz * UVScale.x;\n uv1 = a_position.xz * UVScale.y;\n uv2 = a_position.xz * UVScale.z;\n uv3 = a_position.xz * UVScale.w;\n #if CC_USE_LIGHTMAP\n luv.xy = cc_lightingMapUVParam.xy + a_texCoord * cc_lightingMapUVParam.z;\n luv.z = cc_lightingMapUVParam.w;\n #endif\n v_position = worldPos;\n v_normal = a_normal;\n CC_TRANSFER_FOG(vec4(worldPos, 1.0));\n #if CC_RECEIVE_SHADOW\n v_shadowBias = vec2(0.0, 0.0);\n #endif\n v_shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n gl_Position = pos;\n}","frag":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return textureLod(shadowMap, coord, 0.0);\n #else\n return texture(shadowMap, coord);\n #endif\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nuniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #else\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nin mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\nin highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in vec3 v_luv;\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n#endif\nin highp vec3 v_position;\nin mediump vec3 v_normal;\n#if CC_RECEIVE_SHADOW\n in vec2 v_shadowBias;\n#endif\nin mediump vec2 uvw;\nin mediump vec2 uv0;\nin mediump vec2 uv1;\nin mediump vec2 uv2;\nin mediump vec2 uv3;\nin mediump vec3 diffuse;\nin mediump vec3 luv;\nlayout(std140) uniform PbrParams {\n vec4 metallic;\n vec4 roughness;\n};\nuniform sampler2D weightMap;\nuniform sampler2D detailMap0;\nuniform sampler2D detailMap1;\nuniform sampler2D detailMap2;\nuniform sampler2D detailMap3;\nuniform sampler2D normalMap0;\nuniform sampler2D normalMap1;\nuniform sampler2D normalMap2;\nuniform sampler2D normalMap3;\nvoid surf (out StandardSurface s) {\n #if LAYERS > 1\n vec4 w = texture(weightMap, uvw);\n #endif\n vec4 baseColor = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseColor = texture(detailMap0, uv0);\n #elif LAYERS == 2\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n baseColor += texture(detailMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseColor += texture(detailMap0, uv0) * w.r;\n baseColor += texture(detailMap1, uv1) * w.g;\n baseColor += texture(detailMap2, uv2) * w.b;\n baseColor += texture(detailMap3, uv3) * w.a;\n #else\n baseColor = texture(detailMap0, uv0);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n #if USE_NORMALMAP\n vec4 baseNormal = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseNormal = texture(normalMap0, uv0);\n #elif LAYERS == 2\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n baseNormal += texture(normalMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseNormal += texture(normalMap0, uv0) * w.r;\n baseNormal += texture(normalMap1, uv1) * w.g;\n baseNormal += texture(normalMap2, uv2) * w.b;\n baseNormal += texture(normalMap3, uv3) * w.a;\n #else\n baseNormal = texture(normalMap0, uv0);\n #endif\n vec3 tangent = vec3(1.0, 0.0, 0.0);\n vec3 binormal = vec3(0.0, 0.0, 1.0);\n binormal = cross(tangent, v_normal);\n tangent = cross(v_normal, binormal);\n vec3 nmmp = baseNormal.xyz - vec3(0.5);\n s.normal =\n nmmp.x * normalize(tangent) +\n nmmp.y * normalize(binormal) +\n nmmp.z * normalize(v_normal);\n #else\n s.normal = v_normal;\n #endif\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBias;\n #endif\n s.albedo = vec4(SRGBToLinear(baseColor.rgb), 1.0);\n s.occlusion = 1.0;\n #if USE_PBR\n s.roughness = 0.0;\n #if LAYERS == 1\n s.roughness = roughness.x;\n #elif LAYERS == 2\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n #elif LAYERS == 3\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n #elif LAYERS == 4\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n s.roughness += roughness.w * w.a;\n #else\n s.roughness = 1.0;\n #endif\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #if LAYERS == 1\n s.specularIntensity = 0.5;\n s.metallic = metallic.x;\n #elif LAYERS == 2\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n #elif LAYERS == 3\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n #elif LAYERS == 4\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n s.metallic += metallic.w * w.a;\n #else\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n #else\n s.roughness = 1.0;\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n s.emissive = vec3(0.0, 0.0, 0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, luv.xy, luv.z, s.normal);\n #endif\n}\n#if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float strength = clamp(cc_lightBoundingSizeVS[i].w, 0.0, 1.0);\n float litAngleScale = 1.0 / max(0.001, mix(cosInner, 1.0, strength) - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, binding = 0) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, binding = 1) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, binding = 2) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n fragColorX = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n }\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n StandardSurface s; surf(s);\n albedoOut = s.albedo;\n normalOut = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n emissiveOut = vec4(s.emissive, s.occlusion);\n }\n#endif"},"glsl1":{"vert":"\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision mediump float;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\nuniform highp mat4 cc_matWorld;\n uniform highp vec4 cc_lightingMapUVParam;\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\nvarying highp vec4 v_shadowPos;\nuniform highp mat4 cc_matLightViewProj;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_RECEIVE_SHADOW\n#endif\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_RECEIVE_SHADOW\n varying vec2 v_shadowBias;\n#endif\nvarying highp vec3 v_position;\nvarying mediump vec3 v_normal;\nvarying mediump vec2 uvw;\nvarying mediump vec2 uv0;\nvarying mediump vec2 uv1;\nvarying mediump vec2 uv2;\nvarying mediump vec2 uv3;\nvarying mediump vec3 luv;\nvarying mediump vec3 diffuse;\n uniform vec4 UVScale;\nvoid main () {\n vec3 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n vec4 pos = vec4(worldPos, 1.0);\n pos = cc_matViewProj * pos;\n uvw = a_texCoord;\n uv0 = a_position.xz * UVScale.x;\n uv1 = a_position.xz * UVScale.y;\n uv2 = a_position.xz * UVScale.z;\n uv3 = a_position.xz * UVScale.w;\n #if CC_USE_LIGHTMAP\n luv.xy = cc_lightingMapUVParam.xy + a_texCoord * cc_lightingMapUVParam.z;\n luv.z = cc_lightingMapUVParam.w;\n #endif\n v_position = worldPos;\n v_normal = a_normal;\n CC_TRANSFER_FOG(vec4(worldPos, 1.0));\n #if CC_RECEIVE_SHADOW\n v_shadowBias = vec2(0.0, 0.0);\n #endif\n v_shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n gl_Position = pos;\n}","frag":"\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers: enable\n#endif\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\nuniform mediump vec4 cc_probeInfo;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_ambientGround;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n uniform mediump vec4 cc_nearFar;\n uniform mediump vec4 cc_viewPort;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nuniform highp mat4 cc_matLightView;\n uniform highp mat4 cc_matLightViewProj;\n uniform highp vec4 cc_shadowInvProjDepthInfo;\n uniform highp vec4 cc_shadowProjDepthInfo;\n uniform highp vec4 cc_shadowProjInfo;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowWHPBInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n uniform highp vec4 cc_csmViewDir0[4];\n uniform highp vec4 cc_csmViewDir1[4];\n uniform highp vec4 cc_csmViewDir2[4];\n uniform highp vec4 cc_csmAtlas[4];\n uniform highp mat4 cc_matCSMViewProj[4];\n uniform highp vec4 cc_csmProjDepthInfo[4];\n uniform highp vec4 cc_csmProjInfo[4];\n uniform highp vec4 cc_csmSplitsInfo;\n#endif\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n void packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n }\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(shadowMap, coord, 0.0);\n #else\n return texture2D(shadowMap, coord);\n #endif\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n}\nuniform samplerCube cc_environment;\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n uniform highp vec4 cc_reflectionProbeData1;\n uniform highp vec4 cc_reflectionProbeData2;\n uniform highp vec4 cc_reflectionProbeBlendData1;\n uniform highp vec4 cc_reflectionProbeBlendData2;\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture2D(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHT_PROBE\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #else\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#endif\nfloat GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nfloat CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n}\nvec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n}\n#if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture2D(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n#endif\nstruct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n};\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\nvec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = textureCube(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n#if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n#endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\nvarying highp vec4 v_shadowPos;\n#if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying vec3 v_luv;\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture2D(lightingMap, luv);\n \tvec4 dataHigh = texture2D(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture2D(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n#endif\nvarying highp vec3 v_position;\nvarying mediump vec3 v_normal;\n#if CC_RECEIVE_SHADOW\n varying vec2 v_shadowBias;\n#endif\nvarying mediump vec2 uvw;\nvarying mediump vec2 uv0;\nvarying mediump vec2 uv1;\nvarying mediump vec2 uv2;\nvarying mediump vec2 uv3;\nvarying mediump vec3 diffuse;\nvarying mediump vec3 luv;\n uniform vec4 metallic;\n uniform vec4 roughness;\nuniform sampler2D weightMap;\nuniform sampler2D detailMap0;\nuniform sampler2D detailMap1;\nuniform sampler2D detailMap2;\nuniform sampler2D detailMap3;\nuniform sampler2D normalMap0;\nuniform sampler2D normalMap1;\nuniform sampler2D normalMap2;\nuniform sampler2D normalMap3;\nvoid surf (out StandardSurface s) {\n #if LAYERS > 1\n vec4 w = texture2D(weightMap, uvw);\n #endif\n vec4 baseColor = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseColor = texture2D(detailMap0, uv0);\n #elif LAYERS == 2\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n baseColor += texture2D(detailMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseColor += texture2D(detailMap0, uv0) * w.r;\n baseColor += texture2D(detailMap1, uv1) * w.g;\n baseColor += texture2D(detailMap2, uv2) * w.b;\n baseColor += texture2D(detailMap3, uv3) * w.a;\n #else\n baseColor = texture2D(detailMap0, uv0);\n #endif\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(s.position, s.position_fract_part, v_position);\n #else\n s.position = v_position;\n #endif\n #if USE_NORMALMAP\n vec4 baseNormal = vec4(0, 0, 0, 0);\n #if LAYERS == 1\n baseNormal = texture2D(normalMap0, uv0);\n #elif LAYERS == 2\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n #elif LAYERS == 3\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n baseNormal += texture2D(normalMap2, uv2) * w.b;\n #elif LAYERS == 4\n baseNormal += texture2D(normalMap0, uv0) * w.r;\n baseNormal += texture2D(normalMap1, uv1) * w.g;\n baseNormal += texture2D(normalMap2, uv2) * w.b;\n baseNormal += texture2D(normalMap3, uv3) * w.a;\n #else\n baseNormal = texture2D(normalMap0, uv0);\n #endif\n vec3 tangent = vec3(1.0, 0.0, 0.0);\n vec3 binormal = vec3(0.0, 0.0, 1.0);\n binormal = cross(tangent, v_normal);\n tangent = cross(v_normal, binormal);\n vec3 nmmp = baseNormal.xyz - vec3(0.5);\n s.normal =\n nmmp.x * normalize(tangent) +\n nmmp.y * normalize(binormal) +\n nmmp.z * normalize(v_normal);\n #else\n s.normal = v_normal;\n #endif\n #if CC_RECEIVE_SHADOW\n s.shadowBias = v_shadowBias;\n #endif\n s.albedo = vec4(SRGBToLinear(baseColor.rgb), 1.0);\n s.occlusion = 1.0;\n #if USE_PBR\n s.roughness = 0.0;\n #if LAYERS == 1\n s.roughness = roughness.x;\n #elif LAYERS == 2\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n #elif LAYERS == 3\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n #elif LAYERS == 4\n s.roughness += roughness.x * w.r;\n s.roughness += roughness.y * w.g;\n s.roughness += roughness.z * w.b;\n s.roughness += roughness.w * w.a;\n #else\n s.roughness = 1.0;\n #endif\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #if LAYERS == 1\n s.specularIntensity = 0.5;\n s.metallic = metallic.x;\n #elif LAYERS == 2\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n #elif LAYERS == 3\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n #elif LAYERS == 4\n s.metallic += metallic.x * w.r;\n s.metallic += metallic.y * w.g;\n s.metallic += metallic.z * w.b;\n s.metallic += metallic.w * w.a;\n #else\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n #else\n s.roughness = 1.0;\n s.specularIntensity = 0.5;\n s.metallic = 0.0;\n #endif\n s.emissive = vec3(0.0, 0.0, 0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n SampleAndDecodeLightMapColor(s.lightmap.rgb, s.lightmap.a, s.lightmap_test, cc_lightingMap, luv.xy, luv.z, s.normal);\n #endif\n}\n#if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n uniform vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n #endif\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float strength = clamp(cc_lightBoundingSizeVS[i].w, 0.0, 1.0);\n float litAngleScale = 1.0 / max(0.001, mix(cosInner, 1.0, strength) - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n void main () {\n StandardSurface s; surf(s);\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n vec4 color = CCClusterShadingAdditive(s, v_shadowPos);\n #else\n vec4 color = CCStandardShadingAdditive(s, v_shadowPos);\n #endif\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n void main () {\n StandardSurface s; surf(s);\n vec4 color = CCStandardShadingBase(s, v_shadowPos);\n #if CC_USE_FOG != 4\n #if CC_USE_FLOAT_OUTPUT\n CC_APPLY_FOG(color, s.position.xyz);\n #elif !CC_FORWARD_ADD\n CC_APPLY_FOG(color, s.position.xyz);\n #endif\n #endif\n gl_FragData[0] = CCFragOutput(color);\n }\n#elif CC_PIPELINE_TYPE == 1\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n }\n void main () {\n StandardSurface s; surf(s);\n gl_FragData[0] = s.albedo;\n gl_FragData[2] = vec4(float32x3_to_oct(s.normal), s.roughness, s.metallic);\n gl_FragData[1] = vec4(s.emissive, s.occlusion);\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":115,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":122}},"defines":[{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"number","range":[0,3]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_REFLECTION_DENOISE","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_LIGHT_MAP_VERSION","type":"number","range":[0,3]},{"name":"LAYERS","type":"number","range":[0,4]},{"name":"USE_NORMALMAP","type":"boolean"},{"name":"USE_PBR","type":"boolean"},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]}]},{"hash":816809058,"name":"legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nout highp vec2 v_clip_depth;\nvec4 vert () {\n vec4 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n worldPos.w = 1.0;\n vec4 clipPos = cc_matLightViewProj * worldPos;\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nin highp vec2 v_clip_depth;\nvec4 frag () {\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matWorld;\nuniform highp mat4 cc_matLightViewProj;\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nvarying highp vec2 v_clip_depth;\nvec4 vert () {\n vec4 worldPos;\n worldPos.x = cc_matWorld[3][0] + a_position.x;\n worldPos.y = cc_matWorld[3][1] + a_position.y;\n worldPos.z = cc_matWorld[3][2] + a_position.z;\n worldPos.w = 1.0;\n vec4 clipPos = cc_matLightViewProj * worldPos;\n v_clip_depth = clipPos.zw;\n return clipPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nvarying highp vec2 v_clip_depth;\nvec4 frag () {\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_FORMAT == 1\n return packDepthToRGBA(clipDepth);\n #else\n return vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":72,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]}]}],[{"name":"opaque","passes":[{"program":"legacy/terrain|terrain-vs|terrain-fs","properties":{"UVScale":{"type":16,"value":[1,1,1,1]},"metallic":{"type":16,"value":[0,0,0,0]},"roughness":{"type":16,"value":[1,1,1,1]},"weightMap":{"value":"black","type":28},"detailMap0":{"value":"grey","type":28},"detailMap1":{"value":"grey","type":28},"detailMap2":{"value":"grey","type":28},"detailMap3":{"value":"grey","type":28},"normalMap0":{"value":"normal","type":28},"normalMap1":{"value":"normal","type":28},"normalMap2":{"value":"normal","type":28},"normalMap3":{"value":"normal","type":28}}},{"phase":"forward-add","propertyIndex":0,"program":"legacy/terrain|terrain-vs|terrain-fs","embeddedMacros":{"CC_FORWARD_ADD":true},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":1}]},"depthStencilState":{"depthFunc":2,"depthTest":true,"depthWrite":false},"properties":{"UVScale":{"type":16,"value":[1,1,1,1]},"metallic":{"type":16,"value":[0,0,0,0]},"roughness":{"type":16,"value":[1,1,1,1]},"weightMap":{"value":"black","type":28},"detailMap0":{"value":"grey","type":28},"detailMap1":{"value":"grey","type":28},"detailMap2":{"value":"grey","type":28},"detailMap3":{"value":"grey","type":28},"normalMap0":{"value":"normal","type":28},"normalMap1":{"value":"normal","type":28},"normalMap2":{"value":"normal","type":28},"normalMap3":{"value":"normal","type":28}}},{"phase":"shadow-add","propertyIndex":0,"program":"legacy/terrain|shadow-caster-vs:vert|shadow-caster-fs:frag","rasterizerState":{"cullMode":2}},{"phase":"deferred-forward","propertyIndex":0,"program":"legacy/terrain|terrain-vs|terrain-fs"}]}]]],0,0,[],[],[]],[[[1,"ui-alpha-test-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_ALPHA_TEST":true,"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]],[[[0,"pipeline/skybox",[{"hash":4049110380,"name":"pipeline/skybox|sky-vs:vert|sky-fs:frag","blocks":[],"samplerTextures":[{"name":"environmentMap","type":31,"count":1,"stageFlags":16,"binding":0,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[{"name":"environmentMap","type":31,"count":1,"stageFlags":16,"binding":0,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nout mediump vec4 viewDir;\nvec4 vert () {\n viewDir = vec4(a_position, 1.0);\n mat4 matViewRotOnly = mat4(mat3(cc_matView));\n vec4 pos = matViewRotOnly * viewDir;\n if (cc_matProj[3].w > 0.0) {\n mat4 matProj = cc_matProj;\n matProj[0].x = 5.2;\n matProj[1].y = 2.6;\n matProj[2].zw = vec2(-1.0);\n matProj[3].zw = vec2(0.0);\n pos = matProj * pos;\n } else {\n pos = cc_matProj * pos;\n }\n pos.z = 0.99999 * pos.w;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nuniform samplerCube cc_environment;\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nin mediump vec4 viewDir;\nuniform samplerCube environmentMap;\nvec4 frag () {\n vec3 rotationDir = RotationVecFromAxisY(viewDir.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_RGBE_CUBEMAP\n vec3 c = unpackRGBE(fragTextureLod(environmentMap, rotationDir.xyz, 0.0));\n #else\n vec3 c = SRGBToLinear(fragTextureLod(environmentMap, rotationDir.xyz, 0.0).rgb);\n #endif\n vec4 color = vec4(c * cc_ambientSky.w, 1.0);\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nvarying mediump vec4 viewDir;\nvec4 vert () {\n viewDir = vec4(a_position, 1.0);\n mat4 matViewRotOnly = mat4(mat3(cc_matView));\n vec4 pos = matViewRotOnly * viewDir;\n if (cc_matProj[3].w > 0.0) {\n mat4 matProj = cc_matProj;\n matProj[0].x = 5.2;\n matProj[1].y = 2.6;\n matProj[2].zw = vec2(-1.0);\n matProj[3].zw = vec2(0.0);\n pos = matProj * pos;\n } else {\n pos = cc_matProj * pos;\n }\n pos.z = 0.99999 * pos.w;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision mediump float;\nuniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_ambientSky;\nuniform samplerCube cc_environment;\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nvarying mediump vec4 viewDir;\nuniform samplerCube environmentMap;\nvec4 frag () {\n vec3 rotationDir = RotationVecFromAxisY(viewDir.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_RGBE_CUBEMAP\n vec3 c = unpackRGBE(fragTextureLod(environmentMap, rotationDir.xyz, 0.0));\n #else\n vec3 c = SRGBToLinear(fragTextureLod(environmentMap, rotationDir.xyz, 0.0).rgb);\n #endif\n vec4 color = vec4(c * cc_ambientSky.w, 1.0);\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[{"name":"cc_environment","defines":[]}],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":42,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"USE_RGBE_CUBEMAP","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"}]}],[{"passes":[{"program":"pipeline/skybox|sky-vs:vert|sky-fs:frag","priority":245,"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"environmentMap":{"value":"grey","type":31}}},{"propertyIndex":0,"phase":"deferred-forward","program":"pipeline/skybox|sky-vs:vert|sky-fs:frag","priority":245,"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"pipeline/deferred-lighting",[{"hash":1995297623,"name":"pipeline/deferred-lighting|lighting-vs|lighting-fs","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":0,"defines":[]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]},{"name":"depthStencil","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[{"name":"b_ccLightsBuffer","memoryAccess":1,"stageFlags":16,"binding":4,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightIndicesBuffer","memoryAccess":1,"stageFlags":16,"binding":5,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"b_clusterLightGridBuffer","memoryAccess":1,"stageFlags":16,"binding":6,"defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nout vec2 v_uv;\nvoid main () {\n vec4 position;\n position = vec4(a_position, 1.0);\n position.xy = cc_cameraPos.w == 0.0 ? vec2(position.xy.x, -position.xy.y) : position.xy;\n gl_Position = vec4(position.x, position.y, 1.0, 1.0);\n v_uv = a_texCoord;\n}","frag":"\n precision highp float;\n layout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n };\n layout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n };\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n vec3 SRGBToLinear (vec3 gamma) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n #endif\n return gamma * gamma;\n }\n vec3 LinearToSRGB(vec3 linear) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n #endif\n return sqrt(linear);\n }\n layout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n };\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n #endif\n #if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n #else\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n #endif\n vec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n {\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n }\n float GetCameraDepthRH(float depthHS, mat4 matProj)\n {\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n }\n float GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n {\n return -matProj32 / (depthHS + matProj22);\n }\n vec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n {\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n }\n float GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n }\n vec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n {\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n }\n vec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n {\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n }\n float CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n \tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n \treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n }\n float CCGetLinearDepth(vec3 worldPos) {\n \treturn CCGetLinearDepth(worldPos, 0.0);\n }\n #if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return textureLod(shadowMap, coord, 0.0);\n #else\n return texture(shadowMap, coord);\n #endif\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #endif\n highp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n }\n vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n vec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n }\n uniform samplerCube cc_environment;\n vec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n {\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n }\n vec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n {\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n }\n vec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n {\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n }\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n #endif\n #if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #else\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n #endif\n #endif\n float GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n }\n float CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n }\n vec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n }\n #if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = texture(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = texture(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n #endif\n struct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n };\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\n vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n #if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n #endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\n }\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float strength = clamp(cc_lightBoundingSizeVS[i].w, 0.0, 1.0);\n float litAngleScale = 1.0 / max(0.001, mix(cosInner, 1.0, strength) - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n layout(std430, binding = 0) readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n layout(std430, binding = 1) readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n layout(std430, binding = 2) readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n#endif\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n void CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n \tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n }\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec3 oct_to_float32x3(vec2 e) {\n vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));\n if (v.z < 0.0) v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n return normalize(v);\n }\n in vec2 v_uv;\n uniform sampler2D albedoMap;\n uniform sampler2D normalMap;\n uniform sampler2D emissiveMap;\n uniform sampler2D depthStencil;\n layout(location = 0) out vec4 fragColor;\n vec4 screen2WS(vec3 coord) {\n vec3 ndc = vec3(\n 2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,\n 2.0 * (coord.y - cc_viewPort.y) / cc_viewPort.w - 1.0,\n 2.0 * coord.z - 1.0);\n CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(ndc.y);\n return GetWorldPosFromNDCPosRH(ndc, cc_matProj, cc_matViewProjInv);\n }\n void main () {\n StandardSurface s;\n vec4 albedo = texture(albedoMap, v_uv);\n vec4 normal = texture(normalMap, v_uv);\n vec4 emissive = texture(emissiveMap, v_uv);\n float depth = texture(depthStencil, v_uv).x;\n s.albedo = albedo;\n vec3 position = screen2WS(vec3(gl_FragCoord.xy, depth)).xyz;\n s.position = position;\n s.roughness = normal.z;\n s.normal = oct_to_float32x3(normal.xy);\n s.specularIntensity = 0.5;\n s.metallic = normal.w;\n s.emissive = emissive.xyz;\n s.occlusion = emissive.w;\n#if CC_RECEIVE_SHADOW\n s.shadowBias = vec2(0, 0);\n#endif\n float fogFactor;\n CC_TRANSFER_FOG_BASE(vec4(position, 1), fogFactor);\n vec4 shadowPos;\n shadowPos = cc_matLightViewProj * vec4(position, 1);\n vec4 color = CCStandardShadingBase(s, shadowPos) +\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n CCClusterShadingAdditive(s, shadowPos);\n#else\n CCStandardShadingAdditive(s, shadowPos);\n#endif\n CC_APPLY_FOG_BASE(color, fogFactor);\n color = CCFragOutput(color);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n color = vec4(albedoMap.rgb, 1.0);\n#endif\n fragColor = color;\n }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\nuniform highp vec4 cc_cameraPos;\nvarying vec2 v_uv;\nvoid main () {\n vec4 position;\n position = vec4(a_position, 1.0);\n position.xy = cc_cameraPos.w == 0.0 ? vec2(position.xy.x, -position.xy.y) : position.xy;\n gl_Position = vec4(position.x, position.y, 1.0, 1.0);\n v_uv = a_texCoord;\n}","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\n precision highp float;\n uniform mediump vec4 cc_probeInfo;\n uniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProj;\n uniform highp mat4 cc_matViewProjInv;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_ambientGround;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n uniform mediump vec4 cc_nearFar;\n uniform mediump vec4 cc_viewPort;\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n vec3 SRGBToLinear (vec3 gamma) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n #endif\n return gamma * gamma;\n }\n vec3 LinearToSRGB(vec3 linear) {\n #ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n #endif\n return sqrt(linear);\n }\n uniform highp mat4 cc_matLightView;\n uniform highp mat4 cc_matLightViewProj;\n uniform highp vec4 cc_shadowInvProjDepthInfo;\n uniform highp vec4 cc_shadowProjDepthInfo;\n uniform highp vec4 cc_shadowProjInfo;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowWHPBInfo;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n uniform highp vec4 cc_csmViewDir0[4];\n uniform highp vec4 cc_csmViewDir1[4];\n uniform highp vec4 cc_csmViewDir2[4];\n uniform highp vec4 cc_csmAtlas[4];\n uniform highp mat4 cc_matCSMViewProj[4];\n uniform highp vec4 cc_csmProjDepthInfo[4];\n uniform highp vec4 cc_csmProjInfo[4];\n uniform highp vec4 cc_csmSplitsInfo;\n #endif\n #if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n #else\n #define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n #endif\n vec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n {\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n }\n float GetCameraDepthRH(float depthHS, mat4 matProj)\n {\n return -matProj[3][2] / (depthHS + matProj[2][2]);\n }\n float GetCameraDepthRH(float depthHS, float matProj32, float matProj22)\n {\n return -matProj32 / (depthHS + matProj22);\n }\n vec4 GetWorldPosFromNDCPosRH(vec3 posHS, mat4 matProj, mat4 matViewProjInv)\n {\n float w = -GetCameraDepthRH(posHS.z, matProj);\n return matViewProjInv * vec4(posHS * w, w);\n }\n float GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n }\n vec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n {\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n }\n vec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n {\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n }\n float CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n \tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n \treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n }\n float CCGetLinearDepth(vec3 worldPos) {\n \treturn CCGetLinearDepth(worldPos, 0.0);\n }\n #if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n highp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n }\n highp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n }\n highp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n }\n highp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n }\n highp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n }\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(shadowMap, coord, 0.0);\n #else\n return texture2D(shadowMap, coord);\n #endif\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n \t vec3 shadowNDCPos;\n \t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n \t\t return 1.0;\n \t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #endif\n highp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n }\n vec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n }\n vec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n }\n uniform samplerCube cc_environment;\n vec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n {\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n }\n vec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n {\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n }\n vec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n {\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n }\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n uniform highp vec4 cc_reflectionProbeData1;\n uniform highp vec4 cc_reflectionProbeData2;\n uniform highp vec4 cc_reflectionProbeBlendData1;\n uniform highp vec4 cc_reflectionProbeBlendData2;\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture2D(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n #endif\n #if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #else\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n #endif\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n #endif\n #endif\n float GGXMobile (float roughness, float NoH, vec3 H, vec3 N) {\n vec3 NxH = cross(N, H);\n float OneMinusNoHSqr = dot(NxH, NxH);\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n }\n float CalcSpecular (float roughness, float NoH, vec3 H, vec3 N) {\n return (roughness * 0.25 + 0.25) * GGXMobile(roughness, NoH, H, N);\n }\n vec3 BRDFApprox (vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n return max(vec3(0.0), specular * AB.x + AB.y);\n }\n #if USE_REFLECTION_DENOISE\n vec3 GetEnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity, vec2 screenUV) {\n #if CC_USE_IBL\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n vec4 biased = fragTextureLod(cc_reflectionProbeCubemap, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_reflectionProbeCubemap, R);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec4 biased = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mip + mipBias);\n vec4 filtered = texture2D(cc_reflectionProbePlanarMap, screenUV);\n #else\n vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);\n \t vec4 filtered = textureCube(cc_environment, R);\n #endif\n #if CC_USE_IBL == 2 || CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_NONE\n biased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n #endif\n struct StandardSurface {\n vec4 albedo;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 position, position_fract_part;\n #else\n vec3 position;\n #endif\n vec3 normal;\n vec3 emissive;\n vec4 lightmap;\n float lightmap_test;\n float roughness;\n float metallic;\n float occlusion;\n float specularIntensity;\n #if CC_RECEIVE_SHADOW\n vec2 shadowBias;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n float reflectionProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n float reflectionProbeBlendId;\n float reflectionProbeBlendFactor;\n #endif\n };\n vec3 SampleReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n if (isRGBE)\n return unpackRGBE(envmap);\n else\n return SRGBToLinear(envmap.rgb);\n }\n vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.08 * s.specularIntensity), s.albedo.rgb, s.metallic);\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n vec3 L = normalize(-cc_mainLitDir.xyz);\n float NL = max(dot(N, L), 0.0);\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (NL > 0.0 && cc_mainLitDir.w > 0.0) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n shadow = CCCSMFactorBase(position, N, s.shadowBias);\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadow = CCShadowFactorBase(shadowPos, N, s.shadowBias);\n #endif\n }\n #endif\n vec3 finalColor = vec3(0.0);\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmap = s.lightmap.rgb;\n #if CC_USE_HDR\n lightmap.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n #if CC_USE_LIGHTMAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n shadow *= s.lightmap.a;\n finalColor += diffuse * lightmap.rgb;\n #else\n finalColor += diffuse * lightmap.rgb * shadow;\n #endif\n s.occlusion *= s.lightmap_test;\n #endif\n #if !CC_DISABLE_DIRECTIONAL_LIGHT\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 H = normalize(L + V);\n float NH = max(dot(N, H), 0.0);\n vec3 lightingColor = NL * cc_mainLitColor.rgb * cc_mainLitColor.w;\n vec3 diffuseContrib = diffuse / PI;\n vec3 specularContrib = specular * CalcSpecular(s.roughness, NH, H, N);\n vec3 dirlightContrib = (diffuseContrib + specularContrib);\n dirlightContrib *= shadow;\n finalColor += lightingColor * dirlightContrib;\n #endif\n float fAmb = max(EPSILON, 0.5 - N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n vec3 env = vec3(0.0), rotationDir;\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n rotationDir = RotationVecFromAxisY(N.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = textureCube(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #if !CC_USE_REFLECTION_PROBE\n vec3 R = normalize(reflect(-V, N));\n rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n #if USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n env = GetEnvReflectionWithMipFiltering(rotationDir, s.roughness, cc_ambientGround.w, 0.6, vec2(0.0));\n #else\n vec4 envmap = fragTextureLod(cc_environment, rotationDir, s.roughness * (cc_ambientGround.w - 1.0));\n #if CC_USE_IBL == 2\n env = unpackRGBE(envmap);\n #else\n env = SRGBToLinear(envmap.rgb);\n #endif\n #endif\n #endif\n #endif\n float lightIntensity = cc_ambientSky.w;\n #if CC_USE_REFLECTION_PROBE\n vec4 probe = vec4(0.0);\n vec3 R = normalize(reflect(-V, N));\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(s.reflectionProbeId < 0.0){\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, position, centerPos, boxHalfSize);\n env = mix(SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity,\n SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId)), fixedR.w);\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n if(s.reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(s.position, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0);\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, s.reflectionProbeId);\n R = normalize(CalculateReflectDirection(N, V, max(abs(dot(N, V)), 0.0)));\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(N, V, s.position, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, V, R);\n probe = fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount);\n }\n env = unpackRGBE(probe);\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if (s.reflectionProbeId < 0.0) {\n env = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2);\n } else {\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, s.reflectionProbeId);\n vec4 fixedR = CalculateBoxProjectedDirection(R, s.position, centerPos, boxHalfSize);\n env = SampleReflectionProbe(cc_reflectionProbeCubemap, fixedR.xyz, s.roughness, mipCount, isReflectProbeUsingRGBE(s.reflectionProbeId));\n if (s.reflectionProbeBlendId < 0.0) {\n vec3 skyBoxEnv = SampleReflectionProbe(cc_environment, R, s.roughness, cc_ambientGround.w, CC_USE_IBL == 2) * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n env = mix(env, skyBoxEnv, s.reflectionProbeBlendFactor);\n #else\n env = mix(skyBoxEnv, env, fixedR.w);\n #endif\n } else {\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, s.reflectionProbeBlendId);\n vec4 fixedRBlend = CalculateBoxProjectedDirection(R, s.position, centerPosBlend, boxHalfSizeBlend);\n vec3 probe1 = SampleReflectionProbe(cc_reflectionProbeBlendCubemap, fixedRBlend.xyz, s.roughness, mipCountBlend, isBlendReflectProbeUsingRGBE(s.reflectionProbeBlendId));\n env = mix(env, probe1, s.reflectionProbeBlendFactor);\n }\n }\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = s.reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n finalColor += env * lightIntensity * specular * s.occlusion;\n #if CC_USE_LIGHT_PROBE\n finalColor += SHEvaluate(N) * diffuse * s.occlusion;\n #endif\n finalColor += ambDiff.rgb * cc_ambientSky.w * diffuse * s.occlusion;\n finalColor += s.emissive;\n return vec4(finalColor, s.albedo.a);\n }\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n uniform vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n #endif\n float SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n }\n float GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n }\n float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n }\n float GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n vec4 CCStandardShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.0);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 SLU = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -cc_lightDir[i].xyz : cc_lightPos[i].xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.0);\n float SNH = max(dot(N, SH), 0.0);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n float illum = 1.0;\n float att = 1.0;\n if (IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n att = GetOutOfRange(position, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n float distSqr = dot(SLU, SLU);\n float litRadius = cc_lightSizeRangeAngle[i].x;\n float litRadiusSqr = litRadius * litRadius;\n illum = (IS_POINT_LIGHT(cc_lightPos[i].w) || IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distSqr);\n float attRadiusSqrInv = 1.0 / max(cc_lightSizeRangeAngle[i].y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n att = GetDistAtt(distSqr, attRadiusSqrInv);\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n float cosInner = max(dot(-cc_lightDir[i].xyz, SL), 0.01);\n float cosOuter = cc_lightSizeRangeAngle[i].z;\n float strength = clamp(cc_lightBoundingSizeVS[i].w, 0.0, 1.0);\n float litAngleScale = 1.0 / max(0.001, mix(cosInner, 1.0, strength) - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -cc_lightDir[i].xyz, litAngleScale, litAngleOffset);\n }\n }\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(cc_lightPos[i].w) && cc_lightSizeRangeAngle[i].w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n finalColor += SNL * cc_lightColor[i].rgb * shadow * cc_lightColor[i].w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n #endif\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n readonly buffer b_ccLightsBuffer { vec4 b_ccLights[]; };\n readonly buffer b_clusterLightIndicesBuffer { uint b_clusterLightIndices[]; };\n readonly buffer b_clusterLightGridBuffer { uvec4 b_clusterLightGrid[]; };\n struct CCLight\n {\n vec4 cc_lightPos;\n vec4 cc_lightColor;\n vec4 cc_lightSizeRangeAngle;\n vec4 cc_lightDir;\n vec4 cc_lightBoundingSizeVS;\n };\n struct Cluster\n {\n vec3 minBounds;\n vec3 maxBounds;\n };\n struct LightGrid\n {\n uint offset;\n uint ccLights;\n };\n CCLight getCCLight(uint i)\n {\n CCLight light;\n light.cc_lightPos = b_ccLights[5u * i + 0u];\n light.cc_lightColor = b_ccLights[5u * i + 1u];\n light.cc_lightSizeRangeAngle = b_ccLights[5u * i + 2u];\n light.cc_lightDir = b_ccLights[5u * i + 3u];\n light.cc_lightBoundingSizeVS = b_ccLights[5u * i + 4u];\n return light;\n }\n LightGrid getLightGrid(uint cluster)\n {\n uvec4 gridvec = b_clusterLightGrid[cluster];\n LightGrid grid;\n grid.offset = gridvec.x;\n grid.ccLights = gridvec.y;\n return grid;\n }\n uint getGridLightIndex(uint start, uint offset)\n {\n return b_clusterLightIndices[start + offset];\n }\n uint getClusterZIndex(vec4 worldPos)\n {\n float scale = float(24u) / log(cc_nearFar.y / cc_nearFar.x);\n float bias = -(float(24u) * log(cc_nearFar.x) / log(cc_nearFar.y / cc_nearFar.x));\n float eyeDepth = -(cc_matView * worldPos).z;\n uint zIndex = uint(max(log(eyeDepth) * scale + bias, 0.0));\n return zIndex;\n }\n uint getClusterIndex(vec4 fragCoord, vec4 worldPos)\n {\n uint zIndex = getClusterZIndex(worldPos);\n float clusterSizeX = ceil(cc_viewPort.z / float(16u));\n float clusterSizeY = ceil(cc_viewPort.w / float(8u));\n uvec3 indices = uvec3(uvec2(fragCoord.xy / vec2(clusterSizeX, clusterSizeY)), zIndex);\n uint cluster = (16u * 8u) * indices.z + 16u * indices.y + indices.x;\n return cluster;\n }\n vec4 CCClusterShadingAdditive (StandardSurface s, vec4 shadowPos) {\n vec3 diffuse = s.albedo.rgb * (1.0 - s.metallic);\n vec3 specular = mix(vec3(0.04), s.albedo.rgb, s.metallic);\n vec3 diffuseContrib = diffuse / PI;\n vec3 position;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n position = unpackHighpData(s.position, s.position_fract_part);\n #else\n position = s.position;\n #endif\n vec3 N = normalize(s.normal);\n vec3 V = normalize(cc_cameraPos.xyz - position);\n float NV = max(abs(dot(N, V)), 0.001);\n specular = BRDFApprox(specular, s.roughness, NV);\n vec3 finalColor = vec3(0.0);\n uint cluster = getClusterIndex(gl_FragCoord, vec4(position, 1.0));\n LightGrid grid = getLightGrid(cluster);\n uint numLights = grid.ccLights;\n for (uint i = 0u; i < 200u; i++) {\n if (i >= numLights) break;\n uint lightIndex = getGridLightIndex(grid.offset, i);\n CCLight light = getCCLight(lightIndex);\n vec3 SLU = light.cc_lightPos.xyz - position;\n vec3 SL = normalize(SLU);\n vec3 SH = normalize(SL + V);\n float SNL = max(dot(N, SL), 0.001);\n float SNH = max(dot(N, SH), 0.0);\n float distSqr = dot(SLU, SLU);\n float litRadius = light.cc_lightSizeRangeAngle.x;\n float litRadiusSqr = litRadius * litRadius;\n float illum = PI * (litRadiusSqr / max(litRadiusSqr , distSqr));\n float attRadiusSqrInv = 1.0 / max(light.cc_lightSizeRangeAngle.y, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float att = GetDistAtt(distSqr, attRadiusSqrInv);\n vec3 lspec = specular * CalcSpecular(s.roughness, SNH, SH, N);\n if (IS_SPOT_LIGHT(light.cc_lightPos.w)) {\n float cosInner = max(dot(-light.cc_lightDir.xyz, SL), 0.01);\n float cosOuter = light.cc_lightSizeRangeAngle.z;\n float litAngleScale = 1.0 / max(0.001, cosInner - cosOuter);\n float litAngleOffset = -cosOuter * litAngleScale;\n att *= GetAngleAtt(SL, -light.cc_lightDir.xyz, litAngleScale, litAngleOffset);\n }\n vec3 lightColor = light.cc_lightColor.rgb;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (IS_SPOT_LIGHT(light.cc_lightPos.w) && light.cc_lightSizeRangeAngle.w > 0.0) {\n shadow = CCSpotShadowFactorBase(shadowPos, position, s.shadowBias);\n }\n #endif\n lightColor *= shadow;\n finalColor += SNL * lightColor * light.cc_lightColor.w * illum * att * (diffuseContrib + lspec);\n }\n return vec4(finalColor, 0.0);\n }\n#endif\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n void CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n \tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n }\n vec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n }\n vec3 oct_to_float32x3(vec2 e) {\n vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));\n if (v.z < 0.0) v.xy = (1.0 - abs(v.yx)) * signNotZero(v.xy);\n return normalize(v);\n }\n varying vec2 v_uv;\n uniform sampler2D albedoMap;\n uniform sampler2D normalMap;\n uniform sampler2D emissiveMap;\n uniform sampler2D depthStencil;\n vec4 screen2WS(vec3 coord) {\n vec3 ndc = vec3(\n 2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,\n 2.0 * (coord.y - cc_viewPort.y) / cc_viewPort.w - 1.0,\n 2.0 * coord.z - 1.0);\n CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(ndc.y);\n return GetWorldPosFromNDCPosRH(ndc, cc_matProj, cc_matViewProjInv);\n }\n void main () {\n StandardSurface s;\n vec4 albedo = texture2D(albedoMap, v_uv);\n vec4 normal = texture2D(normalMap, v_uv);\n vec4 emissive = texture2D(emissiveMap, v_uv);\n float depth = texture2D(depthStencil, v_uv).x;\n s.albedo = albedo;\n vec3 position = screen2WS(vec3(gl_FragCoord.xy, depth)).xyz;\n s.position = position;\n s.roughness = normal.z;\n s.normal = oct_to_float32x3(normal.xy);\n s.specularIntensity = 0.5;\n s.metallic = normal.w;\n s.emissive = emissive.xyz;\n s.occlusion = emissive.w;\n#if CC_RECEIVE_SHADOW\n s.shadowBias = vec2(0, 0);\n#endif\n float fogFactor;\n CC_TRANSFER_FOG_BASE(vec4(position, 1), fogFactor);\n vec4 shadowPos;\n shadowPos = cc_matLightViewProj * vec4(position, 1);\n vec4 color = CCStandardShadingBase(s, shadowPos) +\n#if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 1\n CCClusterShadingAdditive(s, shadowPos);\n#else\n CCStandardShadingAdditive(s, shadowPos);\n#endif\n CC_APPLY_FOG_BASE(color, fogFactor);\n color = CCFragOutput(color);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n color = vec4(albedoMap.rgb, 1.0);\n#endif\n gl_FragColor = color;\n }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]},{"name":"CCForwardLight","defines":["CC_ENABLE_CLUSTERED_LIGHT_CULLING"]}],"samplerTextures":[{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":42,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":120}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"number","range":[0,3]},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_REFLECTION_DENOISE","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]}]}],[{"passes":[{"pass":"deferred-lighting","program":"pipeline/deferred-lighting|lighting-vs|lighting-fs","rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[3,"for2d/builtin-sprite",[{}],[{"hash":2249878161,"name":"for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if SAMPLE_FROM_RT\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n#endif\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec4 color;\nout vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n layout(std140) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 color;\n#if USE_TEXTURE\n in vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n#if USE_LOCAL\n uniform highp mat4 cc_matWorld;\n#endif\n#if SAMPLE_FROM_RT\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define LIGHT_MAP_TYPE_DISABLED 0\n #define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n #define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n #define REFLECTION_PROBE_TYPE_NONE 0\n #define REFLECTION_PROBE_TYPE_CUBE 1\n #define REFLECTION_PROBE_TYPE_PLANAR 2\n #define REFLECTION_PROBE_TYPE_BLEND 3\n #define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n #define LIGHT_TYPE_DIRECTIONAL 0.0\n #define LIGHT_TYPE_SPHERE 1.0\n #define LIGHT_TYPE_SPOT 2.0\n #define LIGHT_TYPE_POINT 3.0\n #define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n #define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n #define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n #define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n #define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n #define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n #define TONE_MAPPING_ACES 0\n #define TONE_MAPPING_LINEAR 1\n #define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n #ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n #endif\n #ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n #endif\n#endif\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec4 color;\nvarying vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture2D(tex, uv).rgb, texture2D(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture2D(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 color;\n#if USE_TEXTURE\n varying vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":["USE_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"USE_PIXEL_ALIGNMENT","type":"boolean"},{"name":"CC_USE_EMBEDDED_ALPHA","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"IS_GRAY","type":"boolean"}]}],[{"passes":[{"program":"for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[0,"pipeline/post-process/tone-mapping",[{"hash":879047950,"name":"pipeline/post-process/tone-mapping|vs|fs-tonemap","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"Pipeline","stageFlags":1,"binding":0,"members":[{"name":"g_platform","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"inputTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform Pipeline {\n vec4 g_platform;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n (In.position).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}","frag":"\nprecision highp float;\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nin vec2 v_uv;\nuniform sampler2D inputTexture;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n fragColor = texture(inputTexture, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n fragColor.rgb = HDRToLDR(fragColor.rgb);\n fragColor.rgb = LinearToSRGB(fragColor.rgb);\n #endif\n}"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n uniform vec4 g_platform;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n (In.position).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}","frag":"\nprecision highp float;\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvarying vec2 v_uv;\nuniform sampler2D inputTexture;\nvoid main () {\n gl_FragColor = texture2D(inputTexture, v_uv);\n #if CC_USE_FLOAT_OUTPUT\n gl_FragColor.rgb = HDRToLDR(gl_FragColor.rgb);\n gl_FragColor.rgb = LinearToSRGB(gl_FragColor.rgb);\n #endif\n}"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":1,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"}]},{"hash":4126709291,"name":"pipeline/post-process/tone-mapping|vs|fs-copy","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"Pipeline","stageFlags":1,"binding":0,"members":[{"name":"g_platform","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"inputTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\nlayout(std140) uniform Pipeline {\n vec4 g_platform;\n};\nout vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n (In.position).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}","frag":"\nprecision highp float;\nin vec2 v_uv;\nuniform sampler2D inputTexture;\nlayout(location = 0) out vec4 fragColor;\nvoid main () {\n fragColor = texture(inputTexture, v_uv);\n}"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n uniform vec4 g_platform;\nvarying vec2 v_uv;\nvoid main () {\n StandardVertInput In;\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n In.tangent = a_tangent;\n (In.position).y = g_platform.w == 0.0 ? -(In.position).y : (In.position).y;\n gl_Position = In.position;\n v_uv = a_texCoord;\n}","frag":"\nprecision highp float;\nvarying vec2 v_uv;\nuniform sampler2D inputTexture;\nvoid main () {\n gl_FragColor = texture2D(inputTexture, v_uv);\n}"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":1,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"}]}],[{"passes":[{"pass":"cc-tone-mapping","program":"pipeline/post-process/tone-mapping|vs|fs-tonemap","rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}},{"pass":"cc-tone-mapping","program":"pipeline/post-process/tone-mapping|vs|fs-copy","rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"particles/builtin-billboard",[{"hash":2281029704,"name":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nlayout(std140) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\n uniform vec4 cc_size_rotation;\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[]},{"hash":2715866145,"name":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":2,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":3,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nlayout(std140) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\n uniform vec4 cc_size_rotation;\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n col.a = (1.0 - texColor.a) * (tintColor.a * color.a * 2.0);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[]},{"hash":3617975406,"name":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nlayout(std140) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\n uniform vec4 cc_size_rotation;\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]},{"hash":3619147658,"name":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"builtin","stageFlags":1,"binding":1,"members":[{"name":"cc_size_rotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nlayout(std140) uniform builtin {\n vec4 cc_size_rotation;\n};\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n , mat4 viewInv\n) {\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n}\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\n uniform vec4 cc_size_rotation;\nvec4 vs_main() {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matWorld * pos;\n vec2 vertOffset = a_texCoord.xy - 0.5;\n computeVertPos(pos, vertOffset, quaternionFromEuler(vec3(0., 0., cc_size_rotation.z)), vec3(cc_size_rotation.xy, 0.), cc_matViewInv);\n pos = cc_matViewProj * pos;\n uv = a_texCoord.xy;\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":61,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]}],[{"name":"add","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-billboard|vert:vs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"default-billboard-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[4]],[[[3,"internal/builtin-clear-stencil",[{}],[{"hash":3507038093,"name":"internal/builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nin vec3 a_position;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 frag () {\n vec4 o = vec4(1.0);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nattribute vec3 a_position;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 frag () {\n vec4 o = vec4(1.0);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":0,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"internal/builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"util/profiler",[{"hash":394204838,"name":"util/profiler|profiler-vs:vert|profiler-fs:frag","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"offset","type":16,"count":1}],"defines":[]},{"name":"PerFrameInfo","stageFlags":1,"binding":1,"members":[{"name":"digits","type":16,"count":22}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"offset","type":16,"count":1}],"defines":[]},{"name":"PerFrameInfo","stageFlags":1,"binding":1,"members":[{"name":"digits","type":16,"count":22}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec2 v_uv;\nlayout(std140) uniform Constants {\n vec4 offset;\n};\nlayout(std140) uniform PerFrameInfo {\n vec4 digits[8 * 11 / 4];\n};\nfloat getComponent(vec4 v, float i) {\n if (i < 1.0) { return v.x; }\n else if (i < 2.0) { return v.y; }\n else if (i < 3.0) { return v.z; }\n else { return v.w; }\n}\nvec4 vert () {\n mat2 proj = mat2(cc_matProj[0].xy, cc_matProj[1].xy);\n proj /= abs(proj[1].x + proj[1].y);\n vec2 position = proj * a_position.xy + offset.xy;\n v_uv = a_color.xy;\n if (a_color.z >= 0.0) {\n float n = getComponent(digits[int(a_color.z)], a_color.w);\n v_uv += vec2(offset.z * n, 0.0);\n }\n return vec4(position, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 v_uv;\nuniform sampler2D mainTexture;\nvec4 frag () {\n return CCFragOutput(texture(mainTexture, v_uv));\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matProj;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec2 v_uv;\n uniform vec4 offset;\n uniform vec4 digits[22];\nfloat getComponent(vec4 v, float i) {\n if (i < 1.0) { return v.x; }\n else if (i < 2.0) { return v.y; }\n else if (i < 3.0) { return v.z; }\n else { return v.w; }\n}\nvec4 vert () {\n mat2 proj = mat2(cc_matProj[0].xy, cc_matProj[1].xy);\n proj /= abs(proj[1].x + proj[1].y);\n vec2 position = proj * a_position.xy + offset.xy;\n v_uv = a_color.xy;\n if (a_color.z >= 0.0) {\n float n = getComponent(digits[int(a_color.z)], a_color.w);\n v_uv += vec2(offset.z * n, 0.0);\n }\n return vec4(position, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 v_uv;\nuniform sampler2D mainTexture;\nvec4 frag () {\n return CCFragOutput(texture2D(mainTexture, v_uv));\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":65,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[]}],[{"passes":[{"program":"util/profiler|profiler-vs:vert|profiler-fs:frag","priority":255,"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"default-clear-stencil",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[5]],[[[0,"pipeline/planar-shadow",[{"hash":3680218420,"name":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nout float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nvarying float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"passes":[{"phase":"planarShadow","program":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}}]}]]],0,0,[],[],[]],[[[0,"util/splash-screen",[{"hash":3189094080,"name":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blocks":[{"name":"Constant","stageFlags":1,"binding":0,"members":[{"name":"u_buffer0","type":16,"count":1},{"name":"u_buffer1","type":16,"count":1},{"name":"u_projection","type":25,"count":1}],"defines":[]},{"name":"Factor","stageFlags":16,"binding":1,"members":[{"name":"u_percent","type":13,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":21,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constant","stageFlags":1,"binding":0,"members":[{"name":"u_buffer0","type":16,"count":1},{"name":"u_buffer1","type":16,"count":1},{"name":"u_projection","type":25,"count":1}],"defines":[]},{"name":"Factor","stageFlags":16,"binding":1,"members":[{"name":"u_percent","type":13,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nin vec2 a_position;\nin vec2 a_texCoord;\nout vec2 v_uv;\nlayout(std140) uniform Constant {\n vec4 u_buffer0;\n vec4 u_buffer1;\n mat4 u_projection;\n};\nvec4 vert () {\n vec2 worldPos = a_position * u_buffer1.xy + u_buffer1.zw;\n vec2 clipSpace = worldPos / u_buffer0.xy * 2.0 - 1.0;\n vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);\n v_uv = a_texCoord;\n return screenPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nin vec2 v_uv;\nlayout(std140) uniform Factor {\n float u_percent;\n};\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = texture(mainTexture, v_uv);\n float percent = clamp(u_percent, 0.0, 1.0);\n color.xyz *= percent;\n return color;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision mediump float;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_uv;\n uniform vec4 u_buffer0;\n uniform vec4 u_buffer1;\n uniform mat4 u_projection;\nvec4 vert () {\n vec2 worldPos = a_position * u_buffer1.xy + u_buffer1.zw;\n vec2 clipSpace = worldPos / u_buffer0.xy * 2.0 - 1.0;\n vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);\n v_uv = a_texCoord;\n return screenPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nvarying vec2 v_uv;\n uniform float u_percent;\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = texture2D(mainTexture, v_uv);\n float percent = clamp(u_percent, 0.0, 1.0);\n color.xyz *= percent;\n return color;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":6,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[]}],[{"name":"default","passes":[{"program":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"resolution":{"type":14,"value":[640,960],"handleInfo":["u_buffer0",0,14]},"percent":{"type":13,"value":[0.5],"handleInfo":["u_percent",0,13]},"scale":{"type":14,"value":[200,500],"handleInfo":["u_buffer1",0,14]},"translate":{"type":14,"value":[320,480],"handleInfo":["u_buffer1",2,14]},"u_buffer0":{"type":16,"value":[640,960,0,0]},"u_percent":{"type":13,"value":[0.5]},"u_buffer1":{"type":16,"value":[200,500,320,480]}}}]}]]],0,0,[],[],[]],[[[0,"particles/builtin-particle-gpu",[{"hash":2859307513,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"glsl1":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":2330235135,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"FragConstants","stageFlags":16,"binding":9,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":15,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":16,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"glsl1":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":1067163463,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"glsl1":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]},{"hash":3967087977,"name":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position_starttime","format":44,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dir_life","format":44,"location":2,"defines":[]},{"name":"a_rndSeed","format":11,"location":3,"defines":[]},{"name":"a_size_uv","format":44,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_rotation_uv","format":44,"location":5,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_size_fid","format":44,"location":6,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_rotation","format":32,"location":7,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_uv","format":32,"location":8,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":10,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":11,"defines":["CC_RENDER_MODE"]},{"name":"a_color1","format":44,"location":12,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"SampleConstants","stageFlags":1,"binding":1,"members":[{"name":"u_sampleInfo","type":16,"count":1}],"defines":[]},{"name":"TickConstants","stageFlags":1,"binding":2,"members":[{"name":"u_worldRot","type":16,"count":1},{"name":"u_timeDelta","type":16,"count":1}],"defines":[]},{"name":"ColorConstant","stageFlags":1,"binding":3,"members":[{"name":"u_color_mode","type":5,"count":1}],"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"RotationConstant","stageFlags":1,"binding":4,"members":[{"name":"u_rotation_mode","type":5,"count":1}],"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"SizeConstant","stageFlags":1,"binding":5,"members":[{"name":"u_size_mode","type":5,"count":1}],"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"ForceConstant","stageFlags":1,"binding":6,"members":[{"name":"u_force_mode","type":5,"count":1},{"name":"u_force_space","type":5,"count":1}],"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"VelocityConstant","stageFlags":1,"binding":7,"members":[{"name":"u_velocity_mode","type":5,"count":1},{"name":"u_velocity_space","type":5,"count":1}],"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"AnimationConstant","stageFlags":1,"binding":8,"members":[{"name":"u_anim_info","type":16,"count":1}],"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]}],"samplerTextures":[{"name":"color_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":9,"defines":["COLOR_OVER_TIME_MODULE_ENABLE"]},{"name":"rotation_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":10,"defines":["ROTATION_OVER_TIME_MODULE_ENABLE"]},{"name":"size_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":11,"defines":["SIZE_OVER_TIME_MODULE_ENABLE"]},{"name":"force_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":12,"defines":["FORCE_OVER_TIME_MODULE_ENABLE"]},{"name":"velocity_over_time_tex0","type":28,"count":1,"stageFlags":1,"binding":13,"defines":["VELOCITY_OVER_TIME_MODULE_ENABLE"]},{"name":"texture_animation_tex0","type":28,"count":1,"stageFlags":1,"binding":14,"defines":["TEXTURE_ANIMATION_MODULE_ENABLE"]},{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":15,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"glsl1":{"vert":"\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":71,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"USE_VK_SHADER","type":"boolean"},{"name":"COLOR_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"SIZE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"FORCE_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"VELOCITY_OVER_TIME_MODULE_ENABLE","type":"boolean"},{"name":"TEXTURE_ANIMATION_MODULE_ENABLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"builtin-unlit",[{"hash":340555192,"name":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1}],"defines":["USE_TEXTURE"]},{"name":"Constant","stageFlags":16,"binding":1,"members":[{"name":"mainColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]},{"name":"a_color","format":44,"location":17,"defines":["USE_VERTEX_COLOR"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1}],"defines":["USE_TEXTURE"]},{"name":"Constant","stageFlags":16,"binding":1,"members":[{"name":"mainColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nout mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n in lowp vec4 a_color;\n out lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n out vec2 v_uv;\n layout(std140) uniform TexCoords {\n vec4 tilingOffset;\n };\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nin mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n in vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\nlayout(std140) uniform Constant {\n vec4 mainColor;\n vec4 colorScaleAndCutoff;\n};\n#if USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n attribute lowp vec4 a_color;\n varying lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform vec4 tilingOffset;\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\n uniform vec4 mainColor;\n uniform vec4 colorScaleAndCutoff;\n#if USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture2D(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":75,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":44}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC","type":"boolean"},{"name":"CC_SURFACES_ENABLE_DEBUG_VIEW","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r","g","b"]}]},{"hash":3680218420,"name":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":16,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nout float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nvarying float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":90,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":58}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_LIGHT_PROBE","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"name":"opaque","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag"}]},{"name":"transparent","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":2,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":2,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"default-spine-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":false}]]],0,0,[0],[0],[6]],[[[4,"default-physics-material",0.8,0.1,0.1,0.1]],0,0,[],[],[]],[[[2,"missing-effect-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4278255615]]],11]]],0,0,[0],[0],[1]],[[[1,"default-particle-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[7]],[[[0,"for2d/builtin-spine",[{"hash":3152403458,"name":"for2d/builtin-spine|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_color2","format":44,"location":3,"defines":["TWO_COLORED"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":1,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec4 v_light;\nout vec2 uv0;\n#if TWO_COLORED\n in vec4 a_color2;\n out vec4 v_dark;\n#endif\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n pos = cc_matViewProj * pos;\n uv0 = a_texCoord;\n v_light = a_color;\n #if TWO_COLORED\n v_dark = a_color2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n layout(std140) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_light;\n#if TWO_COLORED\n in vec4 v_dark;\n#endif\nin vec2 uv0;\nuniform sampler2D cc_spriteTexture;\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if TWO_COLORED\n vec4 texColor = vec4(1, 1, 1, 1);\n texColor *= texture(cc_spriteTexture, uv0);\n o.a = texColor.a * v_light.a;\n o.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n o *= texture(cc_spriteTexture, uv0);\n o *= v_light;\n #endif\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matViewProj;\n#if USE_LOCAL\n uniform highp mat4 cc_matWorld;\n#endif\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec4 v_light;\nvarying vec2 uv0;\n#if TWO_COLORED\n attribute vec4 a_color2;\n varying vec4 v_dark;\n#endif\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n pos = cc_matViewProj * pos;\n uv0 = a_texCoord;\n v_light = a_color;\n #if TWO_COLORED\n v_dark = a_color2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_light;\n#if TWO_COLORED\n varying vec4 v_dark;\n#endif\nvarying vec2 uv0;\nuniform sampler2D cc_spriteTexture;\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if TWO_COLORED\n vec4 texColor = vec4(1, 1, 1, 1);\n texColor *= texture2D(cc_spriteTexture, uv0);\n o.a = texColor.a * v_light.a;\n o.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n o *= texture2D(cc_spriteTexture, uv0);\n o *= v_light;\n #endif\n ALPHA_TEST(o);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":[]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":56,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"TWO_COLORED","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"}]}],[{"passes":[{"program":"for2d/builtin-spine|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[0,"particles/builtin-particle",[{"hash":3958058022,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"},"glsl1":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = add(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":3441772896,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]},{"name":"FragConstants","stageFlags":16,"binding":1,"members":[{"name":"tintColor","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"},"glsl1":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = multiply(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":43}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":868591613,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"},"glsl1":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]},{"hash":2411109044,"name":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_texCoord1","format":32,"location":0,"defines":[]},{"name":"a_texCoord2","format":32,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_texCoord","format":32,"location":3,"defines":[]},{"name":"a_position","format":32,"location":4,"defines":["!CC_INSTANCE_PARTICLE"]},{"name":"a_texCoord4","format":44,"location":5,"defines":["CC_INSTANCE_PARTICLE"]},{"name":"a_color1","format":32,"location":9,"defines":["CC_RENDER_MODE"]},{"name":"a_texCoord3","format":32,"location":7,"defines":["CC_RENDER_MODE"]},{"name":"a_normal","format":32,"location":8,"defines":["CC_RENDER_MODE"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"mainTiling_Offset","type":16,"count":1},{"name":"frameTile_velLenScale","type":16,"count":1},{"name":"scale","type":16,"count":1},{"name":"nodeRotation","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":1,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"},"glsl1":{"vert":"\nprecision highp float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color = a_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }","frag":"\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":60,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":42}},"defines":[{"name":"CC_RENDER_MODE","type":"number","range":[0,4]},{"name":"CC_INSTANCE_PARTICLE","type":"boolean"},{"name":"CC_USE_WORLD_SPACE","type":"boolean"},{"name":"ROTATION_OVER_TIME_MODULE_ENABLE","type":"boolean"}]}],[{"name":"add","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"alpha-blend","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-multiply","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]},"tintColor":{"type":16,"value":[0.5,0.5,0.5,0.5]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":7,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":3}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"add-smooth","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]},{"name":"premultiply-blend","passes":[{"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"mainTiling_Offset":{"type":16,"value":[1,1,0,0]}}},{"phase":"deferred-forward","propertyIndex":0,"program":"particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":0,"blendDstAlpha":1,"blendAlphaEq":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[2,"missing-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4294902015]]],11]]],0,0,[0],[0],[1]],[[[1,"ui-sprite-gray-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[1,"ui-base-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[0]],[[[1,"ui-sprite-gray-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[1,"ui-graphics-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[8]],[[[1,"ui-sprite-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":false}]]],0,0,[0],[0],[0]],[[[1,"ui-sprite-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]]]] diff --git a/code/assets/internal/index.js b/code/assets/internal/index.js new file mode 100644 index 0000000..e77feb8 --- /dev/null +++ b/code/assets/internal/index.js @@ -0,0 +1,26 @@ +System.register("chunks:///_virtual/builtin-pipeline-settings.ts",["./rollupPluginModLoBabelHelpers.js","cc","./builtin-pipeline-types.ts"],(function(t){var e,o,i,n,r,s,a,p,l,g,c,y,u,d,b,m,h;return{setters:[function(t){e=t.applyDecoratedDescriptor,o=t.inheritsLoose,i=t.createClass,n=t.initializerDefineProperty,r=t.assertThisInitialized},function(t){s=t.cclegacy,a=t._decorator,p=t.Camera,l=t.CCBoolean,g=t.CCInteger,c=t.CCFloat,y=t.Material,u=t.Texture2D,d=t.rendering,b=t.Component},function(t){m=t.fillRequiredPipelineSettings,h=t.makePipelineSettings}],execute:function(){var f,_,P,M,S,O,w,E,G,k,D,C,A,j,v,x,F,B,R,I,T,L,X,z,H,q,Y,N;s._RF.push({},"de1c2EHcMhAIYRZY5nyTQHG","builtin-pipeline-settings",void 0);var Q=a.ccclass,Z=a.disallowMultiple,J=a.executeInEditMode,K=a.menu,U=a.property,V=a.requireComponent;a.type,t("BuiltinPipelineSettings",(f=Q("BuiltinPipelineSettings"),_=K("Rendering/BuiltinPipelineSettings"),P=V(p),M=U(l),S=U({displayName:"Editor Preview (Experimental)",type:l}),O=U({group:{id:"MSAA",name:"Multisample Anti-Aliasing"},type:l}),w=U({group:{id:"MSAA",name:"Multisample Anti-Aliasing",style:"section"},type:g,range:[2,4,2]}),E=U({group:{id:"ShadingScale",name:"ShadingScale",style:"section"},type:l}),G=U({tooltip:"i18n:postprocess.shadingScale",group:{id:"ShadingScale",name:"ShadingScale"},type:c,range:[.01,4,.01],slide:!0}),k=U({group:{id:"Bloom",name:"Bloom (PostProcessing)",style:"section"},type:l}),D=U({group:{id:"Bloom",name:"Bloom (PostProcessing)",style:"section"},type:y}),C=U({tooltip:"i18n:bloom.enableAlphaMask",group:{id:"Bloom",name:"Bloom (PostProcessing)",style:"section"},type:l}),A=U({tooltip:"i18n:bloom.iterations",group:{id:"Bloom",name:"Bloom (PostProcessing)",style:"section"},type:g,range:[1,6,1],slide:!0}),j=U({tooltip:"i18n:bloom.threshold",group:{id:"Bloom",name:"Bloom (PostProcessing)",style:"section"},type:c,min:0}),v=U({group:{id:"Color Grading",name:"ColorGrading (LDR) (PostProcessing)",style:"section"},type:l}),x=U({group:{id:"Color Grading",name:"ColorGrading (LDR) (PostProcessing)",style:"section"},type:y}),F=U({tooltip:"i18n:color_grading.contribute",group:{id:"Color Grading",name:"ColorGrading (LDR) (PostProcessing)",style:"section"},type:c,range:[0,1,.01],slide:!0}),B=U({tooltip:"i18n:color_grading.originalMap",group:{id:"Color Grading",name:"ColorGrading (LDR) (PostProcessing)",style:"section"},type:u}),R=U({group:{id:"FXAA",name:"Fast Approximate Anti-Aliasing (PostProcessing)",style:"section"},type:l}),I=U({group:{id:"FXAA",name:"Fast Approximate Anti-Aliasing (PostProcessing)",style:"section"},type:y}),T=U({group:{id:"FSR",name:"FidelityFX Super Resolution",style:"section"},type:l}),L=U({group:{id:"FSR",name:"FidelityFX Super Resolution",style:"section"},type:y}),X=U({group:{id:"FSR",name:"FidelityFX Super Resolution",style:"section"},type:c,range:[0,1,.01],slide:!0}),z=U({group:{id:"ToneMapping",name:"ToneMapping",style:"section"},type:y}),f(H=_(H=P(H=Z(H=J((Y=e((q=function(t){function e(){for(var e,o=arguments.length,i=new Array(o),s=0;s0?Math.trunc(.5*(1-Math.floor(i/2))*t):Math.trunc(.5*Math.floor(i/2)*t),n.width=Math.trunc(.5*a),n.height=Math.trunc(.5*t)),n.left=Math.max(0,n.left),n.top=Math.max(0,n.top),n.width=Math.max(1,n.width),n.height=Math.max(1,n.height)}var Q=e("PipelineConfigs",(function(){this.isWeb=!1,this.isWebGL1=!1,this.isWebGPU=!1,this.isMobile=!1,this.isHDR=!1,this.useFloatOutput=!1,this.toneMappingType=0,this.shadowEnabled=!1,this.shadowMapFormat=M.R32F,this.shadowMapSize=new s(1,1),this.usePlanarShadow=!1,this.screenSpaceSignY=1,this.supportDepthSample=!1,this.mobileMaxSpotLightShadowMaps=1,this.platform=new o(0,0,0,0)}));function y(e,a){var t=E.SAMPLED_TEXTURE|E.LINEAR_FILTER,i=e.device;a.isWeb=!m.isNative,a.isWebGL1=i.gfxAPI===n.API.WEBGL,a.isWebGPU=i.gfxAPI===n.API.WEBGPU,a.isMobile=m.isMobile,a.isHDR=e.pipelineSceneData.isHDR,a.useFloatOutput=e.getMacroBool("CC_USE_FLOAT_OUTPUT"),a.toneMappingType=e.pipelineSceneData.postSettings.toneMappingType;var s=e.pipelineSceneData.shadows;a.shadowEnabled=s.enabled,a.shadowMapFormat=S.supportsR32FloatTexture(e.device)?M.R32F:M.RGBA8,a.shadowMapSize.set(s.size),a.usePlanarShadow=s.enabled&&s.type===r.scene.ShadowType.Planar,a.screenSpaceSignY=e.device.capabilities.screenSpaceSignY,a.supportDepthSample=(e.device.getFormatFeatures(M.DEPTH_STENCIL)&t)===t;var o=i.capabilities.screenSpaceSignY;a.platform.x=a.isMobile?1:0,a.platform.w=.5*o+.5<<1|.5*i.capabilities.clipSpaceSignY+.5}var H=_(),z=e("CameraConfigs",(function(){this.settings=H,this.isMainGameWindow=!1,this.renderWindowId=0,this.colorName="",this.depthStencilName="",this.enableFullPipeline=!1,this.enableProfiler=!1,this.remainingPasses=0,this.enableShadingScale=!1,this.shadingScale=1,this.nativeWidth=1,this.nativeHeight=1,this.width=1,this.height=1,this.enableHDR=!1,this.radianceFormat=n.Format.RGBA8,this.copyAndTonemapMaterial=null,this.enableStoreSceneDepth=!1})),I=new T(0,0,0,0);function W(e,a,t,i){l(!!t.copyAndTonemapMaterial);var n=e.addRenderPass(t.nativeWidth,t.nativeHeight,"cc-tone-mapping");return n.addRenderTarget(t.colorName,v.CLEAR,C.STORE,I),n.addTexture(i,"inputTexture"),n.setVec4("g_platform",a.platform),n.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(t.copyAndTonemapMaterial,1),n}function G(e,a,t){return e.startsWith(a)?""+a+(1-Number(e.charAt(a.length)))+"_"+t:a+"0_"+t}var U=function(){function e(){this.lights=[],this.shadowEnabledSpotLights=[],this._sphere=b.create(0,0,0,1),this._boundingBox=new w,this._rangedDirLightBoundingBox=new w(0,0,0,.5,.5,.5)}var t=e.prototype;return t.cullLights=function(e,t,i){this.lights.length=0,this.shadowEnabledSpotLights.length=0;for(var n,r=a(e.spotLights);!(n=r()).done;){var s=n.value;s.baked||(b.set(this._sphere,s.position.x,s.position.y,s.position.z,s.range),P.sphereFrustum(this._sphere,t)&&(s.shadowEnabled?this.shadowEnabledSpotLights.push(s):this.lights.push(s)))}for(var o,d=a(e.sphereLights);!(o=d()).done;){var l=o.value;l.baked||(b.set(this._sphere,l.position.x,l.position.y,l.position.z,l.range),P.sphereFrustum(this._sphere,t)&&this.lights.push(l))}for(var h,u=a(e.pointLights);!(h=u()).done;){var p=h.value;p.baked||(b.set(this._sphere,p.position.x,p.position.y,p.position.z,p.range),P.sphereFrustum(this._sphere,t)&&this.lights.push(p))}for(var g,m=a(e.rangedDirLights);!(g=m()).done;){var S=g.value;w.transform(this._boundingBox,this._rangedDirLightBoundingBox,S.node.getWorldMatrix()),P.aabbFrustum(this._boundingBox,t)&&this.lights.push(S)}i&&this.shadowEnabledSpotLights.sort((function(e,a){return c.squaredDistance(i,e.position)-c.squaredDistance(i,a.position)}))},t._addLightQueues=function(e,t){for(var i,n=a(this.lights);!(i=n()).done;){var r=i.value,s=t.addQueue(d.QueueHint.BLEND,"forward-add");switch(r.type){case N.SPHERE:s.name="sphere-light";break;case N.SPOT:s.name="spot-light";break;case N.POINT:s.name="point-light";break;case N.RANGED_DIRECTIONAL:s.name="ranged-directional-light";break;default:s.name="unknown-light"}s.addScene(e,d.SceneFlags.BLEND,r)}},t.addSpotlightShadowPasses=function(e,t,i){for(var n,r=0,s=a(this.shadowEnabledSpotLights);!(n=s()).done;){var o=n.value,l=e.pipelineSceneData.shadows.size,h=e.addRenderPass(l.x,l.y,"default");if(h.name="SpotLightShadowPass"+r,h.addRenderTarget("SpotShadowMap"+r,v.CLEAR,C.STORE,new T(1,1,1,1)),h.addDepthStencil("SpotShadowDepth"+r,v.CLEAR,C.DISCARD),h.addQueue(d.QueueHint.NONE,"shadow-caster").addScene(t,d.SceneFlags.OPAQUE|d.SceneFlags.MASK|d.SceneFlags.SHADOW_CASTER).useLightFrustum(o),++r>=i)break}},t.addLightQueues=function(e,t,i){this._addLightQueues(t,e);for(var n,r=0,s=a(this.shadowEnabledSpotLights);!(n=s()).done;){var o=n.value;if(e.addTexture("SpotShadowMap"+r,"cc_spotShadowMap"),e.addQueue(d.QueueHint.BLEND,"forward-add").addScene(t,d.SceneFlags.BLEND,o),++r>=i)break}},t.addLightPasses=function(e,t,i,n,r,s,o,l,h,c){this._addLightQueues(o,c);for(var u,p=0,g=h.pipelineSceneData.shadows.size,m=a(this.shadowEnabledSpotLights);!(u=m()).done;){var S=u.value,f=h.addRenderPass(g.x,g.y,"default");f.name="SpotlightShadowPass",f.addRenderTarget("ShadowMap"+n,v.CLEAR,C.STORE,new T(1,1,1,1)),f.addDepthStencil("ShadowDepth"+n,v.CLEAR,C.DISCARD),f.addQueue(d.QueueHint.NONE,"shadow-caster").addScene(o,d.SceneFlags.OPAQUE|d.SceneFlags.MASK|d.SceneFlags.SHADOW_CASTER).useLightFrustum(S);var _=++p===this.shadowEnabledSpotLights.length?i:C.STORE;(c=h.addRenderPass(r,s,"default")).name="SpotlightWithShadowMap",c.setViewport(l),c.addRenderTarget(e,v.LOAD),c.addDepthStencil(t,v.LOAD,_),c.addTexture("ShadowMap"+n,"cc_spotShadowMap"),c.addQueue(d.QueueHint.BLEND,"forward-add").addScene(o,d.SceneFlags.BLEND,S)}return c},t.isMultipleLightPassesNeeded=function(){return this.shadowEnabledSpotLights.length>0},e}(),V=e("BuiltinForwardPassBuilder",function(){function e(){this.forwardLighting=new U,this._viewport=new L,this._clearColor=new T(0,0,0,1),this._reflectionProbeClearColor=new c(0,0,0)}var i=e.prototype;return i.getConfigOrder=function(){return e.ConfigOrder},i.getRenderOrder=function(){return e.RenderOrder},i.configCamera=function(e,a,t){t.enableMainLightShadowMap=a.shadowEnabled&&!a.usePlanarShadow&&!!e.scene&&!!e.scene.mainLight&&e.scene.mainLight.shadowEnabled,t.enableMainLightPlanarShadowMap=a.shadowEnabled&&a.usePlanarShadow&&!!e.scene&&!!e.scene.mainLight&&e.scene.mainLight.shadowEnabled,t.enablePlanarReflectionProbe=t.isMainGameWindow||e.cameraUsage===D.SCENE_VIEW,t.enableMSAA=t.settings.msaa.enabled&&!t.enableStoreSceneDepth&&!a.isWeb&&!a.isWebGL1,t.enableSingleForwardPass=a.isMobile||t.enableMSAA,++t.remainingPasses},i.windowResize=function(e,a,t,i,n,r,s){var o=d.ResourceFlags,l=d.ResourceResidency,h=i.renderWindowId,c=t.settings,u=t.enableShadingScale?Math.max(Math.floor(r*t.shadingScale),1):r,p=t.enableShadingScale?Math.max(Math.floor(s*t.shadingScale),1):s;if(t.enableMSAA&&(t.enableHDR?e.addTexture("MsaaRadiance"+h,A.TEX2D,t.radianceFormat,u,p,1,1,1,c.msaa.sampleCount,o.COLOR_ATTACHMENT,l.MEMORYLESS):e.addTexture("MsaaRadiance"+h,A.TEX2D,M.RGBA8,u,p,1,1,1,c.msaa.sampleCount,o.COLOR_ATTACHMENT,l.MEMORYLESS),e.addTexture("MsaaDepthStencil"+h,A.TEX2D,M.DEPTH_STENCIL,u,p,1,1,1,c.msaa.sampleCount,o.DEPTH_STENCIL_ATTACHMENT,l.MEMORYLESS)),e.addRenderTarget("ShadowMap"+h,a.shadowMapFormat,a.shadowMapSize.x,a.shadowMapSize.y),e.addDepthStencil("ShadowDepth"+h,M.DEPTH_STENCIL,a.shadowMapSize.x,a.shadowMapSize.y),t.enableSingleForwardPass)for(var g=a.mobileMaxSpotLightShadowMaps,m=0;m!==g;++m)e.addRenderTarget("SpotShadowMap"+m,a.shadowMapFormat,a.shadowMapSize.x,a.shadowMapSize.y),e.addDepthStencil("SpotShadowDepth"+m,M.DEPTH_STENCIL,a.shadowMapSize.x,a.shadowMapSize.y)},i.setup=function(e,a,t,i,n){var r=i.window.renderWindowId,s=i.scene,o=s.mainLight;--t.remainingPasses,l(t.remainingPasses>=0),this.forwardLighting.cullLights(s,i.frustum),t.enableMainLightShadowMap&&(l(!!o),this._addCascadedShadowMapPass(e,a,r,o,i)),t.enableSingleForwardPass&&this.forwardLighting.addSpotlightShadowPasses(e,i,a.mobileMaxSpotLightShadowMaps),this._tryAddReflectionProbePasses(e,t,r,o,i.scene),t.remainingPasses>0||t.enableShadingScale?(n.colorName=t.enableShadingScale?"ScaledRadiance0_"+r:"Radiance0_"+r,n.depthStencilName=t.enableShadingScale?"ScaledSceneDepth_"+r:"SceneDepth_"+r):(n.colorName=t.colorName,n.depthStencilName=t.depthStencilName);var d=this._addForwardRadiancePasses(e,a,t,r,i,t.width,t.height,o,n.colorName,n.depthStencilName,!t.enableMSAA,t.enableStoreSceneDepth?C.STORE:C.DISCARD);return t.enableStoreSceneDepth||(n.depthStencilName=""),0===t.remainingPasses&&t.enableShadingScale?W(e,a,t,n.colorName):d},i._addCascadedShadowMapPass=function(e,a,t,i,n){var r=d.QueueHint,s=d.SceneFlags,o=e.pipelineSceneData.shadows.size,l=o.x,h=o.y,c=this._viewport;c.left=c.top=0,c.width=l,c.height=h;var u=e.addRenderPass(l,h,"default");u.name="CascadedShadowMap",u.addRenderTarget("ShadowMap"+t,v.CLEAR,C.STORE,new T(1,1,1,1)),u.addDepthStencil("ShadowDepth"+t,v.CLEAR,C.DISCARD);for(var p=e.pipelineSceneData.csmSupported?i.csmLevel:1,g=0;g!==p;++g){B(i,l,h,g,this._viewport,a.screenSpaceSignY);var m=u.addQueue(r.NONE,"shadow-caster");a.isWebGPU||m.setViewport(this._viewport),m.addScene(n,s.OPAQUE|s.MASK|s.SHADOW_CASTER).useLightFrustum(i,g)}},i._tryAddReflectionProbePasses=function(e,i,s,o,l){var h=t.internal.reflectionProbeManager;if(h)for(var c,u=d.ResourceResidency,p=h.getProbes(),g=0,m=a(p);!(c=m()).done;){var S=c.value;if(S.needRender){var f=S.renderArea(),_=Math.max(Math.floor(f.x),1),w=Math.max(Math.floor(f.y),1);if(S.probeType===r.scene.ProbeType.PLANAR){if(!i.enablePlanarReflectionProbe)continue;var b=S.realtimePlanarTexture.window,P="PlanarProbeRT"+g,R="PlanarProbeDS"+g;e.addRenderWindow(P,i.radianceFormat,_,w,b),e.addDepthStencil(R,n.Format.DEPTH_STENCIL,_,w,u.MEMORYLESS);var T=e.addRenderPass(_,w,"default");T.name="PlanarReflectionProbe"+g,this._buildReflectionProbePass(T,i,s,S.camera,P,R,o,l)}if(4===++g)break}}},i._buildReflectionProbePass=function(e,a,t,i,n,r,s,o){void 0===o&&(o=null);var l=d.QueueHint,h=d.SceneFlags,c=a.enableMSAA?C.DISCARD:C.STORE;if(O(i)){this._reflectionProbeClearColor.x=i.clearColor.x,this._reflectionProbeClearColor.y=i.clearColor.y,this._reflectionProbeClearColor.z=i.clearColor.z;var u=d.packRGBE(this._reflectionProbeClearColor);this._clearColor.x=u.x,this._clearColor.y=u.y,this._clearColor.z=u.z,this._clearColor.w=u.w,e.addRenderTarget(n,v.CLEAR,c,this._clearColor)}else e.addRenderTarget(n,v.LOAD,c);i.clearFlag&R.DEPTH_STENCIL?e.addDepthStencil(r,v.CLEAR,C.DISCARD,i.clearDepth,i.clearStencil,i.clearFlag&R.DEPTH_STENCIL):e.addDepthStencil(r,v.LOAD,C.DISCARD),a.enableMainLightShadowMap&&e.addTexture("ShadowMap"+t,"cc_shadowMap"),e.addQueue(l.NONE,"reflect-map").addScene(i,h.OPAQUE|h.MASK|h.REFLECTION_PROBE,s||void 0,o||void 0)},i._addForwardRadiancePasses=function(e,a,t,i,n,r,s,o,h,c,u,p){void 0===u&&(u=!1),void 0===p&&(p=C.DISCARD);var g=d.QueueHint,m=d.SceneFlags,S=n.clearColor;this._clearColor.x=S.x,this._clearColor.y=S.y,this._clearColor.z=S.z,this._clearColor.w=S.w;var f=n.viewport;this._viewport.left=Math.round(f.x*r),this._viewport.top=Math.round(f.y*s),this._viewport.width=Math.max(Math.round(f.width*r),1),this._viewport.height=Math.max(Math.round(f.height*s),1);var _=!u&&t.enableMSAA;l(!_||t.enableSingleForwardPass);var w=t.enableSingleForwardPass?this._addForwardSingleRadiancePass(e,a,t,i,n,_,r,s,o,h,c,p):this._addForwardMultipleRadiancePasses(e,t,i,n,r,s,o,h,c,p);t.enableMainLightPlanarShadowMap&&this._addPlanarShadowQueue(n,o,w);var b=m.BLEND|(n.geometryRenderer?m.GEOMETRY:m.NONE);return w.addQueue(g.BLEND).addScene(n,b,o||void 0),w},i._addForwardSingleRadiancePass=function(e,a,t,i,n,r,s,o,d,h,c,u){var p;if(l(t.enableSingleForwardPass),r){var g="MsaaRadiance"+i,m="MsaaDepthStencil"+i,S=t.settings.msaa.sampleCount,f=e.addMultisampleRenderPass(s,o,S,0,"default");f.name="MsaaForwardPass",this._buildForwardMainLightPass(f,t,i,n,g,m,C.DISCARD,d),f.resolveRenderTarget(g,h),p=f}else(p=e.addRenderPass(s,o,"default")).name="ForwardPass",this._buildForwardMainLightPass(p,t,i,n,h,c,u,d);return l(void 0!==p),this.forwardLighting.addLightQueues(p,n,a.mobileMaxSpotLightShadowMaps),p},i._addForwardMultipleRadiancePasses=function(e,a,t,i,n,r,s,o,d,h){l(!a.enableSingleForwardPass);var c=e.addRenderPass(n,r,"default");c.name="ForwardPass";var u=this.forwardLighting.isMultipleLightPassesNeeded()?C.STORE:h;return this._buildForwardMainLightPass(c,a,t,i,o,d,u,s),c=this.forwardLighting.addLightPasses(o,d,h,t,n,r,i,this._viewport,e,c)},i._buildForwardMainLightPass=function(e,a,t,i,n,r,s,o,l){void 0===l&&(l=null);var h=d.QueueHint,c=d.SceneFlags;e.setViewport(this._viewport);var u=a.enableMSAA?C.DISCARD:C.STORE;O(i)?e.addRenderTarget(n,v.CLEAR,u,this._clearColor):e.addRenderTarget(n,v.LOAD,u),i.clearFlag&R.DEPTH_STENCIL?e.addDepthStencil(r,v.CLEAR,s,i.clearDepth,i.clearStencil,i.clearFlag&R.DEPTH_STENCIL):e.addDepthStencil(r,v.LOAD,s),a.enableMainLightShadowMap&&e.addTexture("ShadowMap"+t,"cc_shadowMap"),e.addQueue(h.NONE).addScene(i,c.OPAQUE|c.MASK,o||void 0,l||void 0)},i._addPlanarShadowQueue=function(e,a,t){var i=d.QueueHint,n=d.SceneFlags;t.addQueue(i.BLEND,"planar-shadow").addScene(e,n.SHADOW_CASTER|n.PLANAR_SHADOW|n.BLEND,a||void 0)},e}());V.ConfigOrder=100,V.RenderOrder=100;var k=e("BuiltinBloomPassBuilder",function(){function e(){this._clearColorTransparentBlack=new T(0,0,0,0),this._bloomParams=new o(0,0,0,0),this._bloomTexSize=new o(0,0,0,0),this._bloomWidths=[],this._bloomHeights=[],this._bloomTexNames=[]}var a=e.prototype;return a.getConfigOrder=function(){return 0},a.getRenderOrder=function(){return 200},a.configCamera=function(e,a,t){t.enableBloom=t.settings.bloom.enabled&&!!t.settings.bloom.material,t.enableBloom&&++t.remainingPasses},a.windowResize=function(e,a,t,i){if(t.enableBloom)for(var n=i.renderWindowId,r=t.width,s=t.height,o=0;o!==t.settings.bloom.iterations+1;++o)r=Math.max(Math.floor(r/2),1),s=Math.max(Math.floor(s/2),1),e.addRenderTarget("BloomTex"+n+"_"+o,t.radianceFormat,r,s)},a.setup=function(e,a,t,i,n,r){if(!t.enableBloom)return r;--t.remainingPasses,l(t.remainingPasses>=0);var s=i.window.renderWindowId;return l(!!t.settings.bloom.material),this._addKawaseDualFilterBloomPasses(e,a,t,t.settings,t.settings.bloom.material,s,t.width,t.height,n.colorName)},a._addKawaseDualFilterBloomPasses=function(e,a,t,i,n,r,s,o,l){var h=d.QueueHint,c=i.bloom.iterations,u=c+1;this._bloomWidths.length=u,this._bloomHeights.length=u,this._bloomWidths[0]=Math.max(Math.floor(s/2),1),this._bloomHeights[0]=Math.max(Math.floor(o/2),1);for(var p=1;p!==u;++p)this._bloomWidths[p]=Math.max(Math.floor(this._bloomWidths[p-1]/2),1),this._bloomHeights[p]=Math.max(Math.floor(this._bloomHeights[p-1]/2),1);this._bloomTexNames.length=u;for(var g=0;g!==u;++g)this._bloomTexNames[g]="BloomTex"+r+"_"+g;this._bloomParams.x=a.useFloatOutput?1:0,this._bloomParams.x=0,this._bloomParams.z=i.bloom.threshold,this._bloomParams.w=i.bloom.enableAlphaMask?1:0;var m=e.addRenderPass(this._bloomWidths[0],this._bloomHeights[0],"cc-bloom-prefilter");m.addRenderTarget(this._bloomTexNames[0],v.CLEAR,C.STORE,this._clearColorTransparentBlack),m.addTexture(l,"inputTexture"),m.setVec4("g_platform",a.platform),m.setVec4("bloomParams",this._bloomParams),m.addQueue(h.OPAQUE).addFullscreenQuad(n,0);for(var S=1;S!==u;++S){var f=e.addRenderPass(this._bloomWidths[S],this._bloomHeights[S],"cc-bloom-downsample");f.addRenderTarget(this._bloomTexNames[S],v.CLEAR,C.STORE,this._clearColorTransparentBlack),f.addTexture(this._bloomTexNames[S-1],"bloomTexture"),this._bloomTexSize.x=this._bloomWidths[S-1],this._bloomTexSize.y=this._bloomHeights[S-1],f.setVec4("g_platform",a.platform),f.setVec4("bloomTexSize",this._bloomTexSize),f.addQueue(h.OPAQUE).addFullscreenQuad(n,1)}for(var _=c;_-- >0;){var w=e.addRenderPass(this._bloomWidths[_],this._bloomHeights[_],"cc-bloom-upsample");w.addRenderTarget(this._bloomTexNames[_],v.CLEAR,C.STORE,this._clearColorTransparentBlack),w.addTexture(this._bloomTexNames[_+1],"bloomTexture"),this._bloomTexSize.x=this._bloomWidths[_+1],this._bloomTexSize.y=this._bloomHeights[_+1],w.setVec4("g_platform",a.platform),w.setVec4("bloomTexSize",this._bloomTexSize),w.addQueue(h.OPAQUE).addFullscreenQuad(n,2)}var b=e.addRenderPass(s,o,"cc-bloom-combine");return b.addRenderTarget(l,v.LOAD,C.STORE),b.addTexture(this._bloomTexNames[0],"bloomTexture"),b.setVec4("g_platform",a.platform),b.setVec4("bloomParams",this._bloomParams),b.addQueue(h.BLEND).addFullscreenQuad(n,3),0===t.remainingPasses?W(e,a,t,l):b},e}()),Y=e("BuiltinToneMappingPassBuilder",function(){function e(){this._colorGradingTexSize=new s(0,0)}var a=e.prototype;return a.getConfigOrder=function(){return 0},a.getRenderOrder=function(){return 300},a.configCamera=function(e,a,t){var i=t.settings;t.enableColorGrading=i.colorGrading.enabled&&!!i.colorGrading.material&&!!i.colorGrading.colorGradingMap,t.enableToneMapping=t.enableHDR||t.enableColorGrading,t.enableToneMapping&&++t.remainingPasses},a.windowResize=function(e,a,t){t.enableColorGrading&&(l(!!t.settings.colorGrading.material),t.settings.colorGrading.material.setProperty("colorGradingMap",t.settings.colorGrading.colorGradingMap))},a.setup=function(e,a,t,i,n,r){if(!t.enableToneMapping)return r;if(--t.remainingPasses,l(t.remainingPasses>=0),0===t.remainingPasses)return this._addCopyAndTonemapPass(e,a,t,t.nativeWidth,t.nativeHeight,n.colorName,t.colorName);var s=t.renderWindowId,o=t.enableShadingScale?"ScaledLdrColor":"LdrColor",d=G(n.colorName,o,s),h=n.colorName;return n.colorName=d,this._addCopyAndTonemapPass(e,a,t,t.width,t.height,h,d)},a._addCopyAndTonemapPass=function(e,a,t,i,n,r,s){var o,h=t.settings;if(t.enableColorGrading){l(!!h.colorGrading.material),l(!!h.colorGrading.colorGradingMap);var c=h.colorGrading.colorGradingMap;this._colorGradingTexSize.x=c.width,this._colorGradingTexSize.y=c.height;var u=c.width===c.height;(o=u?e.addRenderPass(i,n,"cc-color-grading-8x8"):e.addRenderPass(i,n,"cc-color-grading-nx1")).addRenderTarget(s,v.CLEAR,C.STORE,I),o.addTexture(r,"sceneColorMap"),o.setVec4("g_platform",a.platform),o.setVec2("lutTextureSize",this._colorGradingTexSize),o.setFloat("contribute",h.colorGrading.contribute),o.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(h.colorGrading.material,u?1:0)}else(o=e.addRenderPass(i,n,"cc-tone-mapping")).addRenderTarget(s,v.CLEAR,C.STORE,I),o.addTexture(r,"inputTexture"),o.setVec4("g_platform",a.platform),h.toneMapping.material?o.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(h.toneMapping.material,0):(l(!!t.copyAndTonemapMaterial),o.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(t.copyAndTonemapMaterial,0));return o},e}()),X=e("BuiltinFXAAPassBuilder",function(){function e(){this._fxaaParams=new o(0,0,0,0)}var a=e.prototype;return a.getConfigOrder=function(){return 0},a.getRenderOrder=function(){return 400},a.configCamera=function(e,a,t){t.enableFXAA=t.settings.fxaa.enabled&&!!t.settings.fxaa.material,t.enableFXAA&&++t.remainingPasses},a.setup=function(e,a,t,i,n,r){if(!t.enableFXAA)return r;--t.remainingPasses,l(t.remainingPasses>=0);var s=t.renderWindowId,o=t.enableShadingScale?"ScaledLdrColor":"LdrColor",d=G(n.colorName,o,s);if(l(!!t.settings.fxaa.material),0===t.remainingPasses)return t.enableShadingScale?(this._addFxaaPass(e,a,t.settings.fxaa.material,t.width,t.height,n.colorName,d),W(e,a,t,d)):(l(t.width===t.nativeWidth),l(t.height===t.nativeHeight),this._addFxaaPass(e,a,t.settings.fxaa.material,t.width,t.height,n.colorName,t.colorName));var h=n.colorName;return n.colorName=d,this._addFxaaPass(e,a,t.settings.fxaa.material,t.width,t.height,h,d)},a._addFxaaPass=function(e,a,t,i,n,r,s){this._fxaaParams.x=i,this._fxaaParams.y=n,this._fxaaParams.z=1/i,this._fxaaParams.w=1/n;var o=e.addRenderPass(i,n,"cc-fxaa");return o.addRenderTarget(s,v.CLEAR,C.STORE,I),o.addTexture(r,"sceneColorMap"),o.setVec4("g_platform",a.platform),o.setVec4("texSize",this._fxaaParams),o.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(t,0),o},e}()),K=e("BuiltinFsrPassBuilder",function(){function e(){this._fsrParams=new o(0,0,0,0),this._fsrTexSize=new o(0,0,0,0)}var a=e.prototype;return a.getConfigOrder=function(){return 0},a.getRenderOrder=function(){return 500},a.configCamera=function(e,a,t){t.enableFSR=t.settings.fsr.enabled&&!!t.settings.fsr.material&&t.enableShadingScale&&t.shadingScale<1,t.enableFSR&&++t.remainingPasses},a.setup=function(e,a,t,i,n,r){if(!t.enableFSR)return r;--t.remainingPasses;var s=n.colorName,o=0===t.remainingPasses?t.colorName:G(n.colorName,"UiColor",t.renderWindowId);return n.colorName=o,l(!!t.settings.fsr.material),this._addFsrPass(e,a,t,t.settings,t.settings.fsr.material,t.renderWindowId,t.width,t.height,s,t.nativeWidth,t.nativeHeight,o)},a._addFsrPass=function(e,a,t,i,n,r,s,o,l,c,u,p){this._fsrTexSize.x=s,this._fsrTexSize.y=o,this._fsrTexSize.z=c,this._fsrTexSize.w=u,this._fsrParams.x=h(1-i.fsr.sharpness,.02,.98);var g=G(p,"UiColor",r),m=e.addRenderPass(c,u,"cc-fsr-easu");m.addRenderTarget(g,v.CLEAR,C.STORE,I),m.addTexture(l,"outputResultMap"),m.setVec4("g_platform",a.platform),m.setVec4("fsrTexSize",this._fsrTexSize),m.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(n,0);var S=e.addRenderPass(c,u,"cc-fsr-rcas");return S.addRenderTarget(p,v.CLEAR,C.STORE,I),S.addTexture(g,"outputResultMap"),S.setVec4("g_platform",a.platform),S.setVec4("fsrTexSize",this._fsrTexSize),S.setVec4("fsrParams",this._fsrParams),S.addQueue(d.QueueHint.OPAQUE).addFullscreenQuad(n,1),S},e}()),q=e("BuiltinUiPassBuilder",function(){function e(){}var a=e.prototype;return a.getConfigOrder=function(){return 0},a.getRenderOrder=function(){return 1e3},a.setup=function(e,a,t,i,n,r){l(!!r);var s=d.SceneFlags.UI;return t.enableProfiler&&(s|=d.SceneFlags.PROFILER,r.showStatistics=!0),r.addQueue(d.QueueHint.BLEND,"default","default").addScene(i,s),r},e}());if(d){var j=d.QueueHint,Z=d.SceneFlags,J=function(){function e(){this._pipelineEvent=t.director.root.pipelineEvent,this._forwardPass=new V,this._bloomPass=new k,this._toneMappingPass=new Y,this._fxaaPass=new X,this._fsrPass=new K,this._uiPass=new q,this._clearColor=new T(0,0,0,1),this._viewport=new L,this._configs=new Q,this._cameraConfigs=new z,this._copyAndTonemapMaterial=new u,this._initialized=!1,this._passBuilders=[]}var i=e.prototype;return i._setupPipelinePreview=function(e,a){if(e.cameraUsage===D.SCENE_VIEW||e.cameraUsage===D.PREVIEW){var t=d.getEditorPipelineSettings();a.settings=t||H}else e.pipelineSettings?a.settings=e.pipelineSettings:a.settings=H},i._preparePipelinePasses=function(e){var t=this._passBuilders;t.length=0;var i=e.settings;if(i._passes){for(var n,r=a(i._passes);!(n=r()).done;){var s=n.value;t.push(s)}l(t.length===i._passes.length)}t.push(this._forwardPass),i.bloom.enabled&&t.push(this._bloomPass),t.push(this._toneMappingPass),i.fxaa.enabled&&t.push(this._fxaaPass),i.fsr.enabled&&t.push(this._fsrPass),t.push(this._uiPass)},i._setupBuiltinCameraConfigs=function(e,a,t){var i=e.window,r=e.cameraUsage===D.GAME&&!!i.swapchain;t.isMainGameWindow=r,t.renderWindowId=i.renderWindowId,t.colorName=i.colorName,t.depthStencilName=i.depthStencilName,t.enableFullPipeline=0!=(e.visibility&p.Enum.DEFAULT),t.enableProfiler=f,t.remainingPasses=0,t.shadingScale=t.settings.shadingScale,t.enableShadingScale=t.settings.enableShadingScale&&1!==t.shadingScale,t.nativeWidth=Math.max(Math.floor(i.width),1),t.nativeHeight=Math.max(Math.floor(i.height),1),t.width=t.enableShadingScale?Math.max(Math.floor(t.nativeWidth*t.shadingScale),1):t.nativeWidth,t.height=t.enableShadingScale?Math.max(Math.floor(t.nativeHeight*t.shadingScale),1):t.nativeHeight,t.enableHDR=t.enableFullPipeline&&a.useFloatOutput,t.radianceFormat=t.enableHDR?n.Format.RGBA16F:n.Format.RGBA8,t.copyAndTonemapMaterial=this._copyAndTonemapMaterial,t.enableStoreSceneDepth=!1},i._setupCameraConfigs=function(e,t,i){this._setupPipelinePreview(e,i),this._preparePipelinePasses(i),this._passBuilders.sort((function(e,a){return e.getConfigOrder()-a.getConfigOrder()})),this._setupBuiltinCameraConfigs(e,t,i);for(var n,r=a(this._passBuilders);!(n=r()).done;){var s=n.value;s.configCamera&&s.configCamera(e,t,i)}},i.windowResize=function(e,t,i,n,r){y(e,this._configs),this._setupCameraConfigs(i,this._configs,this._cameraConfigs);var s=t.renderWindowId;e.addRenderWindow(this._cameraConfigs.colorName,M.RGBA8,n,r,t,this._cameraConfigs.depthStencilName);var o=this._cameraConfigs.width,d=this._cameraConfigs.height;this._cameraConfigs.enableShadingScale?(e.addDepthStencil("ScaledSceneDepth_"+s,M.DEPTH_STENCIL,o,d),e.addRenderTarget("ScaledRadiance0_"+s,this._cameraConfigs.radianceFormat,o,d),e.addRenderTarget("ScaledRadiance1_"+s,this._cameraConfigs.radianceFormat,o,d),e.addRenderTarget("ScaledLdrColor0_"+s,M.RGBA8,o,d),e.addRenderTarget("ScaledLdrColor1_"+s,M.RGBA8,o,d)):(e.addDepthStencil("SceneDepth_"+s,M.DEPTH_STENCIL,o,d),e.addRenderTarget("Radiance0_"+s,this._cameraConfigs.radianceFormat,o,d),e.addRenderTarget("Radiance1_"+s,this._cameraConfigs.radianceFormat,o,d),e.addRenderTarget("LdrColor0_"+s,M.RGBA8,o,d),e.addRenderTarget("LdrColor1_"+s,M.RGBA8,o,d)),e.addRenderTarget("UiColor0_"+s,M.RGBA8,n,r),e.addRenderTarget("UiColor1_"+s,M.RGBA8,n,r);for(var l,h=a(this._passBuilders);!(l=h()).done;){var c=l.value;c.windowResize&&c.windowResize(e,this._configs,this._cameraConfigs,t,i,n,r)}},i.setup=function(e,t){if(!this._initMaterials(t))for(var i,n=a(e);!(i=n()).done;){var r=i.value;r.scene&&r.window&&(this._setupCameraConfigs(r,this._configs,this._cameraConfigs),this._pipelineEvent.emit(g.RENDER_CAMERA_BEGIN,r),this._cameraConfigs.enableFullPipeline?this._buildForwardPipeline(t,r,r.scene,this._passBuilders):this._buildSimplePipeline(t,r),this._pipelineEvent.emit(g.RENDER_CAMERA_END,r))}},i._buildSimplePipeline=function(e,a){var t=Math.max(Math.floor(a.window.width),1),i=Math.max(Math.floor(a.window.height),1),n=this._cameraConfigs.colorName,r=this._cameraConfigs.depthStencilName,s=a.viewport;this._viewport.left=Math.round(s.x*t),this._viewport.top=Math.round(s.y*i),this._viewport.width=Math.max(Math.round(s.width*t),1),this._viewport.height=Math.max(Math.round(s.height*i),1);var o=a.clearColor;this._clearColor.x=o.x,this._clearColor.y=o.y,this._clearColor.z=o.z,this._clearColor.w=o.w;var d=e.addRenderPass(t,i,"default");O(a)?d.addRenderTarget(n,v.CLEAR,C.STORE,this._clearColor):d.addRenderTarget(n,v.LOAD,C.STORE),a.clearFlag&R.DEPTH_STENCIL?d.addDepthStencil(r,v.CLEAR,C.DISCARD,a.clearDepth,a.clearStencil,a.clearFlag&R.DEPTH_STENCIL):d.addDepthStencil(r,v.LOAD,C.DISCARD),d.setViewport(this._viewport),d.addQueue(j.OPAQUE).addScene(a,Z.OPAQUE);var l=Z.BLEND|Z.UI;this._cameraConfigs.enableProfiler&&(l|=Z.PROFILER,d.showStatistics=!0),d.addQueue(j.BLEND).addScene(a,l)},i._buildForwardPipeline=function(e,t,i,n){!function(e){e.sort((function(e,a){return e.getRenderOrder()-a.getRenderOrder()}))}(n);for(var r,s={colorName:"",depthStencilName:""},o=void 0,d=a(n);!(r=d()).done;){var h=r.value;h.setup&&(o=h.setup(e,this._configs,this._cameraConfigs,t,s,o))}l(0===this._cameraConfigs.remainingPasses)},i._initMaterials=function(e){return this._initialized?0:(y(e,this._configs),this._copyAndTonemapMaterial._uuid="builtin-pipeline-tone-mapping-material",this._copyAndTonemapMaterial.initialize({effectName:"pipeline/post-process/tone-mapping"}),this._copyAndTonemapMaterial.effectAsset&&(this._initialized=!0),this._initialized?0:1)},e}();d.setCustomPipeline("Builtin",new J)}t._RF.pop()}}})); + +System.register("chunks:///_virtual/internal",["./builtin-pipeline-settings.ts","./builtin-pipeline-types.ts","./builtin-pipeline.ts"],(function(){return{setters:[null,null,null],execute:function(){}}})); + +(function(r) { + r('virtual:///prerequisite-imports/internal', 'chunks:///_virtual/internal'); +})(function(mid, cid) { + System.register(mid, [cid], function (_export, _context) { + return { + setters: [function(_m) { + var _exportObj = {}; + + for (var _key in _m) { + if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; + } + + _export(_exportObj); + }], + execute: function () { } + }; + }); +}); \ No newline at end of file diff --git a/code/assets/main/config.json b/code/assets/main/config.json new file mode 100644 index 0000000..253eacb --- /dev/null +++ b/code/assets/main/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"main","deps":["internal"],"uuids":["0699aaa4c","090ad915b","0a6d024a0","baIUdvKGZPgZxNbjWTFuRI","0by2OqhTtD6KVmY6y0fvqN","20g1ukYUVPvKWKBRznAKo+","20g1ukYUVPvKWKBRznAKo+@6c48a","20g1ukYUVPvKWKBRznAKo+@f9941","54TknWPwVPqJqeCR+Y/Czo","95XCK3e35K+K1FhBWgwj5g","54TknWPwVPqJqeCR+Y/Czo@6c48a","54TknWPwVPqJqeCR+Y/Czo@f9941","6fAc9/gb9Kfr1dCvwZaWSA@b47c0","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@40c10","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@74afd","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@7d38f","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@8fd34","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@bb97f","6fAc9/gb9Kfr1dCvwZaWSA@b47c0@e9a6d","87cJVYNlpFCqZOYVSlxe8Y","9c1kh84FxPb70wzi6zaCvX","a3zQCfCrBCDZJ4uf2rk5u8","afxHkx8GZGsJC+n+YfITQo","afxHkx8GZGsJC+n+YfITQo@6c48a","afxHkx8GZGsJC+n+YfITQo@f9941","b7MFJ8MjNBwqr3fNq1j5dJ","b7MFJ8MjNBwqr3fNq1j5dJ@6c48a","b7MFJ8MjNBwqr3fNq1j5dJ@f9941","c89m0XNRpI2qEsAhLShXXE","d0MqyYBeFAkIi762QNy1/B@b47c0","d0MqyYBeFAkIi762QNy1/B@b47c0@40c10","d0MqyYBeFAkIi762QNy1/B@b47c0@74afd","d0MqyYBeFAkIi762QNy1/B@b47c0@7d38f","d0MqyYBeFAkIi762QNy1/B@b47c0@8fd34","d0MqyYBeFAkIi762QNy1/B@b47c0@bb97f","d0MqyYBeFAkIi762QNy1/B@b47c0@e9a6d","e2Y/hxG/5JJ4f+EuJgfHP4@63096","e4sZyu/AFCepU5HK+e0zbc@006bd","e4sZyu/AFCepU5HK+e0zbc@0089c","e4sZyu/AFCepU5HK+e0zbc@01feb","e4sZyu/AFCepU5HK+e0zbc@03ec6","e4sZyu/AFCepU5HK+e0zbc@04761","e4sZyu/AFCepU5HK+e0zbc@067c6","e4sZyu/AFCepU5HK+e0zbc@07f2f","e4sZyu/AFCepU5HK+e0zbc@0af0b","e4sZyu/AFCepU5HK+e0zbc@0c6f1","e4sZyu/AFCepU5HK+e0zbc@0c93e","e4sZyu/AFCepU5HK+e0zbc@0dd94","e4sZyu/AFCepU5HK+e0zbc@0f9a3","e4sZyu/AFCepU5HK+e0zbc@0fa64","e4sZyu/AFCepU5HK+e0zbc@14738","e4sZyu/AFCepU5HK+e0zbc@161ec","e4sZyu/AFCepU5HK+e0zbc@1827c","e4sZyu/AFCepU5HK+e0zbc@1ca10","e4sZyu/AFCepU5HK+e0zbc@1eaad","e4sZyu/AFCepU5HK+e0zbc@1f444","e4sZyu/AFCepU5HK+e0zbc@221a5","e4sZyu/AFCepU5HK+e0zbc@23859","e4sZyu/AFCepU5HK+e0zbc@2a682","e4sZyu/AFCepU5HK+e0zbc@2a87f","e4sZyu/AFCepU5HK+e0zbc@2bc87","e4sZyu/AFCepU5HK+e0zbc@2cd19","e4sZyu/AFCepU5HK+e0zbc@2e76e","e4sZyu/AFCepU5HK+e0zbc@2e78d","e4sZyu/AFCepU5HK+e0zbc@2f00a","e4sZyu/AFCepU5HK+e0zbc@2f6d1","e4sZyu/AFCepU5HK+e0zbc@31c60","e4sZyu/AFCepU5HK+e0zbc@35e77","e4sZyu/AFCepU5HK+e0zbc@3693d","e4sZyu/AFCepU5HK+e0zbc@39e53","e4sZyu/AFCepU5HK+e0zbc@3bc15","e4sZyu/AFCepU5HK+e0zbc@3c999","e4sZyu/AFCepU5HK+e0zbc@3d208","e4sZyu/AFCepU5HK+e0zbc@3e076","e4sZyu/AFCepU5HK+e0zbc@3e23d","e4sZyu/AFCepU5HK+e0zbc@3f608","e4sZyu/AFCepU5HK+e0zbc@3f79a","e4sZyu/AFCepU5HK+e0zbc@404ea","e4sZyu/AFCepU5HK+e0zbc@41791","e4sZyu/AFCepU5HK+e0zbc@422fc","e4sZyu/AFCepU5HK+e0zbc@4275b","e4sZyu/AFCepU5HK+e0zbc@48729","e4sZyu/AFCepU5HK+e0zbc@49b18","e4sZyu/AFCepU5HK+e0zbc@4affa","e4sZyu/AFCepU5HK+e0zbc@4c2f7","e4sZyu/AFCepU5HK+e0zbc@4f501","e4sZyu/AFCepU5HK+e0zbc@4f540","e4sZyu/AFCepU5HK+e0zbc@50743","e4sZyu/AFCepU5HK+e0zbc@50f7f","e4sZyu/AFCepU5HK+e0zbc@51278","e4sZyu/AFCepU5HK+e0zbc@51c5c","e4sZyu/AFCepU5HK+e0zbc@52127","e4sZyu/AFCepU5HK+e0zbc@531b0","e4sZyu/AFCepU5HK+e0zbc@54d9f","e4sZyu/AFCepU5HK+e0zbc@5501b","e4sZyu/AFCepU5HK+e0zbc@55257","e4sZyu/AFCepU5HK+e0zbc@56552","e4sZyu/AFCepU5HK+e0zbc@58994","e4sZyu/AFCepU5HK+e0zbc@59be8","e4sZyu/AFCepU5HK+e0zbc@5c5bd","e4sZyu/AFCepU5HK+e0zbc@5f29a","e4sZyu/AFCepU5HK+e0zbc@5f893","e4sZyu/AFCepU5HK+e0zbc@60a81","e4sZyu/AFCepU5HK+e0zbc@65e4a","e4sZyu/AFCepU5HK+e0zbc@69af2","e4sZyu/AFCepU5HK+e0zbc@6af60","e4sZyu/AFCepU5HK+e0zbc@6cae0","e4sZyu/AFCepU5HK+e0zbc@6ee89","e4sZyu/AFCepU5HK+e0zbc@6fe55","e4sZyu/AFCepU5HK+e0zbc@72311","e4sZyu/AFCepU5HK+e0zbc@72c32","e4sZyu/AFCepU5HK+e0zbc@73f47","e4sZyu/AFCepU5HK+e0zbc@742df","e4sZyu/AFCepU5HK+e0zbc@7597f","e4sZyu/AFCepU5HK+e0zbc@781f0","e4sZyu/AFCepU5HK+e0zbc@78ea3","e4sZyu/AFCepU5HK+e0zbc@7b290","e4sZyu/AFCepU5HK+e0zbc@7eb92","e4sZyu/AFCepU5HK+e0zbc@809b5","e4sZyu/AFCepU5HK+e0zbc@809d9","e4sZyu/AFCepU5HK+e0zbc@8222a","e4sZyu/AFCepU5HK+e0zbc@8229f","e4sZyu/AFCepU5HK+e0zbc@8598a","e4sZyu/AFCepU5HK+e0zbc@87329","e4sZyu/AFCepU5HK+e0zbc@89667","e4sZyu/AFCepU5HK+e0zbc@8c06b","e4sZyu/AFCepU5HK+e0zbc@8f420","e4sZyu/AFCepU5HK+e0zbc@90288","e4sZyu/AFCepU5HK+e0zbc@90611","e4sZyu/AFCepU5HK+e0zbc@9333c","e4sZyu/AFCepU5HK+e0zbc@935b9","e4sZyu/AFCepU5HK+e0zbc@9395b","e4sZyu/AFCepU5HK+e0zbc@95418","e4sZyu/AFCepU5HK+e0zbc@96cab","e4sZyu/AFCepU5HK+e0zbc@98962","e4sZyu/AFCepU5HK+e0zbc@98d72","e4sZyu/AFCepU5HK+e0zbc@99ea5","e4sZyu/AFCepU5HK+e0zbc@9b633","e4sZyu/AFCepU5HK+e0zbc@9c3d2","e4sZyu/AFCepU5HK+e0zbc@9d0a2","e4sZyu/AFCepU5HK+e0zbc@9faa0","e4sZyu/AFCepU5HK+e0zbc@a0c07","e4sZyu/AFCepU5HK+e0zbc@a1f5c","e4sZyu/AFCepU5HK+e0zbc@a21ca","e4sZyu/AFCepU5HK+e0zbc@a27a5","e4sZyu/AFCepU5HK+e0zbc@a2905","e4sZyu/AFCepU5HK+e0zbc@a2999","e4sZyu/AFCepU5HK+e0zbc@a3985","e4sZyu/AFCepU5HK+e0zbc@a4654","e4sZyu/AFCepU5HK+e0zbc@a4688","e4sZyu/AFCepU5HK+e0zbc@a61a2","e4sZyu/AFCepU5HK+e0zbc@a6a64","e4sZyu/AFCepU5HK+e0zbc@a6b6e","e4sZyu/AFCepU5HK+e0zbc@a87a2","e4sZyu/AFCepU5HK+e0zbc@ab0a9","e4sZyu/AFCepU5HK+e0zbc@af523","e4sZyu/AFCepU5HK+e0zbc@b20c6","e4sZyu/AFCepU5HK+e0zbc@b2533","e4sZyu/AFCepU5HK+e0zbc@b36a3","e4sZyu/AFCepU5HK+e0zbc@b4805","e4sZyu/AFCepU5HK+e0zbc@b4841","e4sZyu/AFCepU5HK+e0zbc@b5f0d","e4sZyu/AFCepU5HK+e0zbc@b719f","e4sZyu/AFCepU5HK+e0zbc@b8e05","e4sZyu/AFCepU5HK+e0zbc@b9514","e4sZyu/AFCepU5HK+e0zbc@bc876","e4sZyu/AFCepU5HK+e0zbc@bcb27","e4sZyu/AFCepU5HK+e0zbc@bf0b5","e4sZyu/AFCepU5HK+e0zbc@c1860","e4sZyu/AFCepU5HK+e0zbc@c5910","e4sZyu/AFCepU5HK+e0zbc@c7100","e4sZyu/AFCepU5HK+e0zbc@c8890","e4sZyu/AFCepU5HK+e0zbc@ca748","e4sZyu/AFCepU5HK+e0zbc@cbac6","e4sZyu/AFCepU5HK+e0zbc@cdec0","e4sZyu/AFCepU5HK+e0zbc@d0968","e4sZyu/AFCepU5HK+e0zbc@d0c04","e4sZyu/AFCepU5HK+e0zbc@d4524","e4sZyu/AFCepU5HK+e0zbc@d5b5e","e4sZyu/AFCepU5HK+e0zbc@d5db4","e4sZyu/AFCepU5HK+e0zbc@d932b","e4sZyu/AFCepU5HK+e0zbc@daa6a","e4sZyu/AFCepU5HK+e0zbc@db620","e4sZyu/AFCepU5HK+e0zbc@dd038","e4sZyu/AFCepU5HK+e0zbc@ddf8f","e4sZyu/AFCepU5HK+e0zbc@df4b3","e4sZyu/AFCepU5HK+e0zbc@e0fe4","e4sZyu/AFCepU5HK+e0zbc@e1124","e4sZyu/AFCepU5HK+e0zbc@e3218","e4sZyu/AFCepU5HK+e0zbc@e461a","e4sZyu/AFCepU5HK+e0zbc@e5ade","e4sZyu/AFCepU5HK+e0zbc@e5e90","e4sZyu/AFCepU5HK+e0zbc@e6790","e4sZyu/AFCepU5HK+e0zbc@e73c6","e4sZyu/AFCepU5HK+e0zbc@eb942","e4sZyu/AFCepU5HK+e0zbc@ec5f7","e4sZyu/AFCepU5HK+e0zbc@efc56","e4sZyu/AFCepU5HK+e0zbc@f2d5a","e4sZyu/AFCepU5HK+e0zbc@f319c","e4sZyu/AFCepU5HK+e0zbc@f3c0a","e4sZyu/AFCepU5HK+e0zbc@f4010","e4sZyu/AFCepU5HK+e0zbc@f9ec9","e4sZyu/AFCepU5HK+e0zbc@fc0b8","f1KiPEuSRDIqJgPZgkKPHo","f1KiPEuSRDIqJgPZgkKPHo@6c48a","f1KiPEuSRDIqJgPZgkKPHo@f9941","fdjsU2o1RKF5x0TziDw3jI","ffuIqPr2JI9I8dPLYGRDpD","ffuIqPr2JI9I8dPLYGRDpD@6c48a","ffuIqPr2JI9I8dPLYGRDpD@f9941"],"paths":{"3":["db:/internal/physics/default-physics-material",2,1],"9":["db:/assets/Scenes/scene",0,1],"206":["db:/internal/default_renderpipeline/builtin-forward",1,1]},"scenes":{"db://assets/Scenes/scene.scene":9},"packs":{"0699aaa4c":[12,13,14,15,16,17,18],"090ad915b":[4,7,11,19,9,20,24,27,28,29,30,31,32,33,34,35,36,40,41,44,45,48,51,52,53,54,57,60,61,62,65,67,70,73,74,75,78,79,80,82,83,84,85,86,91,96,97,102,103,104,110,112,114,116,117,118,121,122,124,130,131,135,140,143,144,147,150,151,152,153,154,155,156,157,161,163,164,168,169,170,172,173,174,178,181,183,184,185,186,188,195,196,199,200,202,205,209],"0a6d024a0":[10,6,23,26,46,47,39,59,58,71,72,37,137,138,139,88,90,98,42,111,115,38,133,136,56,77,92,119,68,50,87,89,95,109,127,134,145,146,148,149,158,162,160,165,166,171,180,175,177,198,204,208]},"versions":{"import":[],"native":[]},"redirect":[21,"0",3,"0"],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.SceneAsset","cc.RenderPipeline","cc.PhysicsMaterial"]} \ No newline at end of file diff --git a/code/assets/main/import/06/0699aaa4c.json b/code/assets/main/import/06/0699aaa4c.json new file mode 100644 index 0000000..c1618de --- /dev/null +++ b/code/assets/main/import/06/0699aaa4c.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset","cc.TextureCube"],0,[[[{"base":"2,2,0,0,2,0","rgbe":false,"mipmaps":[{"front":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@e9a6d","back":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@40c10","left":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@8fd34","right":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@74afd","top":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@bb97f","bottom":"6fAc9/gb9Kfr1dCvwZaWSA@b47c0@7d38f"}]}],[1],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]]] diff --git a/code/assets/main/import/09/090ad915b.json b/code/assets/main/import/09/090ad915b.json new file mode 100644 index 0000000..f709a21 --- /dev/null +++ b/code/assets/main/import/09/090ad915b.json @@ -0,0 +1 @@ +[1,["c89m0XNRpI2qEsAhLShXXE","87cJVYNlpFCqZOYVSlxe8Y","0by2OqhTtD6KVmY6y0fvqN","e4sZyu/AFCepU5HK+e0zbc@742df","e4sZyu/AFCepU5HK+e0zbc@fc0b8","e4sZyu/AFCepU5HK+e0zbc@0c6f1","f1KiPEuSRDIqJgPZgkKPHo@f9941","a3zQCfCrBCDZJ4uf2rk5u8","e4sZyu/AFCepU5HK+e0zbc@2bc87","e4sZyu/AFCepU5HK+e0zbc@2cd19","e4sZyu/AFCepU5HK+e0zbc@60a81","e4sZyu/AFCepU5HK+e0zbc@a6a64","e4sZyu/AFCepU5HK+e0zbc@0f9a3","e4sZyu/AFCepU5HK+e0zbc@23859","e4sZyu/AFCepU5HK+e0zbc@daa6a","e4sZyu/AFCepU5HK+e0zbc@809b5","e4sZyu/AFCepU5HK+e0zbc@935b9","e4sZyu/AFCepU5HK+e0zbc@a87a2","e4sZyu/AFCepU5HK+e0zbc@ddf8f","e4sZyu/AFCepU5HK+e0zbc@72c32","e4sZyu/AFCepU5HK+e0zbc@b20c6","e4sZyu/AFCepU5HK+e0zbc@af523","e4sZyu/AFCepU5HK+e0zbc@ab0a9","e4sZyu/AFCepU5HK+e0zbc@a21ca","e4sZyu/AFCepU5HK+e0zbc@3e076","e4sZyu/AFCepU5HK+e0zbc@56552","e4sZyu/AFCepU5HK+e0zbc@49b18","20g1ukYUVPvKWKBRznAKo+@f9941","e4sZyu/AFCepU5HK+e0zbc@90288","e4sZyu/AFCepU5HK+e0zbc@a4688","e4sZyu/AFCepU5HK+e0zbc@c8890","e4sZyu/AFCepU5HK+e0zbc@0089c","e4sZyu/AFCepU5HK+e0zbc@9b633","e4sZyu/AFCepU5HK+e0zbc@221a5","e4sZyu/AFCepU5HK+e0zbc@b36a3","e4sZyu/AFCepU5HK+e0zbc@f319c","e4sZyu/AFCepU5HK+e0zbc@b4841","e4sZyu/AFCepU5HK+e0zbc@3c999","e4sZyu/AFCepU5HK+e0zbc@99ea5","e4sZyu/AFCepU5HK+e0zbc@006bd","e4sZyu/AFCepU5HK+e0zbc@50743","e4sZyu/AFCepU5HK+e0zbc@55257","e4sZyu/AFCepU5HK+e0zbc@809d9","e4sZyu/AFCepU5HK+e0zbc@a2905","e4sZyu/AFCepU5HK+e0zbc@531b0","e4sZyu/AFCepU5HK+e0zbc@9c3d2","20g1ukYUVPvKWKBRznAKo+@6c48a","54TknWPwVPqJqeCR+Y/Czo@6c48a","e4sZyu/AFCepU5HK+e0zbc@7b290","e4sZyu/AFCepU5HK+e0zbc@3bc15","e4sZyu/AFCepU5HK+e0zbc@cdec0","e4sZyu/AFCepU5HK+e0zbc@f4010","e4sZyu/AFCepU5HK+e0zbc@b2533","e4sZyu/AFCepU5HK+e0zbc@3e23d","e4sZyu/AFCepU5HK+e0zbc@b8e05","e4sZyu/AFCepU5HK+e0zbc@8229f","e4sZyu/AFCepU5HK+e0zbc@c7100","e4sZyu/AFCepU5HK+e0zbc@35e77","e4sZyu/AFCepU5HK+e0zbc@d5b5e","e4sZyu/AFCepU5HK+e0zbc@52127","e4sZyu/AFCepU5HK+e0zbc@58994","e4sZyu/AFCepU5HK+e0zbc@1ca10","e4sZyu/AFCepU5HK+e0zbc@e0fe4","e4sZyu/AFCepU5HK+e0zbc@41791","e4sZyu/AFCepU5HK+e0zbc@98d72","e4sZyu/AFCepU5HK+e0zbc@c5910","e4sZyu/AFCepU5HK+e0zbc@a27a5","e4sZyu/AFCepU5HK+e0zbc@1eaad","e4sZyu/AFCepU5HK+e0zbc@7eb92","e4sZyu/AFCepU5HK+e0zbc@781f0","e4sZyu/AFCepU5HK+e0zbc@8598a","e4sZyu/AFCepU5HK+e0zbc@89667","e4sZyu/AFCepU5HK+e0zbc@c1860","e4sZyu/AFCepU5HK+e0zbc@65e4a","e4sZyu/AFCepU5HK+e0zbc@69af2","e4sZyu/AFCepU5HK+e0zbc@efc56","e4sZyu/AFCepU5HK+e0zbc@04761","e2Y/hxG/5JJ4f+EuJgfHP4@63096","e4sZyu/AFCepU5HK+e0zbc@a3985","e4sZyu/AFCepU5HK+e0zbc@b5f0d","e4sZyu/AFCepU5HK+e0zbc@9faa0","e4sZyu/AFCepU5HK+e0zbc@4affa","e4sZyu/AFCepU5HK+e0zbc@df4b3","e4sZyu/AFCepU5HK+e0zbc@161ec","e4sZyu/AFCepU5HK+e0zbc@4c2f7","e4sZyu/AFCepU5HK+e0zbc@1827c","e4sZyu/AFCepU5HK+e0zbc@2f6d1","e4sZyu/AFCepU5HK+e0zbc@cbac6","e4sZyu/AFCepU5HK+e0zbc@0af0b","e4sZyu/AFCepU5HK+e0zbc@4f501","e4sZyu/AFCepU5HK+e0zbc@b9514","e4sZyu/AFCepU5HK+e0zbc@dd038","e4sZyu/AFCepU5HK+e0zbc@422fc","e4sZyu/AFCepU5HK+e0zbc@a6b6e","e4sZyu/AFCepU5HK+e0zbc@ca748","e4sZyu/AFCepU5HK+e0zbc@f3c0a","e4sZyu/AFCepU5HK+e0zbc@ec5f7","e4sZyu/AFCepU5HK+e0zbc@3f608","e4sZyu/AFCepU5HK+e0zbc@4f540","e4sZyu/AFCepU5HK+e0zbc@9395b","e4sZyu/AFCepU5HK+e0zbc@e3218","e4sZyu/AFCepU5HK+e0zbc@03ec6","e4sZyu/AFCepU5HK+e0zbc@a61a2","e4sZyu/AFCepU5HK+e0zbc@4275b","e4sZyu/AFCepU5HK+e0zbc@2e76e","ffuIqPr2JI9I8dPLYGRDpD@f9941","b7MFJ8MjNBwqr3fNq1j5dJ@f9941","9c1kh84FxPb70wzi6zaCvX","d0MqyYBeFAkIi762QNy1/B@b47c0","6fAc9/gb9Kfr1dCvwZaWSA@b47c0","afxHkx8GZGsJC+n+YfITQo@f9941","54TknWPwVPqJqeCR+Y/Czo@f9941","afxHkx8GZGsJC+n+YfITQo@6c48a","b7MFJ8MjNBwqr3fNq1j5dJ@6c48a","e4sZyu/AFCepU5HK+e0zbc@a2999","e4sZyu/AFCepU5HK+e0zbc@067c6","e4sZyu/AFCepU5HK+e0zbc@96cab","e4sZyu/AFCepU5HK+e0zbc@d932b","e4sZyu/AFCepU5HK+e0zbc@98962","e4sZyu/AFCepU5HK+e0zbc@d4524","e4sZyu/AFCepU5HK+e0zbc@404ea","e4sZyu/AFCepU5HK+e0zbc@51c5c","e4sZyu/AFCepU5HK+e0zbc@b719f","e4sZyu/AFCepU5HK+e0zbc@a4654","e4sZyu/AFCepU5HK+e0zbc@3d208","e4sZyu/AFCepU5HK+e0zbc@78ea3","e4sZyu/AFCepU5HK+e0zbc@9d0a2","e4sZyu/AFCepU5HK+e0zbc@51278","e4sZyu/AFCepU5HK+e0zbc@72311","e4sZyu/AFCepU5HK+e0zbc@2a87f","e4sZyu/AFCepU5HK+e0zbc@0dd94","e4sZyu/AFCepU5HK+e0zbc@bcb27","e4sZyu/AFCepU5HK+e0zbc@d0968","e4sZyu/AFCepU5HK+e0zbc@2a682","e4sZyu/AFCepU5HK+e0zbc@73f47","e4sZyu/AFCepU5HK+e0zbc@01feb","e4sZyu/AFCepU5HK+e0zbc@bc876","e4sZyu/AFCepU5HK+e0zbc@59be8","e4sZyu/AFCepU5HK+e0zbc@3693d","e4sZyu/AFCepU5HK+e0zbc@0c93e","e4sZyu/AFCepU5HK+e0zbc@50f7f","e4sZyu/AFCepU5HK+e0zbc@14738","f1KiPEuSRDIqJgPZgkKPHo@6c48a","ffuIqPr2JI9I8dPLYGRDpD@6c48a"],["node","_mesh","_effectAsset","mainTexture","pbrMap","redMaterial","yellowMaterial","normalMap","_spriteFrame","_textureSource","_parent","spriteBg","_target","Walls","nodeThump","WallLb","_cameraComponent","equipmentLb","cameraMover","camera","scene","_verticalScrollBar","_content","itemPrefab","_envmapHDR","_envmapLDR","root","button","timeLabel","nameLabel","data","_normalSprite","_pressedSprite","emissiveMap"],[["cc.Node",["_name","_layer","_id","_components","_parent","_children","_lpos","_lrot","_euler","_prefab","_lscale"],0,9,1,2,5,5,5,4,5],["cc.Node",["_name","_layer","_components","_lpos","_parent","_lscale","_children","_prefab","_lrot","_euler"],1,12,5,1,5,2,4,5,5],"cc.SpriteFrame","cc.ImageAsset",["cc.Sprite",["_type","_sizeMode","node","_spriteFrame","__prefab","_color"],1,1,6,4,5],["cc.UITransform",["node","_contentSize","_anchorPoint","__prefab"],3,1,5,5,4],["cc.Button",["_transition","node","_normalColor","_target","clickEvents","__prefab"],2,1,5,1,9,4],["cc.Label",["_string","_actualFontSize","_fontSize","_overflow","_cacheMode","_lineHeight","_enableWrapText","node","_color","__prefab"],-4,1,5,4],["cc.Material",["_name","_states","_defines","_techIdx","_props"],-1,12],["cc.Widget",["_alignFlags","_originalHeight","_alignMode","node"],0,1],["cc.Camera",["_clearFlags","_visibility","_projection","_priority","_orthoHeight","_far","node","_color"],-3,1,5],"cc.TextureCube",["cc.SceneAsset",["_name"],2],["cc.Node",["_name","_parent","_components","_lpos"],2,1,2,5],["c6cc9hNiE5Axr2R3ChCk2AB",["node","Walls"],3,1,1],["25c6avRXM5AKrkSp8VWFb2Y",["node","nodeThump","spriteBg","colorBg"],3,1,1,1,12],["bae91xJwvJDa5PQthCiFX8w",["node","WallLb"],3,1,1],["cc.Canvas",["node","_cameraComponent"],3,1,1],["cc.Scene",["_name","_children","_prefab","_globals"],2,2,4,4],["cc.PrefabInfo",["root","asset","fileId","instance","nestedPrefabInstanceRoots","targetOverrides"],-3],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.SceneGlobals",["ambient","shadows","_skybox","fog","octree","skin","lightProbeInfo","postSettings"],3,4,4,4,4,4,4,4,4],["cc.AmbientInfo",["_skyIllumLDR","_skyColorHDR","_skyColorLDR","_groundAlbedoLDR"],2,5,5,5],["cc.ShadowsInfo",["_enabled","_type","_shadowColor","_size"],1,5,5],["cc.SkyboxInfo",["_envLightingType","_enabled","_envmapHDR","_envmapLDR"],1,6,6],["cc.FogInfo",["_type"],2],["cc.OctreeInfo",[],3],["cc.SkinInfo",["_enabled"],2],["cc.LightProbeInfo",[],3],["cc.PostSettingsInfo",[],3],["41a9dZz2mVOFoYwOsk9H98q",["node","equipmentLb","spriteBg","colorBg","equipmentList"],3,1,1,1,12,1],["96ff6EZCmtHRYuI/W42BPVH",["node","camera","cameraMover"],3,1,1,1],["cc.ClickEvent",["_componentId","handler","target"],1,1],["cc.Mask",["node"],3,1],["cc.Graphics",["node","_fillColor"],3,1,5],["cc.MeshRenderer",["_shadowCastingMode","node","_materials","bakeSettings","_mesh"],2,1,3,4,6],["cc.MeshRenderer",["_shadowCastingMode","_materials","node","bakeSettings","_mesh"],1,1,4,6],["cc.ModelBakeSettings",["_castShadow","_receiveShadow"],1],["cc.MeshCollider",["node","_mesh"],3,1,6],["04b2bx0wWRFNZUDzjOKuS7p",["node","redMaterial","yellowMaterial"],3,1,6,6],["5d80eQJlnxA9ooItxxIqddm",["node","camera"],3,1,1],["cc.ScrollView",["bounceDuration","brake","horizontal","node"],0,1],["cc.DirectionalLight",["_shadowEnabled","_shadowPcf","node","_color","_staticSettings"],1,1,5,4],["cc.StaticLightSettings",["_castShadow"],2],["6e9d1pTCW9PELDNeLCm44VF",["node","camera"],3,1,1],["cc.ScrollBar",["_direction","node","_scrollView","_handle"],2,1,1,1],["e8aeeDTB95N27vY5YNwlCRI",["node","scrollView","itemPrefab"],3,1,1,6],["bdf50LzsO9GkrF5oSw4uDK/",["node"],3,1],["cc.Prefab",["_name"],2],["cc.CompPrefabInfo",["fileId"],2],["e5a794S61FLarSaWsI+BZm6",["node","__prefab","nameLabel","timeLabel","button"],3,1,4,1,1,1],["cc.EffectAsset",["_name","combinations","shaders","techniques"],-1],["cc.Mesh",["_native","_hash","_struct"],1,11],["cc.Mesh",["_native","_hash","_struct"],0]],[[0,0,4,3,6,2],[37,0,1,3],[53,0,1,2,4],[35,0,1,2,3,4,2],[8,0,1,2,4,4],[38,0,1,1],[39,0,1,2,1],[5,0,1,1],[49,0,2],[5,0,3,1,1],[20,0,1,2,3,4,5,5],[4,0,1,2,3],[32,0,1,2,3],[0,0,1,4,3,6,3],[5,0,1,2,1],[4,0,1,2,3,3],[8,0,3,1,2,4,5],[0,0,5,2],[1,0,1,4,6,2,3,5,3],[1,0,1,4,2,3,3],[1,0,1,4,2,7,3,5,3],[7,0,1,2,3,6,4,7,9,8,7],[12,0,2],[0,0,5,3,2],[0,0,1,2,5,3,6,4],[0,0,1,4,5,3,3],[0,0,1,4,3,3],[0,0,2,4,5,3],[0,0,2,4,5,3,3],[0,0,2,4,3,6,7,8,3],[0,0,1,2,4,3,4],[0,0,2,4,3,3],[0,0,1,5,3,9,6,10,3],[1,0,1,6,2,3,3],[1,0,1,4,6,2,3,3],[1,0,2,3,8,9,2],[1,0,1,4,2,5,3],[1,0,1,4,2,7,5,3],[13,0,1,2,3,2],[14,0,1,1],[15,0,1,2,3,1],[16,0,1,1],[17,0,1,1],[9,0,3,2],[9,0,1,2,3,4],[18,0,1,2,3,2],[19,0,1,2,3,4,5,7],[21,0,1,2,3,4,5,6,7,1],[22,0,1,2,3,2],[23,0,1,2,3,3],[24,0,1,2,3,3],[25,0,2],[26,1],[27,0,2],[28,1],[29,1],[4,0,1,2,5,3],[4,2,4,1],[4,0,1,2,4,3,3],[30,0,1,2,3,4,1],[31,0,1,2,1],[6,1,4,2,3,1],[6,0,1,4,2,3,2],[6,0,1,5,2,3,2],[33,0,1],[34,0,1,1],[36,0,1,2,3,4,3],[40,0,1,1],[10,0,1,6,7,3],[10,2,3,4,5,0,1,6,7,7],[41,0,1,2,3,4],[42,0,1,2,3,4,3],[43,0,2],[44,0,1,1],[7,0,1,2,5,3,4,7,8,7],[7,0,1,2,5,3,4,7,7],[45,0,1,2,3,2],[46,0,1,2,1],[47,0,1],[48,0,2],[50,0,1,2,3,4,1],[51,0,1,2,3,5],[52,0,1,2,3]],[[[[16,"YellowPulseMaterial",1,[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_INSTANCING":true,"USE_ALPHA_TEST":true},{},{}],[[[{"alphaThreshold":0},"mainColor",8,[4,4278255615]],{},{}],11,0,0]]],0,0,[0],[2],[7]],[[{"name":"default_btn_normal","rect":{"x":0,"y":0,"width":40,"height":40},"offset":{"x":0,"y":0},"originalSize":{"width":40,"height":40},"rotated":false,"capInsets":[12,12,12,12],"vertices":{"rawPosition":[-20,-20,0,20,-20,0,-20,20,0,20,20,0],"indexes":[0,1,2,2,1,3],"uv":[0,40,40,40,0,0,40,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-20,"y":-20,"z":0},"maxPos":{"x":20,"y":20,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[46]],[[{"name":"default_btn_pressed","rect":{"x":0,"y":0,"width":40,"height":40},"offset":{"x":0,"y":0},"originalSize":{"width":40,"height":40},"rotated":false,"capInsets":[12,12,12,12],"vertices":{"rawPosition":[-20,-20,0,20,-20,0,-20,20,0,20,20,0],"indexes":[0,1,2,2,1,3],"uv":[0,40,40,40,0,0,40,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-20,"y":-20,"z":0},"maxPos":{"x":20,"y":20,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[47]],[[[16,"RedPulseMaterial",1,[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}},{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_INSTANCING":true,"USE_ALPHA_TEST":true},{},{}],[[[{"alphaThreshold":0},"mainColor",8,[4,4278190335]],{},{}],11,0,0]]],0,0,[0],[2],[7]],[[[22,"scene"],[17,"Equipment",[-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18]],[17,"Area",[-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36]],[23,"Walls",[-39,-40,-41,-42,-43,-44,-45],[[39,-38,-37]]],[33,"WallSwitch",33554432,[-53,-54,-55],[[[7,-46,[5,80,26]],-47,[40,-50,-49,-48,[[[4,4285398898],[4,4278190335]],8,8]],[41,-52,-51]],4,1,4,4],[1,-455.66,304.314,0]],[24,"Canvas",33554432,"0d2R2xa05Daaje59M2bvvU",[-60,4,-61,-62],[[7,-56,[5,1280,720]],[42,-58,-57],[43,45,-59]],[1,640,360,0]],[45,"scene",[-63,-64,-65,5,-66,-67],[46,null,null,"955c22b7-7b7e-4af8-ad45-8415a0c23e60",null,null,[]],[47,[48,0.8,[2,0.2,0.5,0.8,0.520833125],[2,0.452588,0.607642,0.755699,0.8],[2,0.618555,0.577848,0.544564,0]],[49,true,1,[4,4283190348],[0,2048,2048]],[50,1,true,147,148],[51,1],[52],[53,false],[54],[55]]],[18,"equipmentList",33554432,5,[-71,-72],[[[7,-68,[5,240,250]],[15,1,0,-69,145],-70],4,4,1],[1,-518.405,151.274,0],[1,0.874,1,1]],[18,"ListSwtich",33554432,5,[-78,-79],[[[7,-73,[5,75,36]],-74,[59,-77,-76,-75,[[[4,4285398898],[4,4278190335]],8,8],7]],4,1,4],[1,-563.898,305.973,0],[1,1.588,0.986,1]],[34,"scrollBar",33554432,7,[-84],[[[14,-80,[5,12,250],[0,1,0.5]],[15,1,0,-81,144],[44,37,250,1,-82],-83],4,4,4,1],[1,120,0,0]],[35,"Main Camera",[[-85,[60,-88,-87,-86],-89],1,4,1],[1,83.5,31.7,93.6],[3,-0.14640662047956113,0.13593483636331533,0.020315597412727305,0.9796295719527848],[1,-17,15.8,0]],[13,"Button",33554432,4,[[7,-90,[5,80,26]],[11,1,0,-91],[61,-93,[[12,"25c6avRXM5AKrkSp8VWFb2Y","setToggle",4],[12,"bae91xJwvJDa5PQthCiFX8w","wallSwitch",4],[12,"c6cc9hNiE5Axr2R3ChCk2AB","wallSwitch",3]],[4,4292269782],-92]],[1,0.237,0,0]],[25,"view",33554432,7,[-97],[[7,-94,[5,240,250]],[64,-95],[65,-96,[4,16777215]]]],[26,"Button",33554432,8,[[7,-98,[5,70,30]],[11,1,0,-99],[62,2,-101,[[12,"41a9dZz2mVOFoYwOsk9H98q","equipmentSwitch",8]],[4,4292269782],-100]]],[27,"zavod","adPjdg2OhGn7QEF5iH4HcZ",6,[3,1,2]],[0,"13",1,[[3,1,-102,[14,15,16],[1,true,true],17],[5,-103,18],[6,-104,19,20]],[1,68.34968566894531,12.088397026062012,-18.31235122680664]],[0,"same",1,[[3,1,-105,[21],[1,true,true],22],[5,-106,23],[6,-107,24,25]],[1,72.23786163330078,25.28400421142578,-41.2019157409668]],[0,"koj.006",1,[[3,1,-108,[26],[1,true,true],27],[6,-109,28,29],[5,-110,30]],[1,72.54381561279297,12.524746894836426,-50.5303840637207]],[0,"koj.004",1,[[3,1,-111,[31],[1,true,true],32],[6,-112,33,34],[5,-113,35]],[1,68.6732177734375,20.75161361694336,-39.07102584838867]],[0,"koj.003",1,[[3,1,-114,[36],[1,true,true],37],[6,-115,38,39],[5,-116,40]],[1,71.55332946777344,22.994470596313477,-41.216407775878906]],[0,"koj.002",1,[[3,1,-117,[41],[1,true,true],42],[5,-118,43],[6,-119,44,45]],[1,69.19572448730469,23.85663604736328,-39.173492431640625]],[0,"koj.005",1,[[3,1,-120,[46],[1,true,true],47],[6,-121,48,49],[5,-122,50]],[1,72.79012298583984,17.926029205322266,-40.42891311645508]],[0,"koj.001",1,[[3,1,-123,[51],[1,true,true],52],[6,-124,53,54],[5,-125,55]],[1,68.35987854003906,26.326915740966797,-38.748714447021484]],[0,"koj",1,[[3,1,-126,[56],[1,true,true],57],[6,-127,58,59],[5,-128,60]],[1,72.49209594726562,27.17462730407715,-41.11946105957031]],[0,"8",1,[[3,1,-129,[61],[1,true,true],62],[6,-130,63,64],[5,-131,65]],[1,71.9390640258789,29.753206253051758,-39.202293395996094]],[0,"9",1,[[3,1,-132,[66],[1,true,true],67],[5,-133,68],[6,-134,69,70]],[1,69.706787109375,24.642227172851562,-39.36470413208008]],[0,"74",1,[[3,1,-135,[71],[1,true,true],72],[6,-136,73,74],[5,-137,75]],[1,72.9434814453125,14.0764799118042,-44.194095611572266]],[0,"14",1,[[3,1,-138,[76,77,78],[1,true,true],79],[6,-139,80,81],[5,-140,82]],[1,63.00178146362305,11.668142318725586,-50.533321380615234]],[0,"19",1,[[3,1,-141,[83],[1,true,true],84],[6,-142,85,86],[5,-143,87]],[1,71.25702667236328,26.897775650024414,-38.52577209472656]],[0,"12",1,[[3,1,-144,[88],[1,true,true],89],[6,-145,90,91],[5,-146,92]],[1,67.10316467285156,18.235525131225586,-39.104305267333984]],[0,"73",1,[[3,1,-147,[93],[1,true,true],94],[6,-148,95,96],[5,-149,97]],[1,72.18412780761719,22.281278610229492,-38.93197250366211]],[0,"4",1,[[3,1,-150,[98],[1,true,true],99],[6,-151,100,101],[5,-152,102]],[1,71.44066619873047,31.17104721069336,-79.49864959716797]],[0,"1",1,[[3,1,-153,[103],[1,true,true],104],[6,-154,105,106],[5,-155,107]],[1,71.40684509277344,31.60773277282715,-121.69174194335938]],[13,"SpriteThump",33554432,4,[[7,-156,[5,26,26]],[15,1,0,-157,143]],[1,-27,0,0]],[28,"Player","d6FlzGFRpN07QYAnUY0l2i",6,[10],[[67,-158,10]]],[68,14,1822425087,10,[4,3838264852]],[19,"Label",33554432,4,[[[7,-159,[5,187.54,40]],-160],4,1],[1,117.733,0,0]],[19,"bar",33554432,9,[[[14,-161,[5,10,156.25],[0,0,0]],-162],4,1],[1,-11,-31.250000000000057,0]],[70,0.23,0.75,false,7],[13,"content",33554432,12,[[14,-163,[5,225,400],[0,0.5,1]]],[1,-10,125,0]],[36,"ListLabel",33554432,8,[[[7,-164,[5,140,31.9]],-165],4,1],[1,0.5,1,1]],[29,"Main Light","c0y6F5f+pAvI805TdmxIjx",6,[[71,true,2,-166,[4,4293982975],[72,true]]],[1,0.996,1.671,1.436],[3,-0.06397656665577071,-0.44608233363525845,-0.8239028751062036,-0.3436591377065261],[1,-117.894,-194.909,38.562]],[73,10,35],[0,"Сортировка АР",3,[[3,1,-167,[0],[1,true,true],1]],[1,69.86260223388672,22.458049774169922,-43.68870544433594]],[0,"GK_korp",3,[[3,1,-168,[2],[1,true,true],3]],[1,-4.459189414978027,8.340529441833496,-48.872779846191406]],[0,"kj",3,[[3,1,-169,[4],[1,true,true],5]],[1,-8.167387008666992,6.861529350280762,-11.300395965576172]],[0,"build.005",3,[[3,1,-170,[6],[1,true,true],7]],[1,-30.420194625854492,12.006189346313477,-51.327430725097656]],[0,"build.008",3,[[3,1,-171,[8],[1,true,true],9]],[1,-40.366851806640625,10.663442611694336,-50.897499084472656]],[0,"build.006",3,[[3,1,-172,[10],[1,true,true],11]],[1,68.3364028930664,13.129583358764648,-10.267422676086426]],[0,"build.007",3,[[3,1,-173,[12],[1,true,true],13]],[1,71.39132690429688,32.06319808959961,-87.59060668945312]],[0,"Ограда",2,[[3,1,-174,[108],[1,true,true],109]],[1,91.36193084716797,41.094356536865234,-139.72804260253906]],[0,"ground.002",2,[[3,1,-175,[110],[1,true,true],111]],[1,17.372573852539062,4.302250862121582,-3.331378698348999]],[0,"ground.001",2,[[3,1,-176,[112],[1,true,true],113]],[1,-16.347625732421875,21.996192932128906,-61.460262298583984]],[0,"Cube",2,[[3,1,-177,[114],[1,true,true],115]],[1,81.5244140625,6.118722438812256,-174.61048889160156]],[0,"ground",2,[[3,1,-178,[116],[1,true,true],117]],[1,141.58145141601562,1.745630145072937,-51.681217193603516]],[0,"pol.002",2,[[3,1,-179,[118],[1,true,true],119]],[1,70.86576843261719,9.545680046081543,-44.04548263549805]],[0,"pol.003",2,[[3,1,-180,[120],[1,true,true],121]],[1,-19.068384170532227,-0.5333344340324402,-48.52812957763672]],[0,"pol.001",2,[[3,1,-181,[122],[1,true,true],123]],[1,-1.2395868301391602,-0.10000111907720566,-51.1351432800293]],[0,"name",2,[[3,1,-182,[124],[1,true,true],125]],[1,119.40760040283203,27.5914363861084,-113.83114624023438]],[0,"ugol",2,[[3,1,-183,[126],[1,true,true],127]],[1,61.87797546386719,33.92856979370117,-98.65628814697266]],[0,"pol",2,[[3,1,-184,[128],[1,true,true],129]],[1,1.6638832092285156,-0.5337653160095215,-45.85536193847656]],[0,"build.004",2,[[3,1,-185,[130],[1,true,true],131]],[1,38.069969177246094,9.563444137573242,-50.7181510925293]],[0,"build.003",2,[[3,1,-186,[132],[1,true,true],133]],[1,-30.94754409790039,7.4964704513549805,-51.320213317871094]],[0,"build.002",2,[[3,1,-187,[134],[1,true,true],135]],[1,71.392333984375,21.2194881439209,-80.8216552734375]],[0,"build.001",2,[[3,1,-188,[136],[1,true,true],137]],[1,68.33491516113281,5.609694004058838,-6.6616973876953125]],[0,"build",2,[[3,1,-189,[138],[1,true,true],139]],[1,-8.16953182220459,3.108523368835449,-11.284934997558594]],[0,"bp",2,[[3,1,-190,[140],[1,true,true],141]],[1,-41.28068542480469,9.053261756896973,-51.24772644042969]],[0,"plane",2,[[66,1,[null],-191,[1,true,true],142]],[1,-40.87005615234375,7.068157196044922,-50.63288879394531]],[38,"Camera",5,[-192],[1,0,0,1000]],[69,0,1073741824,472.5233644859813,2000,6,41943040,68,[4,4278190080]],[74,"стены включены",18,18,26,1,2,36,[4,4278190080]],[56,1,0,4,[4,4285398898]],[11,1,0,37],[76,1,9,38,72],[75,"показать список",18,18,18,1,2,40],[11,1,0,8],[30,"list-view-ctrl",33554432,"e94d9IruhInaT82HtgsrmW",6,[[77,-193,38,146]]],[31,"EquipmentManager","69M7KX4tlGoaQ2ReN7vGm1",6,[[78,-194]]]],0,[0,-1,15,0,-2,16,0,-3,17,0,-4,18,0,-5,19,0,-6,20,0,-7,21,0,-8,22,0,-9,23,0,-10,24,0,-11,25,0,-12,26,0,-13,27,0,-14,28,0,-15,29,0,-16,30,0,-17,31,0,-18,32,0,-1,50,0,-2,51,0,-3,52,0,-4,53,0,-5,54,0,-6,55,0,-7,56,0,-8,57,0,-9,58,0,-10,59,0,-11,60,0,-12,61,0,-13,62,0,-14,63,0,-15,64,0,-16,65,0,-17,66,0,-18,67,0,13,3,0,0,3,0,-1,43,0,-2,44,0,-3,45,0,-4,46,0,-5,47,0,-6,48,0,-7,49,0,0,4,0,-2,71,0,11,71,0,14,33,0,0,4,0,15,70,0,0,4,0,-1,33,0,-2,11,0,-3,36,0,0,5,0,16,69,0,0,5,0,0,5,0,-1,68,0,-3,7,0,-4,8,0,-1,41,0,-2,34,0,-3,14,0,-5,76,0,-6,77,0,0,7,0,0,7,0,-3,38,0,-1,9,0,-2,12,0,0,8,0,-2,75,0,11,75,0,17,74,0,0,8,0,-1,40,0,-2,13,0,0,9,0,0,9,0,0,9,0,-4,73,0,-1,37,0,-1,35,0,18,42,0,19,35,0,0,10,0,-3,42,0,0,11,0,0,11,0,12,11,0,0,11,0,0,12,0,0,12,0,0,12,0,-1,39,0,0,13,0,0,13,0,12,13,0,0,13,0,0,15,0,0,15,0,0,15,0,0,16,0,0,16,0,0,16,0,0,17,0,0,17,0,0,17,0,0,18,0,0,18,0,0,18,0,0,19,0,0,19,0,0,19,0,0,20,0,0,20,0,0,20,0,0,21,0,0,21,0,0,21,0,0,22,0,0,22,0,0,22,0,0,23,0,0,23,0,0,23,0,0,24,0,0,24,0,0,24,0,0,25,0,0,25,0,0,25,0,0,26,0,0,26,0,0,26,0,0,27,0,0,27,0,0,27,0,0,28,0,0,28,0,0,28,0,0,29,0,0,29,0,0,29,0,0,30,0,0,30,0,0,30,0,0,31,0,0,31,0,0,31,0,0,32,0,0,32,0,0,32,0,0,33,0,0,33,0,0,34,0,0,36,0,-2,70,0,0,37,0,-2,72,0,0,39,0,0,40,0,-2,74,0,0,41,0,0,43,0,0,44,0,0,45,0,0,46,0,0,47,0,0,48,0,0,49,0,0,50,0,0,51,0,0,52,0,0,53,0,0,54,0,0,55,0,0,56,0,0,57,0,0,58,0,0,59,0,0,60,0,0,61,0,0,62,0,0,63,0,0,64,0,0,65,0,0,66,0,0,67,0,-1,69,0,0,76,0,0,77,0,20,6,1,10,14,2,10,14,3,10,14,4,10,5,5,10,6,10,10,34,38,21,73,38,22,39,194],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,72,75],[-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-2,-3,1,1,5,6,-1,1,1,5,6,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,1,5,6,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,1,5,6,-1,1,5,6,1,-1,-2,-3,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,5,6,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,1,8,8,8,23,24,25,8,8,8],[48,49,50,51,4,52,4,53,54,55,56,57,4,58,59,60,61,8,8,1,2,62,9,9,1,2,10,11,1,2,11,63,12,1,2,12,64,13,1,2,13,65,14,14,1,2,66,15,1,2,15,67,16,1,2,16,68,17,1,2,17,69,18,1,2,18,10,19,19,1,2,70,20,1,2,20,21,71,72,22,1,2,22,73,23,1,2,23,74,24,1,2,24,75,76,1,2,77,21,25,1,2,25,78,26,1,2,26,79,80,81,82,83,84,85,86,87,88,5,89,5,90,5,91,92,93,94,95,96,97,3,98,3,99,3,100,3,101,3,102,3,103,104,6,105,106,107,108,109,6,110,6]],[[[79,"ItemPrefab"],[32,"ItemPrefab",33554432,[-8,-9,-10],[[9,-2,[8,"29o4eyV5ZNy4dV0MMtsx28"],[5,200,36]],[57,-3,[8,"90NAT7FghLQ6RsYo8dZKX5"]],[80,-7,[8,"a7eUqQGCFIJY6XcePbqHc7"],-6,-5,-4]],[10,"4aBpvR+bhJdI7i8LzRRtvb",null,null,null,-1,0],[1,603.141,-276.8,0],[1,3.321,1.154,1]],[37,"ItemButton",33554432,1,[[[9,-11,[8,"5a6u38NxNLvIT/gVnl4Kyc"],[5,180,40]],[58,1,0,-12,[8,"c0MMcAQoRKh5dcpTs1+Qjt"],0],-13],4,4,1],[10,"1fHNB1CLNCZpwOtSgQJljf",null,null,null,1,0],[1,0.381,0.93,1]],[20,"Label",33554432,1,[[[9,-14,[8,"65+KzBR3dPbr711K9CQ39S"],[5,200,30]],-15],4,1],[10,"721GJYNz1E/7th3pz4p0FM",null,null,null,1,0],[1,0,5.591,0],[1,0.158,0.582,1]],[20,"Label-001",33554432,1,[[[9,-16,[8,"1e7o7412dCV5hX3YLwQeyc"],[5,200,15]],-17],4,1],[10,"8fAdewM09EmJgQtmW9WIWv",null,null,null,1,0],[1,0,-11.367999999999995,0],[1,0.163,0.582,1]],[63,2,2,[8,"0181n7qDZMGLC8oGGI2DWt"],[4,4292269782],2],[21,"button",20,20,1,false,2,3,[8,"dfMeiwh0hAYYKBonsUe56x"],[4,4278190080]],[21,"button",15,15,1,false,2,4,[8,"61G54mSwBEC76bZuWlZobr"],[4,4278190080]]],0,[0,26,1,0,0,1,0,0,1,0,27,5,0,28,7,0,29,6,0,0,1,0,-1,2,0,-2,3,0,-3,4,0,0,2,0,0,2,0,-3,5,0,0,3,0,-2,6,0,0,4,0,-2,7,0,30,1,17],[0,5,5],[8,31,32],[27,27,111]],[[{"name":"default_scrollbar_vertical","rect":{"x":0,"y":0,"width":15,"height":30},"offset":{"x":0,"y":0},"originalSize":{"width":15,"height":30},"rotated":false,"capInsets":[4,10,4,10],"vertices":{"rawPosition":[-7.5,-15,0,7.5,-15,0,-7.5,15,0,7.5,15,0],"indexes":[0,1,2,2,1,3],"uv":[0,30,15,30,0,0,15,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-7.5,"y":-15,"z":0},"maxPos":{"x":7.5,"y":15,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[112]],[[{"name":"default_panel","rect":{"x":0,"y":0,"width":20,"height":20},"offset":{"x":0,"y":0},"originalSize":{"width":20,"height":20},"rotated":false,"capInsets":[8,8,8,8],"vertices":{"rawPosition":[-10,-10,0,10,-10,0,-10,10,0,10,10,0],"indexes":[0,1,2,2,1,3],"uv":[0,20,20,20,0,0,20,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-10,"y":-10,"z":0},"maxPos":{"x":10,"y":10,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[113]],[[[81,"builtin-standard",[{},{},{},{}],[{"hash":4193119560,"name":"builtin-standard|standard-vs|standard-fs","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_color","format":44,"location":6,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","format":21,"location":7,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":16,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":17,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":18,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"tags":[],"defines":[]},{"name":"albedoOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":1,"tags":["CC_PIPELINE_TYPE"],"defines":["CC_PIPELINE_TYPE"]},{"name":"emissiveOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":2,"defines":["CC_PIPELINE_TYPE"]},{"name":"normalOut","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":3,"defines":["CC_PIPELINE_TYPE"]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias + vec2(anisotropyParam.z, 0.0);\n}\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}","frag":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\nbool equalf_mode(float data1, float data2) { return abs(float(data1) - float(data2)) < 0.001; }\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nbool isnans(vec2 val) {\n return isnan(val.x) || isnan(val.y);\n}\nbool isnans(vec3 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z);\n}\nbool isnans(vec4 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z) || isnan(val.w);\n}\nbool isinfs(vec2 val) {\n return isinf(val.x) || isinf(val.y);\n}\nbool isinfs(vec3 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z);\n}\nbool isinfs(vec4 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z) || isinf(val.w);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateTangent(vec3 normal, vec3 binormal)\n{\n return cross(binormal, normal);\n}\nvec3 CalculateNormal(vec3 tangent, vec3 binormal)\n{\n return cross(tangent, binormal);\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nvoid RotateTangentAndBinormal(inout vec3 tangent, inout vec3 binormal, vec3 normal, float rotationAngle)\n{\n float cosTheta = cos(rotationAngle), sinTheta = sin(rotationAngle);\n vec3 B = RotationVecFromAxisY(vec3(1.0, 0.0, 0.0), cosTheta, sinTheta);\n vec3 T = RotationVecFromAxisY(vec3(0.0, 0.0, 1.0), cosTheta, sinTheta);\n vec3 tangentNew, binormalNew;\n binormalNew = B.x * binormal + B.y * normal + B.z * tangent;\n binormal = normalize(binormalNew);\n tangentNew = T.x * binormal + T.y * normal + T.z * tangent;\n tangent = normalize(tangentNew);\n}\nvoid RotateNormalAndBinormal(inout vec3 binormal, inout vec3 normal, in vec3 tangent, float rotationAngle, float mirrorNormal)\n{\n if(rotationAngle > 0.0)\n {\n normal += (binormal - normal) * rotationAngle;\n normal = normalize(normal);\n binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n }\n else if(rotationAngle < 0.0)\n {\n binormal += (binormal - normal) * rotationAngle;\n binormal = normalize(binormal);\n normal = CalculateNormal(tangent, binormal);\n }\n}\nvec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n}\nvec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n}\nfloat RoughnessToPerceptualRoughness(float roughness)\n{\n return sqrt(roughness);\n}\n vec3 EnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity) {\n #if CC_USE_IBL\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n \tvec4 biased = fragTextureLod(cc_environment, rotationDir, mip + mipBias);\n \tvec4 filtered = texture(cc_environment, rotationDir);\n #if CC_USE_IBL == 2\n \tbiased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n vec3 EnvReflection(samplerCube tex, vec3 R, float roughness, float mipCount) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 envmap = fragTextureLod(tex, rotationDir, roughness * (mipCount - 1.0));\n #if CC_USE_IBL == 2\n return unpackRGBE(envmap);\n #else\n return SRGBToLinear(envmap.rgb);\n #endif\n }\n vec3 EnvReflectionOfReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n return isRGBE ? unpackRGBE(envmap) : SRGBToLinear(envmap.rgb);\n }\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return textureLod(shadowMap, coord, 0.0);\n #else\n return texture(shadowMap, coord);\n #endif\n }\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return shadowTexure(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(FSInput_vertexColor.rgb);\n baseColor.a *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n baseColor.rgb *= albedoScaleAndCutoff.xyz;\n return baseColor;\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleParam.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n float anisotropyRotation = anisotropyParam.y * PI;\n float anisotropyShape = anisotropyParam.x;\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 tex = texture(anisotropyMap, DEFAULT_UV);\n anisotropyRotation = fract(anisotropyRotation * 0.5 + tex.y) * PI2;\n anisotropyShape *= tex.x;\n #endif\n #if FIX_ANISOTROPIC_ROTATION_MAP\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 reference = texture(anisotropyMapNearestFilter, DEFAULT_UV);\n vec2 oneTap = vec2(0.0, 1.0 / anisotropyParam.w);\n float threshold = 0.2;\n vec4 sample1 = texture(anisotropyMapNearestFilter, DEFAULT_UV + oneTap);\n vec4 sample2 = texture(anisotropyMapNearestFilter, DEFAULT_UV - oneTap);\n if (abs(sample1.y - reference.y) > threshold || abs(sample2.y - reference.y) > threshold) {\n tex.y = reference.y;\n }\n anisotropyRotation = fract(anisotropyParam.y * PI * 0.5 + tex.y) * PI2;\n #endif\n #endif\n isRotation = 1.0;\n return vec4(anisotropyShape, anisotropyRotation, 0.0, 0.0);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n emissive = SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n return emissive * emissiveScaleParam.xyz;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, DEFAULT_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture(occlusionMap, DEFAULT_UV).r, pbrParams.x);\n #endif\n return pbr;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\nfloat square(float a) { return a * a;}\nvec2 square(vec2 a) { return a * a;}\nvec3 square(vec3 a) { return a * a;}\nfloat G_Schlick( float roughness, float NoV, float NoL )\n{\n\tfloat k = square( 0.5 + 0.5*roughness );\n\tfloat G_SchlickV = NoV * (1.0 - k) + k;\n\tfloat G_SchlickL = NoL * (1.0 - k) + k;\n\treturn 0.25 / ( G_SchlickV * G_SchlickL );\n}\nvec3 F_SchlickMultiplier( vec3 specularColor, float VoH )\n{\n\tfloat Fc = exp2( (-5.55473 * VoH - 6.98316) * VoH );\n float selfShadowTerm = saturate(50.0 * specularColor.g);\n return vec3(1.0 - Fc) + vec3(selfShadowTerm * Fc) / (specularColor + vec3(EPSILON));\n}\nfloat D_GGX(float roughness, float NoH)\n{\n float m = roughness * roughness;\n float m2 = m * m;\n float d = (NoH * m2 - NoH) * NoH + 1.0;\n return m2 / max(EPSILON, d * d);\n}\nfloat D_GGXMobile(float roughness, float NoH) {\n float OneMinusNoHSqr = 1.0 - NoH * NoH;\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nvoid GetAnisotropicRoughness(float roughness, float anisotropyShape, out float roughnessX, out float roughnessY)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n float r1 = roughness, r2 = roughness;\n float lerpedRoughness = mix(1.0, 10.0, anisotropyShape);\n r2 *= shapeSign < 0.0 ? lerpedRoughness : 1.0;\n r1 *= shapeSign > 0.0 ? lerpedRoughness : 1.0;\n roughnessX = saturate(r1);\n roughnessY = saturate(r2);\n}\nfloat D_GGXAniso(float RoughnessX, float RoughnessY, float NoH, vec3 H, vec3 X, vec3 Y)\n{\n float mx = max(EPSILON_LOWP, RoughnessX * RoughnessX);\n float my = max(EPSILON_LOWP, RoughnessY * RoughnessY);\n float XoH = dot(X, H);\n float YoH = dot(Y, H);\n float d = XoH * XoH / (mx * mx) + YoH * YoH / (my * my) + NoH * NoH;\n return 1.0 / max(EPSILON_LOWP, mx * my * d * d);\n}\nvec3 GetAnisotropicReflect(float roughness, float anisotropyShape, vec3 V, vec3 N, vec3 X, vec3 Y)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n anisotropyShape = min(anisotropyShape, 0.4);\n anisotropyShape *= smoothstep(0.0, 0.03, roughness);\n vec3 reflectTarget = shapeSign < 0.0 ? mix(N, -Y, anisotropyShape) :\n shapeSign > 0.0 ? mix(N, -X, anisotropyShape) : N;\n return reflect(-V, reflectTarget);\n}\nvoid IntegratedGFMultiplier (out vec3 integratedGF, out vec3 integratedF, vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n integratedF = vec3(max(0.0, AB.x));\n integratedGF = max(vec3(0.0), vec3(AB.x) + vec3(AB.y) / (specular + EPSILON_LOWP));\n}\nfloat Sheen_HorizonFading(float NoL)\n{\n const float horizonFade = 1.3;\n float horiz = saturate( 1.0 + horizonFade * NoL);\n return horiz * horiz;\n}\nfloat Sheen(float NoHSat, float NoL, float NoV, float roughness)\n{\n if (NoL <= 0.0 || NoV <= 0.0)\n return 0.0;\n float NoH2 = NoHSat*NoHSat;\n float NoL2 = NoL*NoL;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoH2 + NoH2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Li = sqrt(1.0 - NoL2 + r2*NoL2) / NoL;\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-(Li + Lo))) / (Li + Lo);\n return Sheen_HorizonFading(NoL) * Pi_D * G / NoV;\n}\nfloat Sheen(float NoV, float roughness)\n{\n NoV *= NoV;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoV2 + NoV2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-Lo)) / Lo;\n float sheen = Pi_D * G / NoV;\n return pow(max(0.0, sheen), 0.5);\n}\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat CalculateFresnelCoefficient(float ior, float NoVSat)\n{\n\tfloat g, c, n, prev, next;\n\tn = ior;\n\tc = ior * NoVSat;\n\tg = sqrt(1.0 + c * c - c);\n\tprev = (g - c) / (g + c);\n\tnext = (c * (g+c) - n*n) / (c * (g-c) + n*n);\n\tprev *= prev;\n\tnext *= next;\n\treturn 0.5 * prev * (1.0 + next);\n}\nfloat CalculateFresnelCoefficient(float F0, float F90, float NoVSat)\n{\n return mix(F90, F0, NoVSat);\n}\nvec3 CalculateScattering(vec3 unscatteredColor, float distance, float outScatterExtinctCoef, float inScatterExtinctCoef, float inScatterCoef, vec3 inScatterColor, vec3 outScatterColor)\n{\n vec2 e = vec2(outScatterExtinctCoef, inScatterExtinctCoef * inScatterCoef);\n vec2 extinction = exp(-e * distance);\n vec3 inScattered = (1.0 - extinction.y) * inScatterColor;\n vec3 outScattered = unscatteredColor * extinction.x * outScatterColor;\n return outScattered + inScattered;\n}\nvoid InitializeLayerBlending(out vec3 blendedBaseLayerD, out vec3 blendedBaseLayerS,\n out vec3 blendedSubLayerD, out vec3 blendedSubLayerS,\n out vec3 lastLayerF,\n in vec3 baseD, in vec3 baseS\n )\n{\n blendedBaseLayerD = baseD;\n blendedBaseLayerS = baseS;\n blendedSubLayerD = blendedSubLayerS = vec3(0.0);\n lastLayerF = vec3(1.0);\n}\nvoid CalculateLayerBlending(inout vec3 blendedBaseLayerD, inout vec3 blendedBaseLayerS,\n inout vec3 blendedSubLayerD, inout vec3 blendedSubLayerS,\n inout vec3 lastLayerF,\n in vec3 subLayerD, in vec3 subLayerDiffuseColor,\n in vec3 subLayerS, in vec3 subLayerSpecularColor,\n in float subLayerOpacity, inout vec3 subLayerF\n )\n{\n subLayerF = saturate(subLayerF * subLayerOpacity);\n blendedSubLayerD = blendedSubLayerD * (vec3(1.0) - lastLayerF) + subLayerD * subLayerDiffuseColor * subLayerF;\n blendedSubLayerS = blendedSubLayerS *(vec3(1.0) - lastLayerF) + subLayerS * subLayerSpecularColor * subLayerF;\n blendedBaseLayerD *= vec3(1.0) - subLayerF;\n blendedBaseLayerS *= vec3(1.0) - subLayerF;\n lastLayerF = subLayerF;\n}\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nvec3 CalculateRefractDirection(vec3 N, vec3 V, float NoV, float ior)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n float cosA = abs(NoV);\n float sinA = sqrt(1.0 - cosA * cosA);\n float sinB = saturate(sinA / ior);\n float cosB = sqrt(1.0 - sinB * sinB);\n vec3 edgeA = -V + N * cosA;\n vec3 edgeB = normalize(edgeA) * sinB;\n vec3 R = edgeB - N * cosB;\n return R;\n}\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\nvec3 CalculateDirectDiffuse(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n return irradiance * DiffuseCoefficient_EnergyConservation;\n}\nvec3 CalculateDirectSpecular(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float rT, rB;\n GetAnisotropicRoughness(roughness, lightingData.anisotropyShape, rT, rB);\n float calcSpec = D_GGXAniso(rT, rB, lightingData.NoHSat, lightingData.H, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n float calcSpec = (roughness * 0.25 + 0.25) * D_GGXMobile(roughness, lightingData.NoHSat);\n #else\n float calcSpec = D_GGX(roughness, lightingData.NoHSat);\n #endif\n #endif\n return irradiance * calcSpec;\n}\n#if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 EnvAnisotropicReflection(samplerCube tex, vec3 R, float roughness, float mipCount, float anisotropyShape, vec3 V, vec3 N, vec3 T, vec3 B) {\n R = normalize(R);\n float integratedBRDF = 0.0;\n vec3 envSpec = vec3(0.0);\n const int SAMPLE_STEP_COUNT = CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT;\n float sampleAngleRange = PI * abs(anisotropyShape);\n vec3 anisoDirection = anisotropyShape < 0.0 ? T : B;\n vec3 ROnNormalPlane = normalize(R - anisoDirection * dot(R, anisoDirection));\n vec3 stepOffset = normalize(ROnNormalPlane - N) * (sampleAngleRange / float(SAMPLE_STEP_COUNT * 2));\n for (int i = -SAMPLE_STEP_COUNT; i <= SAMPLE_STEP_COUNT; ++i)\n {\n float rT, rB;\n GetAnisotropicRoughness(roughness, anisotropyShape, rT, rB);\n #if CC_IBL_CONVOLUTED\n float coef = abs(float(i)) / float(SAMPLE_STEP_COUNT) * float(SAMPLE_STEP_COUNT);\n #else\n float coef = pow(abs(float(i)) / float(SAMPLE_STEP_COUNT), 1.3) * float(SAMPLE_STEP_COUNT);\n #endif\n vec3 H = normalize(N + stepOffset * sign(float(i)) * coef);\n vec3 L = reflect(-V, H);\n float NoHSat = saturate(dot(N, H));\n float calcSpec = D_GGXAniso(rT, rB, NoHSat, H, T, B);\n envSpec += calcSpec * EnvReflection(tex, L, roughness, mipCount);\n integratedBRDF += calcSpec;\n }\n envSpec /= integratedBRDF;\n return envSpec;\n }\n#endif\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, R, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflection(tex, R, roughness, mipCount);\n #endif\n #endif\n return envSpec;\n}\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount, vec3 worldPos, vec3 cubeCenterPos, vec3 boxHalfSize, bool isRGBE)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, cubeCenterPos, boxHalfSize);\n R = fixedR.xyz;\n vec3 envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, fixedR.xyz, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflectionOfReflectionProbe(tex, R, roughness, mipCount, isRGBE);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #endif\n #endif\n return envSpec;\n}\nvec3 CalculateEnvironmentDiffuse(in LightingIntermediateData lightingData, float lightIntensity)\n{\n float fAmb = max(EPSILON, 0.5 - lightingData.N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n vec3 rotationDir = RotationVecFromAxisY(lightingData.N, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #endif\n ambDiff.rgb *= lightIntensity;\n #if CC_USE_LIGHT_PROBE\n ambDiff.rgb += SHEvaluate(lightingData.N);\n #endif\n return ambDiff.rgb;\n}\nvec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, float lightIntensity)\n{\n vec3 envSpec = vec3(0.0);\n#if CC_USE_REFLECTION_PROBE\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(lightingData.worldPosition, lightingData.worldPosition_fract_part);\n #else\n worldPos = lightingData.worldPosition;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n if(FSInput_reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(worldPos, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0)).xyz;\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, FSInput_reflectionProbeId);\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(lightingData.N, lightingData.V, worldPos, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount)).xyz;\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n float blendFactor = 0.0;\n #if USE_INSTANCING\n blendFactor = FSInput_reflectionProbeData.x;\n #else\n blendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n if(FSInput_reflectionProbeBlendId < 0.0)\n {\n vec3 skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n envSpec = mix(envSpec, skyBoxEnv, blendFactor);\n #else\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, centerPos, boxHalfSize);\n envSpec = mix(skyBoxEnv, envSpec, fixedR.w);\n #endif\n }else{\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, FSInput_reflectionProbeBlendId);\n vec3 probeBlend = SampleEnvironmentSpecular(cc_reflectionProbeBlendCubemap, lightingData, mipCountBlend, worldPos, centerPosBlend, boxHalfSizeBlend, isBlendReflectProbeUsingRGBE(FSInput_reflectionProbeBlendId));\n envSpec = mix(envSpec, probeBlend, blendFactor);\n }\n }\n #endif\n#elif CC_USE_IBL\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n#endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = FSInput_reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n return envSpec * lightIntensity;\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n return true;\n#elif CC_SURFACES_LIGHTING_SSS\n return true;\n#else\n return NoL > 0.0;\n#endif\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateDirectSpecular(lightingData, lightSourceColorAndIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n float fresnel = CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVAbsSat);\n return vec3(fresnel);\n}\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 directGF, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n directGF = environmentGF;\n #else\n float roughness = lightingData.specularParam;\n directGF = F_SchlickMultiplier(specularColor, lightingData.VoHAbsSat) * G_Schlick(roughness, lightingData.NoVSat, lightingData.NoLSat);\n #endif\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n float roughness = lightingData.specularParam;\n IntegratedGFMultiplier(integratedGF, integratedF, specularColor, roughness, lightingData.NoVAbsSat);\n}\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfaceLightingCalculateDirectSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n float VoH = lightingData.VoHAbsSat;\n \tsubLayerF = vec3(exp2( (-5.55473 * VoH - 6.98316) * VoH ));\n }\n void CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n subLayerF = vec3(CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVSat));\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n void CCSurfacesLightingCalculateDirectTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n float roughness = lightingData.specularParam;\n float NoLSat = saturate(dot(lightingData.N, -lightingData.L));\n vec3 irradiance = NoLSat * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float RoL = dot(lightingData.L, normalize(R));\n float calcSpec = D_GGX(roughness, saturate(RoL));\n lightingSpecular = irradiance * calcSpec;\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n {\n vec3 envSpec = vec3(0.0);\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float roughness = lightingData.specularParam;\n #if CC_USE_REFLECTION_PROBE\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_reflectionProbeCubemap, R, roughness, cc_ambientGround.w);\n #endif\n #endif\n #if CC_USE_IBL && CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_environment, R, roughness, cc_ambientGround.w);\n #endif\n lightingSpecular = CalculateScattering(envSpec * lightIntensity, lightingData.transmitScatteringParams.w, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define objectThickness lightingData.transmitDiffuseParams.x\n #define transmitMask lightingData.transmitDiffuseParams.y\n #define envTransmitScale lightingData.transmitDiffuseParams.z\n #define envFixedDistanceScale lightingData.transmitScatteringParams.w\n #define transmitDistanceScale lightingData.transmitDiffuseParams.w\n #define DONOT_USE_SHADOWMAP_DISTANCE ((abs(float(lightingData.shadowPosAndDepth.z) - float(lightingData.shadowPosAndDepth.w)) < EPSILON) && (abs(float(lightingData.shadowPosAndDepth.z) - float(SURFACES_MAX_TRANSMIT_DEPTH_VALUE)) < EPSILON))\n #define SHADOWMAP_DISTANCE max(lightingData.shadowPosAndDepth.w - lightingData.shadowPosAndDepth.z, 0.0)\n void CCSurfacesLightingCalculateDirectTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float shadow)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n distance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n shadow = step(SHADOWMAP_DISTANCE, objectThickness) > 0.0 ? 1.0 : shadow;\n }\n vec3 backIrradiance = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n backIrradiance *= shadow * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, float lightIntensity, float ao, vec3 shadowLightDirection)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n float shadowMapDistance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n float fixedDistance = transmitDistanceScale * envFixedDistanceScale;\n float lerpCoef = saturate(dot(lightingData.N, shadowLightDirection));\n distance = mix(fixedDistance, shadowMapDistance, lerpCoef);\n }\n vec3 backIrradiance = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n backIrradiance *= ao * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n transmitDiffuse *= envTransmitScale;\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n #undef objectThickness\n #undef transmitMask\n #undef envTransmitScale\n #undef envFixedDistanceScale\n #undef DONOT_USE_SHADOWMAP_DISTANCE\n #undef SHADOWMAP_DISTANCE\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #ifndef CC_SURFACES_FRAGMENT_MODIFY_2ND_SPECULAR_COLOR\n #endif\n void CCSurfacesLightingCalculateDirect2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n CCSurfacesLightingCalculateDirect(unused, specularLighting, lightingData, lightSourceColorAndIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironment2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n specularLighting = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateDirectSheen(out vec3 specularLighting, out vec3 directGF, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n float sheen = Sheen(lightingData.NoHSat, lightingData.NoL, lightingData.NoV, lightingData.specularParam);\n specularLighting = vec3(sheen) * intensitySpecular * lightSourceColorAndIntensity.xyz * lightSourceColorAndIntensity.w;\n directGF = vec3(1.0);\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentSheen(out vec3 specularLighting, out vec3 environmentGF, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n LightingIntermediateData lightingDataSheen = lightingData;\n float roughness = lightingData.specularParam;\n vec3 L = normalize(mix(lightingDataSheen.B, lightingDataSheen.N, 0.3));\n lightingDataSheen.specularParam = mix(0.5, 0.9, roughness);\n lightingDataSheen.V = lightingDataSheen.N = L;\n specularLighting = CalculateEnvironmentSpecular(lightingDataSheen, lightIntensity);\n specularLighting *= intensitySpecular;\n environmentGF = vec3(Sheen(lightingData.NoV, roughness));\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n#endif\n#if CC_SURFACES_LIGHTING_TT\n void CCSurfacesLightingCalculateDirectTT(inout LightingResult lightingResult, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n lightingResult.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLighting;\n float w = lightingData.ttIntensity;\n vec3 scatteredLighting = pow(saturate(lightingData.baseColorTT * w + lightingData.NoLSat) * lightingData.NoLSat, vec3(mix(0.5, 0.5 + lightingData.ttScatterCoef, w)));\n vec3 ttLighting = scatteredLighting - lightingData.NoLSat;\n lightingResult.directTT = ttLighting * DiffuseCoefficient_EnergyConservation * lightSourceColorAndIntensity.xyz* lightSourceColorAndIntensity.w;\n }\n#endif\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfacesLightingCalculateDirectMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.directDiffuse, blendedBaseS = lightingResult.directSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n lightingResult.directDiffuse, lightingResult.directSpecular\n );\n CCSurfaceLightingCalculateDirectSubLayerFresnel(lightingResult.directSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.direct2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.directSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.directDiffuse = blendedBaseD;\n lightingResult.directSpecular = blendedBaseS;\n }\n void CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.environmentDiffuse, blendedBaseS = lightingResult.environmentSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n lightingResult.environmentDiffuse, lightingResult.environmentSpecular\n );\n CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(lightingResult.environmentSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.environment2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.environmentSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.environmentDiffuse = blendedBaseD;\n lightingResult.environmentSpecular = blendedBaseS;\n }\n#endif\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec3 worldNormal;\n vec3 emissive;\n float specularIntensity;\n float roughness;\n float metallic;\n float ao;\n vec3 worldTangent, worldBinormal;\n float ior;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 outScatteringColor, inScatteringColor;\n vec4 transmitScatteringParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 baseColor2ndSpecular, color2ndSpecular;\n float intensity2ndSpecular, roughness2ndSpecular, metallic2ndSpecular;\n vec3 worldNormal2ndSpecular, worldTangent2ndSpecular, worldBinormal2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape2ndSpecular;\n #endif\n float ior2ndSpecular, opacity2ndSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n vec4 sssParams;\n#endif\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\nvoid SurfacesFragmentModifyWorldTangentAndBinormal(inout vec3 worldTangent, inout vec3 worldBinormal, vec3 worldNormal)\n{\n vec3 tangent = normalize(FSInput_worldTangent);\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec3 binormal = normalize(CalculateBinormal(worldNormal.xyz, tangent, FSInput_mirrorNormal));\n tangent = normalize(cross(binormal, worldNormal));\n#else\n vec3 binormal = vec3(0.0, 0.0, 0.0);\n#endif\n worldTangent = tangent;\n worldBinormal = binormal;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\nfloat SurfacesFragmentModifyIOR()\n{\n return 1.0;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n isRotation = 1.0;\n return vec4(1.0, 0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n return vec4(1.0, 0.5, 0.0, 0.5);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\nvec4 SurfacesFragmentModifyTransmitScatteringParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitInScatteringColor()\n{\n return vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitOutScatteringColor()\n{\n return vec3(1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\nvec4 SurfacesFragmentModifyTransmitDiffuseParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\nvec4 SurfacesFragmentModifyTRTParams()\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\nvec3 SurfacesFragmentModifyTRTColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\nvec4 SurfacesFragmentModifyTTParams()\n{\n return vec4(0.0, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\nvec3 SurfacesFragmentModifyTTColor(in vec3 baseColor)\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\nvec4 SurfacesFragmentModifySSSParams()\n{\n return vec4(1.0, 0.1, 1.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\nvec4 SurfacesFragmentModifyDualLobeSpecularParams(float roughness)\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\nvec4 SurfacesFragmentModifyClearCoatParams()\n{\n return vec4(0.2, 1.5, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\nvec3 SurfacesFragmentModifyClearCoatColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\nvec3 SurfacesFragmentModifyClearCoatWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\nvec4 SurfacesFragmentModifySheenParams()\n{\n return vec4(0.7, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\nvec3 SurfacesFragmentModifySheenColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.baseColor = SurfacesFragmentModifyBaseColorAndTransparency();\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n SurfacesFragmentModifyWorldTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal);\n surfaceData.ior = SurfacesFragmentModifyIOR();\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float isRotation;\n vec4 anisotropyParams = SurfacesFragmentModifyAnisotropyParams(isRotation);\n surfaceData.anisotropyShape = anisotropyParams.x;\n if (isRotation > 0.0) {\n RotateTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal, anisotropyParams.y);\n } else {\n vec3 anisoDirTS = anisotropyParams.yzw;\n vec3 tangentWS = anisoDirTS.x * surfaceData.worldTangent + anisoDirTS.y * surfaceData.worldBinormal + anisoDirTS.z * surfaceData.worldNormal;\n surfaceData.worldTangent = normalize(tangentWS);\n surfaceData.worldBinormal = cross(surfaceData.worldNormal, tangentWS);\n }\n#endif\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n vec4 pbr = SurfacesFragmentModifyPBRParams();\n surfaceData.ao = pbr.x;\n surfaceData.roughness = pbr.y;\n surfaceData.metallic = pbr.z;\n surfaceData.specularIntensity = pbr.w;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitScatteringParams = SurfacesFragmentModifyTransmitScatteringParams();\n surfaceData.inScatteringColor = SurfacesFragmentModifyTransmitInScatteringColor();\n surfaceData.outScatteringColor = SurfacesFragmentModifyTransmitOutScatteringColor();\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitDiffuseParams = SurfacesFragmentModifyTransmitDiffuseParams();\n#endif\n#if CC_SURFACES_LIGHTING_TRT\n vec4 trtParams = SurfacesFragmentModifyTRTParams();\n surfaceData.roughness2ndSpecular = saturate(surfaceData.roughness + trtParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = trtParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyTRTColor();\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n RotateNormalAndBinormal(surfaceData.worldBinormal2ndSpecular, surfaceData.worldNormal2ndSpecular, surfaceData.worldTangent2ndSpecular, trtParams.y, FSInput_mirrorNormal);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec4 ttParams = SurfacesFragmentModifyTTParams();\n surfaceData.ttScatterCoef = ttParams.x;\n surfaceData.ttIntensity = ttParams.w;\n surfaceData.baseColorTT = SurfacesFragmentModifyTTColor(surfaceData.baseColor.rgb);\n#endif\n#if CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n vec4 dualLobeParams = SurfacesFragmentModifyDualLobeSpecularParams(surfaceData.roughness);\n surfaceData.roughness2ndSpecular = saturate(dualLobeParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = dualLobeParams.w;\n surfaceData.baseColor2ndSpecular = surfaceData.baseColor.rgb;\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SHEEN\n vec4 sheenParams = SurfacesFragmentModifySheenParams();\n surfaceData.roughness2ndSpecular = saturate(sheenParams.x);\n surfaceData.intensity2ndSpecular = sheenParams.y * sheenParams.w;\n surfaceData.metallic2ndSpecular = 1.0;\n surfaceData.baseColor2ndSpecular = SurfacesFragmentModifySheenColor();\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_CLEAR_COAT\n vec4 clearCoatParams = SurfacesFragmentModifyClearCoatParams();\n surfaceData.roughness2ndSpecular = clearCoatParams.x;\n surfaceData.metallic2ndSpecular = 0.0;\n surfaceData.ior2ndSpecular = clearCoatParams.y;\n surfaceData.opacity2ndSpecular = clearCoatParams.z;\n surfaceData.intensity2ndSpecular = clearCoatParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyClearCoatColor();\n surfaceData.worldNormal2ndSpecular = SurfacesFragmentModifyClearCoatWorldNormal();\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.worldTangent2ndSpecular = CalculateTangent(surfaceData.worldNormal2ndSpecular, surfaceData.worldBinormal2ndSpecular);\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n surfaceData.sssParams = SurfacesFragmentModifySSSParams();\n#endif\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP) {\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n surfaceData.worldTangent = normalize(FSInput_worldTangent);\n }\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO)\n {\n surfaceData.baseColor.rgb = vec3(1.0);\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n surfaceData.baseColor2ndSpecular.rgb = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n surfaceData.baseColorTT.rgb = vec3(1.0);\n #endif\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.baseColor.rgb * (1.0 - surfaceData.metallic);\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n float F0 = surfaceData.specularIntensity * 0.08;\n return mix(vec3(F0), surfaceData.baseColor.rgb, surfaceData.metallic);\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = CCSurfacesGetDiffuseColor(surfaceData);\n specularColorWithLighting = CCSurfacesGetSpecularColor(surfaceData).xyz;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, surfaceData.worldTangent, surfaceData.worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , surfaceData.anisotropyShape\n#endif\n );\n lightingData.specularParam = surfaceData.roughness;\n lightingData.ior = surfaceData.ior;\n lightingData.layerOpacity = surfaceData.baseColor.a;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitScatteringParams = surfaceData.transmitScatteringParams;\n lightingData.inScatteringColor = surfaceData.inScatteringColor;\n lightingData.outScatteringColor = surfaceData.outScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitDiffuseParams = surfaceData.transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingData.baseColorTT = surfaceData.baseColorTT;\n lightingData.ttIntensity = surfaceData.ttIntensity;\n lightingData.ttScatterCoef = surfaceData.ttScatterCoef;\n#endif\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\nvoid CCSurfacesGetLightingIntermediateDataTransmitDiffuse(inout LightingIntermediateData lightingDataTD, in LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n lightingDataTD = lightingData;\n lightingDataTD.N = lightingData.transmitScatteringParams.z > 0.0 ? -FSInput_worldNormal : -(normalize(FSInput_worldNormal)+lightingData.V);\n lightingDataTD.N = normalize(lightingDataTD.N);\n}\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\nvoid CCSurfacesGetSurfacesMaterialData2ndSpecular(inout SurfacesMaterialData surfaceData2ndSpecular, in SurfacesMaterialData surfaceData)\n{\n surfaceData2ndSpecular = surfaceData;\n surfaceData2ndSpecular.baseColor = vec4(surfaceData.baseColor2ndSpecular, surfaceData.opacity2ndSpecular);\n surfaceData2ndSpecular.roughness = surfaceData.roughness2ndSpecular;\n surfaceData2ndSpecular.metallic = surfaceData.metallic2ndSpecular;\n surfaceData2ndSpecular.worldNormal = surfaceData.worldNormal2ndSpecular;\n surfaceData2ndSpecular.worldTangent = surfaceData.worldTangent2ndSpecular;\n surfaceData2ndSpecular.worldBinormal = surfaceData.worldBinormal2ndSpecular;\n surfaceData2ndSpecular.ior = surfaceData.ior2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData2ndSpecular.anisotropyShape = surfaceData.anisotropyShape2ndSpecular;\n #endif\n}\n#endif\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.ao = surfaceData.ao;\n lightingResult.emissive = surfaceData.emissive;\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n lightingResult.environmentDiffuseSubLayers = lightingResult.environmentSpecularSubLayers = vec3(0.0);\n#endif\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResult.directTransmitSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResult.directTransmitDiffuse = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResult.direct2ndSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingResult.directTT = vec3(0.0);\n#endif\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow * lightingResult.directGF * lightingResult.fresnel;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResultAccumulated.directDiffuseSubLayers += lightingResult.directDiffuseSubLayers * lightingResult.shadow;\n lightingResultAccumulated.directSpecularSubLayers += lightingResult.directSpecularSubLayers * lightingResult.shadow;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResultAccumulated.directTransmitSpecular += lightingResult.directTransmitSpecular * (vec3(1.0) - lightingResult.fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResultAccumulated.directTransmitDiffuse += lightingResult.directTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResultAccumulated.direct2ndSpecular += lightingResult.direct2ndSpecular * lightingResult.shadow * lightingResult.directGF2ndSpecular * lightingResult.fresnel;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n lightingResultAccumulated.directTT += lightingResult.directTT * lightingResult.shadow;\n lightingResultAccumulated.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLightingTT;\n #endif\n}\n#if CC_PIPELINE_TYPE == 1\n vec4 CCSurfacesDeferredOutputBaseColor(in SurfacesMaterialData surfaceData)\n {\n return surfaceData.baseColor;\n }\n vec4 CCSurfacesDeferredOutputNormalMR(in SurfacesMaterialData surfaceData)\n {\n return vec4(float32x3_to_oct(surfaceData.worldNormal), surfaceData.roughness, surfaceData.metallic);\n }\n vec4 CCSurfacesDeferredOutputEmissiveAO(in SurfacesMaterialData surfaceData)\n {\n return vec4(surfaceData.emissive, surfaceData.ao);\n }\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n#else\n vec3 fresnel = lightingResult.fresnel;\n vec3 invFresnel = vec3(1.0) - fresnel;\n color.xyz +=\n ( lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n )\n * lightingResult.shadow\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_ALL_IN_ONE\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting * lightingResult.shadow;\n #elif CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting;\n #endif\n color.xyz +=\n ( lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.environmentTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.environmentDiffuseSubLayers\n + lightingResult.environmentSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.environment2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.environmentGF2ndSpecular\n #endif\n #endif\n )\n * lightingResult.ao\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.environmentTransmitDiffuse\n #endif\n ;\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\nbool CCSurfacesDebugViewSurfaceData(inout vec4 color, in SurfacesMaterialData surfaceData)\n{\n bool enableMaterialAlpha = true;\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n float scalar;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(surfaceData.worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(surfaceData.worldBinormal * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSPARENCY)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.baseColor.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n enableMaterialAlpha = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_BASE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(surfaceData.baseColor.rgb), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetSpecularColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ROUGHNESS)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.roughness;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_METALLIC)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.metallic;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.specularIntensity;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_IOR)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.ior - 1.0;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n return enableMaterialAlpha;\n}\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\nvec4 CCSurfacesDebugDisplayInvalidNumber(vec4 color)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;\n}\nvec4 CCSurfacesDebugDisplayInvalidInputData(vec4 color, vec3 data)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(data) || isinfs(data)) ? error : color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n void CCSurfacesDebugViewMeshData(inout vec4 color)\n {\n vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_VERTEX_COLOR\n color = FSInput_vertexColor;\n #else\n color = white;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n float sign = FSInput_mirrorNormal * 0.5 + 0.5;\n color = vec4(sign, sign, sign, 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FACE_SIDE)) && (cc_surfaceTransform.y != 3.0)))\n {\n float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV0)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV1)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);\n #else\n color = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = clipPos.z / clipPos.w;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_WORLD_POS)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldPos.xyz, 1.0);\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n bool CCSurfacesDebugViewLightingResult(inout vec4 color, in LightingResult lightingResult)\n {\n bool isSRGBColor = false;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LIGHT_MAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.lightmapColor;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_EMISSIVE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.emissive;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_AO)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.ao);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SHADOW)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.shadow);\n isSRGBColor = false;\n }\n vec3 fresnel = lightingResult.fresnel;\n vec3 directTransmitSpecular = vec3(0.0), environmentTransmitSpecular = vec3(0.0);\n vec3 directTransmitDiffuse = vec3(0.0), environmentTransmitDiffuse = vec3(0.0);\n vec3 diffuseColorWithLightingTT = vec3(0.0), specularColorWithLighting2ndSpecular = vec3(0.0);\n vec3 direct2ndSpecular = vec3(0.0), environment2ndSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n directTransmitSpecular = lightingResult.directTransmitSpecular;\n environmentTransmitSpecular = lightingResult.environmentTransmitSpecular;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n directTransmitDiffuse = lightingResult.directTransmitDiffuse;\n environmentTransmitDiffuse = lightingResult.environmentTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n direct2ndSpecular = lightingResult.direct2ndSpecular * lightingResult.directGF2ndSpecular;\n environment2ndSpecular = lightingResult.environment2ndSpecular * lightingResult.environmentGF2ndSpecular;\n specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n fresnel = lightingResult.environmentSubLayerF;\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n direct2ndSpecular = lightingResult.directSpecularSubLayers;\n environment2ndSpecular = lightingResult.environmentSpecularSubLayers;\n #endif\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRESNEL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(fresnel);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular + environmentTransmitSpecular + directTransmitDiffuse + environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = direct2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environment2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = (direct2ndSpecular + environment2ndSpecular) * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n return isSRGBColor;\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)\n {\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE)\n lightingResult.directDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR)\n lightingResult.directSpecular = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE)\n lightingResult.environmentDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR)\n lightingResult.environmentSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE)\n lightingResult.directTransmitDiffuse = lightingResult.environmentTransmitDiffuse = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR)\n lightingResult.directTransmitSpecular = lightingResult.environmentTransmitSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR)\n lightingResult.direct2ndSpecular = lightingResult.environment2ndSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT)\n lightingResult.directTT = vec3(0.0);\n #endif\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE)\n lightingResult.emissive = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP)\n lightingResult.lightmapColor = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL)\n lightingResult.fresnel = vec3(1.0);\n }\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n layout(location = 0) out vec4 fragColorX;\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n vec3 colDebugCSMLayer = vec3(1.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #if !CC_FORWARD_ADD\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION)\n {\n vec4 csmPos;\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int csmLayer = -1;\n csmLayer = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, surfaceData.worldPos);\n bool OutOfRange = csmLayer < 0;\n if (OutOfRange)\n colDebugCSMLayer = vec3(1.0);\n else if (csmLayer == 0)\n colDebugCSMLayer = vec3(1.0, 0.0, 0.0);\n else if (csmLayer == 1)\n colDebugCSMLayer = vec3(0.0, 1.0, 0.0);\n else if (csmLayer == 2)\n colDebugCSMLayer = vec3(0.0, 0.0, 1.0);\n else if (csmLayer == 3)\n colDebugCSMLayer = vec3(0.0, 1.0, 1.0);\n }\n #endif\n #endif\n #endif\n float fogFactor = 1.0;\n #if !CC_FORWARD_ADD\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG) {\n fogFactor = 1.0;\n }\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n float materialTransparency = CCSurfacesShading(surfaceData, lightingResult).a;\n #if !CC_FORWARD_ADD && !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n CCSurfacesDebugViewMeshData(debugColor);\n if (CCSurfacesDebugViewSurfaceData(debugColor, surfaceData))\n {\n debugColor.a = materialTransparency;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FOG)) && (cc_surfaceTransform.y != 3.0)))\n {\n debugColor.rgb = vec3(1.0 - fogFactor);\n }\n #endif\n #if CC_FORWARD_ADD\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)) ||\n (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n #endif\n {\n if (CCSurfacesDebugViewLightingResult(debugColor, lightingResult))\n {\n debugColor.a = materialTransparency;\n #if !CC_USE_FLOAT_OUTPUT\n debugColor.rgb = HDRToLDR(debugColor.rgb);\n debugColor.rgb = LinearToSRGB(debugColor.rgb);\n #endif\n }\n }\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n fragColorX = debugColor;\n return;\n }\n #elif CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n CCSurfacesDebugViewCompositeLightingResult(lightingResult);\n #endif\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION) {\n color.rgb *= colDebugCSMLayer.rgb;\n }\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = CCSurfacesDebugDisplayInvalidInputData(color, FSInput_worldTangent);\n #endif\n #endif\n #endif\n #if CC_USE_FOG != 4 && (!CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS)\n #if !CC_FORWARD_ADD\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FOG\n color.rgb = CCSurfacesLightingModifyFog(fogFactor, color.rgb, surfaceData, lightingResult);\n #else\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n #endif\n #endif\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color = CCSurfacesDebugDisplayInvalidNumber(color);\n #if !CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n #endif\n fragColorX = color;\n }\n#elif CC_PIPELINE_TYPE == 1\n layout(location = 0) out vec4 albedoOut;\n layout(location = 1) out vec4 emissiveOut;\n layout(location = 2) out vec4 normalOut;\n void main () {\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n albedoOut = CCSurfacesDeferredOutputBaseColor(surfaceData);\n normalOut = CCSurfacesDeferredOutputNormalMR(surfaceData);\n emissiveOut = CCSurfacesDeferredOutputEmissiveAO(surfaceData);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n CCSurfacesDebugViewMeshData(debugColor);\n CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n albedoOut = debugColor;\n }\n #endif\n }\n#endif"},"glsl1":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n uniform highp vec4 cc_lightingMapUVParam;\n uniform highp vec4 cc_localShadowBias;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n uniform vec4 tilingOffset;\n uniform vec4 anisotropyParam;\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias + vec2(anisotropyParam.z, 0.0);\n}\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}","frag":"\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers: enable\n#endif\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform highp vec4 cc_time;\n uniform mediump vec4 cc_probeInfo;\n uniform mediump vec4 cc_debug_view_mode;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_ambientGround;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n uniform mediump vec4 cc_nearFar;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\nbool equalf_mode(float data1, float data2) { return abs(float(data1) - float(data2)) < 0.001; }\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n uniform vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n #endif\n#endif\nuniform highp mat4 cc_matLightView;\n uniform highp mat4 cc_matLightViewProj;\n uniform highp vec4 cc_shadowInvProjDepthInfo;\n uniform highp vec4 cc_shadowProjDepthInfo;\n uniform highp vec4 cc_shadowProjInfo;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowWHPBInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n uniform highp vec4 cc_csmViewDir0[4];\n uniform highp vec4 cc_csmViewDir1[4];\n uniform highp vec4 cc_csmViewDir2[4];\n uniform highp vec4 cc_csmAtlas[4];\n uniform highp mat4 cc_matCSMViewProj[4];\n uniform highp vec4 cc_csmProjDepthInfo[4];\n uniform highp vec4 cc_csmProjInfo[4];\n uniform highp vec4 cc_csmSplitsInfo;\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 HDRToLDR(vec3 color)\n{\n #if CC_USE_HDR\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING)\n #endif\n {\n #if CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n }\n #endif\n return color;\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nbool isnan(float val) {\n return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n}\nbool isinf(float x) {\n return x == x * 2.0 && x != 0.0;\n}\nbool isnans(vec2 val) {\n return isnan(val.x) || isnan(val.y);\n}\nbool isnans(vec3 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z);\n}\nbool isnans(vec4 val) {\n return isnan(val.x) || isnan(val.y) || isnan(val.z) || isnan(val.w);\n}\nbool isinfs(vec2 val) {\n return isinf(val.x) || isinf(val.y);\n}\nbool isinfs(vec3 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z);\n}\nbool isinfs(vec4 val) {\n return isinf(val.x) || isinf(val.y) || isinf(val.z) || isinf(val.w);\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateTangent(vec3 normal, vec3 binormal)\n{\n return cross(binormal, normal);\n}\nvec3 CalculateNormal(vec3 tangent, vec3 binormal)\n{\n return cross(tangent, binormal);\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nvoid RotateTangentAndBinormal(inout vec3 tangent, inout vec3 binormal, vec3 normal, float rotationAngle)\n{\n float cosTheta = cos(rotationAngle), sinTheta = sin(rotationAngle);\n vec3 B = RotationVecFromAxisY(vec3(1.0, 0.0, 0.0), cosTheta, sinTheta);\n vec3 T = RotationVecFromAxisY(vec3(0.0, 0.0, 1.0), cosTheta, sinTheta);\n vec3 tangentNew, binormalNew;\n binormalNew = B.x * binormal + B.y * normal + B.z * tangent;\n binormal = normalize(binormalNew);\n tangentNew = T.x * binormal + T.y * normal + T.z * tangent;\n tangent = normalize(tangentNew);\n}\nvoid RotateNormalAndBinormal(inout vec3 binormal, inout vec3 normal, in vec3 tangent, float rotationAngle, float mirrorNormal)\n{\n if(rotationAngle > 0.0)\n {\n normal += (binormal - normal) * rotationAngle;\n normal = normalize(normal);\n binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n }\n else if(rotationAngle < 0.0)\n {\n binormal += (binormal - normal) * rotationAngle;\n binormal = normalize(binormal);\n normal = CalculateNormal(tangent, binormal);\n }\n}\nvec2 signNotZero(vec2 v) {\n return vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0);\n}\nvec2 float32x3_to_oct(in vec3 v) {\n vec2 p = v.xy * (1.0 / (abs(v.x) + abs(v.y) + abs(v.z)));\n return (v.z <= 0.0) ? ((1.0 - abs(p.yx)) * signNotZero(p)) : p;\n}\nfloat RoughnessToPerceptualRoughness(float roughness)\n{\n return sqrt(roughness);\n}\n vec3 EnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity) {\n #if CC_USE_IBL\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n \tvec4 biased = fragTextureLod(cc_environment, rotationDir, mip + mipBias);\n \tvec4 filtered = textureCube(cc_environment, rotationDir);\n #if CC_USE_IBL == 2\n \tbiased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n vec3 EnvReflection(samplerCube tex, vec3 R, float roughness, float mipCount) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 envmap = fragTextureLod(tex, rotationDir, roughness * (mipCount - 1.0));\n #if CC_USE_IBL == 2\n return unpackRGBE(envmap);\n #else\n return SRGBToLinear(envmap.rgb);\n #endif\n }\n vec3 EnvReflectionOfReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n return isRGBE ? unpackRGBE(envmap) : SRGBToLinear(envmap.rgb);\n }\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(shadowMap, coord, 0.0);\n #else\n return texture2D(shadowMap, coord);\n #endif\n }\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return shadowTexure(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform highp vec4 cc_reflectionProbeData1;\n uniform highp vec4 cc_reflectionProbeData2;\n uniform highp vec4 cc_reflectionProbeBlendData1;\n uniform highp vec4 cc_reflectionProbeBlendData2;\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture2D(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture2D(lightingMap, luv);\n \tvec4 dataHigh = texture2D(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture2D(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n uniform vec4 pbrParams;\n uniform vec4 emissive;\n uniform vec4 emissiveScaleParam;\n uniform vec4 anisotropyParam;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(FSInput_vertexColor.rgb);\n baseColor.a *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture2D(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n baseColor.rgb *= albedoScaleAndCutoff.xyz;\n return baseColor;\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture2D(normalMap, NORMAL_UV).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleParam.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n float anisotropyRotation = anisotropyParam.y * PI;\n float anisotropyShape = anisotropyParam.x;\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 tex = texture2D(anisotropyMap, DEFAULT_UV);\n anisotropyRotation = fract(anisotropyRotation * 0.5 + tex.y) * PI2;\n anisotropyShape *= tex.x;\n #endif\n #if FIX_ANISOTROPIC_ROTATION_MAP\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 reference = texture2D(anisotropyMapNearestFilter, DEFAULT_UV);\n vec2 oneTap = vec2(0.0, 1.0 / anisotropyParam.w);\n float threshold = 0.2;\n vec4 sample1 = texture2D(anisotropyMapNearestFilter, DEFAULT_UV + oneTap);\n vec4 sample2 = texture2D(anisotropyMapNearestFilter, DEFAULT_UV - oneTap);\n if (abs(sample1.y - reference.y) > threshold || abs(sample2.y - reference.y) > threshold) {\n tex.y = reference.y;\n }\n anisotropyRotation = fract(anisotropyParam.y * PI * 0.5 + tex.y) * PI2;\n #endif\n #endif\n isRotation = 1.0;\n return vec4(anisotropyShape, anisotropyRotation, 0.0, 0.0);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n emissive = SRGBToLinear(texture2D(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n return emissive * emissiveScaleParam.xyz;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture2D(pbrMap, DEFAULT_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture2D(occlusionMap, DEFAULT_UV).r, pbrParams.x);\n #endif\n return pbr;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\nfloat square(float a) { return a * a;}\nvec2 square(vec2 a) { return a * a;}\nvec3 square(vec3 a) { return a * a;}\nfloat G_Schlick( float roughness, float NoV, float NoL )\n{\n\tfloat k = square( 0.5 + 0.5*roughness );\n\tfloat G_SchlickV = NoV * (1.0 - k) + k;\n\tfloat G_SchlickL = NoL * (1.0 - k) + k;\n\treturn 0.25 / ( G_SchlickV * G_SchlickL );\n}\nvec3 F_SchlickMultiplier( vec3 specularColor, float VoH )\n{\n\tfloat Fc = exp2( (-5.55473 * VoH - 6.98316) * VoH );\n float selfShadowTerm = saturate(50.0 * specularColor.g);\n return vec3(1.0 - Fc) + vec3(selfShadowTerm * Fc) / (specularColor + vec3(EPSILON));\n}\nfloat D_GGX(float roughness, float NoH)\n{\n float m = roughness * roughness;\n float m2 = m * m;\n float d = (NoH * m2 - NoH) * NoH + 1.0;\n return m2 / max(EPSILON, d * d);\n}\nfloat D_GGXMobile(float roughness, float NoH) {\n float OneMinusNoHSqr = 1.0 - NoH * NoH;\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nvoid GetAnisotropicRoughness(float roughness, float anisotropyShape, out float roughnessX, out float roughnessY)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n float r1 = roughness, r2 = roughness;\n float lerpedRoughness = mix(1.0, 10.0, anisotropyShape);\n r2 *= shapeSign < 0.0 ? lerpedRoughness : 1.0;\n r1 *= shapeSign > 0.0 ? lerpedRoughness : 1.0;\n roughnessX = saturate(r1);\n roughnessY = saturate(r2);\n}\nfloat D_GGXAniso(float RoughnessX, float RoughnessY, float NoH, vec3 H, vec3 X, vec3 Y)\n{\n float mx = max(EPSILON_LOWP, RoughnessX * RoughnessX);\n float my = max(EPSILON_LOWP, RoughnessY * RoughnessY);\n float XoH = dot(X, H);\n float YoH = dot(Y, H);\n float d = XoH * XoH / (mx * mx) + YoH * YoH / (my * my) + NoH * NoH;\n return 1.0 / max(EPSILON_LOWP, mx * my * d * d);\n}\nvec3 GetAnisotropicReflect(float roughness, float anisotropyShape, vec3 V, vec3 N, vec3 X, vec3 Y)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n anisotropyShape = min(anisotropyShape, 0.4);\n anisotropyShape *= smoothstep(0.0, 0.03, roughness);\n vec3 reflectTarget = shapeSign < 0.0 ? mix(N, -Y, anisotropyShape) :\n shapeSign > 0.0 ? mix(N, -X, anisotropyShape) : N;\n return reflect(-V, reflectTarget);\n}\nvoid IntegratedGFMultiplier (out vec3 integratedGF, out vec3 integratedF, vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n integratedF = vec3(max(0.0, AB.x));\n integratedGF = max(vec3(0.0), vec3(AB.x) + vec3(AB.y) / (specular + EPSILON_LOWP));\n}\nfloat Sheen_HorizonFading(float NoL)\n{\n const float horizonFade = 1.3;\n float horiz = saturate( 1.0 + horizonFade * NoL);\n return horiz * horiz;\n}\nfloat Sheen(float NoHSat, float NoL, float NoV, float roughness)\n{\n if (NoL <= 0.0 || NoV <= 0.0)\n return 0.0;\n float NoH2 = NoHSat*NoHSat;\n float NoL2 = NoL*NoL;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoH2 + NoH2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Li = sqrt(1.0 - NoL2 + r2*NoL2) / NoL;\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-(Li + Lo))) / (Li + Lo);\n return Sheen_HorizonFading(NoL) * Pi_D * G / NoV;\n}\nfloat Sheen(float NoV, float roughness)\n{\n NoV *= NoV;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoV2 + NoV2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-Lo)) / Lo;\n float sheen = Pi_D * G / NoV;\n return pow(max(0.0, sheen), 0.5);\n}\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat CalculateFresnelCoefficient(float ior, float NoVSat)\n{\n\tfloat g, c, n, prev, next;\n\tn = ior;\n\tc = ior * NoVSat;\n\tg = sqrt(1.0 + c * c - c);\n\tprev = (g - c) / (g + c);\n\tnext = (c * (g+c) - n*n) / (c * (g-c) + n*n);\n\tprev *= prev;\n\tnext *= next;\n\treturn 0.5 * prev * (1.0 + next);\n}\nfloat CalculateFresnelCoefficient(float F0, float F90, float NoVSat)\n{\n return mix(F90, F0, NoVSat);\n}\nvec3 CalculateScattering(vec3 unscatteredColor, float distance, float outScatterExtinctCoef, float inScatterExtinctCoef, float inScatterCoef, vec3 inScatterColor, vec3 outScatterColor)\n{\n vec2 e = vec2(outScatterExtinctCoef, inScatterExtinctCoef * inScatterCoef);\n vec2 extinction = exp(-e * distance);\n vec3 inScattered = (1.0 - extinction.y) * inScatterColor;\n vec3 outScattered = unscatteredColor * extinction.x * outScatterColor;\n return outScattered + inScattered;\n}\nvoid InitializeLayerBlending(out vec3 blendedBaseLayerD, out vec3 blendedBaseLayerS,\n out vec3 blendedSubLayerD, out vec3 blendedSubLayerS,\n out vec3 lastLayerF,\n in vec3 baseD, in vec3 baseS\n )\n{\n blendedBaseLayerD = baseD;\n blendedBaseLayerS = baseS;\n blendedSubLayerD = blendedSubLayerS = vec3(0.0);\n lastLayerF = vec3(1.0);\n}\nvoid CalculateLayerBlending(inout vec3 blendedBaseLayerD, inout vec3 blendedBaseLayerS,\n inout vec3 blendedSubLayerD, inout vec3 blendedSubLayerS,\n inout vec3 lastLayerF,\n in vec3 subLayerD, in vec3 subLayerDiffuseColor,\n in vec3 subLayerS, in vec3 subLayerSpecularColor,\n in float subLayerOpacity, inout vec3 subLayerF\n )\n{\n subLayerF = saturate(subLayerF * subLayerOpacity);\n blendedSubLayerD = blendedSubLayerD * (vec3(1.0) - lastLayerF) + subLayerD * subLayerDiffuseColor * subLayerF;\n blendedSubLayerS = blendedSubLayerS *(vec3(1.0) - lastLayerF) + subLayerS * subLayerSpecularColor * subLayerF;\n blendedBaseLayerD *= vec3(1.0) - subLayerF;\n blendedBaseLayerS *= vec3(1.0) - subLayerF;\n lastLayerF = subLayerF;\n}\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nvec3 CalculateRefractDirection(vec3 N, vec3 V, float NoV, float ior)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n float cosA = abs(NoV);\n float sinA = sqrt(1.0 - cosA * cosA);\n float sinB = saturate(sinA / ior);\n float cosB = sqrt(1.0 - sinB * sinB);\n vec3 edgeA = -V + N * cosA;\n vec3 edgeB = normalize(edgeA) * sinB;\n vec3 R = edgeB - N * cosB;\n return R;\n}\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\nvec3 CalculateDirectDiffuse(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n return irradiance * DiffuseCoefficient_EnergyConservation;\n}\nvec3 CalculateDirectSpecular(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float rT, rB;\n GetAnisotropicRoughness(roughness, lightingData.anisotropyShape, rT, rB);\n float calcSpec = D_GGXAniso(rT, rB, lightingData.NoHSat, lightingData.H, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n float calcSpec = (roughness * 0.25 + 0.25) * D_GGXMobile(roughness, lightingData.NoHSat);\n #else\n float calcSpec = D_GGX(roughness, lightingData.NoHSat);\n #endif\n #endif\n return irradiance * calcSpec;\n}\n#if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 EnvAnisotropicReflection(samplerCube tex, vec3 R, float roughness, float mipCount, float anisotropyShape, vec3 V, vec3 N, vec3 T, vec3 B) {\n R = normalize(R);\n float integratedBRDF = 0.0;\n vec3 envSpec = vec3(0.0);\n const int SAMPLE_STEP_COUNT = CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT;\n float sampleAngleRange = PI * abs(anisotropyShape);\n vec3 anisoDirection = anisotropyShape < 0.0 ? T : B;\n vec3 ROnNormalPlane = normalize(R - anisoDirection * dot(R, anisoDirection));\n vec3 stepOffset = normalize(ROnNormalPlane - N) * (sampleAngleRange / float(SAMPLE_STEP_COUNT * 2));\n for (int i = -SAMPLE_STEP_COUNT; i <= SAMPLE_STEP_COUNT; ++i)\n {\n float rT, rB;\n GetAnisotropicRoughness(roughness, anisotropyShape, rT, rB);\n #if CC_IBL_CONVOLUTED\n float coef = abs(float(i)) / float(SAMPLE_STEP_COUNT) * float(SAMPLE_STEP_COUNT);\n #else\n float coef = pow(abs(float(i)) / float(SAMPLE_STEP_COUNT), 1.3) * float(SAMPLE_STEP_COUNT);\n #endif\n vec3 H = normalize(N + stepOffset * sign(float(i)) * coef);\n vec3 L = reflect(-V, H);\n float NoHSat = saturate(dot(N, H));\n float calcSpec = D_GGXAniso(rT, rB, NoHSat, H, T, B);\n envSpec += calcSpec * EnvReflection(tex, L, roughness, mipCount);\n integratedBRDF += calcSpec;\n }\n envSpec /= integratedBRDF;\n return envSpec;\n }\n#endif\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, R, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflection(tex, R, roughness, mipCount);\n #endif\n #endif\n return envSpec;\n}\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount, vec3 worldPos, vec3 cubeCenterPos, vec3 boxHalfSize, bool isRGBE)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, cubeCenterPos, boxHalfSize);\n R = fixedR.xyz;\n vec3 envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, fixedR.xyz, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflectionOfReflectionProbe(tex, R, roughness, mipCount, isRGBE);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #endif\n #endif\n return envSpec;\n}\nvec3 CalculateEnvironmentDiffuse(in LightingIntermediateData lightingData, float lightIntensity)\n{\n float fAmb = max(EPSILON, 0.5 - lightingData.N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n vec3 rotationDir = RotationVecFromAxisY(lightingData.N, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = textureCube(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #endif\n ambDiff.rgb *= lightIntensity;\n #if CC_USE_LIGHT_PROBE\n ambDiff.rgb += SHEvaluate(lightingData.N);\n #endif\n return ambDiff.rgb;\n}\nvec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, float lightIntensity)\n{\n vec3 envSpec = vec3(0.0);\n#if CC_USE_REFLECTION_PROBE\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(lightingData.worldPosition, lightingData.worldPosition_fract_part);\n #else\n worldPos = lightingData.worldPosition;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n if(FSInput_reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(worldPos, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0)).xyz;\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, FSInput_reflectionProbeId);\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(lightingData.N, lightingData.V, worldPos, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount)).xyz;\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n float blendFactor = 0.0;\n #if USE_INSTANCING\n blendFactor = FSInput_reflectionProbeData.x;\n #else\n blendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n if(FSInput_reflectionProbeBlendId < 0.0)\n {\n vec3 skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n envSpec = mix(envSpec, skyBoxEnv, blendFactor);\n #else\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, centerPos, boxHalfSize);\n envSpec = mix(skyBoxEnv, envSpec, fixedR.w);\n #endif\n }else{\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, FSInput_reflectionProbeBlendId);\n vec3 probeBlend = SampleEnvironmentSpecular(cc_reflectionProbeBlendCubemap, lightingData, mipCountBlend, worldPos, centerPosBlend, boxHalfSizeBlend, isBlendReflectProbeUsingRGBE(FSInput_reflectionProbeBlendId));\n envSpec = mix(envSpec, probeBlend, blendFactor);\n }\n }\n #endif\n#elif CC_USE_IBL\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n#endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = FSInput_reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n return envSpec * lightIntensity;\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n return true;\n#elif CC_SURFACES_LIGHTING_SSS\n return true;\n#else\n return NoL > 0.0;\n#endif\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateDirectSpecular(lightingData, lightSourceColorAndIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n float fresnel = CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVAbsSat);\n return vec3(fresnel);\n}\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 directGF, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n directGF = environmentGF;\n #else\n float roughness = lightingData.specularParam;\n directGF = F_SchlickMultiplier(specularColor, lightingData.VoHAbsSat) * G_Schlick(roughness, lightingData.NoVSat, lightingData.NoLSat);\n #endif\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n float roughness = lightingData.specularParam;\n IntegratedGFMultiplier(integratedGF, integratedF, specularColor, roughness, lightingData.NoVAbsSat);\n}\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfaceLightingCalculateDirectSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n float VoH = lightingData.VoHAbsSat;\n \tsubLayerF = vec3(exp2( (-5.55473 * VoH - 6.98316) * VoH ));\n }\n void CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n subLayerF = vec3(CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVSat));\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n void CCSurfacesLightingCalculateDirectTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n float roughness = lightingData.specularParam;\n float NoLSat = saturate(dot(lightingData.N, -lightingData.L));\n vec3 irradiance = NoLSat * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float RoL = dot(lightingData.L, normalize(R));\n float calcSpec = D_GGX(roughness, saturate(RoL));\n lightingSpecular = irradiance * calcSpec;\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n {\n vec3 envSpec = vec3(0.0);\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float roughness = lightingData.specularParam;\n #if CC_USE_REFLECTION_PROBE\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_reflectionProbeCubemap, R, roughness, cc_ambientGround.w);\n #endif\n #endif\n #if CC_USE_IBL && CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_environment, R, roughness, cc_ambientGround.w);\n #endif\n lightingSpecular = CalculateScattering(envSpec * lightIntensity, lightingData.transmitScatteringParams.w, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define objectThickness lightingData.transmitDiffuseParams.x\n #define transmitMask lightingData.transmitDiffuseParams.y\n #define envTransmitScale lightingData.transmitDiffuseParams.z\n #define envFixedDistanceScale lightingData.transmitScatteringParams.w\n #define transmitDistanceScale lightingData.transmitDiffuseParams.w\n #define DONOT_USE_SHADOWMAP_DISTANCE ((abs(float(lightingData.shadowPosAndDepth.z) - float(lightingData.shadowPosAndDepth.w)) < EPSILON) && (abs(float(lightingData.shadowPosAndDepth.z) - float(SURFACES_MAX_TRANSMIT_DEPTH_VALUE)) < EPSILON))\n #define SHADOWMAP_DISTANCE max(lightingData.shadowPosAndDepth.w - lightingData.shadowPosAndDepth.z, 0.0)\n void CCSurfacesLightingCalculateDirectTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float shadow)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n distance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n shadow = step(SHADOWMAP_DISTANCE, objectThickness) > 0.0 ? 1.0 : shadow;\n }\n vec3 backIrradiance = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n backIrradiance *= shadow * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, float lightIntensity, float ao, vec3 shadowLightDirection)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n float shadowMapDistance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n float fixedDistance = transmitDistanceScale * envFixedDistanceScale;\n float lerpCoef = saturate(dot(lightingData.N, shadowLightDirection));\n distance = mix(fixedDistance, shadowMapDistance, lerpCoef);\n }\n vec3 backIrradiance = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n backIrradiance *= ao * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n transmitDiffuse *= envTransmitScale;\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n #undef objectThickness\n #undef transmitMask\n #undef envTransmitScale\n #undef envFixedDistanceScale\n #undef DONOT_USE_SHADOWMAP_DISTANCE\n #undef SHADOWMAP_DISTANCE\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #ifndef CC_SURFACES_FRAGMENT_MODIFY_2ND_SPECULAR_COLOR\n #endif\n void CCSurfacesLightingCalculateDirect2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n CCSurfacesLightingCalculateDirect(unused, specularLighting, lightingData, lightSourceColorAndIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironment2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n specularLighting = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateDirectSheen(out vec3 specularLighting, out vec3 directGF, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n float sheen = Sheen(lightingData.NoHSat, lightingData.NoL, lightingData.NoV, lightingData.specularParam);\n specularLighting = vec3(sheen) * intensitySpecular * lightSourceColorAndIntensity.xyz * lightSourceColorAndIntensity.w;\n directGF = vec3(1.0);\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentSheen(out vec3 specularLighting, out vec3 environmentGF, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n LightingIntermediateData lightingDataSheen = lightingData;\n float roughness = lightingData.specularParam;\n vec3 L = normalize(mix(lightingDataSheen.B, lightingDataSheen.N, 0.3));\n lightingDataSheen.specularParam = mix(0.5, 0.9, roughness);\n lightingDataSheen.V = lightingDataSheen.N = L;\n specularLighting = CalculateEnvironmentSpecular(lightingDataSheen, lightIntensity);\n specularLighting *= intensitySpecular;\n environmentGF = vec3(Sheen(lightingData.NoV, roughness));\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n#endif\n#if CC_SURFACES_LIGHTING_TT\n void CCSurfacesLightingCalculateDirectTT(inout LightingResult lightingResult, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n lightingResult.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLighting;\n float w = lightingData.ttIntensity;\n vec3 scatteredLighting = pow(saturate(lightingData.baseColorTT * w + lightingData.NoLSat) * lightingData.NoLSat, vec3(mix(0.5, 0.5 + lightingData.ttScatterCoef, w)));\n vec3 ttLighting = scatteredLighting - lightingData.NoLSat;\n lightingResult.directTT = ttLighting * DiffuseCoefficient_EnergyConservation * lightSourceColorAndIntensity.xyz* lightSourceColorAndIntensity.w;\n }\n#endif\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfacesLightingCalculateDirectMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.directDiffuse, blendedBaseS = lightingResult.directSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n lightingResult.directDiffuse, lightingResult.directSpecular\n );\n CCSurfaceLightingCalculateDirectSubLayerFresnel(lightingResult.directSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.direct2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.directSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.directDiffuse = blendedBaseD;\n lightingResult.directSpecular = blendedBaseS;\n }\n void CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.environmentDiffuse, blendedBaseS = lightingResult.environmentSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n lightingResult.environmentDiffuse, lightingResult.environmentSpecular\n );\n CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(lightingResult.environmentSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.environment2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.environmentSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.environmentDiffuse = blendedBaseD;\n lightingResult.environmentSpecular = blendedBaseS;\n }\n#endif\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec3 worldNormal;\n vec3 emissive;\n float specularIntensity;\n float roughness;\n float metallic;\n float ao;\n vec3 worldTangent, worldBinormal;\n float ior;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 outScatteringColor, inScatteringColor;\n vec4 transmitScatteringParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 baseColor2ndSpecular, color2ndSpecular;\n float intensity2ndSpecular, roughness2ndSpecular, metallic2ndSpecular;\n vec3 worldNormal2ndSpecular, worldTangent2ndSpecular, worldBinormal2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape2ndSpecular;\n #endif\n float ior2ndSpecular, opacity2ndSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n vec4 sssParams;\n#endif\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\nvoid SurfacesFragmentModifyWorldTangentAndBinormal(inout vec3 worldTangent, inout vec3 worldBinormal, vec3 worldNormal)\n{\n vec3 tangent = normalize(FSInput_worldTangent);\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec3 binormal = normalize(CalculateBinormal(worldNormal.xyz, tangent, FSInput_mirrorNormal));\n tangent = normalize(cross(binormal, worldNormal));\n#else\n vec3 binormal = vec3(0.0, 0.0, 0.0);\n#endif\n worldTangent = tangent;\n worldBinormal = binormal;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\nfloat SurfacesFragmentModifyIOR()\n{\n return 1.0;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n isRotation = 1.0;\n return vec4(1.0, 0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n return vec4(1.0, 0.5, 0.0, 0.5);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\nvec4 SurfacesFragmentModifyTransmitScatteringParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitInScatteringColor()\n{\n return vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitOutScatteringColor()\n{\n return vec3(1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\nvec4 SurfacesFragmentModifyTransmitDiffuseParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\nvec4 SurfacesFragmentModifyTRTParams()\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\nvec3 SurfacesFragmentModifyTRTColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\nvec4 SurfacesFragmentModifyTTParams()\n{\n return vec4(0.0, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\nvec3 SurfacesFragmentModifyTTColor(in vec3 baseColor)\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\nvec4 SurfacesFragmentModifySSSParams()\n{\n return vec4(1.0, 0.1, 1.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\nvec4 SurfacesFragmentModifyDualLobeSpecularParams(float roughness)\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\nvec4 SurfacesFragmentModifyClearCoatParams()\n{\n return vec4(0.2, 1.5, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\nvec3 SurfacesFragmentModifyClearCoatColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\nvec3 SurfacesFragmentModifyClearCoatWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\nvec4 SurfacesFragmentModifySheenParams()\n{\n return vec4(0.7, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\nvec3 SurfacesFragmentModifySheenColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.baseColor = SurfacesFragmentModifyBaseColorAndTransparency();\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n SurfacesFragmentModifyWorldTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal);\n surfaceData.ior = SurfacesFragmentModifyIOR();\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float isRotation;\n vec4 anisotropyParams = SurfacesFragmentModifyAnisotropyParams(isRotation);\n surfaceData.anisotropyShape = anisotropyParams.x;\n if (isRotation > 0.0) {\n RotateTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal, anisotropyParams.y);\n } else {\n vec3 anisoDirTS = anisotropyParams.yzw;\n vec3 tangentWS = anisoDirTS.x * surfaceData.worldTangent + anisoDirTS.y * surfaceData.worldBinormal + anisoDirTS.z * surfaceData.worldNormal;\n surfaceData.worldTangent = normalize(tangentWS);\n surfaceData.worldBinormal = cross(surfaceData.worldNormal, tangentWS);\n }\n#endif\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n vec4 pbr = SurfacesFragmentModifyPBRParams();\n surfaceData.ao = pbr.x;\n surfaceData.roughness = pbr.y;\n surfaceData.metallic = pbr.z;\n surfaceData.specularIntensity = pbr.w;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitScatteringParams = SurfacesFragmentModifyTransmitScatteringParams();\n surfaceData.inScatteringColor = SurfacesFragmentModifyTransmitInScatteringColor();\n surfaceData.outScatteringColor = SurfacesFragmentModifyTransmitOutScatteringColor();\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitDiffuseParams = SurfacesFragmentModifyTransmitDiffuseParams();\n#endif\n#if CC_SURFACES_LIGHTING_TRT\n vec4 trtParams = SurfacesFragmentModifyTRTParams();\n surfaceData.roughness2ndSpecular = saturate(surfaceData.roughness + trtParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = trtParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyTRTColor();\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n RotateNormalAndBinormal(surfaceData.worldBinormal2ndSpecular, surfaceData.worldNormal2ndSpecular, surfaceData.worldTangent2ndSpecular, trtParams.y, FSInput_mirrorNormal);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec4 ttParams = SurfacesFragmentModifyTTParams();\n surfaceData.ttScatterCoef = ttParams.x;\n surfaceData.ttIntensity = ttParams.w;\n surfaceData.baseColorTT = SurfacesFragmentModifyTTColor(surfaceData.baseColor.rgb);\n#endif\n#if CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n vec4 dualLobeParams = SurfacesFragmentModifyDualLobeSpecularParams(surfaceData.roughness);\n surfaceData.roughness2ndSpecular = saturate(dualLobeParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = dualLobeParams.w;\n surfaceData.baseColor2ndSpecular = surfaceData.baseColor.rgb;\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SHEEN\n vec4 sheenParams = SurfacesFragmentModifySheenParams();\n surfaceData.roughness2ndSpecular = saturate(sheenParams.x);\n surfaceData.intensity2ndSpecular = sheenParams.y * sheenParams.w;\n surfaceData.metallic2ndSpecular = 1.0;\n surfaceData.baseColor2ndSpecular = SurfacesFragmentModifySheenColor();\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_CLEAR_COAT\n vec4 clearCoatParams = SurfacesFragmentModifyClearCoatParams();\n surfaceData.roughness2ndSpecular = clearCoatParams.x;\n surfaceData.metallic2ndSpecular = 0.0;\n surfaceData.ior2ndSpecular = clearCoatParams.y;\n surfaceData.opacity2ndSpecular = clearCoatParams.z;\n surfaceData.intensity2ndSpecular = clearCoatParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyClearCoatColor();\n surfaceData.worldNormal2ndSpecular = SurfacesFragmentModifyClearCoatWorldNormal();\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.worldTangent2ndSpecular = CalculateTangent(surfaceData.worldNormal2ndSpecular, surfaceData.worldBinormal2ndSpecular);\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n surfaceData.sssParams = SurfacesFragmentModifySSSParams();\n#endif\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP) {\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n surfaceData.worldTangent = normalize(FSInput_worldTangent);\n }\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO)\n {\n surfaceData.baseColor.rgb = vec3(1.0);\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n surfaceData.baseColor2ndSpecular.rgb = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n surfaceData.baseColorTT.rgb = vec3(1.0);\n #endif\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.baseColor.rgb * (1.0 - surfaceData.metallic);\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n float F0 = surfaceData.specularIntensity * 0.08;\n return mix(vec3(F0), surfaceData.baseColor.rgb, surfaceData.metallic);\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = CCSurfacesGetDiffuseColor(surfaceData);\n specularColorWithLighting = CCSurfacesGetSpecularColor(surfaceData).xyz;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, surfaceData.worldTangent, surfaceData.worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , surfaceData.anisotropyShape\n#endif\n );\n lightingData.specularParam = surfaceData.roughness;\n lightingData.ior = surfaceData.ior;\n lightingData.layerOpacity = surfaceData.baseColor.a;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitScatteringParams = surfaceData.transmitScatteringParams;\n lightingData.inScatteringColor = surfaceData.inScatteringColor;\n lightingData.outScatteringColor = surfaceData.outScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitDiffuseParams = surfaceData.transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingData.baseColorTT = surfaceData.baseColorTT;\n lightingData.ttIntensity = surfaceData.ttIntensity;\n lightingData.ttScatterCoef = surfaceData.ttScatterCoef;\n#endif\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\nvoid CCSurfacesGetLightingIntermediateDataTransmitDiffuse(inout LightingIntermediateData lightingDataTD, in LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n lightingDataTD = lightingData;\n lightingDataTD.N = lightingData.transmitScatteringParams.z > 0.0 ? -FSInput_worldNormal : -(normalize(FSInput_worldNormal)+lightingData.V);\n lightingDataTD.N = normalize(lightingDataTD.N);\n}\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\nvoid CCSurfacesGetSurfacesMaterialData2ndSpecular(inout SurfacesMaterialData surfaceData2ndSpecular, in SurfacesMaterialData surfaceData)\n{\n surfaceData2ndSpecular = surfaceData;\n surfaceData2ndSpecular.baseColor = vec4(surfaceData.baseColor2ndSpecular, surfaceData.opacity2ndSpecular);\n surfaceData2ndSpecular.roughness = surfaceData.roughness2ndSpecular;\n surfaceData2ndSpecular.metallic = surfaceData.metallic2ndSpecular;\n surfaceData2ndSpecular.worldNormal = surfaceData.worldNormal2ndSpecular;\n surfaceData2ndSpecular.worldTangent = surfaceData.worldTangent2ndSpecular;\n surfaceData2ndSpecular.worldBinormal = surfaceData.worldBinormal2ndSpecular;\n surfaceData2ndSpecular.ior = surfaceData.ior2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData2ndSpecular.anisotropyShape = surfaceData.anisotropyShape2ndSpecular;\n #endif\n}\n#endif\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.ao = surfaceData.ao;\n lightingResult.emissive = surfaceData.emissive;\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n lightingResult.environmentDiffuseSubLayers = lightingResult.environmentSpecularSubLayers = vec3(0.0);\n#endif\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResult.directTransmitSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResult.directTransmitDiffuse = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResult.direct2ndSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingResult.directTT = vec3(0.0);\n#endif\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow * lightingResult.directGF * lightingResult.fresnel;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResultAccumulated.directDiffuseSubLayers += lightingResult.directDiffuseSubLayers * lightingResult.shadow;\n lightingResultAccumulated.directSpecularSubLayers += lightingResult.directSpecularSubLayers * lightingResult.shadow;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResultAccumulated.directTransmitSpecular += lightingResult.directTransmitSpecular * (vec3(1.0) - lightingResult.fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResultAccumulated.directTransmitDiffuse += lightingResult.directTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResultAccumulated.direct2ndSpecular += lightingResult.direct2ndSpecular * lightingResult.shadow * lightingResult.directGF2ndSpecular * lightingResult.fresnel;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n lightingResultAccumulated.directTT += lightingResult.directTT * lightingResult.shadow;\n lightingResultAccumulated.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLightingTT;\n #endif\n}\n#if CC_PIPELINE_TYPE == 1\n vec4 CCSurfacesDeferredOutputBaseColor(in SurfacesMaterialData surfaceData)\n {\n return surfaceData.baseColor;\n }\n vec4 CCSurfacesDeferredOutputNormalMR(in SurfacesMaterialData surfaceData)\n {\n return vec4(float32x3_to_oct(surfaceData.worldNormal), surfaceData.roughness, surfaceData.metallic);\n }\n vec4 CCSurfacesDeferredOutputEmissiveAO(in SurfacesMaterialData surfaceData)\n {\n return vec4(surfaceData.emissive, surfaceData.ao);\n }\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n#else\n vec3 fresnel = lightingResult.fresnel;\n vec3 invFresnel = vec3(1.0) - fresnel;\n color.xyz +=\n ( lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n )\n * lightingResult.shadow\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_ALL_IN_ONE\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting * lightingResult.shadow;\n #elif CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting;\n #endif\n color.xyz +=\n ( lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.environmentTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.environmentDiffuseSubLayers\n + lightingResult.environmentSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.environment2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.environmentGF2ndSpecular\n #endif\n #endif\n )\n * lightingResult.ao\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.environmentTransmitDiffuse\n #endif\n ;\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\nbool CCSurfacesDebugViewSurfaceData(inout vec4 color, in SurfacesMaterialData surfaceData)\n{\n bool enableMaterialAlpha = true;\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n float scalar;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(surfaceData.worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(surfaceData.worldBinormal * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSPARENCY)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.baseColor.a;\n color = vec4(scalar, scalar, scalar, 1.0);\n enableMaterialAlpha = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_BASE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(surfaceData.baseColor.rgb), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(LinearToSRGB(CCSurfacesGetSpecularColor(surfaceData)), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ROUGHNESS)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.roughness;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_METALLIC)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.metallic;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.specularIntensity;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_IOR)) && (cc_surfaceTransform.y != 3.0))) {\n scalar = surfaceData.ior - 1.0;\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n return enableMaterialAlpha;\n}\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\nvec4 CCSurfacesDebugDisplayInvalidNumber(vec4 color)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;\n}\nvec4 CCSurfacesDebugDisplayInvalidInputData(vec4 color, vec3 data)\n{\n float index = mod(cc_time.x * 10.0, 2.0);\n vec4 error = index < 1.0 ? vec4(1.0, 0.0, 0.2, 1.0) : vec4(0.0, 1.0, 0.2, 1.0);\n return (isnans(data) || isinfs(data)) ? error : color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n void CCSurfacesDebugViewMeshData(inout vec4 color)\n {\n vec4 white = vec4(1.0, 1.0, 1.0, 1.0);\n vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_VERTEX_COLOR\n color = FSInput_vertexColor;\n #else\n color = white;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_SURFACES_USE_TANGENT_SPACE\n float sign = FSInput_mirrorNormal * 0.5 + 0.5;\n color = vec4(sign, sign, sign, 1.0);\n #else\n color = black;\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FACE_SIDE)) && (cc_surfaceTransform.y != 3.0)))\n {\n float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);\n color = vec4(scalar, scalar, scalar, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV0)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UV1)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n #if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);\n #else\n color = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = clipPos.z / clipPos.w;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH)) && (cc_surfaceTransform.y != 3.0)))\n {\n vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);\n float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;\n color = vec4(depth, depth, depth, 1.0);\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_WORLD_POS)) && (cc_surfaceTransform.y != 3.0)))\n color = vec4(FSInput_worldPos.xyz, 1.0);\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n bool CCSurfacesDebugViewLightingResult(inout vec4 color, in LightingResult lightingResult)\n {\n bool isSRGBColor = false;\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENV_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_LIGHT_MAP)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.lightmapColor;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_EMISSIVE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = lightingResult.emissive;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_AO)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.ao);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_SHADOW)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(lightingResult.shadow);\n isSRGBColor = false;\n }\n vec3 fresnel = lightingResult.fresnel;\n vec3 directTransmitSpecular = vec3(0.0), environmentTransmitSpecular = vec3(0.0);\n vec3 directTransmitDiffuse = vec3(0.0), environmentTransmitDiffuse = vec3(0.0);\n vec3 diffuseColorWithLightingTT = vec3(0.0), specularColorWithLighting2ndSpecular = vec3(0.0);\n vec3 direct2ndSpecular = vec3(0.0), environment2ndSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n directTransmitSpecular = lightingResult.directTransmitSpecular;\n environmentTransmitSpecular = lightingResult.environmentTransmitSpecular;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n directTransmitDiffuse = lightingResult.directTransmitDiffuse;\n environmentTransmitDiffuse = lightingResult.environmentTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n direct2ndSpecular = lightingResult.direct2ndSpecular * lightingResult.directGF2ndSpecular;\n environment2ndSpecular = lightingResult.environment2ndSpecular * lightingResult.environmentGF2ndSpecular;\n specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n fresnel = lightingResult.environmentSubLayerF;\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n direct2ndSpecular = lightingResult.directSpecularSubLayers;\n environment2ndSpecular = lightingResult.environmentSpecularSubLayers;\n #endif\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FRESNEL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = vec3(fresnel);\n isSRGBColor = false;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = directTransmitSpecular + environmentTransmitSpecular + directTransmitDiffuse + environmentTransmitDiffuse;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = direct2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = environment2ndSpecular * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL)) && (cc_surfaceTransform.y != 3.0)))\n {\n color.rgb = (direct2ndSpecular + environment2ndSpecular) * specularColorWithLighting2ndSpecular;\n isSRGBColor = true;\n }\n return isSRGBColor;\n }\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)\n {\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE)\n lightingResult.directDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR)\n lightingResult.directSpecular = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE)\n lightingResult.environmentDiffuse = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR)\n lightingResult.environmentSpecular = vec3(0.0);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE)\n lightingResult.directTransmitDiffuse = lightingResult.environmentTransmitDiffuse = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR)\n lightingResult.directTransmitSpecular = lightingResult.environmentTransmitSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR)\n lightingResult.direct2ndSpecular = lightingResult.environment2ndSpecular = vec3(0.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT)\n lightingResult.directTT = vec3(0.0);\n #endif\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE)\n lightingResult.emissive = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP)\n lightingResult.lightmapColor = vec3(0.0);\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL)\n lightingResult.fresnel = vec3(1.0);\n }\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n vec3 colDebugCSMLayer = vec3(1.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #if !CC_FORWARD_ADD\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION)\n {\n vec4 csmPos;\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int csmLayer = -1;\n csmLayer = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, surfaceData.worldPos);\n bool OutOfRange = csmLayer < 0;\n if (OutOfRange)\n colDebugCSMLayer = vec3(1.0);\n else if (csmLayer == 0)\n colDebugCSMLayer = vec3(1.0, 0.0, 0.0);\n else if (csmLayer == 1)\n colDebugCSMLayer = vec3(0.0, 1.0, 0.0);\n else if (csmLayer == 2)\n colDebugCSMLayer = vec3(0.0, 0.0, 1.0);\n else if (csmLayer == 3)\n colDebugCSMLayer = vec3(0.0, 1.0, 1.0);\n }\n #endif\n #endif\n #endif\n float fogFactor = 1.0;\n #if !CC_FORWARD_ADD\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG) {\n fogFactor = 1.0;\n }\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n float materialTransparency = CCSurfacesShading(surfaceData, lightingResult).a;\n #if !CC_FORWARD_ADD && !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n CCSurfacesDebugViewMeshData(debugColor);\n if (CCSurfacesDebugViewSurfaceData(debugColor, surfaceData))\n {\n debugColor.a = materialTransparency;\n }\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_FOG)) && (cc_surfaceTransform.y != 3.0)))\n {\n debugColor.rgb = vec3(1.0 - fogFactor);\n }\n #endif\n #if CC_FORWARD_ADD\n if ((equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)) && (cc_surfaceTransform.y != 3.0)) ||\n (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR)) && (cc_surfaceTransform.y != 3.0)) || (equalf_mode(cc_debug_view_mode.x, float(CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR)) && (cc_surfaceTransform.y != 3.0)))\n #endif\n {\n if (CCSurfacesDebugViewLightingResult(debugColor, lightingResult))\n {\n debugColor.a = materialTransparency;\n #if !CC_USE_FLOAT_OUTPUT\n debugColor.rgb = HDRToLDR(debugColor.rgb);\n debugColor.rgb = LinearToSRGB(debugColor.rgb);\n #endif\n }\n }\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n gl_FragData[0] = debugColor;\n return;\n }\n #elif CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n CCSurfacesDebugViewCompositeLightingResult(lightingResult);\n #endif\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #if CC_USE_DEBUG_VIEW && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION) {\n color.rgb *= colDebugCSMLayer.rgb;\n }\n #if CC_SURFACES_USE_TANGENT_SPACE\n color = CCSurfacesDebugDisplayInvalidInputData(color, FSInput_worldTangent);\n #endif\n #endif\n #endif\n #if CC_USE_FOG != 4 && (!CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS)\n #if !CC_FORWARD_ADD\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FOG\n color.rgb = CCSurfacesLightingModifyFog(fogFactor, color.rgb, surfaceData, lightingResult);\n #else\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n #endif\n #endif\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #else\n color = CCSurfacesDebugDisplayInvalidNumber(color);\n #if !CC_USE_FLOAT_OUTPUT || CC_IS_TRANSPARENCY_PASS\n color.rgb = HDRToLDR(color.rgb);\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n #endif\n gl_FragData[0] = color;\n }\n#elif CC_PIPELINE_TYPE == 1\n void main () {\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n gl_FragData[0] = CCSurfacesDeferredOutputBaseColor(surfaceData);\n gl_FragData[2] = CCSurfacesDeferredOutputNormalMR(surfaceData);\n gl_FragData[1] = CCSurfacesDeferredOutputEmissiveAO(surfaceData);\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && CC_SURFACES_ENABLE_DEBUG_VIEW\n vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);\n CCSurfacesDebugViewMeshData(debugColor);\n CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);\n if (IS_DEBUG_VIEW_ENABLE_WITH_CAMERA) {\n gl_FragData[0] = debugColor;\n }\n #endif\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":97,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":127}},"defines":[{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"USE_TWOSIDE","type":"boolean"},{"name":"IS_ANISOTROPY","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"FIX_ANISOTROPIC_ROTATION_MAP","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER","type":"number","range":[0,1]},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_TONE_MAPPING_TYPE","type":"number","range":[0,3]},{"name":"HDR_TONE_MAPPING_ACES","type":"boolean"},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_LIGHT_MAP_VERSION","type":"number","range":[0,3]},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"DEFAULT_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean"},{"name":"USE_OCCLUSION_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"EMISSIVE_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ANISOTROPY_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]},{"name":"CC_SURFACES_LIGHTING_DISABLE_DIFFUSE","type":"boolean"},{"name":"CC_SURFACES_LIGHTING_DISABLE_SPECULAR","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"},{"name":"CC_USE_FLOAT_OUTPUT","type":"boolean"},{"name":"CC_IS_TRANSPARENCY_PASS","type":"boolean"},{"name":"CC_USE_RGBE_OUTPUT","type":"boolean"}]},{"hash":357206043,"name":"builtin-standard|shadow-caster-vs|shadow-caster-fs","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_color","format":44,"location":6,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","format":21,"location":7,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":16,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":17,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":18,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nout highp vec2 v_clip_depth;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_clip_depth = In.clipPos.zw;\n}","frag":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = albedo.ALPHA_TEST_CHANNEL;\n #if USE_VERTEX_COLOR\n alpha *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n alpha = texture(albedoMap, ALBEDO_UV).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < albedoScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nin highp vec2 v_clip_depth;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n fragColorX = packDepthToRGBA(clipDepth);\n #else\n fragColorX = vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}"},"glsl1":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matLightViewProj;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\n uniform vec4 tilingOffset;\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvarying highp vec2 v_clip_depth;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_clip_depth = In.clipPos.zw;\n}","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_debug_view_mode;\nuniform mediump vec4 cc_surfaceTransform;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\nuniform highp mat4 cc_matLightView;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 packDepthToRGBA (float depth) {\n vec4 ret = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n ret = fract(ret);\n ret -= vec4(ret.yzw, 0.0) / 255.0;\n return ret;\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = albedo.ALPHA_TEST_CHANNEL;\n #if USE_VERTEX_COLOR\n alpha *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n alpha = texture2D(albedoMap, ALBEDO_UV).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < albedoScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvarying highp vec2 v_clip_depth;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {\n clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);\n }\n #endif\n #if CC_SHADOWMAP_FORMAT == 1\n gl_FragColor = packDepthToRGBA(clipDepth);\n #else\n gl_FragColor = vec4(clipDepth, 1.0, 1.0, 1.0);\n #endif\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":97,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":127}},"defines":[{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"USE_TWOSIDE","type":"boolean"},{"name":"IS_ANISOTROPY","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"FIX_ANISOTROPIC_ROTATION_MAP","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER","type":"number","range":[0,1]},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"DEFAULT_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean"},{"name":"USE_OCCLUSION_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"EMISSIVE_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ANISOTROPY_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]}]},{"hash":2546924674,"name":"builtin-standard|standard-vs|reflect-map-fs","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_color","format":44,"location":6,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","format":21,"location":7,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":16,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":17,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":18,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias + vec2(anisotropyParam.z, 0.0);\n}\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}","frag":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n return textureLod(tex, coord, lod);\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateTangent(vec3 normal, vec3 binormal)\n{\n return cross(binormal, normal);\n}\nvec3 CalculateNormal(vec3 tangent, vec3 binormal)\n{\n return cross(tangent, binormal);\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nvoid RotateTangentAndBinormal(inout vec3 tangent, inout vec3 binormal, vec3 normal, float rotationAngle)\n{\n float cosTheta = cos(rotationAngle), sinTheta = sin(rotationAngle);\n vec3 B = RotationVecFromAxisY(vec3(1.0, 0.0, 0.0), cosTheta, sinTheta);\n vec3 T = RotationVecFromAxisY(vec3(0.0, 0.0, 1.0), cosTheta, sinTheta);\n vec3 tangentNew, binormalNew;\n binormalNew = B.x * binormal + B.y * normal + B.z * tangent;\n binormal = normalize(binormalNew);\n tangentNew = T.x * binormal + T.y * normal + T.z * tangent;\n tangent = normalize(tangentNew);\n}\nvoid RotateNormalAndBinormal(inout vec3 binormal, inout vec3 normal, in vec3 tangent, float rotationAngle, float mirrorNormal)\n{\n if(rotationAngle > 0.0)\n {\n normal += (binormal - normal) * rotationAngle;\n normal = normalize(normal);\n binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n }\n else if(rotationAngle < 0.0)\n {\n binormal += (binormal - normal) * rotationAngle;\n binormal = normalize(binormal);\n normal = CalculateNormal(tangent, binormal);\n }\n}\nfloat RoughnessToPerceptualRoughness(float roughness)\n{\n return sqrt(roughness);\n}\n vec3 EnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity) {\n #if CC_USE_IBL\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n \tvec4 biased = fragTextureLod(cc_environment, rotationDir, mip + mipBias);\n \tvec4 filtered = texture(cc_environment, rotationDir);\n #if CC_USE_IBL == 2\n \tbiased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n vec3 EnvReflection(samplerCube tex, vec3 R, float roughness, float mipCount) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 envmap = fragTextureLod(tex, rotationDir, roughness * (mipCount - 1.0));\n #if CC_USE_IBL == 2\n return unpackRGBE(envmap);\n #else\n return SRGBToLinear(envmap.rgb);\n #endif\n }\n vec3 EnvReflectionOfReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n return isRGBE ? unpackRGBE(envmap) : SRGBToLinear(envmap.rgb);\n }\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return textureLod(shadowMap, coord, 0.0);\n #else\n return texture(shadowMap, coord);\n #endif\n }\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return shadowTexure(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture(lightingMap, luv);\n \tvec4 dataHigh = texture(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(FSInput_vertexColor.rgb);\n baseColor.a *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n baseColor.rgb *= albedoScaleAndCutoff.xyz;\n return baseColor;\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleParam.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n float anisotropyRotation = anisotropyParam.y * PI;\n float anisotropyShape = anisotropyParam.x;\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 tex = texture(anisotropyMap, DEFAULT_UV);\n anisotropyRotation = fract(anisotropyRotation * 0.5 + tex.y) * PI2;\n anisotropyShape *= tex.x;\n #endif\n #if FIX_ANISOTROPIC_ROTATION_MAP\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 reference = texture(anisotropyMapNearestFilter, DEFAULT_UV);\n vec2 oneTap = vec2(0.0, 1.0 / anisotropyParam.w);\n float threshold = 0.2;\n vec4 sample1 = texture(anisotropyMapNearestFilter, DEFAULT_UV + oneTap);\n vec4 sample2 = texture(anisotropyMapNearestFilter, DEFAULT_UV - oneTap);\n if (abs(sample1.y - reference.y) > threshold || abs(sample2.y - reference.y) > threshold) {\n tex.y = reference.y;\n }\n anisotropyRotation = fract(anisotropyParam.y * PI * 0.5 + tex.y) * PI2;\n #endif\n #endif\n isRotation = 1.0;\n return vec4(anisotropyShape, anisotropyRotation, 0.0, 0.0);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n emissive = SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n return emissive * emissiveScaleParam.xyz;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture(pbrMap, DEFAULT_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture(occlusionMap, DEFAULT_UV).r, pbrParams.x);\n #endif\n return pbr;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\nfloat square(float a) { return a * a;}\nvec2 square(vec2 a) { return a * a;}\nvec3 square(vec3 a) { return a * a;}\nfloat G_Schlick( float roughness, float NoV, float NoL )\n{\n\tfloat k = square( 0.5 + 0.5*roughness );\n\tfloat G_SchlickV = NoV * (1.0 - k) + k;\n\tfloat G_SchlickL = NoL * (1.0 - k) + k;\n\treturn 0.25 / ( G_SchlickV * G_SchlickL );\n}\nvec3 F_SchlickMultiplier( vec3 specularColor, float VoH )\n{\n\tfloat Fc = exp2( (-5.55473 * VoH - 6.98316) * VoH );\n float selfShadowTerm = saturate(50.0 * specularColor.g);\n return vec3(1.0 - Fc) + vec3(selfShadowTerm * Fc) / (specularColor + vec3(EPSILON));\n}\nfloat D_GGX(float roughness, float NoH)\n{\n float m = roughness * roughness;\n float m2 = m * m;\n float d = (NoH * m2 - NoH) * NoH + 1.0;\n return m2 / max(EPSILON, d * d);\n}\nfloat D_GGXMobile(float roughness, float NoH) {\n float OneMinusNoHSqr = 1.0 - NoH * NoH;\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nvoid GetAnisotropicRoughness(float roughness, float anisotropyShape, out float roughnessX, out float roughnessY)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n float r1 = roughness, r2 = roughness;\n float lerpedRoughness = mix(1.0, 10.0, anisotropyShape);\n r2 *= shapeSign < 0.0 ? lerpedRoughness : 1.0;\n r1 *= shapeSign > 0.0 ? lerpedRoughness : 1.0;\n roughnessX = saturate(r1);\n roughnessY = saturate(r2);\n}\nfloat D_GGXAniso(float RoughnessX, float RoughnessY, float NoH, vec3 H, vec3 X, vec3 Y)\n{\n float mx = max(EPSILON_LOWP, RoughnessX * RoughnessX);\n float my = max(EPSILON_LOWP, RoughnessY * RoughnessY);\n float XoH = dot(X, H);\n float YoH = dot(Y, H);\n float d = XoH * XoH / (mx * mx) + YoH * YoH / (my * my) + NoH * NoH;\n return 1.0 / max(EPSILON_LOWP, mx * my * d * d);\n}\nvec3 GetAnisotropicReflect(float roughness, float anisotropyShape, vec3 V, vec3 N, vec3 X, vec3 Y)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n anisotropyShape = min(anisotropyShape, 0.4);\n anisotropyShape *= smoothstep(0.0, 0.03, roughness);\n vec3 reflectTarget = shapeSign < 0.0 ? mix(N, -Y, anisotropyShape) :\n shapeSign > 0.0 ? mix(N, -X, anisotropyShape) : N;\n return reflect(-V, reflectTarget);\n}\nvoid IntegratedGFMultiplier (out vec3 integratedGF, out vec3 integratedF, vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n integratedF = vec3(max(0.0, AB.x));\n integratedGF = max(vec3(0.0), vec3(AB.x) + vec3(AB.y) / (specular + EPSILON_LOWP));\n}\nfloat Sheen_HorizonFading(float NoL)\n{\n const float horizonFade = 1.3;\n float horiz = saturate( 1.0 + horizonFade * NoL);\n return horiz * horiz;\n}\nfloat Sheen(float NoHSat, float NoL, float NoV, float roughness)\n{\n if (NoL <= 0.0 || NoV <= 0.0)\n return 0.0;\n float NoH2 = NoHSat*NoHSat;\n float NoL2 = NoL*NoL;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoH2 + NoH2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Li = sqrt(1.0 - NoL2 + r2*NoL2) / NoL;\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-(Li + Lo))) / (Li + Lo);\n return Sheen_HorizonFading(NoL) * Pi_D * G / NoV;\n}\nfloat Sheen(float NoV, float roughness)\n{\n NoV *= NoV;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoV2 + NoV2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-Lo)) / Lo;\n float sheen = Pi_D * G / NoV;\n return pow(max(0.0, sheen), 0.5);\n}\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat CalculateFresnelCoefficient(float ior, float NoVSat)\n{\n\tfloat g, c, n, prev, next;\n\tn = ior;\n\tc = ior * NoVSat;\n\tg = sqrt(1.0 + c * c - c);\n\tprev = (g - c) / (g + c);\n\tnext = (c * (g+c) - n*n) / (c * (g-c) + n*n);\n\tprev *= prev;\n\tnext *= next;\n\treturn 0.5 * prev * (1.0 + next);\n}\nfloat CalculateFresnelCoefficient(float F0, float F90, float NoVSat)\n{\n return mix(F90, F0, NoVSat);\n}\nvec3 CalculateScattering(vec3 unscatteredColor, float distance, float outScatterExtinctCoef, float inScatterExtinctCoef, float inScatterCoef, vec3 inScatterColor, vec3 outScatterColor)\n{\n vec2 e = vec2(outScatterExtinctCoef, inScatterExtinctCoef * inScatterCoef);\n vec2 extinction = exp(-e * distance);\n vec3 inScattered = (1.0 - extinction.y) * inScatterColor;\n vec3 outScattered = unscatteredColor * extinction.x * outScatterColor;\n return outScattered + inScattered;\n}\nvoid InitializeLayerBlending(out vec3 blendedBaseLayerD, out vec3 blendedBaseLayerS,\n out vec3 blendedSubLayerD, out vec3 blendedSubLayerS,\n out vec3 lastLayerF,\n in vec3 baseD, in vec3 baseS\n )\n{\n blendedBaseLayerD = baseD;\n blendedBaseLayerS = baseS;\n blendedSubLayerD = blendedSubLayerS = vec3(0.0);\n lastLayerF = vec3(1.0);\n}\nvoid CalculateLayerBlending(inout vec3 blendedBaseLayerD, inout vec3 blendedBaseLayerS,\n inout vec3 blendedSubLayerD, inout vec3 blendedSubLayerS,\n inout vec3 lastLayerF,\n in vec3 subLayerD, in vec3 subLayerDiffuseColor,\n in vec3 subLayerS, in vec3 subLayerSpecularColor,\n in float subLayerOpacity, inout vec3 subLayerF\n )\n{\n subLayerF = saturate(subLayerF * subLayerOpacity);\n blendedSubLayerD = blendedSubLayerD * (vec3(1.0) - lastLayerF) + subLayerD * subLayerDiffuseColor * subLayerF;\n blendedSubLayerS = blendedSubLayerS *(vec3(1.0) - lastLayerF) + subLayerS * subLayerSpecularColor * subLayerF;\n blendedBaseLayerD *= vec3(1.0) - subLayerF;\n blendedBaseLayerS *= vec3(1.0) - subLayerF;\n lastLayerF = subLayerF;\n}\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nvec3 CalculateRefractDirection(vec3 N, vec3 V, float NoV, float ior)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n float cosA = abs(NoV);\n float sinA = sqrt(1.0 - cosA * cosA);\n float sinB = saturate(sinA / ior);\n float cosB = sqrt(1.0 - sinB * sinB);\n vec3 edgeA = -V + N * cosA;\n vec3 edgeB = normalize(edgeA) * sinB;\n vec3 R = edgeB - N * cosB;\n return R;\n}\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\nvec3 CalculateDirectDiffuse(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n return irradiance * DiffuseCoefficient_EnergyConservation;\n}\nvec3 CalculateDirectSpecular(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float rT, rB;\n GetAnisotropicRoughness(roughness, lightingData.anisotropyShape, rT, rB);\n float calcSpec = D_GGXAniso(rT, rB, lightingData.NoHSat, lightingData.H, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n float calcSpec = (roughness * 0.25 + 0.25) * D_GGXMobile(roughness, lightingData.NoHSat);\n #else\n float calcSpec = D_GGX(roughness, lightingData.NoHSat);\n #endif\n #endif\n return irradiance * calcSpec;\n}\n#if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 EnvAnisotropicReflection(samplerCube tex, vec3 R, float roughness, float mipCount, float anisotropyShape, vec3 V, vec3 N, vec3 T, vec3 B) {\n R = normalize(R);\n float integratedBRDF = 0.0;\n vec3 envSpec = vec3(0.0);\n const int SAMPLE_STEP_COUNT = CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT;\n float sampleAngleRange = PI * abs(anisotropyShape);\n vec3 anisoDirection = anisotropyShape < 0.0 ? T : B;\n vec3 ROnNormalPlane = normalize(R - anisoDirection * dot(R, anisoDirection));\n vec3 stepOffset = normalize(ROnNormalPlane - N) * (sampleAngleRange / float(SAMPLE_STEP_COUNT * 2));\n for (int i = -SAMPLE_STEP_COUNT; i <= SAMPLE_STEP_COUNT; ++i)\n {\n float rT, rB;\n GetAnisotropicRoughness(roughness, anisotropyShape, rT, rB);\n #if CC_IBL_CONVOLUTED\n float coef = abs(float(i)) / float(SAMPLE_STEP_COUNT) * float(SAMPLE_STEP_COUNT);\n #else\n float coef = pow(abs(float(i)) / float(SAMPLE_STEP_COUNT), 1.3) * float(SAMPLE_STEP_COUNT);\n #endif\n vec3 H = normalize(N + stepOffset * sign(float(i)) * coef);\n vec3 L = reflect(-V, H);\n float NoHSat = saturate(dot(N, H));\n float calcSpec = D_GGXAniso(rT, rB, NoHSat, H, T, B);\n envSpec += calcSpec * EnvReflection(tex, L, roughness, mipCount);\n integratedBRDF += calcSpec;\n }\n envSpec /= integratedBRDF;\n return envSpec;\n }\n#endif\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, R, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflection(tex, R, roughness, mipCount);\n #endif\n #endif\n return envSpec;\n}\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount, vec3 worldPos, vec3 cubeCenterPos, vec3 boxHalfSize, bool isRGBE)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, cubeCenterPos, boxHalfSize);\n R = fixedR.xyz;\n vec3 envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, fixedR.xyz, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflectionOfReflectionProbe(tex, R, roughness, mipCount, isRGBE);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #endif\n #endif\n return envSpec;\n}\nvec3 CalculateEnvironmentDiffuse(in LightingIntermediateData lightingData, float lightIntensity)\n{\n float fAmb = max(EPSILON, 0.5 - lightingData.N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n vec3 rotationDir = RotationVecFromAxisY(lightingData.N, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = texture(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #endif\n ambDiff.rgb *= lightIntensity;\n #if CC_USE_LIGHT_PROBE\n ambDiff.rgb += SHEvaluate(lightingData.N);\n #endif\n return ambDiff.rgb;\n}\nvec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, float lightIntensity)\n{\n vec3 envSpec = vec3(0.0);\n#if CC_USE_REFLECTION_PROBE\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(lightingData.worldPosition, lightingData.worldPosition_fract_part);\n #else\n worldPos = lightingData.worldPosition;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n if(FSInput_reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(worldPos, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0)).xyz;\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, FSInput_reflectionProbeId);\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(lightingData.N, lightingData.V, worldPos, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount)).xyz;\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n float blendFactor = 0.0;\n #if USE_INSTANCING\n blendFactor = FSInput_reflectionProbeData.x;\n #else\n blendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n if(FSInput_reflectionProbeBlendId < 0.0)\n {\n vec3 skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n envSpec = mix(envSpec, skyBoxEnv, blendFactor);\n #else\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, centerPos, boxHalfSize);\n envSpec = mix(skyBoxEnv, envSpec, fixedR.w);\n #endif\n }else{\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, FSInput_reflectionProbeBlendId);\n vec3 probeBlend = SampleEnvironmentSpecular(cc_reflectionProbeBlendCubemap, lightingData, mipCountBlend, worldPos, centerPosBlend, boxHalfSizeBlend, isBlendReflectProbeUsingRGBE(FSInput_reflectionProbeBlendId));\n envSpec = mix(envSpec, probeBlend, blendFactor);\n }\n }\n #endif\n#elif CC_USE_IBL\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n#endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = FSInput_reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n return envSpec * lightIntensity;\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n return true;\n#elif CC_SURFACES_LIGHTING_SSS\n return true;\n#else\n return NoL > 0.0;\n#endif\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateDirectSpecular(lightingData, lightSourceColorAndIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n float fresnel = CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVAbsSat);\n return vec3(fresnel);\n}\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 directGF, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n directGF = environmentGF;\n #else\n float roughness = lightingData.specularParam;\n directGF = F_SchlickMultiplier(specularColor, lightingData.VoHAbsSat) * G_Schlick(roughness, lightingData.NoVSat, lightingData.NoLSat);\n #endif\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n float roughness = lightingData.specularParam;\n IntegratedGFMultiplier(integratedGF, integratedF, specularColor, roughness, lightingData.NoVAbsSat);\n}\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfaceLightingCalculateDirectSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n float VoH = lightingData.VoHAbsSat;\n \tsubLayerF = vec3(exp2( (-5.55473 * VoH - 6.98316) * VoH ));\n }\n void CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n subLayerF = vec3(CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVSat));\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n void CCSurfacesLightingCalculateDirectTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n float roughness = lightingData.specularParam;\n float NoLSat = saturate(dot(lightingData.N, -lightingData.L));\n vec3 irradiance = NoLSat * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float RoL = dot(lightingData.L, normalize(R));\n float calcSpec = D_GGX(roughness, saturate(RoL));\n lightingSpecular = irradiance * calcSpec;\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n {\n vec3 envSpec = vec3(0.0);\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float roughness = lightingData.specularParam;\n #if CC_USE_REFLECTION_PROBE\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_reflectionProbeCubemap, R, roughness, cc_ambientGround.w);\n #endif\n #endif\n #if CC_USE_IBL && CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_environment, R, roughness, cc_ambientGround.w);\n #endif\n lightingSpecular = CalculateScattering(envSpec * lightIntensity, lightingData.transmitScatteringParams.w, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define objectThickness lightingData.transmitDiffuseParams.x\n #define transmitMask lightingData.transmitDiffuseParams.y\n #define envTransmitScale lightingData.transmitDiffuseParams.z\n #define envFixedDistanceScale lightingData.transmitScatteringParams.w\n #define transmitDistanceScale lightingData.transmitDiffuseParams.w\n #define DONOT_USE_SHADOWMAP_DISTANCE ((abs(float(lightingData.shadowPosAndDepth.z) - float(lightingData.shadowPosAndDepth.w)) < EPSILON) && (abs(float(lightingData.shadowPosAndDepth.z) - float(SURFACES_MAX_TRANSMIT_DEPTH_VALUE)) < EPSILON))\n #define SHADOWMAP_DISTANCE max(lightingData.shadowPosAndDepth.w - lightingData.shadowPosAndDepth.z, 0.0)\n void CCSurfacesLightingCalculateDirectTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float shadow)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n distance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n shadow = step(SHADOWMAP_DISTANCE, objectThickness) > 0.0 ? 1.0 : shadow;\n }\n vec3 backIrradiance = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n backIrradiance *= shadow * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, float lightIntensity, float ao, vec3 shadowLightDirection)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n float shadowMapDistance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n float fixedDistance = transmitDistanceScale * envFixedDistanceScale;\n float lerpCoef = saturate(dot(lightingData.N, shadowLightDirection));\n distance = mix(fixedDistance, shadowMapDistance, lerpCoef);\n }\n vec3 backIrradiance = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n backIrradiance *= ao * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n transmitDiffuse *= envTransmitScale;\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n #undef objectThickness\n #undef transmitMask\n #undef envTransmitScale\n #undef envFixedDistanceScale\n #undef DONOT_USE_SHADOWMAP_DISTANCE\n #undef SHADOWMAP_DISTANCE\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #ifndef CC_SURFACES_FRAGMENT_MODIFY_2ND_SPECULAR_COLOR\n #endif\n void CCSurfacesLightingCalculateDirect2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n CCSurfacesLightingCalculateDirect(unused, specularLighting, lightingData, lightSourceColorAndIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironment2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n specularLighting = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateDirectSheen(out vec3 specularLighting, out vec3 directGF, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n float sheen = Sheen(lightingData.NoHSat, lightingData.NoL, lightingData.NoV, lightingData.specularParam);\n specularLighting = vec3(sheen) * intensitySpecular * lightSourceColorAndIntensity.xyz * lightSourceColorAndIntensity.w;\n directGF = vec3(1.0);\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentSheen(out vec3 specularLighting, out vec3 environmentGF, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n LightingIntermediateData lightingDataSheen = lightingData;\n float roughness = lightingData.specularParam;\n vec3 L = normalize(mix(lightingDataSheen.B, lightingDataSheen.N, 0.3));\n lightingDataSheen.specularParam = mix(0.5, 0.9, roughness);\n lightingDataSheen.V = lightingDataSheen.N = L;\n specularLighting = CalculateEnvironmentSpecular(lightingDataSheen, lightIntensity);\n specularLighting *= intensitySpecular;\n environmentGF = vec3(Sheen(lightingData.NoV, roughness));\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n#endif\n#if CC_SURFACES_LIGHTING_TT\n void CCSurfacesLightingCalculateDirectTT(inout LightingResult lightingResult, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n lightingResult.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLighting;\n float w = lightingData.ttIntensity;\n vec3 scatteredLighting = pow(saturate(lightingData.baseColorTT * w + lightingData.NoLSat) * lightingData.NoLSat, vec3(mix(0.5, 0.5 + lightingData.ttScatterCoef, w)));\n vec3 ttLighting = scatteredLighting - lightingData.NoLSat;\n lightingResult.directTT = ttLighting * DiffuseCoefficient_EnergyConservation * lightSourceColorAndIntensity.xyz* lightSourceColorAndIntensity.w;\n }\n#endif\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfacesLightingCalculateDirectMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.directDiffuse, blendedBaseS = lightingResult.directSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n lightingResult.directDiffuse, lightingResult.directSpecular\n );\n CCSurfaceLightingCalculateDirectSubLayerFresnel(lightingResult.directSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.direct2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.directSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.directDiffuse = blendedBaseD;\n lightingResult.directSpecular = blendedBaseS;\n }\n void CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.environmentDiffuse, blendedBaseS = lightingResult.environmentSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n lightingResult.environmentDiffuse, lightingResult.environmentSpecular\n );\n CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(lightingResult.environmentSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.environment2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.environmentSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.environmentDiffuse = blendedBaseD;\n lightingResult.environmentSpecular = blendedBaseS;\n }\n#endif\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec3 worldNormal;\n vec3 emissive;\n float specularIntensity;\n float roughness;\n float metallic;\n float ao;\n vec3 worldTangent, worldBinormal;\n float ior;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 outScatteringColor, inScatteringColor;\n vec4 transmitScatteringParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 baseColor2ndSpecular, color2ndSpecular;\n float intensity2ndSpecular, roughness2ndSpecular, metallic2ndSpecular;\n vec3 worldNormal2ndSpecular, worldTangent2ndSpecular, worldBinormal2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape2ndSpecular;\n #endif\n float ior2ndSpecular, opacity2ndSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n vec4 sssParams;\n#endif\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\nvoid SurfacesFragmentModifyWorldTangentAndBinormal(inout vec3 worldTangent, inout vec3 worldBinormal, vec3 worldNormal)\n{\n vec3 tangent = normalize(FSInput_worldTangent);\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec3 binormal = normalize(CalculateBinormal(worldNormal.xyz, tangent, FSInput_mirrorNormal));\n tangent = normalize(cross(binormal, worldNormal));\n#else\n vec3 binormal = vec3(0.0, 0.0, 0.0);\n#endif\n worldTangent = tangent;\n worldBinormal = binormal;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\nfloat SurfacesFragmentModifyIOR()\n{\n return 1.0;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n isRotation = 1.0;\n return vec4(1.0, 0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n return vec4(1.0, 0.5, 0.0, 0.5);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\nvec4 SurfacesFragmentModifyTransmitScatteringParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitInScatteringColor()\n{\n return vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitOutScatteringColor()\n{\n return vec3(1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\nvec4 SurfacesFragmentModifyTransmitDiffuseParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\nvec4 SurfacesFragmentModifyTRTParams()\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\nvec3 SurfacesFragmentModifyTRTColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\nvec4 SurfacesFragmentModifyTTParams()\n{\n return vec4(0.0, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\nvec3 SurfacesFragmentModifyTTColor(in vec3 baseColor)\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\nvec4 SurfacesFragmentModifySSSParams()\n{\n return vec4(1.0, 0.1, 1.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\nvec4 SurfacesFragmentModifyDualLobeSpecularParams(float roughness)\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\nvec4 SurfacesFragmentModifyClearCoatParams()\n{\n return vec4(0.2, 1.5, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\nvec3 SurfacesFragmentModifyClearCoatColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\nvec3 SurfacesFragmentModifyClearCoatWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\nvec4 SurfacesFragmentModifySheenParams()\n{\n return vec4(0.7, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\nvec3 SurfacesFragmentModifySheenColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.baseColor = SurfacesFragmentModifyBaseColorAndTransparency();\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n SurfacesFragmentModifyWorldTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal);\n surfaceData.ior = SurfacesFragmentModifyIOR();\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float isRotation;\n vec4 anisotropyParams = SurfacesFragmentModifyAnisotropyParams(isRotation);\n surfaceData.anisotropyShape = anisotropyParams.x;\n if (isRotation > 0.0) {\n RotateTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal, anisotropyParams.y);\n } else {\n vec3 anisoDirTS = anisotropyParams.yzw;\n vec3 tangentWS = anisoDirTS.x * surfaceData.worldTangent + anisoDirTS.y * surfaceData.worldBinormal + anisoDirTS.z * surfaceData.worldNormal;\n surfaceData.worldTangent = normalize(tangentWS);\n surfaceData.worldBinormal = cross(surfaceData.worldNormal, tangentWS);\n }\n#endif\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n vec4 pbr = SurfacesFragmentModifyPBRParams();\n surfaceData.ao = pbr.x;\n surfaceData.roughness = pbr.y;\n surfaceData.metallic = pbr.z;\n surfaceData.specularIntensity = pbr.w;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitScatteringParams = SurfacesFragmentModifyTransmitScatteringParams();\n surfaceData.inScatteringColor = SurfacesFragmentModifyTransmitInScatteringColor();\n surfaceData.outScatteringColor = SurfacesFragmentModifyTransmitOutScatteringColor();\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitDiffuseParams = SurfacesFragmentModifyTransmitDiffuseParams();\n#endif\n#if CC_SURFACES_LIGHTING_TRT\n vec4 trtParams = SurfacesFragmentModifyTRTParams();\n surfaceData.roughness2ndSpecular = saturate(surfaceData.roughness + trtParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = trtParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyTRTColor();\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n RotateNormalAndBinormal(surfaceData.worldBinormal2ndSpecular, surfaceData.worldNormal2ndSpecular, surfaceData.worldTangent2ndSpecular, trtParams.y, FSInput_mirrorNormal);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec4 ttParams = SurfacesFragmentModifyTTParams();\n surfaceData.ttScatterCoef = ttParams.x;\n surfaceData.ttIntensity = ttParams.w;\n surfaceData.baseColorTT = SurfacesFragmentModifyTTColor(surfaceData.baseColor.rgb);\n#endif\n#if CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n vec4 dualLobeParams = SurfacesFragmentModifyDualLobeSpecularParams(surfaceData.roughness);\n surfaceData.roughness2ndSpecular = saturate(dualLobeParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = dualLobeParams.w;\n surfaceData.baseColor2ndSpecular = surfaceData.baseColor.rgb;\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SHEEN\n vec4 sheenParams = SurfacesFragmentModifySheenParams();\n surfaceData.roughness2ndSpecular = saturate(sheenParams.x);\n surfaceData.intensity2ndSpecular = sheenParams.y * sheenParams.w;\n surfaceData.metallic2ndSpecular = 1.0;\n surfaceData.baseColor2ndSpecular = SurfacesFragmentModifySheenColor();\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_CLEAR_COAT\n vec4 clearCoatParams = SurfacesFragmentModifyClearCoatParams();\n surfaceData.roughness2ndSpecular = clearCoatParams.x;\n surfaceData.metallic2ndSpecular = 0.0;\n surfaceData.ior2ndSpecular = clearCoatParams.y;\n surfaceData.opacity2ndSpecular = clearCoatParams.z;\n surfaceData.intensity2ndSpecular = clearCoatParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyClearCoatColor();\n surfaceData.worldNormal2ndSpecular = SurfacesFragmentModifyClearCoatWorldNormal();\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.worldTangent2ndSpecular = CalculateTangent(surfaceData.worldNormal2ndSpecular, surfaceData.worldBinormal2ndSpecular);\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n surfaceData.sssParams = SurfacesFragmentModifySSSParams();\n#endif\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP) {\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n surfaceData.worldTangent = normalize(FSInput_worldTangent);\n }\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO)\n {\n surfaceData.baseColor.rgb = vec3(1.0);\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n surfaceData.baseColor2ndSpecular.rgb = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n surfaceData.baseColorTT.rgb = vec3(1.0);\n #endif\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.baseColor.rgb * (1.0 - surfaceData.metallic);\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n float F0 = surfaceData.specularIntensity * 0.08;\n return mix(vec3(F0), surfaceData.baseColor.rgb, surfaceData.metallic);\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = CCSurfacesGetDiffuseColor(surfaceData);\n specularColorWithLighting = CCSurfacesGetSpecularColor(surfaceData).xyz;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, surfaceData.worldTangent, surfaceData.worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , surfaceData.anisotropyShape\n#endif\n );\n lightingData.specularParam = surfaceData.roughness;\n lightingData.ior = surfaceData.ior;\n lightingData.layerOpacity = surfaceData.baseColor.a;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitScatteringParams = surfaceData.transmitScatteringParams;\n lightingData.inScatteringColor = surfaceData.inScatteringColor;\n lightingData.outScatteringColor = surfaceData.outScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitDiffuseParams = surfaceData.transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingData.baseColorTT = surfaceData.baseColorTT;\n lightingData.ttIntensity = surfaceData.ttIntensity;\n lightingData.ttScatterCoef = surfaceData.ttScatterCoef;\n#endif\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\nvoid CCSurfacesGetLightingIntermediateDataTransmitDiffuse(inout LightingIntermediateData lightingDataTD, in LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n lightingDataTD = lightingData;\n lightingDataTD.N = lightingData.transmitScatteringParams.z > 0.0 ? -FSInput_worldNormal : -(normalize(FSInput_worldNormal)+lightingData.V);\n lightingDataTD.N = normalize(lightingDataTD.N);\n}\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\nvoid CCSurfacesGetSurfacesMaterialData2ndSpecular(inout SurfacesMaterialData surfaceData2ndSpecular, in SurfacesMaterialData surfaceData)\n{\n surfaceData2ndSpecular = surfaceData;\n surfaceData2ndSpecular.baseColor = vec4(surfaceData.baseColor2ndSpecular, surfaceData.opacity2ndSpecular);\n surfaceData2ndSpecular.roughness = surfaceData.roughness2ndSpecular;\n surfaceData2ndSpecular.metallic = surfaceData.metallic2ndSpecular;\n surfaceData2ndSpecular.worldNormal = surfaceData.worldNormal2ndSpecular;\n surfaceData2ndSpecular.worldTangent = surfaceData.worldTangent2ndSpecular;\n surfaceData2ndSpecular.worldBinormal = surfaceData.worldBinormal2ndSpecular;\n surfaceData2ndSpecular.ior = surfaceData.ior2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData2ndSpecular.anisotropyShape = surfaceData.anisotropyShape2ndSpecular;\n #endif\n}\n#endif\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.ao = surfaceData.ao;\n lightingResult.emissive = surfaceData.emissive;\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n lightingResult.environmentDiffuseSubLayers = lightingResult.environmentSpecularSubLayers = vec3(0.0);\n#endif\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResult.directTransmitSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResult.directTransmitDiffuse = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResult.direct2ndSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingResult.directTT = vec3(0.0);\n#endif\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow * lightingResult.directGF * lightingResult.fresnel;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResultAccumulated.directDiffuseSubLayers += lightingResult.directDiffuseSubLayers * lightingResult.shadow;\n lightingResultAccumulated.directSpecularSubLayers += lightingResult.directSpecularSubLayers * lightingResult.shadow;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResultAccumulated.directTransmitSpecular += lightingResult.directTransmitSpecular * (vec3(1.0) - lightingResult.fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResultAccumulated.directTransmitDiffuse += lightingResult.directTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResultAccumulated.direct2ndSpecular += lightingResult.direct2ndSpecular * lightingResult.shadow * lightingResult.directGF2ndSpecular * lightingResult.fresnel;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n lightingResultAccumulated.directTT += lightingResult.directTT * lightingResult.shadow;\n lightingResultAccumulated.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLightingTT;\n #endif\n}\n#if CC_PIPELINE_TYPE == 1\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n#else\n vec3 fresnel = lightingResult.fresnel;\n vec3 invFresnel = vec3(1.0) - fresnel;\n color.xyz +=\n ( lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n )\n * lightingResult.shadow\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_ALL_IN_ONE\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting * lightingResult.shadow;\n #elif CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting;\n #endif\n color.xyz +=\n ( lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.environmentTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.environmentDiffuseSubLayers\n + lightingResult.environmentSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.environment2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.environmentGF2ndSpecular\n #endif\n #endif\n )\n * lightingResult.ao\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.environmentTransmitDiffuse\n #endif\n ;\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n#endif\nlayout(location = 0) out vec4 fragColorX;\n#if CC_PIPELINE_TYPE == 1 && !CC_FORCE_FORWARD_SHADING\n void main() { fragColorX = vec4(0.0, 1.0, 0.0, 1.0); }\n#else\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #endif\n #if !CC_FORWARD_ADD\n float fogFactor = 1.0;\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #endif\n #if !CC_FORWARD_ADD\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n fragColorX = packRGBE(color.rgb);\n }\n#endif"},"glsl1":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_shadowLPNNInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n uniform highp vec4 cc_lightingMapUVParam;\n uniform highp vec4 cc_localShadowBias;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n #endif\n void CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n {\n #if CC_USE_FOG == 0\n \tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n #elif CC_USE_FOG == 1\n \tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 2\n \tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n #elif CC_USE_FOG == 3\n \tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n #else\n \tfactor = 1.0;\n #endif\n }\n#endif\n uniform vec4 tilingOffset;\n uniform vec4 anisotropyParam;\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias + vec2(anisotropyParam.z, 0.0);\n}\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\nvec3 SurfacesVertexModifyLocalNormal(in SurfacesStandardVertexIntermediate In)\n{\n return In.normal.xyz;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec4 SurfacesVertexModifyLocalTangent(in SurfacesStandardVertexIntermediate In)\n {\n return In.tangent;\n }\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\nvec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)\n{\n vec3 worldNormal = In.worldNormal.xyz;\n #if CC_SURFACES_USE_TWO_SIDED\n worldNormal.xyz *= In.worldNormal.w;\n #endif\n return worldNormal;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\nvec2 SurfacesVertexModifyShadowBias(in SurfacesStandardVertexIntermediate In, vec2 originShadowBias)\n{\n return originShadowBias;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);\n#endif\n}\nvoid CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId = vec4(0.0);\n #endif\n #if CC_RECEIVE_SHADOW\n In.shadowBiasAndProbeId.xy = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.xy += a_localShadowBiasAndProbeId.xy;\n #else\n In.shadowBiasAndProbeId.xy += cc_localShadowBias.xy;\n #endif\n #endif\n #if CC_USE_REFLECTION_PROBE\n #if USE_INSTANCING\n In.shadowBiasAndProbeId.zw = a_localShadowBiasAndProbeId.zw;\n #else\n In.shadowBiasAndProbeId.zw = cc_localShadowBias.zw;\n #endif\n #endif\n}\nvoid CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)\n{\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #if USE_INSTANCING\n In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;\n In.lightmapUV.z = a_lightingMapUVParam.w;\n #else\n In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;\n In.lightmapUV.z = cc_lightingMapUVParam.w;\n #endif\n#endif\n}\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n In.normal.xyz = SurfacesVertexModifyLocalNormal(In);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = SurfacesVertexModifyLocalTangent(In);\n #endif\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);\n In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;\n In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexTransferFog(In);\n CCSurfacesVertexTransferLightMapUV(In);\n CCSurfacesVertexTransferShadow(In);\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n In.shadowBiasAndProbeId.xy = SurfacesVertexModifyShadowBias(In, In.shadowBiasAndProbeId.xy);\n #endif\n CCSurfacesVertexOutput(In);\n}","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_probeInfo;\n uniform mediump vec4 cc_debug_view_mode;\nuniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n uniform mediump vec4 cc_exposure;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_mainLitColor;\n uniform mediump vec4 cc_ambientSky;\n uniform mediump vec4 cc_ambientGround;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n uniform highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n uniform vec4 cc_lightColor[LIGHTS_PER_PASS];\n uniform vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n uniform vec4 cc_lightDir[LIGHTS_PER_PASS];\n uniform vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n #endif\n#endif\nuniform highp mat4 cc_matLightView;\n uniform highp mat4 cc_matLightViewProj;\n uniform highp vec4 cc_shadowInvProjDepthInfo;\n uniform highp vec4 cc_shadowProjDepthInfo;\n uniform highp vec4 cc_shadowProjInfo;\n uniform mediump vec4 cc_shadowNFLSInfo;\n uniform mediump vec4 cc_shadowWHPBInfo;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n uniform highp vec4 cc_csmViewDir0[4];\n uniform highp vec4 cc_csmViewDir1[4];\n uniform highp vec4 cc_csmViewDir2[4];\n uniform highp vec4 cc_csmAtlas[4];\n uniform highp mat4 cc_matCSMViewProj[4];\n uniform highp vec4 cc_csmProjDepthInfo[4];\n uniform highp vec4 cc_csmProjInfo[4];\n uniform highp vec4 cc_csmSplitsInfo;\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\nvec4 fragTextureLod (sampler2D tex, vec2 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return texture2DLodEXT(tex, coord, lod);\n #else\n return texture2D(tex, coord, lod);\n #endif\n}\nvec4 fragTextureLod (samplerCube tex, vec3 coord, float lod) {\n #ifdef GL_EXT_shader_texture_lod\n return textureCubeLodEXT(tex, coord, lod);\n #else\n return textureCube(tex, coord, lod);\n #endif\n}\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\nhighp float unpackHighpData (float mainPart, float modPart) {\n highp float data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp float unpackHighpData (float mainPart, float modPart, const float modValue) {\n highp float data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out float mainPart, out float modPart, highp float data, const float modValue) {\n highp float divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart) {\n highp vec2 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec2 unpackHighpData (vec2 mainPart, vec2 modPart, const float modValue) {\n highp vec2 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec2 mainPart, out vec2 modPart, highp vec2 data, const float modValue) {\n highp vec2 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart) {\n highp vec3 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec3 unpackHighpData (vec3 mainPart, vec3 modPart, const float modValue) {\n highp vec3 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec3 mainPart, out vec3 modPart, highp vec3 data, const float modValue) {\n highp vec3 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart) {\n highp vec4 data = mainPart;\n return data + modPart;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data) {\n mainPart = fract(data);\n modPart = data - mainPart;\n}\nhighp vec4 unpackHighpData (vec4 mainPart, vec4 modPart, const float modValue) {\n highp vec4 data = mainPart * modValue;\n return data + modPart * modValue;\n}\nvoid packHighpData (out vec4 mainPart, out vec4 modPart, highp vec4 data, const float modValue) {\n highp vec4 divide = data / modValue;\n mainPart = floor(divide);\n modPart = (data - mainPart * modValue) / modValue;\n}\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec3 unpackRGBE (vec4 rgbe) {\n return rgbe.rgb * pow(1.1, rgbe.a * 255.0 - 128.0);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\nvec2 GetPlanarReflectScreenUV(vec3 worldPos, mat4 matVirtualCameraViewProj, float flipNDCSign, vec3 viewDir, vec3 reflectDir)\n{\n vec4 clipPos = matVirtualCameraViewProj * vec4(worldPos, 1.0);\n vec2 screenUV = clipPos.xy / clipPos.w * 0.5 + 0.5;\n screenUV = vec2(1.0 - screenUV.x, screenUV.y);\n screenUV = flipNDCSign == 1.0 ? vec2(screenUV.x, 1.0 - screenUV.y) : screenUV;\n return screenUV;\n}\nfloat GetLinearDepthFromViewSpace(vec3 viewPos, float near, float far) {\n float dist = length(viewPos);\n return (dist - near) / (far - near);\n}\nvec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)\n{\n return cross(normal, tangent) * mirrorNormal;\n}\nvec3 CalculateTangent(vec3 normal, vec3 binormal)\n{\n return cross(binormal, normal);\n}\nvec3 CalculateNormal(vec3 tangent, vec3 binormal)\n{\n return cross(tangent, binormal);\n}\nvec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)\n{\n vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +\n (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +\n normalFromTangentSpace.z * normalize(normal);\n}\nvec3 RotationVecFromAxisY(vec3 v, float cosTheta, float sinTheta)\n{\n vec3 result;\n result.x = dot(v, vec3(cosTheta, 0.0, -sinTheta));\n result.y = v.y;\n result.z = dot(v, vec3(sinTheta, 0.0, cosTheta));\n return result;\n}\nvec3 RotationVecFromAxisY(vec3 v, float rotateAngleArc)\n{\n return RotationVecFromAxisY(v, cos(rotateAngleArc), sin(rotateAngleArc));\n}\nvoid RotateTangentAndBinormal(inout vec3 tangent, inout vec3 binormal, vec3 normal, float rotationAngle)\n{\n float cosTheta = cos(rotationAngle), sinTheta = sin(rotationAngle);\n vec3 B = RotationVecFromAxisY(vec3(1.0, 0.0, 0.0), cosTheta, sinTheta);\n vec3 T = RotationVecFromAxisY(vec3(0.0, 0.0, 1.0), cosTheta, sinTheta);\n vec3 tangentNew, binormalNew;\n binormalNew = B.x * binormal + B.y * normal + B.z * tangent;\n binormal = normalize(binormalNew);\n tangentNew = T.x * binormal + T.y * normal + T.z * tangent;\n tangent = normalize(tangentNew);\n}\nvoid RotateNormalAndBinormal(inout vec3 binormal, inout vec3 normal, in vec3 tangent, float rotationAngle, float mirrorNormal)\n{\n if(rotationAngle > 0.0)\n {\n normal += (binormal - normal) * rotationAngle;\n normal = normalize(normal);\n binormal = CalculateBinormal(normal, tangent, mirrorNormal);\n }\n else if(rotationAngle < 0.0)\n {\n binormal += (binormal - normal) * rotationAngle;\n binormal = normalize(binormal);\n normal = CalculateNormal(tangent, binormal);\n }\n}\nfloat RoughnessToPerceptualRoughness(float roughness)\n{\n return sqrt(roughness);\n}\n vec3 EnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity) {\n #if CC_USE_IBL\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n \tfloat mip = roughness * (mipCount - 1.0);\n \tfloat delta = (dot(dFdx(R), dFdy(R))) * 1000.0;\n \tfloat mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n \tvec4 biased = fragTextureLod(cc_environment, rotationDir, mip + mipBias);\n \tvec4 filtered = textureCube(cc_environment, rotationDir);\n #if CC_USE_IBL == 2\n \tbiased.rgb = unpackRGBE(biased);\n \tfiltered.rgb = unpackRGBE(filtered);\n #else\n \tbiased.rgb = SRGBToLinear(biased.rgb);\n \tfiltered.rgb = SRGBToLinear(filtered.rgb);\n #endif\n return mix(biased.rgb, filtered.rgb, denoiseIntensity);\n #else\n return vec3(0.0, 0.0, 0.0);\n #endif\n }\n vec3 EnvReflection(samplerCube tex, vec3 R, float roughness, float mipCount) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec3 rotationDir = RotationVecFromAxisY(R.xyz, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 envmap = fragTextureLod(tex, rotationDir, roughness * (mipCount - 1.0));\n #if CC_USE_IBL == 2\n return unpackRGBE(envmap);\n #else\n return SRGBToLinear(envmap.rgb);\n #endif\n }\n vec3 EnvReflectionOfReflectionProbe(samplerCube tex, vec3 R, float roughness, float mipCount, bool isRGBE) {\n #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING && !CC_IBL_CONVOLUTED\n roughness = RoughnessToPerceptualRoughness(roughness);\n #endif\n vec4 envmap = fragTextureLod(tex, R, roughness * (mipCount - 1.0));\n return isRGBE ? unpackRGBE(envmap) : SRGBToLinear(envmap.rgb);\n }\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\nfloat CCGetLinearDepth(vec3 worldPos, float viewSpaceBias) {\n\tvec4 viewPos = cc_matLightView * vec4(worldPos.xyz, 1.0);\n viewPos.z += viewSpaceBias;\n\treturn GetLinearDepthFromViewSpace(viewPos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n}\nfloat CCGetLinearDepth(vec3 worldPos) {\n\treturn CCGetLinearDepth(worldPos, 0.0);\n}\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n vec4 shadowTexure(highp sampler2D shadowMap, vec2 coord) {\n #if defined(CC_USE_WGPU)\n return texture2DLod(shadowMap, coord, 0.0);\n #else\n return texture2D(shadowMap, coord);\n #endif\n }\n float SampleShadowMap (vec3 shadowNDCPos, highp sampler2D shadowMap)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n #else\n return shadowTexure(shadowMap, shadowNDCPos.xy).x;\n #endif\n }\n float SampleShadowMapSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block1 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos.y, shadowNDCPos.z), shadowMap);\n float block2 = SampleShadowMap(vec3(shadowNDCPos.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float block3 = SampleShadowMap(vec3(shadowNDCPos_offset.x, shadowNDCPos_offset.y, shadowNDCPos.z), shadowMap);\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorHard (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n #if CC_SHADOWMAP_FORMAT == 1\n return step(shadowNDCPos.z, dot(shadowTexure(shadowMap, shadowNDCPos.xy), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n return step(shadowNDCPos.z, shadowTexure(shadowMap, shadowNDCPos.xy).x);\n #endif\n }\n float NativePCFShadowFactorSoft (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 shadowNDCPos_offset = shadowNDCPos.xy + oneTap;\n float block0, block1, block2, block3;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos.y)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset.y)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset.x, shadowNDCPos_offset.y)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block2, block3, coefX);\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n return mix(resultX, resultY, coefY);\n }\n float NativePCFShadowFactorSoft3X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n float shadowNDCPos_offset_L = shadowNDCPos.x - oneTap.x;\n float shadowNDCPos_offset_R = shadowNDCPos.x + oneTap.x;\n float shadowNDCPos_offset_U = shadowNDCPos.y - oneTap.y;\n float shadowNDCPos_offset_D = shadowNDCPos.y + oneTap.y;\n float block0, block1, block2, block3, block4, block5, block6, block7, block8;\n #if CC_SHADOWMAP_FORMAT == 1\n block0 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block0 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_U)).x);\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_U)).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_U)).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos.y)).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos.y)).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos.y)).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_L, shadowNDCPos_offset_D)).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos.x, shadowNDCPos_offset_D)).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, vec2(shadowNDCPos_offset_R, shadowNDCPos_offset_D)).x);\n #endif\n float coefX = mod(shadowNDCPos.x, oneTap.x) * shadowMapResolution.x;\n float coefY = mod(shadowNDCPos.y, oneTap.y) * shadowMapResolution.y;\n float shadow = 0.0;\n float resultX = mix(block0, block1, coefX);\n float resultY = mix(block3, block4, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block1, block2, coefX);\n resultY = mix(block4, block5, coefX);\n shadow += mix(resultX , resultY, coefY);\n resultX = mix(block3, block4, coefX);\n resultY = mix(block6, block7, coefX);\n shadow += mix(resultX, resultY, coefY);\n resultX = mix(block4, block5, coefX);\n resultY = mix(block7, block8, coefX);\n shadow += mix(resultX, resultY, coefY);\n return shadow * 0.25;\n }\n float NativePCFShadowFactorSoft5X (vec3 shadowNDCPos, highp sampler2D shadowMap, vec2 shadowMapResolution)\n {\n vec2 oneTap = 1.0 / shadowMapResolution;\n vec2 twoTap = oneTap * 2.0;\n vec2 offset1 = shadowNDCPos.xy + vec2(-twoTap.x, -twoTap.y);\n vec2 offset2 = shadowNDCPos.xy + vec2(-oneTap.x, -twoTap.y);\n vec2 offset3 = shadowNDCPos.xy + vec2(0.0, -twoTap.y);\n vec2 offset4 = shadowNDCPos.xy + vec2(oneTap.x, -twoTap.y);\n vec2 offset5 = shadowNDCPos.xy + vec2(twoTap.x, -twoTap.y);\n vec2 offset6 = shadowNDCPos.xy + vec2(-twoTap.x, -oneTap.y);\n vec2 offset7 = shadowNDCPos.xy + vec2(-oneTap.x, -oneTap.y);\n vec2 offset8 = shadowNDCPos.xy + vec2(0.0, -oneTap.y);\n vec2 offset9 = shadowNDCPos.xy + vec2(oneTap.x, -oneTap.y);\n vec2 offset10 = shadowNDCPos.xy + vec2(twoTap.x, -oneTap.y);\n vec2 offset11 = shadowNDCPos.xy + vec2(-twoTap.x, 0.0);\n vec2 offset12 = shadowNDCPos.xy + vec2(-oneTap.x, 0.0);\n vec2 offset13 = shadowNDCPos.xy + vec2(0.0, 0.0);\n vec2 offset14 = shadowNDCPos.xy + vec2(oneTap.x, 0.0);\n vec2 offset15 = shadowNDCPos.xy + vec2(twoTap.x, 0.0);\n vec2 offset16 = shadowNDCPos.xy + vec2(-twoTap.x, oneTap.y);\n vec2 offset17 = shadowNDCPos.xy + vec2(-oneTap.x, oneTap.y);\n vec2 offset18 = shadowNDCPos.xy + vec2(0.0, oneTap.y);\n vec2 offset19 = shadowNDCPos.xy + vec2(oneTap.x, oneTap.y);\n vec2 offset20 = shadowNDCPos.xy + vec2(twoTap.x, oneTap.y);\n vec2 offset21 = shadowNDCPos.xy + vec2(-twoTap.x, twoTap.y);\n vec2 offset22 = shadowNDCPos.xy + vec2(-oneTap.x, twoTap.y);\n vec2 offset23 = shadowNDCPos.xy + vec2(0.0, twoTap.y);\n vec2 offset24 = shadowNDCPos.xy + vec2(oneTap.x, twoTap.y);\n vec2 offset25 = shadowNDCPos.xy + vec2(twoTap.x, twoTap.y);\n float block1, block2, block3, block4, block5, block6, block7, block8, block9, block10, block11, block12, block13, block14, block15, block16, block17, block18, block19, block20, block21, block22, block23, block24, block25;\n #if CC_SHADOWMAP_FORMAT == 1\n block1 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset1), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block2 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset2), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block3 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset3), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block4 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset4), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block5 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset5), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block6 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset6), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block7 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset7), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block8 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset8), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block9 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset9), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block10 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset10), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block11 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset11), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block12 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset12), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block13 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset13), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block14 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset14), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block15 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset15), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block16 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset16), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block17 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset17), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block18 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset18), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block19 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset19), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block20 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset20), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block21 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset21), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block22 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset22), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block23 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset23), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block24 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset24), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n block25 = step(shadowNDCPos.z, dot(shadowTexure(shadowMap, offset25), vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0)));\n #else\n block1 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset1).x);\n block2 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset2).x);\n block3 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset3).x);\n block4 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset4).x);\n block5 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset5).x);\n block6 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset6).x);\n block7 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset7).x);\n block8 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset8).x);\n block9 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset9).x);\n block10 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset10).x);\n block11 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset11).x);\n block12 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset12).x);\n block13 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset13).x);\n block14 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset14).x);\n block15 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset15).x);\n block16 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset16).x);\n block17 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset17).x);\n block18 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset18).x);\n block19 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset19).x);\n block20 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset20).x);\n block21 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset21).x);\n block22 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset22).x);\n block23 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset23).x);\n block24 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset24).x);\n block25 = step(shadowNDCPos.z, shadowTexure(shadowMap, offset25).x);\n #endif\n vec2 coef = fract(shadowNDCPos.xy * shadowMapResolution);\n vec2 v1X1 = mix(vec2(block1, block6), vec2(block2, block7), coef.xx);\n vec2 v1X2 = mix(vec2(block2, block7), vec2(block3, block8), coef.xx);\n vec2 v1X3 = mix(vec2(block3, block8), vec2(block4, block9), coef.xx);\n vec2 v1X4 = mix(vec2(block4, block9), vec2(block5, block10), coef.xx);\n float v1 = mix(v1X1.x, v1X1.y, coef.y) + mix(v1X2.x, v1X2.y, coef.y) + mix(v1X3.x, v1X3.y, coef.y) + mix(v1X4.x, v1X4.y, coef.y);\n vec2 v2X1 = mix(vec2(block6, block11), vec2(block7, block12), coef.xx);\n vec2 v2X2 = mix(vec2(block7, block12), vec2(block8, block13), coef.xx);\n vec2 v2X3 = mix(vec2(block8, block13), vec2(block9, block14), coef.xx);\n vec2 v2X4 = mix(vec2(block9, block14), vec2(block10, block15), coef.xx);\n float v2 = mix(v2X1.x, v2X1.y, coef.y) + mix(v2X2.x, v2X2.y, coef.y) + mix(v2X3.x, v2X3.y, coef.y) + mix(v2X4.x, v2X4.y, coef.y);\n vec2 v3X1 = mix(vec2(block11, block16), vec2(block12, block17), coef.xx);\n vec2 v3X2 = mix(vec2(block12, block17), vec2(block13, block18), coef.xx);\n vec2 v3X3 = mix(vec2(block13, block18), vec2(block14, block19), coef.xx);\n vec2 v3X4 = mix(vec2(block14, block19), vec2(block15, block20), coef.xx);\n float v3 = mix(v3X1.x, v3X1.y, coef.y) + mix(v3X2.x, v3X2.y, coef.y) + mix(v3X3.x, v3X3.y, coef.y) + mix(v3X4.x, v3X4.y, coef.y);\n vec2 v4X1 = mix(vec2(block16, block21), vec2(block17, block22), coef.xx);\n vec2 v4X2 = mix(vec2(block17, block22), vec2(block18, block23), coef.xx);\n vec2 v4X3 = mix(vec2(block18, block23), vec2(block19, block24), coef.xx);\n vec2 v4X4 = mix(vec2(block19, block24), vec2(block20, block25), coef.xx);\n float v4 = mix(v4X1.x, v4X1.y, coef.y) + mix(v4X2.x, v4X2.y, coef.y) + mix(v4X3.x, v4X3.y, coef.y) + mix(v4X4.x, v4X4.y, coef.y);\n float fAvg = (v1 + v2 + v3 + v4) * 0.0625;\n return fAvg;\n }\n bool GetShadowNDCPos(out vec3 shadowNDCPos, vec4 shadowPosWithDepthBias)\n {\n \tshadowNDCPos = shadowPosWithDepthBias.xyz / shadowPosWithDepthBias.w * 0.5 + 0.5;\n \tif (shadowNDCPos.x < 0.0 || shadowNDCPos.x > 1.0 ||\n \t\tshadowNDCPos.y < 0.0 || shadowNDCPos.y > 1.0 ||\n \t\tshadowNDCPos.z < 0.0 || shadowNDCPos.z > 1.0) {\n \t\treturn false;\n \t}\n \tshadowNDCPos.xy = cc_cameraPos.w == 1.0 ? vec2(shadowNDCPos.xy.x, 1.0 - shadowNDCPos.xy.y) : shadowNDCPos.xy;\n \treturn true;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, vec3 matViewDir0, vec3 matViewDir1, vec3 matViewDir2, vec2 projScaleXY)\n {\n vec4 newShadowPos = shadowPos;\n if (normalBias > EPSILON_LOWP)\n {\n vec3 viewNormal = vec3(dot(matViewDir0, worldNormal), dot(matViewDir1, worldNormal), dot(matViewDir2, worldNormal));\n if (viewNormal.z < 0.1)\n newShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n }\n return newShadowPos;\n }\n vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal, float normalBias, mat4 matLightView, vec2 projScaleXY)\n {\n \tvec4 newShadowPos = shadowPos;\n \tif (normalBias > EPSILON_LOWP)\n \t{\n \t\tvec4 viewNormal = matLightView * vec4(worldNormal, 0.0);\n \t\tif (viewNormal.z < 0.1)\n \t\t\tnewShadowPos.xy += viewNormal.xy * projScaleXY * normalBias * clamp(viewNormal.z, 0.001, 0.1);\n \t}\n \treturn newShadowPos;\n }\n float GetViewSpaceDepthFromNDCDepth_Orthgraphic(float NDCDepth, float projScaleZ, float projBiasZ)\n {\n \treturn (NDCDepth - projBiasZ) / projScaleZ;\n }\n float GetViewSpaceDepthFromNDCDepth_Perspective(float NDCDepth, float homogenousDividW, float invProjScaleZ, float invProjBiasZ)\n {\n \treturn NDCDepth * invProjScaleZ + homogenousDividW * invProjBiasZ;\n }\n vec4 ApplyShadowDepthBias_Perspective(vec4 shadowPos, float viewspaceDepthBias)\n {\n \tvec3 viewSpacePos;\n \tviewSpacePos.xy = shadowPos.xy * cc_shadowProjInfo.zw;\n \tviewSpacePos.z = GetViewSpaceDepthFromNDCDepth_Perspective(shadowPos.z, shadowPos.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n \tviewSpacePos.xyz += cc_shadowProjDepthInfo.z * normalize(viewSpacePos.xyz) * viewspaceDepthBias;\n \tvec4 clipSpacePos;\n \tclipSpacePos.xy = viewSpacePos.xy * cc_shadowProjInfo.xy;\n \tclipSpacePos.zw = viewSpacePos.z * cc_shadowProjDepthInfo.xz + vec2(cc_shadowProjDepthInfo.y, 0.0);\n \t#if CC_SHADOWMAP_USE_LINEAR_DEPTH\n \t\tclipSpacePos.z = GetLinearDepthFromViewSpace(viewSpacePos.xyz, cc_shadowNFLSInfo.x, cc_shadowNFLSInfo.y);\n \t\tclipSpacePos.z = (clipSpacePos.z * 2.0 - 1.0) * clipSpacePos.w;\n \t#endif\n \treturn clipSpacePos;\n }\n vec4 ApplyShadowDepthBias_Orthographic(vec4 shadowPos, float viewspaceDepthBias, float projScaleZ, float projBiasZ)\n {\n \tfloat coeffA = projScaleZ;\n \tfloat coeffB = projBiasZ;\n \tfloat viewSpacePos_z = GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowPos.z, projScaleZ, projBiasZ);\n \tviewSpacePos_z += viewspaceDepthBias;\n \tvec4 result = shadowPos;\n \tresult.z = viewSpacePos_z * coeffA + coeffB;\n \treturn result;\n }\n vec4 ApplyShadowDepthBias_PerspectiveLinearDepth(vec4 shadowPos, float viewspaceDepthBias, vec3 worldPos)\n {\n shadowPos.z = CCGetLinearDepth(worldPos, viewspaceDepthBias) * 2.0 - 1.0;\n shadowPos.z *= shadowPos.w;\n return shadowPos;\n }\n float CCGetDirLightShadowFactorHard (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetDirLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorHard (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorHard(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft3X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft3X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCGetSpotLightShadowFactorSoft5X (vec4 shadowPosWithDepthBias, vec3 worldPos) {\n\t vec3 shadowNDCPos;\n\t if (!GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias)) {\n\t\t return 1.0;\n\t }\n return NativePCFShadowFactorSoft5X(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy);\n }\n float CCSpotShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n float pcf = cc_shadowWHPBInfo.z;\n vec4 pos = vec4(1.0);\n #if CC_SHADOWMAP_USE_LINEAR_DEPTH\n pos = ApplyShadowDepthBias_PerspectiveLinearDepth(shadowPos, shadowBias.x, worldPos);\n #else\n pos = ApplyShadowDepthBias_Perspective(shadowPos, shadowBias.x);\n #endif\n float realtimeShadow = 1.0;\n if (pcf > 2.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft5X(pos, worldPos);\n }else if (pcf > 1.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft3X(pos, worldPos);\n }else if (pcf > 0.9) {\n realtimeShadow = CCGetSpotLightShadowFactorSoft(pos, worldPos);\n }else {\n realtimeShadow = CCGetSpotLightShadowFactorHard(pos, worldPos);\n }\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n float CCShadowFactorBase(out vec4 shadowPosWithDepthBias, vec4 shadowPos, vec3 N, vec2 shadowBias)\n {\n vec4 pos = ApplyShadowDepthBias_FaceNormal(shadowPos, N, shadowBias.y, cc_matLightView, cc_shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, cc_shadowProjDepthInfo.x, cc_shadowProjDepthInfo.y);\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n shadowPosWithDepthBias = pos;\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n }\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n bool CCGetCSMLevelWithTransition(out highp float ratio, vec3 clipPos) {\n highp float maxRange = 1.0 - cc_csmSplitsInfo.x;\n highp float minRange = cc_csmSplitsInfo.x;\n highp float thresholdInvert = 1.0 / cc_csmSplitsInfo.x;\n ratio = 0.0;\n if (clipPos.x <= minRange) {\n ratio = clipPos.x * thresholdInvert;\n return true;\n }\n if (clipPos.x >= maxRange) {\n ratio = 1.0 - (clipPos.x - maxRange) * thresholdInvert;\n return true;\n }\n if (clipPos.y <= minRange) {\n ratio = clipPos.y * thresholdInvert;\n return true;\n }\n if (clipPos.y >= maxRange) {\n ratio = 1.0 - (clipPos.y - maxRange) * thresholdInvert;\n return true;\n }\n return false;\n }\n bool CCHasCSMLevel(int level, vec3 worldPos) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n bool hasLevel = false;\n for (int i = 0; i < 4; i++) {\n if (i == level) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0) {\n hasLevel = true;\n }\n }\n }\n return hasLevel;\n }\n void CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos, int level) {\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && i == level) {\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n }\n }\n }\n int CCGetCSMLevel(out bool isTransitionArea, out highp float transitionRatio, out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n int level = -1;\n highp float layerThreshold = cc_csmViewDir0[0].w;\n for (int i = 0; i < 4; i++) {\n vec4 shadowPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n vec3 clipPos = shadowPos.xyz / shadowPos.w * 0.5 + 0.5;\n if (clipPos.x >= layerThreshold && clipPos.x <= (1.0 - layerThreshold) &&\n clipPos.y >= layerThreshold && clipPos.y <= (1.0 - layerThreshold) &&\n clipPos.z >= 0.0 && clipPos.z <= 1.0 && level < 0) {\n #if CC_CASCADED_LAYERS_TRANSITION\n isTransitionArea = CCGetCSMLevelWithTransition(transitionRatio, clipPos);\n #endif\n csmPos = cc_matCSMViewProj[i] * vec4(worldPos.xyz, 1.0);\n csmPos.xy = csmPos.xy * cc_csmAtlas[i].xy + cc_csmAtlas[i].zw;\n shadowProjDepthInfo = cc_csmProjDepthInfo[i];\n shadowProjInfo = cc_csmProjInfo[i];\n shadowViewDir0 = cc_csmViewDir0[i].xyz;\n shadowViewDir1 = cc_csmViewDir1[i].xyz;\n shadowViewDir2 = cc_csmViewDir2[i].xyz;\n level = i;\n }\n }\n return level;\n }\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos)\n {\n bool isTransitionArea = false;\n highp float transitionRatio = 0.0;\n return CCGetCSMLevel(isTransitionArea, transitionRatio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias)\n {\n bool isTransitionArea = false;\n highp float ratio = 0.0;\n csmPos = vec4(1.0);\n vec4 shadowProjDepthInfo, shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n int level = -1;\n #if CC_CASCADED_LAYERS_TRANSITION\n level = CCGetCSMLevel(isTransitionArea, ratio, csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #else\n level = CCGetCSMLevel(csmPos, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n #endif\n if (level < 0) { return 1.0; }\n vec4 pos = ApplyShadowDepthBias_FaceNormal(csmPos, N, shadowBias.y, shadowViewDir0, shadowViewDir1, shadowViewDir2, shadowProjInfo.xy);\n pos = ApplyShadowDepthBias_Orthographic(pos, shadowBias.x, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n csmPosWithBias = pos;\n float realtimeShadow = 1.0;\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n realtimeShadow = CCGetDirLightShadowFactorSoft5X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n realtimeShadow = CCGetDirLightShadowFactorSoft3X(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n realtimeShadow = CCGetDirLightShadowFactorSoft(pos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n realtimeShadow = CCGetDirLightShadowFactorHard(pos);\n #endif\n #if CC_CASCADED_LAYERS_TRANSITION\n vec4 nextCSMPos = vec4(1.0);\n vec4 nextShadowProjDepthInfo, nextShadowProjInfo;\n vec3 nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2;\n float nextRealtimeShadow = 1.0;\n CCGetCSMLevel(nextCSMPos, nextShadowProjDepthInfo, nextShadowProjInfo, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, worldPos, level + 1);\n bool hasNextLevel = CCHasCSMLevel(level + 1, worldPos);\n if (hasNextLevel && isTransitionArea) {\n vec4 nexPos = ApplyShadowDepthBias_FaceNormal(nextCSMPos, N, shadowBias.y, nextShadowViewDir0, nextShadowViewDir1, nextShadowViewDir2, nextShadowProjInfo.xy);\n nexPos = ApplyShadowDepthBias_Orthographic(nexPos, shadowBias.x, nextShadowProjDepthInfo.x, nextShadowProjDepthInfo.y);\n #if CC_DIR_SHADOW_PCF_TYPE == 3\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft5X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 2\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft3X(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 1\n nextRealtimeShadow = CCGetDirLightShadowFactorSoft(nexPos);\n #endif\n #if CC_DIR_SHADOW_PCF_TYPE == 0\n nextRealtimeShadow = CCGetDirLightShadowFactorHard(nexPos);\n #endif\n return mix(mix(nextRealtimeShadow, realtimeShadow, ratio), 1.0, cc_shadowNFLSInfo.w);\n }\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #else\n return mix(realtimeShadow, 1.0, cc_shadowNFLSInfo.w);\n #endif\n }\n #else\n int CCGetCSMLevel(out vec4 csmPos, out vec4 shadowProjDepthInfo, out vec4 shadowProjInfo, out vec3 shadowViewDir0, out vec3 shadowViewDir1, out vec3 shadowViewDir2, vec3 worldPos) {\n return -1;\n }\n float CCCSMFactorBase(out vec4 csmPos, out vec4 csmPosWithBias, vec3 worldPos, vec3 N, vec2 shadowBias) {\n csmPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n return CCShadowFactorBase(csmPosWithBias, csmPos, N, shadowBias);\n }\n #endif\n float CCShadowFactorBase(vec4 shadowPos, vec3 N, vec2 shadowBias) {\n vec4 shadowPosWithDepthBias;\n return CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, N, shadowBias);\n }\n float CCCSMFactorBase(vec3 worldPos, vec3 N, vec2 shadowBias) {\n vec4 csmPos, csmPosWithBias;\n return CCCSMFactorBase(csmPos, csmPosWithBias, worldPos, N, shadowBias);\n }\n float CCSpotShadowFactorBase(vec4 shadowPos, vec3 worldPos, vec2 shadowBias)\n {\n vec4 shadowPosWithDepthBias;\n return CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n#endif\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform highp vec4 cc_reflectionProbeData1;\n uniform highp vec4 cc_reflectionProbeData2;\n uniform highp vec4 cc_reflectionProbeBlendData1;\n uniform highp vec4 cc_reflectionProbeBlendData2;\n vec4 GetTexData(sampler2D dataMap, float dataMapWidth, float x, float uv_y)\n {\n return vec4(\n decode32(texture2D(dataMap, vec2(((x + 0.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 1.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 2.5)/dataMapWidth), uv_y))),\n decode32(texture2D(dataMap, vec2(((x + 3.5)/dataMapWidth), uv_y)))\n );\n }\n void GetPlanarReflectionProbeData(out vec4 plane, out float planarReflectionDepthScale, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n plane.xyz = texData1.xyz;\n plane.w = texData2.x;\n planarReflectionDepthScale = texData2.y;\n mipCount = texData2.z;\n #else\n plane = cc_reflectionProbeData1;\n planarReflectionDepthScale = cc_reflectionProbeData2.x;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n }\n void GetCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeData1.xyz;\n boxHalfSize = cc_reflectionProbeData2.xyz;\n mipCount = cc_reflectionProbeData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n bool isReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeData2.w > 1000.0;\n #endif\n }\n bool isBlendReflectProbeUsingRGBE(float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n return texData3.x > 1000.0;\n #else\n return cc_reflectionProbeBlendData2.w > 1000.0;\n #endif\n }\n void GetBlendCubeReflectionProbeData(out vec3 centerPos, out vec3 boxHalfSize, out float mipCount, float probeId)\n {\n #if USE_INSTANCING\n float uv_y = (probeId + 0.5) / cc_probeInfo.x;\n float dataMapWidth = 12.0;\n vec4 texData1 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 0.0, uv_y);\n vec4 texData2 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 4.0, uv_y);\n vec4 texData3 = GetTexData(cc_reflectionProbeDataMap, dataMapWidth, 8.0, uv_y);\n centerPos = texData1.xyz;\n boxHalfSize = texData2.xyz;\n mipCount = texData3.x;\n #else\n centerPos = cc_reflectionProbeBlendData1.xyz;\n boxHalfSize = cc_reflectionProbeBlendData2.xyz;\n mipCount = cc_reflectionProbeBlendData2.w;\n #endif\n if (mipCount > 1000.0) mipCount -= 1000.0;\n }\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n void SampleAndDecodeLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n #if CC_LIGHT_MAP_VERSION > 2\n #elif CC_LIGHT_MAP_VERSION > 1\n \tvec4 dataLow = texture2D(lightingMap, luv);\n \tvec4 dataHigh = texture2D(lightingMap, luv + vec2(0.5, 0.0));\n \tlightmapColor.xyz = dataLow.xyz + dataHigh.xyz * 0.00392156862745098;\n lightmapColor.rgb *= lum;\n \tdirShadow = dataLow.a;\n \tao = dataHigh.a;\n #else\n vec4 lightmap = texture2D(lightingMap, luv);\n lightmapColor = lightmap.rgb * lum;\n \tdirShadow = lightmap.a;\n \tao = 1.0;\n #endif\n }\n void GetLightMapColor(out vec3 lightmapColor, out float dirShadow, out float ao, sampler2D lightingMap, vec2 luv, float lum, vec3 worldNormal)\n {\n \tvec4 lightmap;\n \tvec2 occlusion;\n \tSampleAndDecodeLightMapColor(lightmapColor, dirShadow, ao, lightingMap, luv, lum, worldNormal);\n #if CC_USE_HDR\n lightmapColor.rgb *= cc_exposure.w * cc_exposure.x;\n #endif\n }\n#endif\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n uniform vec4 pbrParams;\n uniform vec4 emissive;\n uniform vec4 emissiveScaleParam;\n uniform vec4 anisotropyParam;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n vec4 baseColor = albedo;\n #if USE_VERTEX_COLOR\n baseColor.rgb *= SRGBToLinear(FSInput_vertexColor.rgb);\n baseColor.a *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n vec4 texColor = texture2D(albedoMap, ALBEDO_UV);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n baseColor *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;\n #endif\n baseColor.rgb *= albedoScaleAndCutoff.xyz;\n return baseColor;\n}\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n vec3 normal = FSInput_worldNormal;\n #if USE_NORMAL_MAP\n vec3 nmmp = texture2D(normalMap, NORMAL_UV).xyz - vec3(0.5);\n normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleParam.w, normalize(normal.xyz), normalize(FSInput_worldTangent), FSInput_mirrorNormal);\n #endif\n return normalize(normal);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n float anisotropyRotation = anisotropyParam.y * PI;\n float anisotropyShape = anisotropyParam.x;\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 tex = texture2D(anisotropyMap, DEFAULT_UV);\n anisotropyRotation = fract(anisotropyRotation * 0.5 + tex.y) * PI2;\n anisotropyShape *= tex.x;\n #endif\n #if FIX_ANISOTROPIC_ROTATION_MAP\n #if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n vec4 reference = texture2D(anisotropyMapNearestFilter, DEFAULT_UV);\n vec2 oneTap = vec2(0.0, 1.0 / anisotropyParam.w);\n float threshold = 0.2;\n vec4 sample1 = texture2D(anisotropyMapNearestFilter, DEFAULT_UV + oneTap);\n vec4 sample2 = texture2D(anisotropyMapNearestFilter, DEFAULT_UV - oneTap);\n if (abs(sample1.y - reference.y) > threshold || abs(sample2.y - reference.y) > threshold) {\n tex.y = reference.y;\n }\n anisotropyRotation = fract(anisotropyParam.y * PI * 0.5 + tex.y) * PI2;\n #endif\n #endif\n isRotation = 1.0;\n return vec4(anisotropyShape, anisotropyRotation, 0.0, 0.0);\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n vec3 emissive = emissive.rgb;\n #if USE_EMISSIVE_MAP\n emissive = SRGBToLinear(texture2D(emissiveMap, EMISSIVE_UV).rgb);\n #endif\n return emissive * emissiveScaleParam.xyz;\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n vec4 pbr = pbrParams;\n pbr.x = 1.0;\n #if USE_PBR_MAP\n vec4 res = texture2D(pbrMap, DEFAULT_UV);\n pbr.x = mix(1.0, res.r, pbrParams.x);\n pbr.y *= res.g;\n pbr.z *= res.b;\n pbr.w *= res.a;\n #endif\n #if USE_OCCLUSION_MAP\n pbr.x = mix(1.0, texture2D(occlusionMap, DEFAULT_UV).r, pbrParams.x);\n #endif\n return pbr;\n}\nstruct LightingIntermediateData\n{\n vec3 N, H, L, V;\n float distToLight, distToLightSqr;\n float distToCamera, distToCameraSqr;\n float angleAttenuation, distAttenuation;\n float NoL, NoV, NoH, VoH;\n float NoLSat, NoVSat, NoHSat;\n float NoVAbsSat, VoHAbsSat;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPosition, worldPosition_fract_part;\n #else\n vec3 worldPosition;\n #endif\n vec3 T, B;\n float specularParam;\n float ior, layerOpacity;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 shadowPosAndDepth;\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitScatteringParams;\n vec3 outScatteringColor, inScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n};\nvoid CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , float anisotropyShape\n#endif\n)\n{\n data.N = worldNormal;\n data.V = cc_cameraPos.xyz - worldPos;\n data.distToCameraSqr = dot(data.V, data.V);\n data.distToCamera = sqrt(data.distToCameraSqr);\n data.V /= data.distToCamera;\n data.angleAttenuation = data.distAttenuation = 1.0;\n data.NoV = dot(data.N, data.V);\n data.NoVSat = max(data.NoV, 0.0);\n data.NoVAbsSat = max(abs(data.NoV), 0.0);\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(data.worldPosition, data.worldPosition_fract_part, worldPos);\n #else\n data.worldPosition = worldPos;\n #endif\n data.T = worldTangent;\n data.B = worldBinormal;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n data.anisotropyShape = anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.outScatteringColor = vec3(1.0);\n data.inScatteringColor = vec3(0.0);\n data.transmitScatteringParams = vec4(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n data.shadowPosAndDepth = vec4(0.0, 0.0, SURFACES_MAX_TRANSMIT_DEPTH_VALUE, SURFACES_MAX_TRANSMIT_DEPTH_VALUE);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n data.baseColorTT = vec3(0.0);\n data.ttIntensity = data.ttScatterCoef = 0.0;\n#endif\n}\nvoid CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)\n{\n data.L = lightDirWithDist;\n data.distToLightSqr = dot(data.L, data.L);\n data.distToLight = sqrt(data.distToLightSqr);\n data.L /= data.distToLight;\n data.H = normalize(data.L + data.V);\n data.NoL = dot(data.N, data.L);\n data.NoH = dot(data.N, data.H);\n data.VoH = dot(data.V, data.H);\n data.NoLSat = max(data.NoL, 0.0);\n data.NoHSat = max(data.NoH, 0.0);\n data.VoHAbsSat = max(abs(data.VoH), 0.0);\n}\nstruct LightingResult\n{\n vec3 diffuseColorWithLighting, specularColorWithLighting;\n vec3 directDiffuse, directSpecular, directGF;\n vec3 environmentDiffuse, environmentSpecular, environmentGF;\n float shadow, ao;\n vec3 lightmapColor;\n vec3 emissive;\n vec3 fresnel;\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n vec3 directDiffuseSubLayers, directSpecularSubLayers;\n vec3 environmentDiffuseSubLayers, environmentSpecularSubLayers;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 directTransmitSpecular, environmentTransmitSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 directTransmitDiffuse, environmentTransmitDiffuse;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 direct2ndSpecular, environment2ndSpecular;\n vec3 specularColorWithLighting2ndSpecular;\n vec3 directGF2ndSpecular, environmentGF2ndSpecular;\n vec3 directSubLayerF, environmentSubLayerF;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 directTT;\n vec3 diffuseColorWithLightingTT;\n#endif\n};\nstruct LightingMiscData\n{\n float lightType;\n vec3 lightPos, lightDir;\n vec4 lightColorAndIntensity;\n vec4 lightSizeRangeAngle;\n};\nfloat square(float a) { return a * a;}\nvec2 square(vec2 a) { return a * a;}\nvec3 square(vec3 a) { return a * a;}\nfloat G_Schlick( float roughness, float NoV, float NoL )\n{\n\tfloat k = square( 0.5 + 0.5*roughness );\n\tfloat G_SchlickV = NoV * (1.0 - k) + k;\n\tfloat G_SchlickL = NoL * (1.0 - k) + k;\n\treturn 0.25 / ( G_SchlickV * G_SchlickL );\n}\nvec3 F_SchlickMultiplier( vec3 specularColor, float VoH )\n{\n\tfloat Fc = exp2( (-5.55473 * VoH - 6.98316) * VoH );\n float selfShadowTerm = saturate(50.0 * specularColor.g);\n return vec3(1.0 - Fc) + vec3(selfShadowTerm * Fc) / (specularColor + vec3(EPSILON));\n}\nfloat D_GGX(float roughness, float NoH)\n{\n float m = roughness * roughness;\n float m2 = m * m;\n float d = (NoH * m2 - NoH) * NoH + 1.0;\n return m2 / max(EPSILON, d * d);\n}\nfloat D_GGXMobile(float roughness, float NoH) {\n float OneMinusNoHSqr = 1.0 - NoH * NoH;\n float a = roughness * roughness;\n float n = NoH * a;\n float p = a / max(EPSILON, OneMinusNoHSqr + n * n);\n return p * p;\n}\nvoid GetAnisotropicRoughness(float roughness, float anisotropyShape, out float roughnessX, out float roughnessY)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n float r1 = roughness, r2 = roughness;\n float lerpedRoughness = mix(1.0, 10.0, anisotropyShape);\n r2 *= shapeSign < 0.0 ? lerpedRoughness : 1.0;\n r1 *= shapeSign > 0.0 ? lerpedRoughness : 1.0;\n roughnessX = saturate(r1);\n roughnessY = saturate(r2);\n}\nfloat D_GGXAniso(float RoughnessX, float RoughnessY, float NoH, vec3 H, vec3 X, vec3 Y)\n{\n float mx = max(EPSILON_LOWP, RoughnessX * RoughnessX);\n float my = max(EPSILON_LOWP, RoughnessY * RoughnessY);\n float XoH = dot(X, H);\n float YoH = dot(Y, H);\n float d = XoH * XoH / (mx * mx) + YoH * YoH / (my * my) + NoH * NoH;\n return 1.0 / max(EPSILON_LOWP, mx * my * d * d);\n}\nvec3 GetAnisotropicReflect(float roughness, float anisotropyShape, vec3 V, vec3 N, vec3 X, vec3 Y)\n{\n float shapeSign = sign(anisotropyShape);\n anisotropyShape *= anisotropyShape;\n anisotropyShape = min(anisotropyShape, 0.4);\n anisotropyShape *= smoothstep(0.0, 0.03, roughness);\n vec3 reflectTarget = shapeSign < 0.0 ? mix(N, -Y, anisotropyShape) :\n shapeSign > 0.0 ? mix(N, -X, anisotropyShape) : N;\n return reflect(-V, reflectTarget);\n}\nvoid IntegratedGFMultiplier (out vec3 integratedGF, out vec3 integratedF, vec3 specular, float roughness, float NoV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);\n integratedF = vec3(max(0.0, AB.x));\n integratedGF = max(vec3(0.0), vec3(AB.x) + vec3(AB.y) / (specular + EPSILON_LOWP));\n}\nfloat Sheen_HorizonFading(float NoL)\n{\n const float horizonFade = 1.3;\n float horiz = saturate( 1.0 + horizonFade * NoL);\n return horiz * horiz;\n}\nfloat Sheen(float NoHSat, float NoL, float NoV, float roughness)\n{\n if (NoL <= 0.0 || NoV <= 0.0)\n return 0.0;\n float NoH2 = NoHSat*NoHSat;\n float NoL2 = NoL*NoL;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoH2 + NoH2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Li = sqrt(1.0 - NoL2 + r2*NoL2) / NoL;\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-(Li + Lo))) / (Li + Lo);\n return Sheen_HorizonFading(NoL) * Pi_D * G / NoV;\n}\nfloat Sheen(float NoV, float roughness)\n{\n NoV *= NoV;\n float NoV2 = NoV*NoV;\n roughness += EPSILON_LOWP;\n float r2 = roughness*roughness;\n float t = 1.0 - NoV2 + NoV2/r2;\n float Pi_D = 1.0 / (roughness * t * t);\n float Lo = sqrt(1.0 - NoV2 + r2*NoV2) / NoV;\n float G = (1.0 - exp(-Lo)) / Lo;\n float sheen = Pi_D * G / NoV;\n return pow(max(0.0, sheen), 0.5);\n}\n#define DiffuseCoefficient_EnergyConservation INV_PI\nfloat CalculateFresnelCoefficient(float ior, float NoVSat)\n{\n\tfloat g, c, n, prev, next;\n\tn = ior;\n\tc = ior * NoVSat;\n\tg = sqrt(1.0 + c * c - c);\n\tprev = (g - c) / (g + c);\n\tnext = (c * (g+c) - n*n) / (c * (g-c) + n*n);\n\tprev *= prev;\n\tnext *= next;\n\treturn 0.5 * prev * (1.0 + next);\n}\nfloat CalculateFresnelCoefficient(float F0, float F90, float NoVSat)\n{\n return mix(F90, F0, NoVSat);\n}\nvec3 CalculateScattering(vec3 unscatteredColor, float distance, float outScatterExtinctCoef, float inScatterExtinctCoef, float inScatterCoef, vec3 inScatterColor, vec3 outScatterColor)\n{\n vec2 e = vec2(outScatterExtinctCoef, inScatterExtinctCoef * inScatterCoef);\n vec2 extinction = exp(-e * distance);\n vec3 inScattered = (1.0 - extinction.y) * inScatterColor;\n vec3 outScattered = unscatteredColor * extinction.x * outScatterColor;\n return outScattered + inScattered;\n}\nvoid InitializeLayerBlending(out vec3 blendedBaseLayerD, out vec3 blendedBaseLayerS,\n out vec3 blendedSubLayerD, out vec3 blendedSubLayerS,\n out vec3 lastLayerF,\n in vec3 baseD, in vec3 baseS\n )\n{\n blendedBaseLayerD = baseD;\n blendedBaseLayerS = baseS;\n blendedSubLayerD = blendedSubLayerS = vec3(0.0);\n lastLayerF = vec3(1.0);\n}\nvoid CalculateLayerBlending(inout vec3 blendedBaseLayerD, inout vec3 blendedBaseLayerS,\n inout vec3 blendedSubLayerD, inout vec3 blendedSubLayerS,\n inout vec3 lastLayerF,\n in vec3 subLayerD, in vec3 subLayerDiffuseColor,\n in vec3 subLayerS, in vec3 subLayerSpecularColor,\n in float subLayerOpacity, inout vec3 subLayerF\n )\n{\n subLayerF = saturate(subLayerF * subLayerOpacity);\n blendedSubLayerD = blendedSubLayerD * (vec3(1.0) - lastLayerF) + subLayerD * subLayerDiffuseColor * subLayerF;\n blendedSubLayerS = blendedSubLayerS *(vec3(1.0) - lastLayerF) + subLayerS * subLayerSpecularColor * subLayerF;\n blendedBaseLayerD *= vec3(1.0) - subLayerF;\n blendedBaseLayerS *= vec3(1.0) - subLayerF;\n lastLayerF = subLayerF;\n}\nfloat SmoothDistAtt (float distSqr, float invSqrAttRadius) {\n float factor = distSqr * invSqrAttRadius;\n float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);\n return smoothFactor * smoothFactor;\n}\nfloat GetDistAtt (float distSqr, float invSqrAttRadius) {\n float attenuation = 1.0 / max(distSqr, 0.01*0.01);\n attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);\n return attenuation;\n}\nfloat GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {\n float cd = dot(litDir, L);\n float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);\n return (attenuation * attenuation);\n}\nfloat GetOutOfRange (vec3 worldPos, vec3 lightPos, vec3 lookAt, vec3 right, vec3 BoundingHalfSizeVS) {\n vec3 v = vec3(0.0);\n vec3 up = cross(right, lookAt);\n worldPos -= lightPos;\n v.x = dot(worldPos, right);\n v.y = dot(worldPos, up);\n v.z = dot(worldPos, lookAt);\n vec3 result = step(abs(v), BoundingHalfSizeVS);\n return result.x * result.y * result.z;\n}\nfloat CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange, float lightType)\n{\n float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);\n attRadiusSqrInv *= attRadiusSqrInv;\n float litRadiusSqr = lightRadius * lightRadius;\n float edgeAttenuation = (IS_POINT_LIGHT(lightType) || IS_RANGED_DIRECTIONAL_LIGHT(lightType)) ? 1.0 : litRadiusSqr / max(litRadiusSqr, distToLightSqr);\n return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;\n}\nfloat CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)\n{\n float cosInner = max(dot(spotLightDir, L), 0.01);\n float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);\n float litAngleOffset = -cosAngleOuter * litAngleScale;\n return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);\n}\nvec3 CalculateRefractDirection(vec3 N, vec3 V, float NoV, float ior)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n float cosA = abs(NoV);\n float sinA = sqrt(1.0 - cosA * cosA);\n float sinB = saturate(sinA / ior);\n float cosB = sqrt(1.0 - sinB * sinB);\n vec3 edgeA = -V + N * cosA;\n vec3 edgeB = normalize(edgeA) * sinB;\n vec3 R = edgeB - N * cosB;\n return R;\n}\nvec3 CalculateReflectDirection(vec3 N, vec3 V, float NoV)\n{\n float sideSign = NoV < 0.0 ? -1.0 : 1.0;\n N *= sideSign;\n return reflect(-V, N);\n}\nvec3 CalculatePlanarReflectPositionOnPlane(vec3 N, vec3 V, vec3 worldPos, vec4 plane, vec3 cameraPos, float probeReflectedDepth)\n{\n float distPixelToPlane = -dot(plane, vec4(worldPos, 1.0));\n plane.w += distPixelToPlane;\n float distCameraToPlane = abs(-dot(plane, vec4(cameraPos, 1.0)));\n vec3 planeN = plane.xyz;\n vec3 virtualCameraPos = cameraPos - 2.0 * distCameraToPlane * planeN;\n vec3 bumpedR = normalize(reflect(-V, N));\n vec3 reflectedPointPos = worldPos + probeReflectedDepth * bumpedR;\n vec3 virtualCameraToReflectedPoint = normalize(reflectedPointPos - virtualCameraPos);\n float y = distCameraToPlane / max(EPSILON_LOWP, dot(planeN, virtualCameraToReflectedPoint));\n return virtualCameraPos + y * virtualCameraToReflectedPoint;\n}\nvec4 CalculateBoxProjectedDirection(vec3 R, vec3 worldPos, vec3 cubeCenterPos, vec3 cubeBoxHalfSize)\n{\n vec3 W = worldPos - cubeCenterPos;\n vec3 projectedLength = (sign(R) * cubeBoxHalfSize - W) / (R + vec3(EPSILON));\n float len = min(min(projectedLength.x, projectedLength.y), projectedLength.z);\n vec3 P = W + len * R;\n float weight = len < 0.0 ? 0.0 : 1.0;\n return vec4(P, weight);\n}\nvec3 CalculateDirectDiffuse(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n return irradiance * DiffuseCoefficient_EnergyConservation;\n}\nvec3 CalculateDirectSpecular(in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float rT, rB;\n GetAnisotropicRoughness(roughness, lightingData.anisotropyShape, rT, rB);\n float calcSpec = D_GGXAniso(rT, rB, lightingData.NoHSat, lightingData.H, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n float calcSpec = (roughness * 0.25 + 0.25) * D_GGXMobile(roughness, lightingData.NoHSat);\n #else\n float calcSpec = D_GGX(roughness, lightingData.NoHSat);\n #endif\n #endif\n return irradiance * calcSpec;\n}\n#if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 EnvAnisotropicReflection(samplerCube tex, vec3 R, float roughness, float mipCount, float anisotropyShape, vec3 V, vec3 N, vec3 T, vec3 B) {\n R = normalize(R);\n float integratedBRDF = 0.0;\n vec3 envSpec = vec3(0.0);\n const int SAMPLE_STEP_COUNT = CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT;\n float sampleAngleRange = PI * abs(anisotropyShape);\n vec3 anisoDirection = anisotropyShape < 0.0 ? T : B;\n vec3 ROnNormalPlane = normalize(R - anisoDirection * dot(R, anisoDirection));\n vec3 stepOffset = normalize(ROnNormalPlane - N) * (sampleAngleRange / float(SAMPLE_STEP_COUNT * 2));\n for (int i = -SAMPLE_STEP_COUNT; i <= SAMPLE_STEP_COUNT; ++i)\n {\n float rT, rB;\n GetAnisotropicRoughness(roughness, anisotropyShape, rT, rB);\n #if CC_IBL_CONVOLUTED\n float coef = abs(float(i)) / float(SAMPLE_STEP_COUNT) * float(SAMPLE_STEP_COUNT);\n #else\n float coef = pow(abs(float(i)) / float(SAMPLE_STEP_COUNT), 1.3) * float(SAMPLE_STEP_COUNT);\n #endif\n vec3 H = normalize(N + stepOffset * sign(float(i)) * coef);\n vec3 L = reflect(-V, H);\n float NoHSat = saturate(dot(N, H));\n float calcSpec = D_GGXAniso(rT, rB, NoHSat, H, T, B);\n envSpec += calcSpec * EnvReflection(tex, L, roughness, mipCount);\n integratedBRDF += calcSpec;\n }\n envSpec /= integratedBRDF;\n return envSpec;\n }\n#endif\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, R, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflection(tex, R, roughness, mipCount);\n #endif\n #endif\n return envSpec;\n}\nvec3 SampleEnvironmentSpecular(samplerCube tex, in LightingIntermediateData lightingData, float mipCount, vec3 worldPos, vec3 cubeCenterPos, vec3 boxHalfSize, bool isRGBE)\n{\n vec3 envSpec = vec3(0.0);\n float roughness = lightingData.specularParam;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #else\n vec3 R = CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV);\n #endif\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, cubeCenterPos, boxHalfSize);\n R = fixedR.xyz;\n vec3 envmap = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).xyz * cc_ambientSky.w;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n envSpec = EnvAnisotropicReflection(tex, fixedR.xyz, roughness, mipCount, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #else\n #if CC_SURFACES_USE_REFLECTION_DENOISE && !CC_IBL_CONVOLUTED\n envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, mipCount, 0.6);\n #else\n envSpec = EnvReflectionOfReflectionProbe(tex, R, roughness, mipCount, isRGBE);\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = mix(envmap, envSpec, fixedR.w);\n #endif\n #endif\n #endif\n return envSpec;\n}\nvec3 CalculateEnvironmentDiffuse(in LightingIntermediateData lightingData, float lightIntensity)\n{\n float fAmb = max(EPSILON, 0.5 - lightingData.N.y * 0.5);\n vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);\n #if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP && !CC_USE_LIGHT_PROBE\n vec3 rotationDir = RotationVecFromAxisY(lightingData.N, cc_surfaceTransform.z, cc_surfaceTransform.w);\n vec4 diffuseMap = textureCube(cc_diffuseMap, rotationDir);\n #if CC_USE_DIFFUSEMAP == 2\n ambDiff = unpackRGBE(diffuseMap);\n #else\n ambDiff = SRGBToLinear(diffuseMap.rgb);\n #endif\n #endif\n #endif\n ambDiff.rgb *= lightIntensity;\n #if CC_USE_LIGHT_PROBE\n ambDiff.rgb += SHEvaluate(lightingData.N);\n #endif\n return ambDiff.rgb;\n}\nvec3 CalculateEnvironmentSpecular(in LightingIntermediateData lightingData, float lightIntensity)\n{\n vec3 envSpec = vec3(0.0);\n#if CC_USE_REFLECTION_PROBE\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(lightingData.worldPosition, lightingData.worldPosition_fract_part);\n #else\n worldPos = lightingData.worldPosition;\n #endif\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_PLANAR\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n if(FSInput_reflectionProbeId < 0.0){\n vec2 screenUV = GetPlanarReflectScreenUV(worldPos, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, 1.0)).xyz;\n }else{\n vec4 plane;\n float planarReflectionDepthScale, mipCount;\n GetPlanarReflectionProbeData(plane, planarReflectionDepthScale, mipCount, FSInput_reflectionProbeId);\n vec3 worldPosOffset = CalculatePlanarReflectPositionOnPlane(lightingData.N, lightingData.V, worldPos, plane, cc_cameraPos.xyz, planarReflectionDepthScale);\n vec2 screenUV = GetPlanarReflectScreenUV(worldPosOffset, cc_matViewProj, cc_cameraPos.w, lightingData.V, R);\n envSpec = unpackRGBE(fragTextureLod(cc_reflectionProbePlanarMap, screenUV, mipCount)).xyz;\n }\n #elif CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n if(FSInput_reflectionProbeId < 0.0){\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n }else{\n vec3 centerPos, boxHalfSize;\n float mipCount;\n GetCubeReflectionProbeData(centerPos, boxHalfSize, mipCount, FSInput_reflectionProbeId);\n envSpec = SampleEnvironmentSpecular(cc_reflectionProbeCubemap, lightingData, mipCount, worldPos, centerPos, boxHalfSize, isReflectProbeUsingRGBE(FSInput_reflectionProbeId));\n float blendFactor = 0.0;\n #if USE_INSTANCING\n blendFactor = FSInput_reflectionProbeData.x;\n #else\n blendFactor = cc_reflectionProbeBlendData1.w;\n #endif\n if(FSInput_reflectionProbeBlendId < 0.0)\n {\n vec3 skyBoxEnv = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w).rgb * lightIntensity;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n envSpec = mix(envSpec, skyBoxEnv, blendFactor);\n #else\n vec3 R = normalize(CalculateReflectDirection(lightingData.N, lightingData.V, lightingData.NoV));\n vec4 fixedR = CalculateBoxProjectedDirection(R, worldPos, centerPos, boxHalfSize);\n envSpec = mix(skyBoxEnv, envSpec, fixedR.w);\n #endif\n }else{\n vec3 centerPosBlend, boxHalfSizeBlend;\n float mipCountBlend;\n GetBlendCubeReflectionProbeData(centerPosBlend, boxHalfSizeBlend, mipCountBlend, FSInput_reflectionProbeBlendId);\n vec3 probeBlend = SampleEnvironmentSpecular(cc_reflectionProbeBlendCubemap, lightingData, mipCountBlend, worldPos, centerPosBlend, boxHalfSizeBlend, isBlendReflectProbeUsingRGBE(FSInput_reflectionProbeBlendId));\n envSpec = mix(envSpec, probeBlend, blendFactor);\n }\n }\n #endif\n#elif CC_USE_IBL\n envSpec = SampleEnvironmentSpecular(cc_environment, lightingData, cc_ambientGround.w);\n#endif\n #if CC_USE_REFLECTION_PROBE\n lightIntensity = FSInput_reflectionProbeId < 0.0 ? lightIntensity : 1.0;\n #endif\n return envSpec * lightIntensity;\n}\nbool CCSurfacesLightingEnableShadow(in float NoL)\n{\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n return true;\n#elif CC_SURFACES_LIGHTING_SSS\n return true;\n#else\n return NoL > 0.0;\n#endif\n}\nfloat CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in float lightType)\n{\n return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y, lightType);\n}\nfloat CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)\n{\n return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);\n}\nvoid CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateDirectSpecular(lightingData, lightSourceColorAndIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvoid CCSurfacesLightingCalculateEnvironment(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n{\n#if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n lightingDiffuse = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n#else\n lightingDiffuse = vec3(0.0);\n#endif\n#if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n lightingSpecular = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n#else\n lightingSpecular = vec3(0.0);\n#endif\n}\nvec3 CCSurfaceLightingCalculateExtraFresnel(in LightingIntermediateData lightingData)\n{\n float fresnel = CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVAbsSat);\n return vec3(fresnel);\n}\nvoid CCSurfaceLightingCalculateDirectFresnel(out vec3 directGF, in LightingIntermediateData lightingData, vec3 specularColor, in vec3 environmentGF)\n{\n #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n directGF = environmentGF;\n #else\n float roughness = lightingData.specularParam;\n directGF = F_SchlickMultiplier(specularColor, lightingData.VoHAbsSat) * G_Schlick(roughness, lightingData.NoVSat, lightingData.NoLSat);\n #endif\n}\nvoid CCSurfaceLightingCalculateEnvironmentFresnel(out vec3 integratedGF, vec3 integratedF, in LightingIntermediateData lightingData, vec3 specularColor)\n{\n float roughness = lightingData.specularParam;\n IntegratedGFMultiplier(integratedGF, integratedF, specularColor, roughness, lightingData.NoVAbsSat);\n}\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfaceLightingCalculateDirectSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n float VoH = lightingData.VoHAbsSat;\n \tsubLayerF = vec3(exp2( (-5.55473 * VoH - 6.98316) * VoH ));\n }\n void CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(out vec3 subLayerF, in LightingIntermediateData lightingData, vec3 specularColor)\n {\n subLayerF = vec3(CalculateFresnelCoefficient(lightingData.ior, lightingData.NoVSat));\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n void CCSurfacesLightingCalculateDirectTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n float roughness = lightingData.specularParam;\n float NoLSat = saturate(dot(lightingData.N, -lightingData.L));\n vec3 irradiance = NoLSat * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float RoL = dot(lightingData.L, normalize(R));\n float calcSpec = D_GGX(roughness, saturate(RoL));\n lightingSpecular = irradiance * calcSpec;\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitSpecular(out vec3 lightingSpecular, in LightingIntermediateData lightingData, float lightIntensity)\n {\n vec3 envSpec = vec3(0.0);\n vec3 R = CalculateRefractDirection(lightingData.N, lightingData.V, lightingData.NoV, lightingData.ior);\n float roughness = lightingData.specularParam;\n #if CC_USE_REFLECTION_PROBE\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_reflectionProbeCubemap, R, roughness, cc_ambientGround.w);\n #endif\n #endif\n #if CC_USE_IBL && CC_USE_REFLECTION_PROBE != REFLECTION_PROBE_TYPE_CUBE\n envSpec = EnvReflection(cc_environment, R, roughness, cc_ambientGround.w);\n #endif\n lightingSpecular = CalculateScattering(envSpec * lightIntensity, lightingData.transmitScatteringParams.w, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n }\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define objectThickness lightingData.transmitDiffuseParams.x\n #define transmitMask lightingData.transmitDiffuseParams.y\n #define envTransmitScale lightingData.transmitDiffuseParams.z\n #define envFixedDistanceScale lightingData.transmitScatteringParams.w\n #define transmitDistanceScale lightingData.transmitDiffuseParams.w\n #define DONOT_USE_SHADOWMAP_DISTANCE ((abs(float(lightingData.shadowPosAndDepth.z) - float(lightingData.shadowPosAndDepth.w)) < EPSILON) && (abs(float(lightingData.shadowPosAndDepth.z) - float(SURFACES_MAX_TRANSMIT_DEPTH_VALUE)) < EPSILON))\n #define SHADOWMAP_DISTANCE max(lightingData.shadowPosAndDepth.w - lightingData.shadowPosAndDepth.z, 0.0)\n void CCSurfacesLightingCalculateDirectTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float shadow)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n distance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n shadow = step(SHADOWMAP_DISTANCE, objectThickness) > 0.0 ? 1.0 : shadow;\n }\n vec3 backIrradiance = CalculateDirectDiffuse(lightingData, lightSourceColorAndIntensity);\n backIrradiance *= shadow * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(out vec3 transmitDiffuse, in LightingIntermediateData lightingData, float lightIntensity, float ao, vec3 shadowLightDirection)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_DIFFUSE\n float distance = lightingData.transmitScatteringParams.w;\n if (!DONOT_USE_SHADOWMAP_DISTANCE)\n {\n float shadowMapDistance = transmitDistanceScale * SHADOWMAP_DISTANCE;\n float fixedDistance = transmitDistanceScale * envFixedDistanceScale;\n float lerpCoef = saturate(dot(lightingData.N, shadowLightDirection));\n distance = mix(fixedDistance, shadowMapDistance, lerpCoef);\n }\n vec3 backIrradiance = CalculateEnvironmentDiffuse(lightingData, lightIntensity);\n backIrradiance *= ao * transmitMask;\n transmitDiffuse = CalculateScattering(backIrradiance, distance, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.x, lightingData.transmitScatteringParams.y, lightingData.inScatteringColor.rgb, lightingData.outScatteringColor.rgb);\n transmitDiffuse *= envTransmitScale;\n #else\n transmitDiffuse = vec3(0.0);\n #endif\n }\n #undef objectThickness\n #undef transmitMask\n #undef envTransmitScale\n #undef envFixedDistanceScale\n #undef DONOT_USE_SHADOWMAP_DISTANCE\n #undef SHADOWMAP_DISTANCE\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #ifndef CC_SURFACES_FRAGMENT_MODIFY_2ND_SPECULAR_COLOR\n #endif\n void CCSurfacesLightingCalculateDirect2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n CCSurfacesLightingCalculateDirect(unused, specularLighting, lightingData, lightSourceColorAndIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironment2ndSpecular(out vec3 specularLighting, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular, in vec3 originalSpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n vec3 unused;\n specularLighting = CalculateEnvironmentSpecular(lightingData, lightIntensity);\n specularLighting *= intensitySpecular;\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateDirectSheen(out vec3 specularLighting, out vec3 directGF, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n float sheen = Sheen(lightingData.NoHSat, lightingData.NoL, lightingData.NoV, lightingData.specularParam);\n specularLighting = vec3(sheen) * intensitySpecular * lightSourceColorAndIntensity.xyz * lightSourceColorAndIntensity.w;\n directGF = vec3(1.0);\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n void CCSurfacesLightingCalculateEnvironmentSheen(out vec3 specularLighting, out vec3 environmentGF, in LightingIntermediateData lightingData, float lightIntensity, float intensitySpecular)\n {\n #if !CC_SURFACES_LIGHTING_DISABLE_SPECULAR\n LightingIntermediateData lightingDataSheen = lightingData;\n float roughness = lightingData.specularParam;\n vec3 L = normalize(mix(lightingDataSheen.B, lightingDataSheen.N, 0.3));\n lightingDataSheen.specularParam = mix(0.5, 0.9, roughness);\n lightingDataSheen.V = lightingDataSheen.N = L;\n specularLighting = CalculateEnvironmentSpecular(lightingDataSheen, lightIntensity);\n specularLighting *= intensitySpecular;\n environmentGF = vec3(Sheen(lightingData.NoV, roughness));\n #else\n specularLighting = vec3(0.0);\n #endif\n }\n#endif\n#if CC_SURFACES_LIGHTING_TT\n void CCSurfacesLightingCalculateDirectTT(inout LightingResult lightingResult, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)\n {\n lightingResult.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLighting;\n float w = lightingData.ttIntensity;\n vec3 scatteredLighting = pow(saturate(lightingData.baseColorTT * w + lightingData.NoLSat) * lightingData.NoLSat, vec3(mix(0.5, 0.5 + lightingData.ttScatterCoef, w)));\n vec3 ttLighting = scatteredLighting - lightingData.NoLSat;\n lightingResult.directTT = ttLighting * DiffuseCoefficient_EnergyConservation * lightSourceColorAndIntensity.xyz* lightSourceColorAndIntensity.w;\n }\n#endif\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n void CCSurfacesLightingCalculateDirectMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.directDiffuse, blendedBaseS = lightingResult.directSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n lightingResult.directDiffuse, lightingResult.directSpecular\n );\n CCSurfaceLightingCalculateDirectSubLayerFresnel(lightingResult.directSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.directDiffuseSubLayers, lightingResult.directSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.direct2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.directSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.directDiffuse = blendedBaseD;\n lightingResult.directSpecular = blendedBaseS;\n }\n void CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(inout LightingResult lightingResult\n , in LightingIntermediateData lightingData2ndLayer\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n )\n {\n vec3 lastLayerF, zeroDiffuse = vec3(0.0);\n vec3 blendedBaseD = lightingResult.environmentDiffuse, blendedBaseS = lightingResult.environmentSpecular;\n InitializeLayerBlending(blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n lightingResult.environmentDiffuse, lightingResult.environmentSpecular\n );\n CCSurfaceLightingCalculateEnvironmentSubLayerFresnel(lightingResult.environmentSubLayerF, lightingData2ndLayer, lightingResult.specularColorWithLighting2ndSpecular);\n CalculateLayerBlending (blendedBaseD, blendedBaseS,\n lightingResult.environmentDiffuseSubLayers, lightingResult.environmentSpecularSubLayers,\n lastLayerF,\n zeroDiffuse, zeroDiffuse,\n lightingResult.environment2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular,\n lightingData2ndLayer.layerOpacity, lightingResult.environmentSubLayerF\n );\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND > 1\n #endif\n lightingResult.environmentDiffuse = blendedBaseD;\n lightingResult.environmentSpecular = blendedBaseS;\n }\n#endif\nstruct SurfacesMaterialData\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n vec3 worldPos, worldPos_fract_part;\n #else\n vec3 worldPos;\n #endif\n vec4 baseColor;\n vec3 worldNormal;\n vec3 emissive;\n float specularIntensity;\n float roughness;\n float metallic;\n float ao;\n vec3 worldTangent, worldBinormal;\n float ior;\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec3 outScatteringColor, inScatteringColor;\n vec4 transmitScatteringParams;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n vec4 transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 baseColor2ndSpecular, color2ndSpecular;\n float intensity2ndSpecular, roughness2ndSpecular, metallic2ndSpecular;\n vec3 worldNormal2ndSpecular, worldTangent2ndSpecular, worldBinormal2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n float anisotropyShape2ndSpecular;\n #endif\n float ior2ndSpecular, opacity2ndSpecular;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec3 baseColorTT;\n float ttIntensity, ttScatterCoef;\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n vec4 sssParams;\n#endif\n};\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\nvec4 SurfacesFragmentModifyBaseColorAndTransparency()\n{\n return FSInput_vertexColor;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\nvec3 SurfacesFragmentModifyWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL\nvoid SurfacesFragmentModifyWorldTangentAndBinormal(inout vec3 worldTangent, inout vec3 worldBinormal, vec3 worldNormal)\n{\n vec3 tangent = normalize(FSInput_worldTangent);\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec3 binormal = normalize(CalculateBinormal(worldNormal.xyz, tangent, FSInput_mirrorNormal));\n tangent = normalize(cross(binormal, worldNormal));\n#else\n vec3 binormal = vec3(0.0, 0.0, 0.0);\n#endif\n worldTangent = tangent;\n worldBinormal = binormal;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_IOR\nfloat SurfacesFragmentModifyIOR()\n{\n return 1.0;\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\nvec4 SurfacesFragmentModifyAnisotropyParams(out float isRotation)\n{\n isRotation = 1.0;\n return vec4(1.0, 0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\nvec3 SurfacesFragmentModifyEmissive()\n{\n return vec3(0.0, 0.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvec4 SurfacesFragmentModifyPBRParams()\n{\n return vec4(1.0, 0.5, 0.0, 0.5);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_SCATTERING_PARAMS\nvec4 SurfacesFragmentModifyTransmitScatteringParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_IN_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitInScatteringColor()\n{\n return vec3(0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_OUT_SCATTERING_COLOR\nvec3 SurfacesFragmentModifyTransmitOutScatteringColor()\n{\n return vec3(1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRANSMIT_DIFFUSE_PARAMS\nvec4 SurfacesFragmentModifyTransmitDiffuseParams()\n{\n return vec4(1.0, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_PARAMS\nvec4 SurfacesFragmentModifyTRTParams()\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TRT_COLOR\nvec3 SurfacesFragmentModifyTRTColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_PARAMS\nvec4 SurfacesFragmentModifyTTParams()\n{\n return vec4(0.0, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_TT_COLOR\nvec3 SurfacesFragmentModifyTTColor(in vec3 baseColor)\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SSS_PARAMS\nvec4 SurfacesFragmentModifySSSParams()\n{\n return vec4(1.0, 0.1, 1.0, 0.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_DUAL_LOBE_SPECULAR_PARAMS\nvec4 SurfacesFragmentModifyDualLobeSpecularParams(float roughness)\n{\n return vec4(0.2, 0.0, 0.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_PARAMS\nvec4 SurfacesFragmentModifyClearCoatParams()\n{\n return vec4(0.2, 1.5, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_COLOR\nvec3 SurfacesFragmentModifyClearCoatColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_CLEAR_COAT_WORLD_NORMAL\nvec3 SurfacesFragmentModifyClearCoatWorldNormal()\n{\n return normalize(FSInput_worldNormal);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_PARAMS\nvec4 SurfacesFragmentModifySheenParams()\n{\n return vec4(0.7, 1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHEEN_COLOR\nvec3 SurfacesFragmentModifySheenColor()\n{\n return vec3(1.0, 1.0, 1.0);\n}\n#endif\n#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA\nvoid SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)\n{\n}\n#endif\nvoid CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)\n{\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n packHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part, FSInput_worldPos);\n #else\n surfaceData.worldPos = FSInput_worldPos;\n #endif\n surfaceData.baseColor = SurfacesFragmentModifyBaseColorAndTransparency();\n surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();\n SurfacesFragmentModifyWorldTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal);\n surfaceData.ior = SurfacesFragmentModifyIOR();\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n float isRotation;\n vec4 anisotropyParams = SurfacesFragmentModifyAnisotropyParams(isRotation);\n surfaceData.anisotropyShape = anisotropyParams.x;\n if (isRotation > 0.0) {\n RotateTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal, anisotropyParams.y);\n } else {\n vec3 anisoDirTS = anisotropyParams.yzw;\n vec3 tangentWS = anisoDirTS.x * surfaceData.worldTangent + anisoDirTS.y * surfaceData.worldBinormal + anisoDirTS.z * surfaceData.worldNormal;\n surfaceData.worldTangent = normalize(tangentWS);\n surfaceData.worldBinormal = cross(surfaceData.worldNormal, tangentWS);\n }\n#endif\n surfaceData.emissive = SurfacesFragmentModifyEmissive();\n vec4 pbr = SurfacesFragmentModifyPBRParams();\n surfaceData.ao = pbr.x;\n surfaceData.roughness = pbr.y;\n surfaceData.metallic = pbr.z;\n surfaceData.specularIntensity = pbr.w;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitScatteringParams = SurfacesFragmentModifyTransmitScatteringParams();\n surfaceData.inScatteringColor = SurfacesFragmentModifyTransmitInScatteringColor();\n surfaceData.outScatteringColor = SurfacesFragmentModifyTransmitOutScatteringColor();\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n surfaceData.transmitDiffuseParams = SurfacesFragmentModifyTransmitDiffuseParams();\n#endif\n#if CC_SURFACES_LIGHTING_TRT\n vec4 trtParams = SurfacesFragmentModifyTRTParams();\n surfaceData.roughness2ndSpecular = saturate(surfaceData.roughness + trtParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = trtParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyTRTColor();\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n RotateNormalAndBinormal(surfaceData.worldBinormal2ndSpecular, surfaceData.worldNormal2ndSpecular, surfaceData.worldTangent2ndSpecular, trtParams.y, FSInput_mirrorNormal);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n vec4 ttParams = SurfacesFragmentModifyTTParams();\n surfaceData.ttScatterCoef = ttParams.x;\n surfaceData.ttIntensity = ttParams.w;\n surfaceData.baseColorTT = SurfacesFragmentModifyTTColor(surfaceData.baseColor.rgb);\n#endif\n#if CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n vec4 dualLobeParams = SurfacesFragmentModifyDualLobeSpecularParams(surfaceData.roughness);\n surfaceData.roughness2ndSpecular = saturate(dualLobeParams.x);\n surfaceData.metallic2ndSpecular = surfaceData.metallic;\n surfaceData.intensity2ndSpecular = dualLobeParams.w;\n surfaceData.baseColor2ndSpecular = surfaceData.baseColor.rgb;\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SHEEN\n vec4 sheenParams = SurfacesFragmentModifySheenParams();\n surfaceData.roughness2ndSpecular = saturate(sheenParams.x);\n surfaceData.intensity2ndSpecular = sheenParams.y * sheenParams.w;\n surfaceData.metallic2ndSpecular = 1.0;\n surfaceData.baseColor2ndSpecular = SurfacesFragmentModifySheenColor();\n surfaceData.color2ndSpecular = vec3(1.0);\n surfaceData.worldNormal2ndSpecular = surfaceData.worldNormal;\n surfaceData.worldTangent2ndSpecular = surfaceData.worldTangent;\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.ior2ndSpecular = surfaceData.ior;\n surfaceData.opacity2ndSpecular = 1.0;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_CLEAR_COAT\n vec4 clearCoatParams = SurfacesFragmentModifyClearCoatParams();\n surfaceData.roughness2ndSpecular = clearCoatParams.x;\n surfaceData.metallic2ndSpecular = 0.0;\n surfaceData.ior2ndSpecular = clearCoatParams.y;\n surfaceData.opacity2ndSpecular = clearCoatParams.z;\n surfaceData.intensity2ndSpecular = clearCoatParams.w;\n surfaceData.baseColor2ndSpecular = vec3(1.0);\n surfaceData.color2ndSpecular = SurfacesFragmentModifyClearCoatColor();\n surfaceData.worldNormal2ndSpecular = SurfacesFragmentModifyClearCoatWorldNormal();\n surfaceData.worldBinormal2ndSpecular = surfaceData.worldBinormal;\n surfaceData.worldTangent2ndSpecular = CalculateTangent(surfaceData.worldNormal2ndSpecular, surfaceData.worldBinormal2ndSpecular);\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData.anisotropyShape2ndSpecular = surfaceData.anisotropyShape;\n #endif\n#endif\n#if CC_SURFACES_LIGHTING_SSS\n surfaceData.sssParams = SurfacesFragmentModifySSSParams();\n#endif\n SurfacesFragmentModifySharedData(surfaceData);\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP) {\n surfaceData.worldNormal = normalize(FSInput_worldNormal);\n surfaceData.worldTangent = normalize(FSInput_worldTangent);\n }\n#endif\n#if CC_USE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO)\n {\n surfaceData.baseColor.rgb = vec3(1.0);\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n surfaceData.baseColor2ndSpecular.rgb = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TT\n surfaceData.baseColorTT.rgb = vec3(1.0);\n #endif\n }\n#endif\n}\nvec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)\n{\n return surfaceData.baseColor.rgb * (1.0 - surfaceData.metallic);\n}\nvec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)\n{\n float F0 = surfaceData.specularIntensity * 0.08;\n return mix(vec3(F0), surfaceData.baseColor.rgb, surfaceData.metallic);\n}\nvoid CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n diffuseColorWithLighting = CCSurfacesGetDiffuseColor(surfaceData);\n specularColorWithLighting = CCSurfacesGetSpecularColor(surfaceData).xyz;\n}\nvoid CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)\n{\n}\nvoid CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, surfaceData.worldTangent, surfaceData.worldBinormal\n#if CC_SURFACES_LIGHTING_ANISOTROPIC\n , surfaceData.anisotropyShape\n#endif\n );\n lightingData.specularParam = surfaceData.roughness;\n lightingData.ior = surfaceData.ior;\n lightingData.layerOpacity = surfaceData.baseColor.a;\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR || CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitScatteringParams = surfaceData.transmitScatteringParams;\n lightingData.inScatteringColor = surfaceData.inScatteringColor;\n lightingData.outScatteringColor = surfaceData.outScatteringColor;\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingData.transmitDiffuseParams = surfaceData.transmitDiffuseParams;\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingData.baseColorTT = surfaceData.baseColorTT;\n lightingData.ttIntensity = surfaceData.ttIntensity;\n lightingData.ttScatterCoef = surfaceData.ttScatterCoef;\n#endif\n}\nvoid CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)\n{\n CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);\n}\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\nvoid CCSurfacesGetLightingIntermediateDataTransmitDiffuse(inout LightingIntermediateData lightingDataTD, in LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)\n{\n lightingDataTD = lightingData;\n lightingDataTD.N = lightingData.transmitScatteringParams.z > 0.0 ? -FSInput_worldNormal : -(normalize(FSInput_worldNormal)+lightingData.V);\n lightingDataTD.N = normalize(lightingDataTD.N);\n}\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\nvoid CCSurfacesGetSurfacesMaterialData2ndSpecular(inout SurfacesMaterialData surfaceData2ndSpecular, in SurfacesMaterialData surfaceData)\n{\n surfaceData2ndSpecular = surfaceData;\n surfaceData2ndSpecular.baseColor = vec4(surfaceData.baseColor2ndSpecular, surfaceData.opacity2ndSpecular);\n surfaceData2ndSpecular.roughness = surfaceData.roughness2ndSpecular;\n surfaceData2ndSpecular.metallic = surfaceData.metallic2ndSpecular;\n surfaceData2ndSpecular.worldNormal = surfaceData.worldNormal2ndSpecular;\n surfaceData2ndSpecular.worldTangent = surfaceData.worldTangent2ndSpecular;\n surfaceData2ndSpecular.worldBinormal = surfaceData.worldBinormal2ndSpecular;\n surfaceData2ndSpecular.ior = surfaceData.ior2ndSpecular;\n #if CC_SURFACES_LIGHTING_ANISOTROPIC\n surfaceData2ndSpecular.anisotropyShape = surfaceData.anisotropyShape2ndSpecular;\n #endif\n}\n#endif\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)\n{\n lightingResult.ao = surfaceData.ao;\n lightingResult.emissive = surfaceData.emissive;\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n lightingResult.environmentDiffuseSubLayers = lightingResult.environmentSpecularSubLayers = vec3(0.0);\n#endif\n}\nvoid CCSurfacesInitializeLightingResult(inout LightingResult lightingResult)\n{\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n lightingResult.directGF = vec3(1.0);\n#if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.directDiffuseSubLayers = lightingResult.directSpecularSubLayers = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResult.directTransmitSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResult.directTransmitDiffuse = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResult.direct2ndSpecular = vec3(0.0);\n#endif\n#if CC_SURFACES_LIGHTING_TT\n lightingResult.directTT = vec3(0.0);\n#endif\n}\nvoid CCSurfacesAccumulateLightingResult(inout LightingResult lightingResultAccumulated, in LightingResult lightingResult)\n{\n lightingResultAccumulated.directDiffuse += lightingResult.directDiffuse * lightingResult.shadow;\n lightingResultAccumulated.directSpecular += lightingResult.directSpecular * lightingResult.shadow * lightingResult.directGF * lightingResult.fresnel;\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResultAccumulated.directDiffuseSubLayers += lightingResult.directDiffuseSubLayers * lightingResult.shadow;\n lightingResultAccumulated.directSpecularSubLayers += lightingResult.directSpecularSubLayers * lightingResult.shadow;\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n lightingResultAccumulated.directTransmitSpecular += lightingResult.directTransmitSpecular * (vec3(1.0) - lightingResult.fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n lightingResultAccumulated.directTransmitDiffuse += lightingResult.directTransmitDiffuse;\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n lightingResultAccumulated.direct2ndSpecular += lightingResult.direct2ndSpecular * lightingResult.shadow * lightingResult.directGF2ndSpecular * lightingResult.fresnel;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n lightingResultAccumulated.directTT += lightingResult.directTT * lightingResult.shadow;\n lightingResultAccumulated.diffuseColorWithLightingTT = lightingResult.diffuseColorWithLightingTT;\n #endif\n}\n#if CC_PIPELINE_TYPE == 1\n#endif\nvec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)\n{\n vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);\n#if CC_FORWARD_ADD\n color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n#else\n vec3 fresnel = lightingResult.fresnel;\n vec3 invFresnel = vec3(1.0) - fresnel;\n color.xyz +=\n ( lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.directSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.directTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.directGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.directDiffuseSubLayers\n + lightingResult.directSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.direct2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.directGF2ndSpecular\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n + lightingResult.directTT * lightingResult.diffuseColorWithLightingTT\n #endif\n )\n * lightingResult.shadow\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.directTransmitDiffuse\n #endif\n ;\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_ALL_IN_ONE\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting * lightingResult.shadow;\n #elif CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n color.xyz += lightingResult.lightmapColor * lightingResult.diffuseColorWithLighting;\n #endif\n color.xyz +=\n ( lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting\n + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * fresnel\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n + lightingResult.environmentTransmitSpecular * lightingResult.specularColorWithLighting * lightingResult.environmentGF * invFresnel\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n + lightingResult.environmentDiffuseSubLayers\n + lightingResult.environmentSpecularSubLayers\n #else\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n + lightingResult.environment2ndSpecular * lightingResult.specularColorWithLighting2ndSpecular * surfaceData.color2ndSpecular * lightingResult.environmentGF2ndSpecular\n #endif\n #endif\n )\n * lightingResult.ao\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n + lightingResult.environmentTransmitDiffuse\n #endif\n ;\n color.xyz += lightingResult.emissive;\n#endif\n return color;\n}\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n#endif\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n void CCSurfacesLighting(inout LightingResult lightingResultAccumulated, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n CCSurfacesInitializeLightingResult(lightingResultAccumulated);\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n LightingResult lightingResult;\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n lightingResultAccumulated.diffuseColorWithLighting = lightingResult.diffuseColorWithLighting;\n lightingResultAccumulated.specularColorWithLighting = lightingResult.specularColorWithLighting;\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n vec3 diff;\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData);\n lightingResultAccumulated.specularColorWithLighting2ndSpecular = lightingResult.specularColorWithLighting2ndSpecular;\n #endif\n int numLights = CC_PIPELINE_TYPE == 0 ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);\n for (int i = 0; i < LIGHTS_PER_PASS; i++) {\n if (i >= numLights) break;\n vec3 lightDirWithLength = IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w) ? -normalize(cc_lightDir[i].xyz) : cc_lightPos[i].xyz - worldPos;\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n vec3 diffuseLighting, specularLighting;\n CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n vec3 fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n vec3 fresnel = vec3(1.0);\n #endif\n lightingResult.fresnel = fresnel;\n float shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n shadow = CCSpotShadowFactorBase(shadowPosWithDepthBias, shadowPos, worldPos, shadowBias);\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec3 shadowNDCPos;\n bool isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Perspective(shadowNDCPos.z, shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Perspective(SampleShadowMapSoft(shadowNDCPos, cc_spotShadowMap, cc_shadowWHPBInfo.xy), shadowPosWithDepthBias.w, cc_shadowInvProjDepthInfo.x, cc_shadowInvProjDepthInfo.y);\n #endif\n }\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n shadow = 1.0;\n #endif\n lightingResult.shadow = shadow;\n float distAtt = 1.0;\n if(IS_RANGED_DIRECTIONAL_LIGHT(cc_lightPos[i].w)) {\n distAtt = GetOutOfRange(worldPos, cc_lightPos[i].xyz, cc_lightDir[i].xyz, cc_lightSizeRangeAngle[i].xyz, cc_lightBoundingSizeVS[i].xyz);\n } else {\n distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i], cc_lightPos[i].w);\n }\n float angleAtt = 1.0;\n if (IS_SPOT_LIGHT(cc_lightPos[i].w)) {\n angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);\n }\n float multiplier = distAtt * angleAtt;\n lightingData.angleAttenuation = angleAtt;\n lightingData.distAttenuation = distAtt;\n lightingResult.directDiffuse = diffuseLighting * multiplier;\n lightingResult.directSpecular = specularLighting * multiplier;\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, vec3(1.0));\n vec4 attenuatedLightColorAndIntensity = vec4(cc_lightColor[i].xyz, cc_lightColor[i].w * multiplier);\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n vec3 transmitSpecularLighting;\n CCSurfacesLightingCalculateDirectTransmitSpecular(transmitSpecularLighting, lightingData, attenuatedLightColorAndIntensity);\n lightingResult.directTransmitSpecular = transmitSpecularLighting * multiplier * (1.0 - fresnel);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, lightDirWithLength);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, attenuatedLightColorAndIntensity, lightingResult.shadow);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData, lightDirWithLength);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, vec3(1.0));\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, attenuatedLightColorAndIntensity, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n lightingResult.direct2ndSpecular *= multiplier;\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, attenuatedLightColorAndIntensity);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = cc_lightPos[i].w;\n miscData.lightPos = cc_lightPos[i].xyz;\n miscData.lightDir = cc_lightDir[i].xyz;\n miscData.lightColorAndIntensity = cc_lightColor[i];\n miscData.lightSizeRangeAngle = cc_lightSizeRangeAngle[i];\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n CCSurfacesAccumulateLightingResult(lightingResultAccumulated, lightingResult);\n }\n }\n #else\n void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec2 shadowBias)\n {\n vec3 worldPos;\n #if CC_PLATFORM_ANDROID_AND_WEBGL && CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES\n worldPos = unpackHighpData(surfaceData.worldPos, surfaceData.worldPos_fract_part);\n #else\n worldPos = surfaceData.worldPos;\n #endif\n LightingIntermediateData lightingData;\n CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);\n CCSurfacesInitializeLightingResult(lightingResult, surfaceData);\n CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);\n lightingResult.shadow = 1.0;\n #if CC_RECEIVE_SHADOW && CC_SHADOW_TYPE == 2\n if (cc_mainLitDir.w > 0.0) {\n vec4 shadowPos = vec4(0.0), shadowPosWithDepthBias = vec4(0.0);\n vec4 shadowProjDepthInfo = vec4(0.0);\n vec3 shadowNDCPos;\n bool isExceedShadowMap = true;\n if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {\n #if CC_DIR_LIGHT_SHADOW_TYPE == 2\n lightingResult.shadow = CCCSMFactorBase(worldPos, lightingData.N, shadowBias);\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n vec4 shadowProjInfo;\n vec3 shadowViewDir0, shadowViewDir1, shadowViewDir2;\n isExceedShadowMap = 0 > CCGetCSMLevel(shadowPosWithDepthBias, shadowProjDepthInfo, shadowProjInfo, shadowViewDir0, shadowViewDir1, shadowViewDir2, worldPos);\n GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n #endif\n #if CC_DIR_LIGHT_SHADOW_TYPE == 1\n shadowPos = cc_matLightViewProj * vec4(worldPos, 1.0);\n lightingResult.shadow = CCShadowFactorBase(shadowPosWithDepthBias, shadowPos, lightingData.N, shadowBias);\n shadowProjDepthInfo = cc_shadowProjDepthInfo;\n isExceedShadowMap = !GetShadowNDCPos(shadowNDCPos, shadowPosWithDepthBias);\n #endif\n }\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE && CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n lightingData.shadowPosAndDepth.xy = shadowNDCPos.xy;\n lightingData.shadowPosAndDepth.z = isExceedShadowMap ? 0.0 : GetViewSpaceDepthFromNDCDepth_Orthgraphic(shadowNDCPos.z, shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n lightingData.shadowPosAndDepth.w = isExceedShadowMap ? lightingData.shadowPosAndDepth.w : GetViewSpaceDepthFromNDCDepth_Orthgraphic(SampleShadowMapSoft(shadowNDCPos, cc_shadowMap, cc_shadowWHPBInfo.xy), shadowProjDepthInfo.x, shadowProjDepthInfo.y);\n #endif\n }\n #endif\n lightingResult.lightmapColor = vec3(0.0);\n #if CC_SURFACES_USE_LIGHT_MAP && !CC_FORWARD_ADD\n float lightmapShadow, lightmapAO;\n GetLightMapColor(lightingResult.lightmapColor, lightmapShadow, lightmapAO, cc_lightingMap, FSInput_lightMapUV.xy, FSInput_lightMapUV.z, surfaceData.worldNormal);\n #if CC_SURFACES_USE_LIGHT_MAP == LIGHT_MAP_TYPE_INDIRECT_OCCLUSION\n lightingResult.shadow *= lightmapShadow;\n #endif\n lightingResult.ao *= lightmapAO;\n #endif\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW)\n lightingResult.shadow = 1.0;\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO)\n lightingResult.ao = 1.0;\n #endif\n vec3 unused;\n CCSurfacesLightingCalculateEnvironment(lightingResult.environmentDiffuse, lightingResult.environmentSpecular, lightingData, cc_ambientSky.w);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF, unused, lightingData, lightingResult.specularColorWithLighting);\n lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);\n #if !CC_DISABLE_DIRECTIONAL_LIGHT && !CC_FORWARD_ADD\n CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);\n CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF, lightingData, lightingResult.specularColorWithLighting, lightingResult.environmentGF);\n #endif\n #if CC_SURFACES_LIGHTING_USE_FRESNEL\n lightingResult.fresnel = CCSurfaceLightingCalculateExtraFresnel(lightingData);\n #else\n lightingResult.fresnel = vec3(1.0);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n CCSurfacesLightingCalculateDirectTransmitSpecular(lightingResult.directTransmitSpecular, lightingData, cc_mainLitColor);\n CCSurfacesLightingCalculateEnvironmentTransmitSpecular(lightingResult.environmentTransmitSpecular, lightingData, cc_ambientSky.w);\n #endif\n #if CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n LightingIntermediateData lightingDataTD;\n CCSurfacesGetLightingIntermediateDataTransmitDiffuse(lightingDataTD, lightingData, surfaceData);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingDataTD, surfaceData, -cc_mainLitDir.xyz);\n CCSurfacesLightingCalculateDirectTransmitDiffuse(lightingResult.directTransmitDiffuse, lightingDataTD, cc_mainLitColor, lightingResult.shadow);\n CCSurfacesLightingCalculateEnvironmentTransmitDiffuse(lightingResult.environmentTransmitDiffuse, lightingDataTD, cc_ambientSky.w, lightingResult.ao, -cc_mainLitDir.xyz);\n #endif\n #if CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n SurfacesMaterialData surfaceData2ndSpecular;\n CCSurfacesGetSurfacesMaterialData2ndSpecular(surfaceData2ndSpecular, surfaceData);\n LightingIntermediateData lightingData2ndSpecular;\n CCSurfacesInitializeLightingIntermediateData(lightingData2ndSpecular, surfaceData2ndSpecular);\n CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData2ndSpecular, surfaceData2ndSpecular, -cc_mainLitDir.xyz);\n vec3 diff;\n CCSurfacesLightingInitializeColorWithLighting(diff, lightingResult.specularColorWithLighting2ndSpecular, surfaceData2ndSpecular, lightingData2ndSpecular);\n #if !CC_SURFACES_LIGHTING_SHEEN\n CCSurfacesLightingCalculateEnvironment2ndSpecular(lightingResult.environment2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.environmentSpecular);\n CCSurfaceLightingCalculateEnvironmentFresnel(lightingResult.environmentGF2ndSpecular, lightingResult.environmentSubLayerF, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular);\n CCSurfacesLightingCalculateDirect2ndSpecular(lightingResult.direct2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular, lightingResult.directSpecular);\n CCSurfaceLightingCalculateDirectFresnel(lightingResult.directGF2ndSpecular, lightingData2ndSpecular, lightingResult.specularColorWithLighting2ndSpecular, lightingResult.environmentGF2ndSpecular);\n #else\n CCSurfacesLightingCalculateDirectSheen(lightingResult.direct2ndSpecular, lightingResult.directGF2ndSpecular, lightingData2ndSpecular, cc_mainLitColor, surfaceData2ndSpecular.intensity2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentSheen(lightingResult.environment2ndSpecular, lightingResult.environmentGF2ndSpecular, lightingData2ndSpecular, cc_ambientSky.w, surfaceData2ndSpecular.intensity2ndSpecular);\n #endif\n #endif\n #if CC_SURFACES_LIGHTING_TT\n CCSurfacesLightingCalculateDirectTT(lightingResult, lightingData, cc_mainLitColor);\n #endif\n #if CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n lightingResult.specularColorWithLighting2ndSpecular *= surfaceData.color2ndSpecular;\n CCSurfacesLightingCalculateDirectMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n CCSurfacesLightingCalculateEnvironmentMultiLayerBlending(lightingResult, lightingData2ndSpecular);\n #endif\n #ifdef CC_SURFACES_LIGHTING_MODIFY_FINAL_RESULT\n LightingMiscData miscData;\n miscData.lightType = LIGHT_TYPE_DIRECTIONAL;\n miscData.lightPos = vec3(0.0);\n miscData.lightDir = cc_mainLitDir.xyz;\n miscData.lightColorAndIntensity = cc_mainLitColor;\n miscData.lightSizeRangeAngle = vec4(0.0, 0.0, 0.0, 0.0);\n SurfacesLightingModifyFinalResult(lightingResult, lightingData, surfaceData, miscData);\n #endif\n }\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING\n #endif\n #endif\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE && !CC_FORWARD_ADD\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE\n#endif\n#if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n#endif\n#if CC_PIPELINE_TYPE == 1 && !CC_FORCE_FORWARD_SHADING\n void main() { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); }\n#else\n void main() {\n #if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER\n float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz);\n vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();\n float fogFactor = 1.0;\n #if CC_FORWARD_ADD\n color.rgb = vec3(0.0);\n #endif\n #else\n SurfacesMaterialData surfaceData;\n CCSurfacesFragmentGetMaterialData(surfaceData);\n vec2 shadowBias = vec2(0.0);\n #if CC_RECEIVE_SHADOW\n shadowBias = FSInput_shadowBias;\n #endif\n #if !CC_FORWARD_ADD\n float fogFactor = 1.0;\n #if CC_USE_FOG != 4\n #if !CC_USE_ACCURATE_FOG\n fogFactor = FSInput_fogFactor;\n #else\n CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);\n #endif\n #endif\n #endif\n LightingResult lightingResult;\n CCSurfacesLighting(lightingResult, surfaceData, shadowBias);\n vec4 color = CCSurfacesShading(surfaceData, lightingResult);\n #endif\n #if !CC_FORWARD_ADD\n CC_APPLY_FOG_BASE(color, fogFactor);\n #endif\n gl_FragColor = packRGBE(color.rgb);\n }\n#endif"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":97,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":127}},"defines":[{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"USE_TWOSIDE","type":"boolean"},{"name":"IS_ANISOTROPY","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"FIX_ANISOTROPIC_ROTATION_MAP","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER","type":"number","range":[0,1]},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_IBL_CONVOLUTED","type":"boolean"},{"name":"CC_SHADOWMAP_FORMAT","type":"number","range":[0,3]},{"name":"CC_SHADOWMAP_USE_LINEAR_DEPTH","type":"boolean"},{"name":"CC_DIR_SHADOW_PCF_TYPE","type":"number","range":[0,3]},{"name":"CC_CASCADED_LAYERS_TRANSITION","type":"boolean"},{"name":"CC_USE_HDR","type":"boolean"},{"name":"CC_LIGHT_MAP_VERSION","type":"number","range":[0,3]},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"DEFAULT_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean"},{"name":"USE_OCCLUSION_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"EMISSIVE_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ANISOTROPY_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]},{"name":"CC_SURFACES_LIGHTING_DISABLE_DIFFUSE","type":"boolean"},{"name":"CC_SURFACES_LIGHTING_DISABLE_SPECULAR","type":"boolean"},{"name":"CC_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DIR_LIGHT_SHADOW_TYPE","type":"number","range":[0,3]},{"name":"CC_DISABLE_DIRECTIONAL_LIGHT","type":"boolean"}]},{"hash":3484027890,"name":"builtin-standard|planar-shadow-vs|planar-shadow-fs","blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_color","format":44,"location":6,"defines":["USE_VERTEX_COLOR"]},{"name":"a_texCoord1","format":21,"location":7,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":11,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":12,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBiasAndProbeId","format":44,"isInstanced":true,"location":13,"defines":["USE_INSTANCING"]},{"name":"a_reflectionProbeData","format":44,"isInstanced":true,"location":14,"defines":["USE_INSTANCING","CC_USE_REFLECTION_PROBE"]},{"name":"a_sh_linear_const_r","format":44,"isInstanced":true,"location":15,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_g","format":44,"isInstanced":true,"location":16,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_sh_linear_const_b","format":44,"isInstanced":true,"location":17,"defines":["USE_INSTANCING","CC_USE_LIGHT_PROBE"]},{"name":"a_vertexId","format":11,"location":18,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"fragColorX","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"descriptors":[{"rate":0,"blocks":[{"name":"CCLocal","stageFlags":17,"tags":{"builtin":"local"},"members":[{"name":"cc_matWorld","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matWorldIT","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_lightingMapUVParam","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_localShadowBias","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeData2","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData1","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_reflectionProbeBlendData2","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["!USE_INSTANCING"]},{"name":"CCMorph","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_displacementWeights","typename":"vec4","type":16,"count":15,"isArray":true},{"name":"cc_displacementTextureInfo","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointTextureInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_jointAnimInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","stageFlags":1,"tags":{"builtin":"local"},"members":[{"name":"cc_joints","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true}],"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_lightPos","typename":"vec4","type":16,"count":0,"precision":"highp ","isArray":true},{"name":"cc_lightColor","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightSizeRangeAngle","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightDir","typename":"vec4","type":16,"count":0,"isArray":true},{"name":"cc_lightBoundingSizeVS","typename":"vec4","type":16,"count":0,"isArray":true}],"defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","stageFlags":16,"tags":{"builtin":"local"},"members":[{"name":"cc_sh_linear_const_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_linear_const_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_r","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_g","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_b","typename":"vec4","type":16,"count":1},{"name":"cc_sh_quadratic_a","typename":"vec4","type":16,"count":1}],"defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","typename":"sampler2D","type":28,"count":1,"stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":1,"tags":{"builtin":"local"},"defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","typename":"sampler2D","type":28,"count":1,"stageFlags":16,"tags":{"builtin":"local"},"defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":1,"blocks":[{"name":"Constants","stageFlags":17,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1},{"name":"albedo","type":16,"count":1},{"name":"albedoScaleAndCutoff","type":16,"count":1},{"name":"pbrParams","type":16,"count":1},{"name":"emissive","type":16,"count":1},{"name":"emissiveScaleParam","type":16,"count":1},{"name":"anisotropyParam","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"albedoMap","type":28,"count":1,"stageFlags":16,"binding":1,"defines":["USE_ALBEDO_MAP"]},{"name":"normalMap","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_NORMAL_MAP"]},{"name":"pbrMap","type":28,"count":1,"stageFlags":16,"binding":3,"defines":["USE_PBR_MAP"]},{"name":"occlusionMap","type":28,"count":1,"stageFlags":16,"binding":4,"defines":["USE_OCCLUSION_MAP"]},{"name":"emissiveMap","type":28,"count":1,"stageFlags":16,"binding":5,"defines":["USE_EMISSIVE_MAP"]},{"name":"anisotropyMap","type":28,"count":1,"stageFlags":16,"binding":6,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]},{"name":"anisotropyMapNearestFilter","type":28,"count":1,"stageFlags":16,"binding":7,"defines":["IS_ANISOTROPY","USE_ANISOTROPY_MAP"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":2,"blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]},{"rate":3,"blocks":[{"name":"CCGlobal","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_time","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_screenSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nativeSize","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_probeInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_debug_view_mode","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCamera","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matViewProjInv","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_cameraPos","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_surfaceTransform","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_screenScale","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_exposure","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitDir","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_mainLitColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientSky","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_ambientGround","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogColor","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogBase","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_fogAdd","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_nearFar","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_viewPort","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCShadow","stageFlags":17,"tags":{"builtin":"global"},"members":[{"name":"cc_matLightView","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_matLightViewProj","typename":"mat4","type":25,"count":1,"precision":"highp "},{"name":"cc_shadowInvProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjDepthInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowProjInfo","typename":"vec4","type":16,"count":1,"precision":"highp "},{"name":"cc_shadowNFLSInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowWHPBInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowLPNNInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "},{"name":"cc_shadowColor","typename":"vec4","type":16,"count":1,"precision":"lowp "},{"name":"cc_planarNDInfo","typename":"vec4","type":16,"count":1,"precision":"mediump "}],"defines":[]},{"name":"CCCSM","stageFlags":16,"tags":{"builtin":"global"},"members":[{"name":"cc_csmViewDir0","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir1","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmViewDir2","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmAtlas","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_matCSMViewProj","typename":"mat4","type":25,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjDepthInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmProjInfo","typename":"vec4","type":16,"count":4,"precision":"highp ","isArray":true},{"name":"cc_csmSplitsInfo","typename":"vec4","type":16,"count":1,"precision":"highp "}],"defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":[]},{"name":"cc_diffuseMap","typename":"samplerCube","type":31,"count":1,"stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","typename":"sampler2D","type":28,"count":1,"precision":"highp ","stageFlags":16,"tags":{"builtin":"global"},"defines":["CC_RECEIVE_SHADOW"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[]}],"glsl3":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n in vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n in vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n in vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nout highp vec3 v_worldPos;\nout vec4 v_normal;\nout vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n out lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n out mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n out mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n out mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n out mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n out mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n out mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n out highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n out highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n out mediump vec4 v_sh_linear_const_r;\n out mediump vec4 v_sh_linear_const_g;\n out mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nout highp float v_dist;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n vec4 shadowPos = CalculatePlanarShadowPos(In.worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n In.worldPos = shadowPos.xyz;\n In.clipPos = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_dist = shadowPos.w;\n}","frag":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nin highp vec3 v_worldPos;\nin vec4 v_normal;\nin vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n in mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n in mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n in mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n in mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n in mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n in mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n in highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n in highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n in mediump vec4 v_sh_linear_const_r;\n in mediump vec4 v_sh_linear_const_g;\n in mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n layout(std140) uniform CCForwardLight {\n highp vec4 cc_lightPos[LIGHTS_PER_PASS];\n vec4 cc_lightColor[LIGHTS_PER_PASS];\n vec4 cc_lightSizeRangeAngle[LIGHTS_PER_PASS];\n vec4 cc_lightDir[LIGHTS_PER_PASS];\n vec4 cc_lightBoundingSizeVS[LIGHTS_PER_PASS];\n };\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n layout(std140) uniform CCSH {\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n };\n #endif\n#endif\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n layout(std140) uniform CCCSM {\n highp vec4 cc_csmViewDir0[4];\n highp vec4 cc_csmViewDir1[4];\n highp vec4 cc_csmViewDir2[4];\n highp vec4 cc_csmAtlas[4];\n highp mat4 cc_matCSMViewProj[4];\n highp vec4 cc_csmProjDepthInfo[4];\n highp vec4 cc_csmProjInfo[4];\n highp vec4 cc_csmSplitsInfo;\n };\n#endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n };\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\nlayout(std140) uniform Constants {\n vec4 tilingOffset;\n vec4 albedo;\n vec4 albedoScaleAndCutoff;\n vec4 pbrParams;\n vec4 emissive;\n vec4 emissiveScaleParam;\n vec4 anisotropyParam;\n};\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = albedo.ALPHA_TEST_CHANNEL;\n #if USE_VERTEX_COLOR\n alpha *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n alpha = texture(albedoMap, ALBEDO_UV).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < albedoScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nin highp float v_dist;\nlayout(location = 0) out vec4 fragColorX;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n if(v_dist < 0.0)\n discard;\n fragColorX = cc_shadowColor;\n}"},"glsl1":{"vert":"\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\n#if CC_SURFACES_USE_TANGENT_SPACE\n attribute vec4 a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n attribute vec4 a_color;\n#endif\n#if CC_SURFACES_USE_SECOND_UV || CC_USE_LIGHTMAP\n attribute vec2 a_texCoord1;\n#endif\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n#endif\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define VSOutput_worldPos v_worldPos\n#define VSOutput_worldNormal v_normal.xyz\n#define VSOutput_faceSideSign v_normal.w\n#define VSOutput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define VSOutput_vertexColor v_color\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define VSOutput_worldTangent v_tangent.xyz\n #define VSOutput_mirrorNormal v_tangent.w\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define VSOutput_texcoord1 v_uv1\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define VSOutput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define VSOutput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define VSOutput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define VSOutput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define VSOutput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define VSOutput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define VSOutput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define VSOutput_clipPos v_clipPos\n#endif\nstruct SurfacesStandardVertexIntermediate\n{\n highp vec4 position;\n vec3 normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n vec4 tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n vec4 color;\n#endif\n vec2 texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n vec2 texCoord1;\n#endif\n highp vec4 clipPos;\n highp vec3 worldPos;\n vec4 worldNormal;\n #if CC_SURFACES_USE_TANGENT_SPACE\n vec3 worldTangent, worldBinormal;\n #endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n vec4 shadowBiasAndProbeId;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n float fogFactor;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n vec3 lightmapUV;\n#endif\n};\n#if CC_USE_MORPH\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #if CC_USE_FOG != 4\n #endif\n#endif\n uniform vec4 tilingOffset;\n#define CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#define CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;\n#endif\n}\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS\nvec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)\n{\n return vec3(In.position.xyz);\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_TANGENT\n #if CC_SURFACES_USE_TANGENT_SPACE\n #endif\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_SHARED_DATA\nvoid SurfacesVertexModifyLocalSharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS\nvec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.worldPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS\nvec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)\n{\n return In.clipPos;\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_UV\nvoid SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHADOW_BIAS\n#endif\n#ifndef CC_SURFACES_VERTEX_MODIFY_SHARED_DATA\nvoid SurfacesVertexModifySharedData(inout SurfacesStandardVertexIntermediate In)\n{\n}\n#endif\nvoid CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)\n{\n In.position = vec4(a_position, 1.0);\n In.normal = a_normal;\n#if CC_SURFACES_USE_TANGENT_SPACE\n In.tangent = a_tangent;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n In.color = a_color;\n#endif\n In.texCoord = a_texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = a_texCoord1;\n#endif\n}\nvoid CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)\n{\n gl_Position = In.clipPos;\n VSOutput_worldNormal = In.worldNormal.xyz;\n VSOutput_faceSideSign = In.worldNormal.w;\n VSOutput_worldPos = In.worldPos;\n#if CC_SURFACES_USE_TANGENT_SPACE\n VSOutput_worldTangent = In.worldTangent.xyz;\n VSOutput_mirrorNormal = In.tangent.w > 0.0 ? 1.0 : -1.0;\n#endif\n#if CC_SURFACES_USE_VERTEX_COLOR\n VSOutput_vertexColor = In.color;\n#endif\n VSOutput_texcoord = In.texCoord;\n#if CC_SURFACES_USE_SECOND_UV\n VSOutput_texcoord1 = In.texCoord1;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n VSOutput_fogFactor = In.fogFactor;\n#endif\n#if CC_RECEIVE_SHADOW\n VSOutput_shadowBias = In.shadowBiasAndProbeId.xy;\n#endif\n#if CC_USE_REFLECTION_PROBE\n VSOutput_reflectionProbeId = In.shadowBiasAndProbeId.z;\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n VSOutput_reflectionProbeBlendId = In.shadowBiasAndProbeId.w;\n #endif\n #if USE_INSTANCING\n v_reflectionProbeData = a_reflectionProbeData;\n #endif\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n VSOutput_lightMapUV = In.lightmapUV;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n VSOutput_localPos = In.position;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n VSOutput_clipPos = In.clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n v_sh_linear_const_r = a_sh_linear_const_r;\n v_sh_linear_const_g = a_sh_linear_const_g;\n v_sh_linear_const_b = a_sh_linear_const_b;\n #endif\n#endif\n}\nvoid CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)\n{\nvec4 temp = vec4(0.0);\n#if CC_USE_MORPH\n #if CC_SURFACES_USE_TANGENT_SPACE\n applyMorph(In.position, In.normal, In.tangent);\n #else\n applyMorph(In.position, In.normal, temp);\n #endif\n#endif\n#if CC_USE_SKINNING\n #if CC_SURFACES_USE_TANGENT_SPACE\n CCSkin(In.position, In.normal, In.tangent);\n #else\n CCSkin(In.position, In.normal, temp);\n #endif\n#endif\n}\nvoid CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)\n{\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n In.worldPos = (matWorld * In.position).xyz;\n In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);\n #if CC_SURFACES_USE_TANGENT_SPACE\n In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);\n In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w;\n #endif\n}\nvoid CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)\n{\n #if CC_SURFACES_FLIP_UV\n In.texCoord = cc_cameraPos.w > 1.0 ? vec2(In.texCoord.x, 1.0 - In.texCoord.y) : In.texCoord;\n #if CC_SURFACES_USE_SECOND_UV\n In.texCoord1 = cc_cameraPos.w > 1.0 ? vec2(In.texCoord1.x, 1.0 - In.texCoord1.y) : In.texCoord1;\n #endif\n #endif\n}\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nvarying highp float v_dist;\nvoid main()\n{\n SurfacesStandardVertexIntermediate In;\n CCSurfacesVertexInput(In);\n CCSurfacesVertexAnimation(In);\n In.position.xyz = SurfacesVertexModifyLocalPos(In);\n SurfacesVertexModifyLocalSharedData(In);\n CCSurfacesVertexWorldTransform(In);\n In.worldPos = SurfacesVertexModifyWorldPos(In);\n vec4 shadowPos = CalculatePlanarShadowPos(In.worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n In.worldPos = shadowPos.xyz;\n In.clipPos = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n In.clipPos = SurfacesVertexModifyClipPos(In);\n SurfacesVertexModifyUV(In);\n SurfacesVertexModifySharedData(In);\n CCSurfacesVertexTransformUV(In);\n CCSurfacesVertexOutput(In);\n v_dist = shadowPos.w;\n}","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod: enable\n#endif\nprecision highp float;\n #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV\n #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE\n #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY\n #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR\n#if IS_ANISOTROPY || USE_NORMAL_MAP\n #define CC_SURFACES_USE_TANGENT_SPACE 1\n#endif\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31\n#ifndef CC_SURFACES_USE_SECOND_UV\n #define CC_SURFACES_USE_SECOND_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TANGENT_SPACE\n #define CC_SURFACES_USE_TANGENT_SPACE 0\n#endif\n#ifndef CC_SURFACES_USE_VERTEX_COLOR\n #define CC_SURFACES_USE_VERTEX_COLOR 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_LOCAL_POS\n #define CC_SURFACES_TRANSFER_LOCAL_POS 0\n#endif\n#ifndef CC_SURFACES_TRANSFER_CLIP_POS\n #define CC_SURFACES_TRANSFER_CLIP_POS 0\n#endif\n#ifndef CC_SURFACES_USE_LIGHT_MAP\n #ifdef CC_USE_LIGHTMAP\n #define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP\n #else\n #define CC_SURFACES_USE_LIGHT_MAP 0\n #endif\n#endif\n#ifndef CC_SURFACES_FLIP_UV\n #define CC_SURFACES_FLIP_UV 0\n#endif\n#ifndef CC_SURFACES_USE_TWO_SIDED\n #define CC_SURFACES_USE_TWO_SIDED 0\n#endif\n#ifndef CC_SURFACES_USE_REFLECTION_DENOISE\n #define CC_SURFACES_USE_REFLECTION_DENOISE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC\n #define CC_SURFACES_LIGHTING_ANISOTROPIC 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT\n #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0\n#endif\n#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING\n #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_FRESNEL\n #define CC_SURFACES_LIGHTING_USE_FRESNEL 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR\n #define CC_SURFACES_LIGHTING_TRANSMIT_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE\n #define CC_SURFACES_LIGHTING_TRANSMIT_DIFFUSE 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT\n #define CC_SURFACES_LIGHTING_USE_SHADOWMAP_TRANSMIT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TRT\n #define CC_SURFACES_LIGHTING_TRT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR\n #define CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SHEEN\n #define CC_SURFACES_LIGHTING_SHEEN 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_CLEAR_COAT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_TT\n #define CC_SURFACES_LIGHTING_TT 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_SSS\n #define CC_SURFACES_LIGHTING_SSS 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #if CC_SURFACES_LIGHTING_TRT || CC_SURFACES_LIGHTING_DUAL_LOBE_SPECULAR || CC_SURFACES_LIGHTING_SHEEN || CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR\n #define CC_SURFACES_LIGHTING_2ND_LAYER_SPECULAR 0\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #if CC_SURFACES_LIGHTING_CLEAR_COAT\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 1\n #endif\n#endif\n#ifndef CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND\n #define CC_SURFACES_LIGHTING_USE_MULTIPLE_LAYER_BLEND 0\n#endif\n#ifndef CC_SURFACES_ENABLE_DEBUG_VIEW\n #define CC_SURFACES_ENABLE_DEBUG_VIEW 1\n#endif\n#define CC_USE_SURFACE_SHADER 1\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nvarying highp vec3 v_worldPos;\nvarying vec4 v_normal;\nvarying vec2 v_uv;\n#if CC_SURFACES_USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n varying mediump vec4 v_tangent;\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n varying mediump vec2 v_uv1;\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n varying mediump vec3 v_luv;\n#endif\n#if CC_RECEIVE_SHADOW || CC_USE_REFLECTION_PROBE\n varying mediump vec4 v_shadowBiasAndProbeId;\n#endif\n#if CC_USE_REFLECTION_PROBE && USE_INSTANCING\n varying mediump vec4 v_reflectionProbeData;\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n varying mediump float v_fogFactor;\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n varying highp vec4 v_localPos;\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n varying highp vec4 v_clipPos;\n#endif\n#if CC_USE_LIGHT_PROBE\n #if USE_INSTANCING\n varying mediump vec4 v_sh_linear_const_r;\n varying mediump vec4 v_sh_linear_const_g;\n varying mediump vec4 v_sh_linear_const_b;\n #endif\n#endif\n#define FSInput_worldPos v_worldPos\n#define FSInput_worldNormal v_normal.xyz\n#define FSInput_faceSideSign v_normal.w\n#define FSInput_texcoord v_uv\n#if CC_SURFACES_USE_VERTEX_COLOR\n #define FSInput_vertexColor v_color\n#else\n #define FSInput_vertexColor vec4(1.0)\n#endif\n#if CC_SURFACES_USE_TANGENT_SPACE\n #define FSInput_worldTangent v_tangent.xyz\n #define FSInput_mirrorNormal v_tangent.w\n#else\n #define FSInput_worldTangent vec3(1.0, 1.0, 1.0)\n #define FSInput_mirrorNormal 1.0\n#endif\n#if CC_SURFACES_USE_SECOND_UV\n #define FSInput_texcoord1 v_uv1\n#else\n #define FSInput_texcoord1 vec2(0.0, 0.0)\n#endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n #define FSInput_lightMapUV v_luv\n#endif\n#if CC_RECEIVE_SHADOW\n #define FSInput_shadowBias v_shadowBiasAndProbeId.xy\n#endif\n#if CC_USE_REFLECTION_PROBE\n #define FSInput_reflectionProbeId v_shadowBiasAndProbeId.z\n #if CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND || CC_USE_REFLECTION_PROBE == REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX\n #define FSInput_reflectionProbeBlendId v_shadowBiasAndProbeId.w\n #endif\n #if USE_INSTANCING\n #define FSInput_reflectionProbeData v_reflectionProbeData\n #endif\n#endif\n#if CC_USE_FOG != 4 && !CC_USE_ACCURATE_FOG\n #define FSInput_fogFactor v_fogFactor\n#endif\n#if CC_SURFACES_TRANSFER_LOCAL_POS\n #define FSInput_localPos v_localPos\n#endif\n#if CC_SURFACES_TRANSFER_CLIP_POS\n #define FSInput_clipPos v_clipPos\n#endif\nuniform mediump vec4 cc_debug_view_mode;\nuniform mediump vec4 cc_surfaceTransform;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_IOR CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_IOR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FRESNEL CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_FRESNEL + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_TRANSMIT_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL CC_SURFACES_DEBUG_VIEW_TRANSMIT_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_TRANSMIT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL CC_SURFACES_DEBUG_VIEW_ENVIRONMENT_2ND_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_2ND_SPECULAR_ALL + 1\n#define IS_DEBUG_VIEW_ENABLE_WITH_CAMERA (cc_surfaceTransform.y != 3.0)\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (UnpackBitFromFloat(cc_debug_view_mode.w, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (UnpackBitFromFloat(cc_debug_view_mode.w, 7) && IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.y, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.y, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (UnpackBitFromFloat(cc_debug_view_mode.y, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (UnpackBitFromFloat(cc_debug_view_mode.y, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (UnpackBitFromFloat(cc_debug_view_mode.y, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (UnpackBitFromFloat(cc_debug_view_mode.y, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (UnpackBitFromFloat(cc_debug_view_mode.z, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (UnpackBitFromFloat(cc_debug_view_mode.z, 1) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (UnpackBitFromFloat(cc_debug_view_mode.z, 2) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (UnpackBitFromFloat(cc_debug_view_mode.z, 3) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FRESNEL (UnpackBitFromFloat(cc_debug_view_mode.z, 4) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_DIFFUSE (UnpackBitFromFloat(cc_debug_view_mode.z, 5) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TRANSMIT_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 6) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_2ND_SPECULAR (UnpackBitFromFloat(cc_debug_view_mode.z, 7) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TT (UnpackBitFromFloat(cc_debug_view_mode.w, 0) || !IS_DEBUG_VIEW_ENABLE_WITH_CAMERA)\n#if (CC_PIPELINE_TYPE == 0 || CC_FORCE_FORWARD_SHADING)\n #if CC_FORWARD_ADD\n #if CC_PIPELINE_TYPE == 0\n #define LIGHTS_PER_PASS 1\n #else\n #define LIGHTS_PER_PASS 10\n #endif\n #if CC_ENABLE_CLUSTERED_LIGHT_CULLING == 0\n #endif\n #endif\n#endif\n#if CC_USE_LIGHT_PROBE\n #if !USE_INSTANCING\n #endif\n#endif\nuniform lowp vec4 cc_shadowColor;\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n #endif\nuniform samplerCube cc_environment;\n#if CC_USE_IBL\n #if CC_USE_DIFFUSEMAP\n uniform samplerCube cc_diffuseMap;\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n uniform samplerCube cc_reflectionProbeCubemap;\n uniform sampler2D cc_reflectionProbePlanarMap;\n uniform sampler2D cc_reflectionProbeDataMap;\n uniform samplerCube cc_reflectionProbeBlendCubemap;\n#endif\n#define UnpackBitFromFloat(value, bit) (mod(floor(value / pow(10.0, float(bit))), 10.0) > 0.0)\n#if defined(CC_USE_METAL) || defined(CC_USE_WGPU)\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y) y = -y\n#else\n#define CC_HANDLE_SAMPLE_NDC_FLIP_STATIC(y)\n#endif\n#if CC_SUPPORT_CASCADED_SHADOW_MAP\n#endif\n#if CC_RECEIVE_SHADOW\n uniform highp sampler2D cc_shadowMap;\n uniform highp sampler2D cc_spotShadowMap;\n #if CC_SUPPORT_CASCADED_SHADOW_MAP\n #else\n #endif\n#endif\n#if CC_USE_FOG != 4\n#endif\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n #endif\n#endif\n#if CC_USE_REFLECTION_PROBE\n #endif\n#if CC_USE_LIGHTMAP && !CC_FORWARD_ADD\n uniform sampler2D cc_lightingMap;\n#endif\n uniform vec4 albedo;\n uniform vec4 albedoScaleAndCutoff;\n#if USE_ALBEDO_MAP\n uniform sampler2D albedoMap;\n#endif\n#if USE_NORMAL_MAP\n uniform sampler2D normalMap;\n#endif\n#if USE_PBR_MAP\n uniform sampler2D pbrMap;\n#endif\n#if USE_OCCLUSION_MAP\n uniform sampler2D occlusionMap;\n#endif\n#if USE_EMISSIVE_MAP\n uniform sampler2D emissiveMap;\n#endif\n#if IS_ANISOTROPY && USE_ANISOTROPY_MAP\n uniform sampler2D anisotropyMap;\n uniform sampler2D anisotropyMapNearestFilter;\n#endif\n#if USE_ALPHA_TEST\n#endif\n#define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY\n#define CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\nvoid SurfacesFragmentAlphaClipOnly()\n{\n #if USE_ALPHA_TEST\n float alpha = albedo.ALPHA_TEST_CHANNEL;\n #if USE_VERTEX_COLOR\n alpha *= FSInput_vertexColor.a;\n #endif\n #if USE_ALBEDO_MAP\n alpha = texture2D(albedoMap, ALBEDO_UV).ALPHA_TEST_CHANNEL;\n #endif\n if (alpha < albedoScaleAndCutoff.w) discard;\n #endif\n}\n#define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL\n#define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS\n#define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE\n#define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS\nvarying highp float v_dist;\nvoid main () {\n#ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY\n SurfacesFragmentAlphaClipOnly();\n#endif\n if(v_dist < 0.0)\n discard;\n gl_FragColor = cc_shadowColor;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]},{"name":"CCCSM","defines":["CC_SUPPORT_CASCADED_SHADOW_MAP"]}],"samplerTextures":[{"name":"cc_environment","defines":[]},{"name":"cc_diffuseMap","defines":["CC_USE_IBL","CC_USE_DIFFUSEMAP"]},{"name":"cc_shadowMap","defines":["CC_RECEIVE_SHADOW"]},{"name":"cc_spotShadowMap","defines":["CC_RECEIVE_SHADOW"]}],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["!USE_INSTANCING"]},{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCForwardLight","defines":["CC_FORWARD_ADD","CC_ENABLE_CLUSTERED_LIGHT_CULLING"]},{"name":"CCSH","defines":["CC_USE_LIGHT_PROBE","!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"cc_reflectionProbeCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbePlanarMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeDataMap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_reflectionProbeBlendCubemap","defines":["CC_USE_REFLECTION_PROBE"]},{"name":"cc_lightingMap","defines":["CC_USE_LIGHTMAP","!CC_FORWARD_ADD"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":97,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":127}},"defines":[{"name":"HAS_SECOND_UV","type":"boolean"},{"name":"USE_TWOSIDE","type":"boolean"},{"name":"IS_ANISOTROPY","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"FIX_ANISOTROPIC_ROTATION_MAP","type":"boolean"},{"name":"USE_NORMAL_MAP","type":"boolean"},{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_REFLECTION_PROBE","type":"number","range":[0,3]},{"name":"CC_USE_LIGHT_PROBE","type":"boolean","default":0},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_FORWARD_ADD","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER","type":"number","range":[0,1]},{"name":"CC_PIPELINE_TYPE","type":"number","range":[0,1]},{"name":"CC_FORCE_FORWARD_SHADING","type":"boolean"},{"name":"CC_ENABLE_CLUSTERED_LIGHT_CULLING","type":"number","range":[0,3]},{"name":"CC_SUPPORT_CASCADED_SHADOW_MAP","type":"boolean"},{"name":"CC_USE_IBL","type":"number","range":[0,2]},{"name":"CC_USE_DIFFUSEMAP","type":"number","range":[0,2]},{"name":"USE_ALBEDO_MAP","type":"boolean"},{"name":"ALBEDO_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"NORMAL_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"DEFAULT_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_PBR_MAP","type":"boolean"},{"name":"USE_OCCLUSION_MAP","type":"boolean"},{"name":"USE_EMISSIVE_MAP","type":"boolean"},{"name":"EMISSIVE_UV","type":"string","options":["v_uv","v_uv1"]},{"name":"USE_ANISOTROPY_MAP","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r"]}]}],[{"name":"opaque","passes":[{"program":"builtin-standard|standard-vs|standard-fs","properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[0],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.5],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0],"handleInfo":["pbrParams",2,13]},"specularIntensity":{"type":13,"value":[0.5],"handleInfo":["pbrParams",3,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"normalStrength":{"type":13,"value":[1],"handleInfo":["emissiveScaleParam",3,13]},"anisotropyIntensity":{"type":13,"value":[1],"handleInfo":["anisotropyParam",0,13]},"anisotropyRotation":{"type":13,"value":[0],"handleInfo":["anisotropyParam",1,13]},"anisotropyMapResolutionHeight":{"type":13,"value":[0],"handleInfo":["anisotropyParam",3,13]},"addOnShadowBias":{"type":13,"value":[0],"handleInfo":["anisotropyParam",2,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"anisotropyMap":{"value":"black","type":28},"anisotropyMapNearestFilter":{"value":"black","type":28},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"pbrParams":{"type":16,"value":[0,0.5,0,0.5]},"emissiveScaleParam":{"type":16,"value":[1,1,1,1]},"anisotropyParam":{"type":16,"value":[1,0,0,0]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"forward-add","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORWARD_ADD":true},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":1}]},"depthStencilState":{"depthFunc":2,"depthTest":true,"depthWrite":false}},{"phase":"shadow-caster","propertyIndex":0,"program":"builtin-standard|shadow-caster-vs|shadow-caster-fs","rasterizerState":{"cullMode":1},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"reflect-map","propertyIndex":0,"program":"builtin-standard|standard-vs|reflect-map-fs"},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-standard|planar-shadow-vs|planar-shadow-fs","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"pass":"gbuffer","phase":"gbuffer","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_PIPELINE_TYPE":1}}]},{"name":"transparent","passes":[{"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORCE_FORWARD_SHADING":true},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"occlusion":{"type":13,"value":[0],"handleInfo":["pbrParams",0,13]},"roughness":{"type":13,"value":[0.5],"handleInfo":["pbrParams",1,13]},"metallic":{"type":13,"value":[0],"handleInfo":["pbrParams",2,13]},"specularIntensity":{"type":13,"value":[0.5],"handleInfo":["pbrParams",3,13]},"emissive":{"linear":true,"type":16,"value":[0,0,0,1]},"emissiveScale":{"type":15,"value":[1,1,1],"handleInfo":["emissiveScaleParam",0,15]},"normalStrength":{"type":13,"value":[1],"handleInfo":["emissiveScaleParam",3,13]},"anisotropyIntensity":{"type":13,"value":[1],"handleInfo":["anisotropyParam",0,13]},"anisotropyRotation":{"type":13,"value":[0],"handleInfo":["anisotropyParam",1,13]},"anisotropyMapResolutionHeight":{"type":13,"value":[0],"handleInfo":["anisotropyParam",3,13]},"addOnShadowBias":{"type":13,"value":[0],"handleInfo":["anisotropyParam",2,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"normalMap":{"value":"normal","type":28},"pbrMap":{"value":"grey","type":28},"occlusionMap":{"value":"white","type":28},"emissiveMap":{"value":"grey","type":28},"anisotropyMap":{"value":"black","type":28},"anisotropyMapNearestFilter":{"value":"black","type":28},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"pbrParams":{"type":16,"value":[0,0.5,0,0.5]},"emissiveScaleParam":{"type":16,"value":[1,1,1,1]},"anisotropyParam":{"type":16,"value":[1,0,0,0]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"forward-add","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_FORWARD_ADD":true},"blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":1,"blendSrcAlpha":0,"blendDstAlpha":1}]},"depthStencilState":{"depthFunc":2,"depthTest":true,"depthWrite":false}},{"phase":"shadow-caster","propertyIndex":0,"program":"builtin-standard|shadow-caster-vs|shadow-caster-fs","rasterizerState":{"cullMode":1},"properties":{"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"type":16,"value":[1,1,1,1],"handleInfo":["albedo",0,16]},"albedoScale":{"type":15,"value":[1,1,1],"handleInfo":["albedoScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["albedoScaleAndCutoff",3,13]},"mainTexture":{"value":"grey","type":28,"handleInfo":["albedoMap",0,28]},"albedo":{"type":16,"value":[1,1,1,1]},"albedoScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]},"albedoMap":{"type":28,"value":"grey"}}},{"phase":"planar-shadow","propertyIndex":0,"program":"builtin-standard|planar-shadow-vs|planar-shadow-fs","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}},{"phase":"deferred-forward","propertyIndex":0,"program":"builtin-standard|standard-vs|standard-fs","embeddedMacros":{"CC_PIPELINE_TYPE":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false}}]}]]],0,0,[],[],[]],[[{"base":"2,2,0,0,2,0","rgbe":true,"mipmaps":[{"front":"d0MqyYBeFAkIi762QNy1/B@b47c0@e9a6d","back":"d0MqyYBeFAkIi762QNy1/B@b47c0@40c10","left":"d0MqyYBeFAkIi762QNy1/B@b47c0@8fd34","right":"d0MqyYBeFAkIi762QNy1/B@b47c0@74afd","top":"d0MqyYBeFAkIi762QNy1/B@b47c0@bb97f","bottom":"d0MqyYBeFAkIi762QNy1/B@b47c0@7d38f"}]}],[11],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[[82,".bin",2243344238,[{"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":576,"length":72,"count":36,"stride":2}}],"vertexBundles":[{"view":{"offset":0,"length":576,"count":24,"stride":24},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false}]}]},"minPosition",8,[1,-4.703986167907715,-0.7049768567085266,-1.8473005294799805],"maxPosition",8,[1,2.9668948650360107,0.5894098877906799,1.3165509700775146]]],-1],0,0,[],[],[]],[[[2,".bin",1098519479,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":96768,"length":12000,"count":3000,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":96768,"count":1728,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-2.051382064819336,"y":-7.167378902435303,"z":-27.182071685791016},"maxPosition":{"x":2.0513916015625,"y":6.791487693786621,"z":22.427738189697266}}],-1],0,0,[],[],[]],[[[2,".bin",2824763344,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":20719552,"length":2097480,"count":524370,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":20719552,"count":369992,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-4.693985939025879,"y":-0.6949768662452698,"z":-1.8373005390167236},"maxPosition":{"x":2.956894874572754,"y":0.5794098973274231,"z":1.290750503540039}}],-1],0,0,[],[],[]],[[[2,".bin",3011687073,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":39256,"length":12672,"count":3168,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":39256,"count":701,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-90.84678649902344,"y":-11.55404281616211,"z":-31.565078735351562},"maxPosition":{"x":95.24180603027344,"y":8.71641731262207,"z":29.075763702392578}}],-1],0,0,[],[],[]],[[[4,"Concrete",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":0,"roughness":1,"normalStrenth":3,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[28,29,30,0]],[[[2,".bin",2183235626,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":9072,"length":1296,"count":324,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":9072,"count":162,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-1.732240915298462,"y":-0.7313365936279297,"z":-0.7364002466201782},"maxPosition":{"x":1.6617214679718018,"y":0.6473045349121094,"z":0.5885758399963379}}],-1],0,0,[],[],[]],[[[4,"blue.025",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.23090064525604248,0.15619874000549316,0.07215280830860138]]],11]]],0,0,[0],[2],[0]],[[[4,"ground.004",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.20155394077301025,0.14702947437763214,0.08437485992908478]]],11]]],0,0,[0],[2],[0]],[[[4,"Green.011",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.800000011920929,0.800000011920929,0.800000011920929]]],11]]],0,0,[0],[2],[0]],[[[4,"Green painted lightly scratched metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[31,32,33,0]],[[[2,".bin",1072531778,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":32592,"length":5232,"count":1308,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":32592,"count":679,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.869581699371338,"y":-7.152346611022949,"z":-0.5820784568786621},"maxPosition":{"x":0.5715322494506836,"y":0.8228311538696289,"z":0.392530620098114}}],-1],0,0,[],[],[]],[[[2,".bin",3027437282,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3305456,"length":421848,"count":105462,"stride":4}},{"primitiveMode":7,"vertexBundelIndices":[1],"indexView":{"offset":4747568,"length":138648,"count":34662,"stride":4}},{"primitiveMode":7,"vertexBundelIndices":[2],"indexView":{"offset":5043808,"length":20088,"count":5022,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3305456,"count":59026,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]},{"view":{"offset":3727304,"length":1020264,"count":18219,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]},{"view":{"offset":4886224,"length":157584,"count":2814,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-0.8272836804389954,"y":-1.414009928703308,"z":-29.121009826660156},"maxPosition":{"x":0.8272573947906494,"y":1.4428189992904663,"z":29.862586975097656}}],-1],0,0,[],[],[]],[[[2,".bin",318960867,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":60984,"length":9228,"count":2307,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":60984,"count":1089,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-1.4984955787658691,"y":-1.4668798446655273,"z":-0.7696774005889893},"maxPosition":{"x":0.9779257774353027,"y":1.096120834350586,"z":0.5600199699401855}}],-1],0,0,[],[],[]],[[[2,".bin",3828672128,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":8112,"length":1344,"count":336,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":8112,"count":169,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-3.838771343231201,"y":-3.068157434463501,"z":-3.9752426147460938},"maxPosition":{"x":2.9212331771850586,"y":3.931842803955078,"z":2.784762144088745}}],-1],0,0,[],[],[]],[[[2,".bin",89730571,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3072,"length":528,"count":132,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3072,"count":64,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-162.24061584472656,"y":-32.68532943725586,"z":-28.270042419433594},"maxPosition":{"x":162.2406005859375,"y":34.21122741699219,"z":35.729679107666016}}],-1],0,0,[],[],[]],[[[2,".bin",1903378408,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":9252824,"length":1127940,"count":281985,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":9252824,"count":165229,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-2.748079299926758,"y":-2.2851486206054688,"z":-23.17571258544922},"maxPosition":{"x":1.7031292915344238,"y":2.718785047531128,"z":26.534069061279297}}],-1],0,0,[],[],[]],[[[2,".bin",1225820022,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":660576,"length":80208,"count":20052,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":660576,"count":11796,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-7.632589340209961,"y":-13.879571914672852,"z":-9.8881196975708},"maxPosition":{"x":7.360372543334961,"y":13.94533634185791,"z":9.889798164367676}}],-1],0,0,[],[],[]],[[[2,".bin",2230636185,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":435064,"length":38388,"count":9597,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":435064,"count":7769,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-2.400458812713623,"y":-4.7764434814453125,"z":-9.352968215942383},"maxPosition":{"x":3.2065510749816895,"y":1.715900182723999,"z":1.9246351718902588}}],-1],0,0,[],[],[]],[[[2,".bin",719661320,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":6965184,"length":1555368,"count":388842,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":6965184,"count":145108,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-7.865898609161377,"y":-4.130477428436279,"z":-2.187797784805298},"maxPosition":{"x":7.508179187774658,"y":2.7857141494750977,"z":2.1882078647613525}}],-1],0,0,[],[],[]],[[[2,".bin",3531307454,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":13824,"length":1824,"count":456,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":13824,"count":216,"stride":64},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false},{"name":"a_texCoord2","format":21,"isNormalized":false}]}],"minPosition":{"x":-25.003673553466797,"y":-0.4662364721298218,"z":-16.01229476928711},"maxPosition":{"x":20.939456939697266,"y":0.4798845946788788,"z":20.067232131958008}}],-1],0,0,[],[],[]],[[[4,"Edge Wear Dull Blue",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[34,35,0]],[[[4,"Scratched Rusted Painted Metal Edge Wear",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"tilingOffset",8,[2,5,5,0,-4],"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[36,37,0]],[[[2,".bin",1026845900,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1835680,"length":640668,"count":160167,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1835680,"count":32780,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-4.248144149780273,"y":-11.25326156616211,"z":-4.180410385131836},"maxPosition":{"x":3.15185546875,"y":8.25032901763916,"z":4.2195892333984375}}],-1],0,0,[],[],[]],[[[2,".bin",235598416,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":371056,"length":61704,"count":15426,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":371056,"count":6626,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-0.48407959938049316,"y":-0.280759334564209,"z":-1.2649946212768555},"maxPosition":{"x":0.49081048369407654,"y":0.7445205450057983,"z":1.4286001920700073}}],-1],0,0,[],[],[]],[[[4,"ground.007",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.28663724660873413,0.17660126090049744,0.05695635825395584]]],11]]],0,0,[0],[2],[0]],[[[2,".bin",1274798288,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":63952,"length":21072,"count":5268,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":63952,"count":1142,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-159.0943603515625,"y":-26.251480102539062,"z":-125.14013671875},"maxPosition":{"x":305.20660400390625,"y":16.387346267700195,"z":161.3263702392578}}],-1],0,0,[],[],[]],[[[2,".bin",3531113039,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":2304,"length":384,"count":96,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":2304,"count":48,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-8.192999839782715,"y":-1.0000004768371582,"z":-9.129300117492676},"maxPosition":{"x":5.941999435424805,"y":1.0000003576278687,"z":9.880701065063477}}],-1],0,0,[],[],[]],[[[2,".bin",1150599285,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3161368,"length":997944,"count":249486,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3161368,"count":56453,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-15.688637733459473,"y":-11.211445808410645,"z":-2.999967098236084},"maxPosition":{"x":26.936033248901367,"y":3.273378372192383,"z":3.0000319480895996}}],-1],0,0,[],[],[]],[[[4,"Green.009",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.800000011920929,0.800000011920929,0.800000011920929]]],11]]],0,0,[0],[2],[0]],[[[2,".bin",3856297539,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":5055456,"length":759840,"count":189960,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":5055456,"count":105322,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-0.8272719383239746,"y":-0.787717342376709,"z":-39.76194763183594},"maxPosition":{"x":0.8272690773010254,"y":0.7072815895080566,"z":39.373207092285156}}],-1],0,0,[],[],[]],[[[4,"Purple painted lightly scratched metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[38,39,40,0]],[[[4,"Scratched red metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[41,42,43,0]],[[[4,"Scratched Rusted Painted Metal Edge Wear",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"tilingOffset",8,[2,5,5,0,-4],"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[36,37,0]],[[[4,"Scratched red metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[41,42,43,0]],[[[2,".bin",3956735824,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":613248,"length":76644,"count":19161,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":613248,"count":12776,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.2033214569091797,"y":-0.7734655737876892,"z":-1.201995849609375},"maxPosition":{"x":3.606947660446167,"y":0.48230844736099243,"z":1.0634585618972778}}],-1],0,0,[],[],[]],[[[4,"Material.021",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0.6073752641677856,"roughness":0.2678958773612976,"occlusion":0},"albedoScale",8,[1,0.6804912090301514,0.8003470301628113,0.09507447481155396]]],11]]],0,0,[0],[2],[0]],[[[4,"Edge Wear Orange",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[44,45,0]],[[[4,"blue.001",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.5,"occlusion":0},"albedoScale",8,[1,0.007058185525238514,0,0.8001105785369873]]],11]]],0,0,[0],[2],[0]],[[[4,"Damaged painted metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[114,115,116,0]],[[[2,".bin",3718645320,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":24696,"length":3504,"count":876,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":24696,"count":441,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-1.432854413986206,"y":-2.474635124206543,"z":-2.8333640098571777},"maxPosition":{"x":1.6561455726623535,"y":3.1793527603149414,"z":1.9177289009094238}}],-1],0,0,[],[],[]],[[[2,".bin",372310987,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":422968,"length":70008,"count":17502,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":422968,"count":7553,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-4.791969299316406,"y":-7.0134429931640625,"z":-3.877774477005005},"maxPosition":{"x":2.868030548095703,"y":6.921552658081055,"z":3.2165074348449707}}],-1],0,0,[],[],[]],[[[4,"Yellow painted lightly scratched metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[117,118,119,0]],[[[4,"Green.013",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.800000011920929,0.800000011920929,0.800000011920929]]],11]]],0,0,[0],[2],[0]],[[[2,".bin",3074049988,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":36240,"length":5844,"count":1461,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":36240,"count":755,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-1.2194815874099731,"y":-1.151947021484375,"z":-1.0781443119049072},"maxPosition":{"x":1.7777738571166992,"y":1.5040531158447266,"z":0.9995324611663818}}],-1],0,0,[],[],[]],[[[2,".bin",3326468655,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3191496,"length":881772,"count":220443,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3191496,"count":56991,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-8.68127155303955,"y":-9.696488380432129,"z":-3.9829044342041016},"maxPosition":{"x":7.544350624084473,"y":4.264317512512207,"z":4.1670989990234375}}],-1],0,0,[],[],[]],[[[4,"Edge Wear Dull Blue",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[34,35,0]],[[[2,".bin",1738707525,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1700384,"length":250992,"count":62748,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1700384,"count":30364,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-162.5094757080078,"y":-4.0075273513793945,"z":-3.6190621852874756},"maxPosition":{"x":164.44305419921875,"y":2.399665117263794,"z":0.09001336246728897}}],-1],0,0,[],[],[]],[[[2,".bin",4053384955,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":5716176,"length":507504,"count":126876,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":5716176,"count":119087,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.5428988933563232,"y":-0.5346171855926514,"z":-0.8335930109024048},"maxPosition":{"x":1.8123376369476318,"y":0.5448670387268066,"z":0.8271138072013855}}],-1],0,0,[],[],[]],[[[4,"Brown scratched brushed metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[120,121,122,0]],[[[4,"blue.013",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.800000011920929,0.800000011920929,0.800000011920929]]],11]]],0,0,[0],[2],[0]],[[[2,".bin",973693803,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":268032,"length":37224,"count":9306,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":268032,"count":5584,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.572575807571411,"y":-5.3567938804626465,"z":-30.82970428466797},"maxPosition":{"x":2.0521557331085205,"y":7.965808868408203,"z":32.95130157470703}}],-1],0,0,[],[],[]],[[[2,".bin",4001531005,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1152,"length":144,"count":36,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1152,"count":24,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-1.2536258697509766,"y":-0.802006721496582,"z":-0.4075794219970703},"maxPosition":{"x":0.9318904876708984,"y":0.7609291076660156,"z":0.40752220153808594}}],-1],0,0,[],[],[]],[[[2,".bin",2838427453,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":636384,"length":94224,"count":23556,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":636384,"count":11364,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-32.36196517944336,"y":-2.535766363143921,"z":-0.6966555118560791},"maxPosition":{"x":32.66276931762695,"y":1.673110008239746,"z":0.6966570019721985}}],-1],0,0,[],[],[]],[[[2,".bin",1935586791,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":212448,"length":40128,"count":10032,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":212448,"count":4426,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-1.3683147430419922,"y":-0.8042640686035156,"z":-0.4647234380245209},"maxPosition":{"x":0.5572705268859863,"y":1.327500343322754,"z":0.3635886609554291}}],-1],0,0,[],[],[]],[[[2,".bin",1224890803,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":610752,"length":99960,"count":24990,"stride":4}},{"primitiveMode":7,"vertexBundelIndices":[1],"indexView":{"offset":845424,"length":20088,"count":5022,"stride":4}},{"primitiveMode":7,"vertexBundelIndices":[2],"indexView":{"offset":1000224,"length":20088,"count":5022,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":610752,"count":12724,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]},{"view":{"offset":710736,"length":134688,"count":2806,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]},{"view":{"offset":865536,"length":134688,"count":2806,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-42.35490798950195,"y":-1.107464075088501,"z":-0.8273162841796875},"maxPosition":{"x":12.217708587646484,"y":2.3330459594726562,"z":0.8272252082824707}}],-1],0,0,[],[],[]],[[[4,"Purple painted lightly scratched metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[38,39,40,0]],[[[2,".bin",225484933,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1552040,"length":201552,"count":50388,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1552040,"count":27715,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-0.827239453792572,"y":-0.8460428714752197,"z":-7.309096813201904},"maxPosition":{"x":0.8273016214370728,"y":0.6489560604095459,"z":7.613480091094971}}],-1],0,0,[],[],[]],[[[2,".bin",681404834,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":10283760,"length":1457412,"count":364353,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":10283760,"count":214245,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.747992515563965,"y":-6.201554298400879,"z":-30.883291244506836},"maxPosition":{"x":1.7032055854797363,"y":7.7247114181518555,"z":33.345977783203125}}],-1],0,0,[],[],[]],[[[4,"Metal mesh",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthWrite":false}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true,"USE_EMISSIVE_MAP":true,"EMISSIVE_UV":"v_uv1"}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2,"emissiveMap",6,3]],11]]],0,0,[0,0,0,0,0],[3,4,7,33,2],[123,124,125,126,0]],[[[4,"Matal solid paint white",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[127,128,129,0]],[[[2,".bin",2764673267,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3136,"length":528,"count":132,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3136,"count":56,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-5.329587459564209,"y":-0.06666702032089233,"z":-6.549999237060547},"maxPosition":{"x":5.279829025268555,"y":0.3333335518836975,"z":6.5500030517578125}}],-1],0,0,[],[],[]],[[[4,"Green.014",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}],[[[{"metallic":0,"roughness":0.4000000059604645,"occlusion":0},"albedoScale",8,[1,0.800000011920929,0.800000011920929,0.800000011920929]]],11]]],0,0,[0],[2],[0]],[[[4,"Edge Wear Orange",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1]],11]]],0,0,[0,0,0],[3,4,2],[44,45,0]],[[[4,"Metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"normalStrenth":0.25,"occlusion":0},"tilingOffset",8,[2,2,2,0,-1],"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[130,131,132,0]],[[[4,"Rock Ground Texture",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":0.20000000298023224,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[133,134,135,0]],[[[4,"yellow",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0,"roughness":0.5,"occlusion":0},"albedoScale",8,[1,0.2195221185684204,0.14413093030452728,0.060379985719919205]]],11]]],0,0,[0],[2],[0]],[[[4,"Material.020",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true}],[[[{"metallic":0.5813449025154114,"roughness":0.27874186635017395,"occlusion":0},"albedoScale",8,[1,0.771022379398346,0.7737046480178833,0.8003705143928528]]],11]]],0,0,[0],[2],[0]],[[[2,".bin",2175087688,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":11680944,"length":1661412,"count":415353,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":11680944,"count":243353,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-1.7036113739013672,"y":-2.0311598777770996,"z":-36.16123580932617},"maxPosition":{"x":2.7475976943969727,"y":1.9540750980377197,"z":34.15791702270508}}],-1],0,0,[],[],[]],[[[2,".bin",1029023149,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1432648,"length":238608,"count":59652,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1432648,"count":25583,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-1.8810688257217407,"y":-1.1512842178344727,"z":-1.5933667421340942},"maxPosition":{"x":3.993788003921509,"y":2.108454704284668,"z":2.606633424758911}}],-1],0,0,[],[],[]],[[[2,".bin",2698525553,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":6720,"length":912,"count":228,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":6720,"count":120,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-12.389026641845703,"y":-0.10000044107437134,"z":-10.632989883422852},"maxPosition":{"x":23.469730377197266,"y":0.10000043362379074,"z":9.147008895874023}}],-1],0,0,[],[],[]],[[[2,".bin",2377055195,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":526416,"length":112548,"count":28137,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":526416,"count":10967,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-1.5477492809295654,"y":-2.0147476196289062,"z":-2.9688880443573},"maxPosition":{"x":1.966205358505249,"y":1.9973793029785156,"z":3.636493444442749}}],-1],0,0,[],[],[]],[[[2,".bin",1262464638,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":1144800,"length":558624,"count":139656,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":1144800,"count":23850,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-483.45770263671875,"y":-10.518309593200684,"z":-496.33306884765625},"maxPosition":{"x":489.79351806640625,"y":47.602664947509766,"z":476.91815185546875}}],-1],0,0,[],[],[]],[[[4,"Blue painted damaged metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[136,137,138,0]],[[[2,".bin",1571579743,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":105984,"length":15264,"count":3816,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":105984,"count":2208,"stride":48},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false}]}],"minPosition":{"x":-2.0513815879821777,"y":-12.598760604858398,"z":-42.30408477783203},"maxPosition":{"x":2.0513978004455566,"y":9.3817720413208,"z":27.425647735595703}}],-1],0,0,[],[],[]],[[[4,"Concrete",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":0,"roughness":1,"normalStrenth":3,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[28,29,30,0]],[[[4,"Green painted lightly scratched metal",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"HAS_SECOND_UV":true,"USE_ALBEDO_MAP":true,"ALBEDO_UV":"v_uv1","USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":1,"occlusion":0},"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[31,32,33,0]],[[[2,".bin",4218699939,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":149240,"length":30480,"count":7620,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":149240,"count":2665,"stride":56},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false}]}],"minPosition":{"x":-73.96753692626953,"y":-36.986610412597656,"z":-120.39309692382812},"maxPosition":{"x":96.42711639404297,"y":34.2363395690918,"z":122.58970642089844}}],-1],0,0,[],[],[]],[[[2,".bin",4156589728,{"compressed":true,"primitives":[{"primitiveMode":7,"vertexBundelIndices":[0],"indexView":{"offset":3991744,"length":540252,"count":135063,"stride":4}}],"vertexBundles":[{"view":{"offset":0,"length":3991744,"count":62371,"stride":64},"attributes":[{"name":"a_position","format":32,"isNormalized":false},{"name":"a_normal","format":32,"isNormalized":false},{"name":"a_texCoord","format":21,"isNormalized":false},{"name":"a_tangent","format":44,"isNormalized":false},{"name":"a_texCoord1","format":21,"isNormalized":false},{"name":"a_texCoord2","format":21,"isNormalized":false}]}],"minPosition":{"x":-20.11028289794922,"y":-8.440529823303223,"z":-13.085355758666992},"maxPosition":{"x":26.956066131591797,"y":14.389472007751465,"z":24.02705955505371}}],-1],0,0,[],[],[]],[[[4,"Metal floor",[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{"USE_ALBEDO_MAP":true,"USE_PBR_MAP":true,"USE_NORMAL_MAP":true}],[[[{"metallic":1,"roughness":0.5,"occlusion":0},"tilingOffset",8,[2,2,2,0,-1],"mainTexture",6,0,"pbrMap",6,1,"normalMap",6,2]],11]]],0,0,[0,0,0,0],[3,4,7,2],[139,140,141,0]],[[{"name":"default_radio_button_off","rect":{"x":3,"y":3,"width":26,"height":26},"offset":{"x":0,"y":0},"originalSize":{"width":32,"height":32},"rotated":false,"capInsets":[13,13,13,13],"vertices":{"rawPosition":[-13,-13,0,13,-13,0,-13,13,0,13,13,0],"indexes":[0,1,2,2,1,3],"uv":[3,29,29,29,3,3,29,3],"nuv":[0.09375,0.09375,0.90625,0.09375,0.09375,0.90625,0.90625,0.90625],"minPos":{"x":-13,"y":-13,"z":0},"maxPos":{"x":13,"y":13,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[142]],[[{"name":"default_scrollbar_vertical_bg","rect":{"x":0,"y":0,"width":15,"height":30},"offset":{"x":0,"y":0},"originalSize":{"width":15,"height":30},"rotated":false,"capInsets":[4,10,4,10],"vertices":{"rawPosition":[-7.5,-15,0,7.5,-15,0,-7.5,15,0,7.5,15,0],"indexes":[0,1,2,2,1,3],"uv":[0,30,15,30,0,0,15,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-7.5,"y":-15,"z":0},"maxPos":{"x":7.5,"y":15,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[2],0,[0],[9],[143]]]] diff --git a/code/assets/main/import/0a/0a6d024a0.json b/code/assets/main/import/0a/0a6d024a0.json new file mode 100644 index 0000000..84c9f8b --- /dev/null +++ b/code/assets/main/import/0a/0a6d024a0.json @@ -0,0 +1 @@ +{"type":"cc.Texture2D","data":[["2,2,2,2,0,0",["54TknWPwVPqJqeCR+Y/Czo"]],["2,2,2,2,0,0",["20g1ukYUVPvKWKBRznAKo+"]],["2,2,2,2,0,0",["afxHkx8GZGsJC+n+YfITQo"]],["2,2,2,2,0,0",["b7MFJ8MjNBwqr3fNq1j5dJ"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6ee89"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@2e78d"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@07f2f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6af60"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@87329"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8f420"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@db620"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e5e90"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5501b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@31c60"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5f29a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@3f79a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@2f00a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@90611"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d5db4"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d0c04"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8222a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e73c6"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f2d5a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@a0c07"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e461a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6fe55"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e6790"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5f893"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f9ec9"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@54d9f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e1124"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@a1f5c"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@39e53"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5501b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@eb942"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5c5bd"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6cae0"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@bf0b5"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6fe55"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@0fa64"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@9333c"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@7597f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@b4805"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@95418"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@48729"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@1f444"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e5ade"]],["2,2,2,2,0,0",["f1KiPEuSRDIqJgPZgkKPHo"]],["2,2,2,2,0,0",["ffuIqPr2JI9I8dPLYGRDpD"]]]} diff --git a/code/assets/main/import/20/20835ba4-6145-4fbc-a58a-051ce700aa3e.json b/code/assets/main/import/20/20835ba4-6145-4fbc-a58a-051ce700aa3e.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/20/20835ba4-6145-4fbc-a58a-051ce700aa3e.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/54/544e49d6-3f05-4fa8-9a9e-091f98fc2ce8.json b/code/assets/main/import/54/544e49d6-3f05-4fa8-9a9e-091f98fc2ce8.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/54/544e49d6-3f05-4fa8-9a9e-091f98fc2ce8.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/af/afc47931-f066-46b0-90be-9fe61f213428.json b/code/assets/main/import/af/afc47931-f066-46b0-90be-9fe61f213428.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/af/afc47931-f066-46b0-90be-9fe61f213428.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/b7/b730527c-3233-41c2-aaf7-7cdab58f9749.json b/code/assets/main/import/b7/b730527c-3233-41c2-aaf7-7cdab58f9749.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/b7/b730527c-3233-41c2-aaf7-7cdab58f9749.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@07f2f.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@07f2f.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@07f2f.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0fa64.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0fa64.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@0fa64.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f444.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f444.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@1f444.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2e78d.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2e78d.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2e78d.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2f00a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2f00a.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@2f00a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@31c60.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@31c60.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@31c60.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@39e53.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@39e53.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@39e53.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@3f79a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@3f79a.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@3f79a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@48729.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@48729.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@48729.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@54d9f.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@54d9f.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@54d9f.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5501b.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5501b.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5501b.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5c5bd.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5c5bd.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5c5bd.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f29a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f29a.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f29a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f893.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f893.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@5f893.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6af60.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6af60.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6af60.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6cae0.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6cae0.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6cae0.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6ee89.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6ee89.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6ee89.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6fe55.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6fe55.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@6fe55.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@7597f.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@7597f.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@7597f.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8222a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8222a.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8222a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@87329.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@87329.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@87329.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8c06b.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8c06b.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8c06b.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8f420.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8f420.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@8f420.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@90611.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@90611.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@90611.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9333c.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9333c.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@9333c.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@95418.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@95418.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@95418.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a0c07.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a0c07.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a0c07.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a1f5c.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a1f5c.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@a1f5c.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@b4805.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@b4805.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@b4805.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@bf0b5.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@bf0b5.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@bf0b5.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d0c04.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d0c04.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d0c04.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d5db4.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d5db4.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@d5db4.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@db620.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@db620.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@db620.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e1124.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e1124.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e1124.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e461a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e461a.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e461a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5ade.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5ade.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5ade.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5e90.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5e90.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e5e90.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e6790.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e6790.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e6790.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e73c6.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e73c6.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@e73c6.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@eb942.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@eb942.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@eb942.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f2d5a.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f2d5a.json new file mode 100644 index 0000000..95c3eaa --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f2d5a.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f9ec9.json b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f9ec9.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/e4/e4b19cae-fc01-427a-9539-1caf9ed336dc@f9ec9.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/f1/f12a23c4-b924-4322-a260-3d982428f1e8.json b/code/assets/main/import/f1/f12a23c4-b924-4322-a260-3d982428f1e8.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/f1/f12a23c4-b924-4322-a260-3d982428f1e8.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json b/code/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json new file mode 100644 index 0000000..2c029ec --- /dev/null +++ b/code/assets/main/import/fd/fd8ec536-a354-4a17-9c74-4f3883c378c8.json @@ -0,0 +1 @@ +[1,0,0,[["RenderQueueDesc",["stages","isTransparent","sortMode"],0],["ForwardPipeline",["_flows"],3,9],["ShadowFlow",["_name","_stages"],2,9],["ShadowStage",["_name"],2],["ForwardFlow",["_name","_priority","_stages"],1,9],["ForwardStage",["_name","renderQueues"],2,9]],[[1,0,1],[2,0,1,2],[3,0,2],[4,0,1,2,3],[5,0,1,2],[0,0,2],[0,1,2,0,4]],[[0,[[1,"ShadowFlow",[[2,"ShadowStage"]]],[3,"ForwardFlow",1,[[4,"ForwardStage",[[5,["default"]],[6,true,1,["default"]]]]]]]]],0,0,[],[],[]] diff --git a/code/assets/main/import/ff/ffb88a8f-af62-48f4-8f1d-3cb606443a43.json b/code/assets/main/import/ff/ffb88a8f-af62-48f4-8f1d-3cb606443a43.json new file mode 100644 index 0000000..b15f35a --- /dev/null +++ b/code/assets/main/import/ff/ffb88a8f-af62-48f4-8f1d-3cb606443a43.json @@ -0,0 +1 @@ +[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]] diff --git a/code/assets/main/index.js b/code/assets/main/index.js new file mode 100644 index 0000000..3690662 --- /dev/null +++ b/code/assets/main/index.js @@ -0,0 +1,46 @@ +System.register("chunks:///_virtual/apiSensors.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(i){var e,t,r,n;return{setters:[function(i){e=i.applyDecoratedDescriptor,t=i.initializerDefineProperty},function(i){r=i.cclegacy,n=i._decorator}],execute:function(){var o,a,l,u,c,s,p,b,f,h;r._RF.push({},"451acwCTa1LL6xezvkqFCFR","apiSensors",void 0);var g=n.ccclass,y=n.property;i("apiSensors",g("apiSensors")((l=e((a=function(){t(this,"connect_time",l,this),t(this,"isServicing",u,this),t(this,"name",c,this),t(this,"position",s,this),t(this,"quality",p,this),t(this,"tag",b,this),t(this,"value",f,this),t(this,"zone",h,this)}).prototype,"connect_time",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),u=e(a.prototype,"isServicing",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),c=e(a.prototype,"name",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),s=e(a.prototype,"position",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),p=e(a.prototype,"quality",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),b=e(a.prototype,"tag",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),f=e(a.prototype,"value",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),h=e(a.prototype,"zone",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),o=a))||o);r._RF.pop()}}})); + +System.register("chunks:///_virtual/CameraMover.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(e){var r,n,o,t,a,i,l,c,s,u,m;return{setters:[function(e){r=e.applyDecoratedDescriptor,n=e.inheritsLoose,o=e.initializerDefineProperty,t=e.assertThisInitialized},function(e){a=e.cclegacy,i=e._decorator,l=e.CameraComponent,c=e.MeshRenderer,s=e.geometry,u=e.tween,m=e.Component}],execute:function(){var p,d,f,h,v,y;a._RF.push({},"6e9d1pTCW9PELDNeLCm44VF","CameraMover",void 0);var w=i.ccclass,g=i.property;e("CameraMover",(p=w("CameraMover"),d=g({type:l}),p((v=r((h=function(e){function r(){for(var r,n=arguments.length,a=new Array(n),i=0;i0?this.moveSpeed=Math.min(this.moveSpeed+this.speedStep,this.maxSpeed):e.getScrollY()<0&&(this.moveSpeed=Math.max(this.moveSpeed-this.speedStep,this.minSpeed)),console.log("Current move speed: "+this.moveSpeed)},s.update=function(e){if(this.camera){var t=p.transformQuat(new p,p.FORWARD,this.camera.worldRotation),o=p.transformQuat(new p,p.RIGHT,this.camera.worldRotation),i=p.UP,n=new p;p.scaleAndAdd(n,n,t,this._moveDirection.z*this.moveSpeed*e),p.scaleAndAdd(n,n,o,this._moveDirection.x*this.moveSpeed*e),p.scaleAndAdd(n,n,i,this._moveDirection.y*this.moveSpeed*e),this.node.translate(n)}},t}(_)).prototype,"camera",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),y=t(v.prototype,"moveSpeed",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 5}}),S=t(v.prototype,"lookSpeed",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),M=t(v.prototype,"speedStep",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),D=t(v.prototype,"minSpeed",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),b=t(v.prototype,"maxSpeed",[w],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 20}}),f=v))||f));s._RF.pop()}}})); + +System.register("chunks:///_virtual/ItemButton.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,n,i,r,a,o,l,u,c;return{setters:[function(t){e=t.applyDecoratedDescriptor,n=t.inheritsLoose,i=t.initializerDefineProperty,r=t.assertThisInitialized},function(t){a=t.cclegacy,o=t._decorator,l=t.Label,u=t.Button,c=t.Component}],execute:function(){var s,m,p,b,f,h,L,y,g;a._RF.push({},"e5a794S61FLarSaWsI+BZm6","ItemButton",void 0);var v=o.ccclass,B=o.property;t("ItemButton",(s=v("ItemButton"),m=B(l),p=B(l),b=B(u),s((L=e((h=function(t){function e(){for(var e,n=arguments.length,a=new Array(n),o=0;o0){var n=o[0].collider.node;console.log("🎯 Попадание по объекту: "+n.name),this._highlightModel(n,"red"),this._moveCamera(n)}else console.log("❌ Raycast ничего не нашел.")}else console.log("⚠️ Raycast не сработал.")}else console.warn("🚨 Камера не найдена!")},i._highlightModel=function(e,t){var o=e.getComponent(f);o&&o.switchToColor(t)},i._moveCamera=function(e){this.cameraMover?this.cameraMover.moveToTarget(e):console.warn("🚨 CameraMover не подключен!")},t}(y)).prototype,"camera",[_],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),k=t(d.prototype,"cameraMover",[C],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),v=d))||v));i._RF.pop()}}})); + +System.register("chunks:///_virtual/Mutex.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(e){var t,r,n,u;return{setters:[function(e){t=e.asyncToGenerator,r=e.regeneratorRuntime},function(e){n=e.cclegacy,u=e._decorator}],execute:function(){var c;n._RF.push({},"84efdsL2ZBGBIfNkxtYiT7w","Mutex",void 0);var i=u.ccclass;e("Mutex",i("Mutex")(c=function(){function e(){this.queue=[],this.locked=!1}var n=e.prototype;return n.acquire=function(){var e=t(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.locked){e.next=3;break}return this.locked=!0,e.abrupt("return");case 3:return e.abrupt("return",new Promise((function(e){return t.queue.push(e)})));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.release=function(){if(this.queue.length>0){var e=this.queue.shift();e&&e()}else this.locked=!1},e}())||c);n._RF.pop()}}})); + +System.register("chunks:///_virtual/PulsatingHighlighter.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,i,r,n,a,l,o,s,c,h;return{setters:[function(t){e=t.applyDecoratedDescriptor,i=t.inheritsLoose,r=t.initializerDefineProperty,n=t.assertThisInitialized},function(t){a=t.cclegacy,l=t._decorator,o=t.Material,s=t.MeshRenderer,c=t.math,h=t.Component}],execute:function(){var u,p,g,_,d,f,v,m;a._RF.push({},"04b2bx0wWRFNZUDzjOKuS7p","PulsatingHighlighter",void 0);var y=l.ccclass,M=l.property;t("PulsatingHighlighter",(u=y("PulsatingHighlighter"),p=M(o),g=M(o),u(((m=function(t){function e(){for(var e,i=arguments.length,a=new Array(i),l=0;l=this._totalCount)){for(var e=this._loadedCount,n=Math.min(this._loadedCount+t,this._totalCount),i=e;i=this._contentUI.height-e-50&&this._loadedCount=0||(r[i]=t[i]);return r}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function g(t){var e=m(t,"string");return"symbol"==typeof e?e:String(e)}function v(t,e,i,n){i&&Object.defineProperty(t,e,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}function y(t,e,i,n,r){var s={};return Object.keys(n).forEach((function(t){s[t]=n[t]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),s),r&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(r):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(t,e,s),s=null),s}function b(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t({$:WO,K:MO,P:NO,W:zO,X:GO,Y:UO,Z:HO,_:p,a0:function(t){return VO.test(t)},a1:function(t){return LO.test(t)},a2:YO,a3:QO,a4:KO,aA:j2,aC:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},aD:bY,aR:rs,aT:Jn,aV:On,aX:Er,a_:Wr,az:W2,b1:hs,b3:fs,b5:rr,bC:De,bD:Me,bE:ke,bJ:function(t){t>0&&(bt=t)},bN:At,bO:function(t){for(var e,i=p(t);!(e=i()).done;)Dt(e.value)},bP:function(t){return wt||(wt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return Dt(e),Reflect.get(t,e,i)}})),wt},bQ:Lo,bR:Vo,bU:Fi,bV:Li,ba:qi,bb:Xi,bc:Yi,bd:Qi,be:Ki,bf:Ji,bg:Zi,bh:$i,bi:tn,bj:en,bk:nn,bl:rn,bm:sn,bn:an,bo:on,bp:hn,bq:un,br:ln,bs:cn,bt:fn,bu:dn,bv:yn,bw:bn,c3:function(t){return t[Gh]},c6:co,c8:K,c9:q,cG:wf,cH:oc,cI:Tc,cU:Hh,cW:Af,cZ:xi,c_:wi,ca:Y,cb:X,cc:Q,cd:nt,ce:et,cf:ot,cg:st,ch:ut,ci:ft,cj:dt,ck:ct,d1:io,d2:no,d5:function(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))},d6:J,d7:function(t,e){return dh(t,e,0)},d8:dh,d9:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(i(a,e)<0)r=s-1;else{if(!(i(a,e)>0))return s;n=s+1}}return~n},dX:zg,dZ:r0,da:function(){},db:function(){},dc:Ie,dd:Pf,dr:dP,fv:function(){return Promise.resolve()},g:sAt,g6:RUt,gP:Bqt,gQ:Mqt}),b("CC_WECHAT",!1),b("CC_BAIDU",!1),b("CC_XIAOMI",!1),b("CC_ALIPAY",!1),b("CC_BYTEDANCE",!1),b("CC_OPPO",!1),b("CC_VIVO",!1),b("CC_HUAWEI",!1),b("CC_COCOSPLAY",!1),b("CC_QTT",!1),b("CC_LINKSURE",!1),b("CC_MIGU",!1);const S=!1;b("CC_EDITOR",!1);const x=!1;b("CC_PREVIEW",!1),b("CC_BUILD",!0),b("CC_TEST",!1),b("CC_DEBUG",!1),b("CC_DEV",!1),b("CC_MINIGAME",!1),b("CC_RUNTIME_BASED",!1),b("CC_SUPPORT_JIT",!0),b("CC_JSB",!1);var w="undefined"==typeof window?global:window,T=t("aO",{_global:w}),C=T;T.internal={};var A=t("aN","3.8.5");w.CocosEngine=C.ENGINE_VERSION=A,w.cc=C;var D=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;w.ccwindow=D;var I=2147483647;function B(t){return(t>0)-(t<0)}function M(t,e){return t^(t^e)&-(t65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function E(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function k(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function O(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}var R=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<>31;return(t^e)-e},countTrailingZeros:k,deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},interleave2:function(t,e){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},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(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},isPow2:function(t){return!(t&t-1||!t)},log10:function(t){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},log2:P,max:M,min:function(t,e){return e^(t^e)&-(t>>k(t)+1},nextPow2:O,parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},popCount:E,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},reverse:function(t){return R[255&t]<<24|R[t>>>8&255]<<16|R[t>>>16&255]<<8|R[t>>>24&255]},sign:B});t("aP",F);var L=D.document,V="https://github.com/cocos/cocos-engine/blob/"+A+"/EngineErrorMap.md",N=null,z=console.log.bind(console),G=z,U=z,H=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r2?i-2:0),r=2;r4){var e=function(t){if(C.game.canvas){if(!N){var e=L.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=C.game.canvas.height;e.setAttribute("height",""+i);var n=e.style;n.zIndex="99999",n.position="absolute",n.top=n.left="0",(N=L.createElement("textarea")).setAttribute("rows","20"),N.setAttribute("cols","30"),N.setAttribute("disabled","true");var r=N.style;r.backgroundColor="transparent",r.borderBottom="1px solid #cccccc",r.borderTopWidth=r.borderLeftWidth=r.borderRightWidth="0px",r.borderTopStyle=r.borderLeftStyle=r.borderRightStyle="none",r.padding="0px",r.margin="0px",e.appendChild(N),C.game.canvas.parentNode.appendChild(e)}N.value=N.value+t+"\r\n",N.scrollTop=N.scrollHeight}};U=function(){e("ERROR : "+j.apply(void 0,arguments))},H=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s2?i-2:0),r=2;r1?n-1:0),s=1;s1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("bK",_t=function(t,e,i){null!=t&&i.forEach((function(i){var n=St++;xt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:bt});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return gt(e,i.name,a,s,X,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,l=null!=i.customGetter;u&&l?Object.defineProperty(t,i.name,{get:function(){return gt(e,i.name,a,s,X,n,h),i.customGetter.call(this)},set:function(t){gt(e,i.name,a,s,X,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){gt(e,i.name,a,s,X,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return gt(e,i.name,a,s,X,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return gt(e,i.name,a,s,X,n,h),o?this[s]:r[s]},set:function(t){gt(e,i.name,a,s,X,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),vt=function(t,e,i,n,r){var s=xt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("bL",pt=function(t,e,i){null!=t&&i.forEach((function(i){var n=St++;xt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:bt});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return vt(e,i.name,Y,n,r)},set:function(){vt(e,i.name,Y,n,r)},enumerable:!1})}))}),t("bM",mt=function(){});var wt,Tt,Ct={};function At(t){for(var e in t){var i=t[e];Ct[e]=i}}function Dt(t){var e=Ct[t];if(e){var i=e.newName,n=e.since;e.removed?i?ot(16003,t,n,i):ot(16002,t,n):i?st(16001,t,n,i):st(16e3,t,n)}}var It=function(){function t(t){this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();Tt=It,It.global=new Tt("global");var Bt=new It("TmpCId."),Mt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Pt="__classname__",Et="__cid__";function kt(t){return"number"==typeof t||t instanceof Number}function Ot(t){return"string"==typeof t||t instanceof String}function Rt(t){for(var e in t)return!1;return!0}var Ft,Lt=(Ft={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Ft.value=i,Ft.writable=n,Ft.enumerable=r,Object.defineProperty(t,e,Ft),Ft.value=void 0}),Vt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),Nt=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),zt=function(){var t={set:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.set=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.set=void 0}}();function Gt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Ut(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty(Pt)&&e[Pt])return e[Pt];var i="";if(t.name)i=t.name;else if(t.toString){var n,r=t.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/^function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return t&&t.constructor?Ut(t.constructor):""}function Ht(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?Vt(t,s,o,(function(t){this[a]=t})):Nt(t,s,o)}function Wt(t,e,i,n){for(var r in i)Ht(t,e+"."+r,i[r],n)}var jt=/(%d)|(%s)/,qt=/%s/;function Xt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},t.put=function(t){var e=this._pool;if(this.count=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ge=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},n(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function ve(t,e){t.splice(e,1)}function ye(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function be(t,e){var i=t.indexOf(e);return i>=0&&(ve(t,i),!0)}function Se(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function xe(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ve(t,i),n}}function we(t,e){return t.indexOf(e)>=0}var Te=Object.freeze({__proto__:null,MutableForwardIterator:ge,appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:we,copy:function(t){for(var e=t.length,i=new Array(e),n=0;n0)for(var i,n=p(t);!(i=n()).done;)if(!(i.value instanceof e))return et(1300),!1;return!0}}),Ce={IDGenerator:It,Pool:me,array:Te,isNumber:kt,isString:Ot,isEmptyObject:Rt,getPropertyDescriptor:Qt,addon:Jt,mixin:Zt,extend:$t,getSuper:te,isChildClassOf:ee,clear:ie,value:Lt,getset:Vt,get:Nt,set:zt,unregisterClass:le,getClassName:Ut,setClassName:he,setClassAlias:ue,getClassByName:de,getClassById:fe,get _registeredClassNames(){return r({},re)},set _registeredClassNames(t){ie(re),Object.assign(re,t)},get _registeredClassIds(){return r({},ne)},set _registeredClassIds(t){ie(ne),Object.assign(ne,t)},_getClassId:_e,getClassId:pe,_setClassId:ae,_getClassById:ce,obsolete:Ht,obsoletes:Wt,formatStr:Xt,shiftArguments:Yt,createMap:Gt};C.js=Ce;var Ae=Object.freeze({__proto__:null,IDGenerator:It,Pool:me,_getClassById:ce,_getClassId:_e,_idToClass:ne,_nameToClass:re,_setClassId:ae,addon:Jt,array:Te,clear:ie,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r=0&&t.length,t.length}t("bG",Ae),De.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},De.getList=function(t){return t.__bitmask__?t.__bitmask__:De.update(t)},De.update=function(t){Array.isArray(t.__bitmask__)||(t.__bitmask__=[]);var e=t.__bitmask__;for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),e},C.BitMask=De;var Be=Object.prototype.hasOwnProperty;function Me(t){return"__enums__"in t?t:(Lt(t,"__enums__",null,!0),Me.update(t))}function Pe(t){Be.call(t,"__enums__")}function Ee(t){Pe(t);var e=t.__enums__||[];e.length=0;var i=!0;for(var n in t){var r=t[n],s=Number.isInteger(r);s||(i=!1),(s||"string"==typeof r&&t[r]!==Number.parseInt(n))&&e.push({name:n,value:r})}return i&&e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function ke(t){"__enums__"in t||Lt(t,"__enums__",null,!0)}Me.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n2?n-2:0),s=2;s1?e-1:0),n=1;ni){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||ii(r,(e=i[n+1])&&e.__attrs__)}return ii(t,(e=i[0])&&e.__attrs__),t.__attrs__}function ri(t,e){var i=si(t),n=e+ei,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function si(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||ni(t)}function ai(t,e,i,n){si(t)[e+ei+i]=n}var oi=function(){function t(t,e){this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),hi=t("bX",new oi("Integer",0));C.Integer=hi,C.CCInteger=hi;var ui=t("bY",new oi("Float",0));C.Float=ui,C.CCFloat=ui;var li=t("bZ",new oi("Boolean",!1));C.Boolean=li,C.CCBoolean=li;var ci=t("b_",new oi("String",""));function fi(t,e){return function(i,n){var r='"'+Ut(i)+"."+n+'"',s=ri(i,n),a=s.type;if(a===hi||a===ui?a="Number":a!==ci&&a!==li||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Je(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;st(3605,r,Ut(s.ctor))}else"Number"!==t&&st(3606,e,r,t);else{if("function"===h)return;t===ci.default&&null==o?st(3607,r):st(3611,e,r,h)}delete s.type}}}else st(3604,r)}}C.String=ci,C.CCString=ci;var di=Object.freeze({__proto__:null,CCBoolean:li,CCFloat:ui,CCInteger:hi,CCString:ci,DELIMETER:ei,PrimitiveType:oi,attr:ri,createAttrs:ni,createAttrsSingle:ii,getClassAttrs:si,getObjTypeChecker_ET:function(t){return function(e,i){fi("Object","type")(e,i);var n=si(e)[i+ei+"default"],r=C.Class.getDefault(n);if(!Array.isArray(r)&&ee(t,C.ValueType)){var s=Ut(t),a=Xt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ut(e),i,s);n?q(a):st(3612,a,s,Ut(e),i,s)}}},getTypeChecker_ET:fi,setClassAttr:ai}),_i={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function pi(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,_i){var o=_i[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function mi(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return ot(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=C.String:e===Boolean?t.type=C.Boolean:e===Number&&(t.type=C.Float))}function gi(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function vi(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return gi(e,[],t);if("function"==typeof t){var i=t;return gi(e,ee(i,C.ValueType)?new i:null,i)}return t instanceof oi?gi(e,void 0,t):gi(e,t)}return null}function yi(t,e){for(var i in t){var n=t[i],r=vi(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&pi(n,i,s,t),"type"in n&&mi(n,n.type,e,i)}}}var bi=[];function Si(){return bi[bi.length-1]}function xi(t,e,i){wi(si(t),e,i)}function wi(t,e,i){t[""+e+ei+"type"]="Enum",t[""+e+ei+"enumList"]=Me.getList(i)}C._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),bi.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=bi.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:Si};var Ti=ei,Ci="__ctors__",Ai=t("c$","Enum"),Di=t("d0","BitMask");function Ii(t,e){t.indexOf(e)<0&&t.push(e)}function Bi(t,e){Ii(t.__props__,e)}function Mi(t,e,i,n){Bi(t,i),Ni(t,n,e,i)}function Pi(t,e,i,n){var r=n.get;n.set,r&&(Ni(t,n,e,i),ai(t,i,"serializable",!1))}function Ei(t){return"function"==typeof t?t():t}function ki(t,e,i){var n=i.ctor;return Lt(n,Ci,!0,!0),n.prototype,e&&(n.$super=e),he(t,n),n}function Oi(t,e,i){var n=C.Component,r=Si();if(r&&ee(e,n)){if(ee(r.cls,n))return ot(3615),null;t=t||r.script}var s=ki(t,e,i);if(r)if(ee(e,n)){var a=r.uuid;a&&ae(a,s),r.cls=s}else ee(r.cls,n)||(r.cls=s);return s}function Ri(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in yi(i,e),i){var s=i[r];s.get||s.set?Pi(t,e,r,s):Mi(t,e,r,s)}var a=si(t);t.__values__=t.__props__.filter((function(t){return!1!==a[""+t+Ti+"serializable"]}))}function Fi(t){var e=t.name,i=t.extends,n=Oi(e,i,t);e||(e=C.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),Ri(n,e,t.properties,i);var r=t.editor;return r&&ee(i,C.Component)&&C.Component._registerEditorProps(n,r),n}function Li(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}Fi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,Ci)},Fi.fastDefine=function(t,e,i){he(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=si(e),s=0;s=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("step","number"),u("userData","object")}Fi.isArray=function(t){return t=Ei(t),Array.isArray(t)},Fi.getDefault=Ei,Fi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Fi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,Fi.getNewValueTypeCode=function(t){for(var e=Ut(t),i=t.constructor,n="new "+e+"(",r=0;ri){var n=e;e=i,i=n}return ti?i:t}function Qi(t){return t<0?0:t>1?1:t}function Ki(t,e,i){return t+(e-t)*i}function Ji(t){return t*zi}function Zi(t){return t*Gi}function $i(){return Ui()}function tn(t){Ui=t}function en(t,e){return $i()*(e-t)+t}function nn(t,e){return Math.floor(en(t,e))}function rn(t){return(t=(9301*t+49297)%233280)/233280}function sn(t,e,i){return rn(t)*(i-e)+e}function an(t,e,i){return Math.floor(sn(t,e,i))}function on(t){return O(t)}function hn(t,e){return t-Math.floor(t/e)*e}function un(t,e){return t=hn(t,2*e),e-Math.abs(t-e)}function ln(t,e,i){return(i-t)/(e-t)}function cn(t){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}function fn(t,e){return Math.abs(t)>Math.abs(e)?t:e}function dn(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var _n,pn,mn,gn=(_n=new Float32Array(1),pn=new Int32Array(_n.buffer),function(t){_n[0]=t;var e=pn[0],i=e>>16&32768,n=2147483647&e,r=n-(112<<23)+4096>>13;return r=n<113<<23?0:r,r=n>=143<<23?31744:r,r=n>255<<23?32256:r,pn[0]=i|r,pn[0]}),vn=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){var n,r=32767&i,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,n=(i>>15&1)<<31|s,e[0]=n,t[0]}}();function yn(t){return gn(t)}function bn(t){return vn(t)}var Sn,xn=Math.abs,wn=Math.max,Tn=Math.min,Cn=Math.PI,An=Math.sin,Dn=Math.cos,In=Math.atan2,Bn=Math.sqrt,Mn=Math.ceil,Pn=Math.floor,En=Math.round,kn=t("aU",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.fromColor=function(t,e){return t.x=e.r,t.y=e.g,t.z=e.b,t.w=e.a,t},e.angle=function(t,e){var i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x,s=t.x*e.x+t.y*e.y+t.z*e.z;return In(Bn(i*i+n*n+r*r),s)},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Mn(e.x),t.y=Mn(e.y),t.z=Mn(e.z),t.w=Mn(e.w),t},e.floor=function(t,e){return t.x=Pn(e.x),t.y=Pn(e.y),t.z=Pn(e.z),t.w=Pn(e.w),t},e.min=function(t,e,i){return t.x=Tn(e.x,i.x),t.y=Tn(e.y,i.y),t.z=Tn(e.z,i.z),t.w=Tn(e.w,i.w),t},e.max=function(t,e,i){return t.x=wn(e.x,i.x),t.y=wn(e.y,i.y),t.z=wn(e.z,i.z),t.w=wn(e.w,i.w),t},e.round=function(t,e){return t.x=En(e.x),t.y=En(e.y),t.z=En(e.z),t.w=En(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Bn(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Bn(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return xn(i)0?(a=1/Bn(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.random=function(t,e){e=e||1;var i=2*$i()*Cn,n=2*$i()-1,r=Bn(1-n*n);return t.x=r*Dn(i)*e,t.y=r*An(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z,u=i.w,l=u*n+o*s-h*r,c=u*r+h*n-a*s,f=u*s+a*r-o*n,d=-a*n-o*r-h*s;return t.x=l*u+d*-a+c*-h-f*-o,t.y=c*u+d*-o+f*-a-l*-h,t.z=f*u+d*-h+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){void 0===i&&(i=ji);var n=1/0;return!(xn(t.x)===n||xn(t.y)===n||xn(t.z)===n||xn(t.w)===n||xn(e.x)===n||xn(e.y)===n||xn(e.z)===n||xn(e.w)===n)&&xn(t.x-e.x)<=i*wn(1,xn(t.x),xn(e.x))&&xn(t.y-e.y)<=i*wn(1,xn(t.y),xn(e.y))&&xn(t.z-e.z)<=i*wn(1,xn(t.z),xn(e.z))&&xn(t.w-e.w)<=i*wn(1,xn(t.w),xn(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){void 0===e&&(e=ji);var i=this;return xn(i.x-t.x)<=e*wn(1,xn(i.x),xn(t.x))&&xn(i.y-t.y)<=e*wn(1,xn(i.y),xn(t.y))&&xn(i.z-t.z)<=e*wn(1,xn(i.z),xn(t.z))&&xn(i.w-t.w)<=e*wn(1,xn(i.w),xn(t.w))},i.equals4f=function(t,e,i,n,r){void 0===r&&(r=ji);var s=this;return xn(s.x-t)<=r*wn(1,xn(s.x),xn(t))&&xn(s.y-e)<=r*wn(1,xn(s.y),xn(e))&&xn(s.z-i)<=r*wn(1,xn(s.z),xn(i))&&xn(s.w-n)<=r*wn(1,xn(s.w),xn(n))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this,n=i.x,r=i.y,s=i.z,a=i.w;return i.x=n+e*(t.x-n),i.y=r+e*(t.y-r),i.z=s+e*(t.z-s),i.w=a+e*(t.w-a),i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(t,e){var i=this;return i.x=Yi(i.x,t.x,e.x),i.y=Yi(i.y,t.y,e.y),i.z=Yi(i.z,t.z,e.z),i.w=Yi(i.w,t.w,e.w),i},i.add=function(t){var e=this;return e.x+=t.x,e.y+=t.y,e.z+=t.z,e.w+=t.w,e},i.add4f=function(t,e,i,n){var r=this;return r.x+=t,r.y+=e,r.z+=i,r.w+=n,r},i.subtract=function(t){var e=this;return e.x-=t.x,e.y-=t.y,e.z-=t.z,e.w-=t.w,e},i.subtract4f=function(t,e,i,n){var r=this;return r.x-=t,r.y-=e,r.z-=i,r.w-=n,r},i.multiplyScalar=function(t){var e=this;return e.x*=t,e.y*=t,e.z*=t,e.w*=t,e},i.multiply=function(t){var e=this;return e.x*=t.x,e.y*=t.y,e.z*=t.z,e.w*=t.w,e},i.multiply4f=function(t,e,i,n){var r=this;return r.x*=t,r.y*=e,r.z*=i,r.w*=n,r},i.divide=function(t){var e=this;return e.x/=t.x,e.y/=t.y,e.z/=t.z,e.w/=t.w,e},i.divide4f=function(t,e,i,n){var r=this;return r.x/=t,r.y/=e,r.z/=i,r.w/=n,r},i.negative=function(){var t=this;return t.x=-t.x,t.y=-t.y,t.z=-t.z,t.w=-t.w,t},i.dot=function(t){var e=this;return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},i.cross=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return e.x=n*o-r*a,e.y=r*s-i*o,e.z=i*a-n*s,e},i.length=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return Bn(e*e+i*i+n*n+r*r)},i.lengthSqr=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},i.normalize=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w,s=e*e+i*i+n*n+r*r;return s>0&&(s=1/Bn(s),t.x=e*s,t.y=i*s,t.z=n*s,t.w=r*s),t},i.scale=function(t){var e=this;return e.x*=t,e.y*=t,e.z*=t,e.w*=t,e},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=e.w;return e.x=t.m00*i+t.m04*n+t.m08*r+t.m12*s,e.y=t.m01*i+t.m05*n+t.m09*r+t.m13*s,e.z=t.m02*i+t.m06*n+t.m10*r+t.m14*s,e.w=t.m03*i+t.m07*n+t.m11*r+t.m15*s,e},e}(Oe));function On(t,e,i,n){return new kn(t,e,i,n)}mn=kn,kn.ZERO=Object.freeze(new mn(0,0,0,0)),kn.ONE=Object.freeze(new mn(1,1,1,1)),kn.NEG_ONE=Object.freeze(new mn(-1,-1,-1,-1)),kn.UNIT_X=Object.freeze(new mn(1,0,0,0)),kn.UNIT_Y=Object.freeze(new mn(0,1,0,0)),kn.UNIT_Z=Object.freeze(new mn(0,0,1,0)),kn.UNIT_W=Object.freeze(new mn(0,0,0,1)),Fi.fastDefine("cc.Vec4",kn,{x:0,y:0,z:0,w:0}),C.Vec4=kn,C.v4=On;var Rn,Fn,Ln,Vn,Nn=Math.abs,zn=Math.max,Gn=Math.min,Un=Math.PI,Hn=Math.acos,Wn=Math.sin,jn=Math.cos,qn=Math.sqrt,Xn=Math.ceil,Yn=Math.floor,Qn=Math.round,Kn=t("aS",function(t){function e(e,i,n){var r;return r=t.call(this)||this,"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}s(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Xn(e.x),t.y=Xn(e.y),t.z=Xn(e.z),t},e.floor=function(t,e){return t.x=Yn(e.x),t.y=Yn(e.y),t.z=Yn(e.z),t},e.min=function(t,e,i){return t.x=Gn(e.x,i.x),t.y=Gn(e.y,i.y),t.z=Gn(e.z,i.z),t},e.max=function(t,e,i){return t.x=zn(e.x,i.x),t.y=zn(e.y,i.y),t.z=zn(e.z,i.z),t},e.round=function(t,e){return t.x=Qn(e.x),t.y=Qn(e.y),t.z=Qn(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return qn(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return qn(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return Nn(i)0?(s=1/qn(s),t.x=i*s,t.y=n*s,t.z=r*s):(t.x=0,t.y=0,t.z=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*$i()*Un,n=2*$i()-1,r=qn(1-n*n);return t.x=r*jn(i)*e,t.y=r*Wn(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+c*-i.x+u*-i.z-l*-i.y+n.x,t.y=u*i.w+c*-i.y+l*-i.x-h*-i.z+n.y,t.z=l*i.w+c*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+c*i.x+u*i.z-l*i.y)/r.x,t.y=(u*i.w+c*i.y+l*i.x-h*i.z)/r.y,t.z=(l*i.w+c*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=jn(n),h=Wn(n),u=r,l=s*o-a*h,c=s*h+a*o;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=jn(n),h=Wn(n),u=a*h+r*o,l=s,c=a*o-r*h;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=jn(n),h=Wn(n),u=r*o-s*h,l=r*h+s*o,c=a;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,a=e.y-i.y,o=e.z-i.z,h=n.x,u=n.y,l=n.z,c=jn(r),f=Wn(r),d=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-l*f)+o*(h*l*(1-c)+u*f),_=s*(h*u*(1-c)+l*f)+a*(u*u*(1-c)+c)+o*(u*l*(1-c)-h*f),p=s*(h*l*(1-c)-u*f)+a*(u*l*(1-c)+h*f)+o*(l*l*(1-c)+c);return t.x=d+i.x,t.y=_+i.y,t.z=p+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=ji);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return Nn(n-a)<=i*zn(1,Nn(n),Nn(a))&&Nn(r-o)<=i*zn(1,Nn(r),Nn(o))&&Nn(s-h)<=i*zn(1,Nn(s),Nn(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/qn(i*n);return r=Yi(r,-1,1),Hn(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o0&&(r=1/qn(r),t.x=e*r,t.y=i*r,t.z=n*r),t},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=e.z,s=t.m03*i+t.m07*n+t.m11*r+t.m15;return s=s?1/s:1,e.x=(t.m00*i+t.m04*n+t.m08*r+t.m12)*s,e.y=(t.m01*i+t.m05*n+t.m09*r+t.m13)*s,e.z=(t.m02*i+t.m06*n+t.m10*r+t.m14)*s,e},i.toVec2=function(){return new C.Vec2(this.x,this.y)},e}(Oe));function Jn(t,e,i){return new Kn(t,e,i)}Sn=Kn,Kn.UNIT_X=Object.freeze(new Sn(1,0,0)),Kn.UNIT_Y=Object.freeze(new Sn(0,1,0)),Kn.UNIT_Z=Object.freeze(new Sn(0,0,1)),Kn.RIGHT=Object.freeze(new Sn(1,0,0)),Kn.UP=Object.freeze(new Sn(0,1,0)),Kn.FORWARD=Object.freeze(new Sn(0,0,-1)),Kn.ZERO=Object.freeze(new Sn(0,0,0)),Kn.ONE=Object.freeze(new Sn(1,1,1)),Kn.NEG_ONE=Object.freeze(new Sn(-1,-1,-1)),Kn.slerp=(Rn=new Sn,Fn=new Sn,Ln=new Sn,function(t,e,i,n){var r=1e-5,s=Sn.len(e),a=Sn.len(i);if(s.99999)return Sn.lerp(t,e,i,n);if(h<-.99999){var u=Sn.multiplyScalar(Rn,e,1/s),l=Sn.generateOrthogonal(Fn,u);return tr(Ln,u,l,Un*n),Sn.multiplyScalar(t,Ln,o),t}var c=h,f=Hn(c)*n,d=Sn.multiplyScalar(Rn,e,1/s),_=Sn.multiplyScalar(Fn,i,1/a);return Sn.scaleAndAdd(Ln,_,d,-c),Sn.normalize(Ln,Ln),Sn.multiplyScalar(Ln,Ln,Wn(f)),Sn.scaleAndAdd(Ln,Ln,d,jn(f)),Sn.multiplyScalar(t,Ln,o),t}),Kn.signedAngle=(Vn=new Sn,function(t,e,i){var n=Sn.angle(t,e),r=Sn.cross(Vn,t,e);return Sn.dot(r,i)<0?-n:n}),Fi.fastDefine("cc.Vec3",Kn,{x:0,y:0,z:0}),C.Vec3=Kn;var Zn,$n,tr=(Zn={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Wn(r);return Zn.x=s*i.x,Zn.y=s*i.y,Zn.z=s*i.z,Zn.w=jn(r),Kn.transformQuat(t,e,Zn),t});C.v3=Jn;var er,ir=1/255,nr=t("b4",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._data=new Uint8ClampedArray(4),"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}s(e,t),e.clone=function(t){var i=new e;return i.r=t.r,i.g=t.g,i.b=t.b,i.a=t.a,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new kn).x=t._data[0]*ir,e.y=t._data[1]*ir,e.z=t._data[2]*ir,e.w=t._data[3]*ir,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i)._data[0]=t.x/ir,i._data[1]=t.y/ir,i._data[2]=t.z/ir,i._data[3]=t.w/ir,i},e.fromHEX=function(t,e){var i;return"string"==typeof e?(6===(e="#"===e[0]?e.substring(1):e).length?e+="FF":3===e.length?e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+"FF":4===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),i=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),i=e),t.r=i>>>24,t.g=(16711680&i)>>>16,t.b=(65280&i)>>>8,t.a=255&i,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return t.r=r+(i.r-r)*n,t.g=s+(i.g-s)*n,t.b=a+(i.b-a)*n,t.a=o+(i.a-o)*n,t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return e>>>=0,t.r=255&e,t.g=e>>8&255,t.b=e>>16&255,t.a=e>>24&255,t},e.toUint32=function(t){return(t.a<<24|t.b<<16|t.g<<8|t.r)>>>0},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=ji),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&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))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._data.set(this._data),t},i.equals=function(t){var e=t;return t&&this._data[0]===e.r&&this._data[1]===e.g&&this._data[2]===e.b&&this._data[3]===e.a},i.lerp=function(t,i){return e.lerp(this,this,t,i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*ir).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){var e;return"string"==typeof t?(6===(t="#"===t[0]?t.substring(1):t).length?t+="FF":3===t.length?t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+"FF":4===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e=Number("0x"+t)):(t<16777216&&(t=255+(t<<8)),e=t),this.r=e>>>24,this.g=(16711680&e)>>>16,this.b=(65280&e)>>>8,this.a=255&e,this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this._data[0]<16?e:"")+this._data[0].toString(16),(this._data[1]<16?e:"")+this._data[1].toString(16),(this._data[2]<16?e:"")+this._data[2].toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this._data[3]<16?e:"")+this._data[3].toString(16)),i.join("")},i.toRGBValue=function(){return this._data[2]<<16|this._data[1]<<8|this._data[0]},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,h=i*(1-e),u=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=l;break;case 3:n=h,r=u,s=i;break;case 4:n=l,r=h,s=i;break;case 5:n=i,r=h,s=u}}return this._data[0]=255*n,this._data[1]=255*r,this._data[2]=255*s,this},i.toHSV=function(){var t=this._data[0]*ir,e=this._data[1]*ir,i=this._data[2]*ir,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){if("object"==typeof t){var r,s,a,o,h=t;h._data?this._data.set(h._data):(this._data[0]=null!==(r=h.r)&&void 0!==r?r:0,this._data[1]=null!==(s=h.g)&&void 0!==s?s:0,this._data[2]=null!==(a=h.b)&&void 0!==a?a:0,this._data[3]=null!==(o=h.a)&&void 0!==o?o:255)}else this._data[0]=null!=t?t:0,this._data[1]=null!=e?e:0,this._data[2]=null!=i?i:0,this._data[3]=null!=n?n:255;return this},i.multiply=function(t){return this._data[0]*=t.r/255,this._data[1]*=t.g/255,this._data[2]*=t.b/255,this._data[3]*=t.a/255,this},i.getModifiableProperties=function(){return["r","g","b","a"]},n(e,[{key:"r",get:function(){return this._data[0]},set:function(t){this._data[0]=t}},{key:"g",get:function(){return this._data[1]},set:function(t){this._data[1]=t}},{key:"b",get:function(){return this._data[2]},set:function(t){this._data[2]=t}},{key:"a",get:function(){return this._data[3]},set:function(t){this._data[3]=t}},{key:"x",get:function(){return this._data[0]*ir},set:function(t){this._data[0]=255*t}},{key:"y",get:function(){return this._data[1]*ir},set:function(t){this._data[1]=255*t}},{key:"z",get:function(){return this._data[2]*ir},set:function(t){this._data[2]=255*t}},{key:"w",get:function(){return this._data[3]*ir},set:function(t){this._data[3]=255*t}}]),e}(Oe));function rr(t,e,i,n){return new nr(t,e,i,n)}function sr(t,e,i){if(e>i){var n=e;e=i,i=n}return ti?i:t}function ar(t){var e=t.clone();return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e}$n=nr,nr.WHITE=Object.freeze(new $n(255,255,255,255)),nr.GRAY=Object.freeze(new $n(127,127,127,255)),nr.BLACK=Object.freeze(new $n(0,0,0,255)),nr.TRANSPARENT=Object.freeze(new $n(0,0,0,0)),nr.RED=Object.freeze(new $n(255,0,0,255)),nr.GREEN=Object.freeze(new $n(0,255,0,255)),nr.BLUE=Object.freeze(new $n(0,0,255,255)),nr.CYAN=Object.freeze(new $n(0,255,255,255)),nr.MAGENTA=Object.freeze(new $n(255,0,255,255)),nr.YELLOW=Object.freeze(new $n(255,255,0,255)),Fi.fastDefine("cc.Color",nr,{r:0,g:0,b:0,a:255}),C.Color=nr,C.color=rr;var or=Math.abs,hr=Math.max,ur=t("aY",function(t){function e(e,i,n,r,s,a,o,h,u){var l;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1);var c=f(l=t.call(this)||this);return"object"==typeof e?(c.m00=e.m00,c.m01=e.m01,c.m02=e.m02,c.m03=e.m03,c.m04=e.m04,c.m05=e.m05,c.m06=e.m06,c.m07=e.m07,c.m08=e.m08):(c.m00=e,c.m01=i,c.m02=n,c.m03=r,c.m04=s,c.m05=a,c.m06=o,c.m07=h,c.m08=u),l}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){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},e.set=function(t,e,i,n,r,s,a,o,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,i){var n=i.m00,r=i.m01,s=i.m02,a=i.m03,o=i.m04,h=i.m05,u=i.m06,l=i.m07,c=i.m08,f=c*o-h*l,d=-c*a+h*u,_=l*a-o*u,p=n*f+r*d+s*_;return 0===p?(e.set(t,0,0,0,0,0,0,0,0,0),t):(p=1/p,t.m00=f*p,t.m01=(-c*r+s*l)*p,t.m02=(h*r-s*o)*p,t.m03=d*p,t.m04=(c*n-s*u)*p,t.m05=(-h*n+s*a)*p,t.m06=_*p,t.m07=(-l*n+r*u)*p,t.m08=(o*n-r*a)*p,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.m00,d=i.m01,_=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,b=i.m08;return t.m00=f*n+d*a+_*u,t.m01=f*r+d*o+_*l,t.m02=f*s+d*h+_*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+b*u,t.m07=v*r+y*o+b*l,t.m08=v*s+y*h+b*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.m00,d=i.m01,_=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,b=i.m10;return t.m00=f*n+d*a+_*u,t.m01=f*r+d*o+_*l,t.m02=f*s+d*h+_*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+b*u,t.m07=v*r+y*o+b*l,t.m08=v*s+y*h+b*c,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=f*n+d*a+u,t.m07=f*r+d*o+l,t.m08=f*s+d*h+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=Math.sin(i),d=Math.cos(i);return t.m00=d*n+f*a,t.m01=d*r+f*o,t.m02=d*s+f*h,t.m03=d*a-f*n,t.m04=d*o-f*r,t.m05=d*h-f*s,t.m06=u,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return Kn.lengthSqr(i)-.999?(e.x=Math.asin(-o),e.y=Math.atan2(a,h),e.z=Math.atan2(n,s),!0):(e.x=Hi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-Hi,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){return new e(this)},i.set=function(t,e,i,n,r,s,a,o,h){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=1);var u=this;return"object"==typeof t?(u.m00=t.m00,u.m01=t.m01,u.m02=t.m02,u.m03=t.m03,u.m04=t.m04,u.m05=t.m05,u.m06=t.m06,u.m07=t.m07,u.m08=t.m08):(u.m00=t,u.m01=e,u.m02=i,u.m03=n,u.m04=r,u.m05=s,u.m06=a,u.m07=o,u.m08=h),u},i.equals=function(t,i){return void 0===i&&(i=ji),e.equals(this,t,i)},i.strictEquals=function(t){return e.strictEquals(this,t)},i.toString=function(){var t=this;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]"},i.identity=function(){return e.identity(this)},i.transpose=function(){var t=this,e=t.m01,i=t.m02,n=t.m05;return t.m01=t.m03,t.m02=t.m06,t.m03=e,t.m05=t.m07,t.m06=i,t.m07=n,t},i.invert=function(){return e.invert(this,this)},i.determinant=function(){return e.determinant(this)},i.add=function(t){var e=this;return e.m00+=t.m00,e.m01+=t.m01,e.m02+=t.m02,e.m03+=t.m03,e.m04+=t.m04,e.m05+=t.m05,e.m06+=t.m06,e.m07+=t.m07,e.m08+=t.m08,e},i.subtract=function(t){var e=this;return e.m00-=t.m00,e.m01-=t.m01,e.m02-=t.m02,e.m03-=t.m03,e.m04-=t.m04,e.m05-=t.m05,e.m06-=t.m06,e.m07-=t.m07,e.m08-=t.m08,e},i.multiply=function(t){return e.multiply(this,this,t)},i.multiplyScalar=function(t){var e=this;return e.m00*=t,e.m01*=t,e.m02*=t,e.m03*=t,e.m04*=t,e.m05*=t,e.m06*=t,e.m07*=t,e.m08*=t,e},i.scale=function(t){var e=t.x,i=t.y,n=this;return n.m00*=e,n.m01*=e,n.m02*=e,n.m03*=i,n.m04*=i,n.m05*=i,n},i.rotate=function(t){var e=this,i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=Math.sin(t),f=Math.cos(t);return e.m00=f*i+c*s,e.m01=f*n+c*a,e.m02=f*r+c*o,e.m03=f*s-c*i,e.m04=f*a-c*n,e.m05=f*o-c*r,e.m06=h,e.m07=u,e.m08=l,e},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,f=n*a,d=n*o,_=r*s,p=r*a,m=r*o,g=this;return g.m00=1-l-d,g.m03=u-m,g.m06=c+p,g.m01=u+m,g.m04=1-h-d,g.m07=f-_,g.m02=c-p,g.m05=f+_,g.m08=1-h-l,g},e}(Oe));er=ur,ur.IDENTITY=Object.freeze(new er);var lr,cr=new Kn,fr=new Kn;Fi.fastDefine("cc.Mat3",ur,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),C.Mat3=ur;var dr=Math.abs,_r=Math.max,pr=Math.min,mr=Math.PI,gr=Math.acos,vr=Math.sin,yr=Math.cos,br=Math.sqrt,Sr=Math.atan2,wr=Math.asin,Tr=Math.sign,Cr=t("aW",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},e.rotationTo=function(t,i,n){var r=Kn.dot(i,n);return r<-.999999?(Kn.cross(Br,Kn.UNIT_X,i),Br.length()<1e-6&&Kn.cross(Br,Kn.UNIT_Y,i),Kn.normalize(Br,Br),e.fromAxisAngle(t,Br,mr),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(Kn.cross(Br,i,n),t.x=Br.x,t.y=Br.y,t.z=Br.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*gr(e.w),n=vr(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){var n=vr(i*=.5),r=yr(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){var n=vr(i*=.5),r=yr(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*r-a*n,t},e.rotateZ=function(t,e,i){var n=vr(i*=.5),r=yr(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(Dr,i),Kn.transformQuat(Br,n,Dr),e.fromAxisAngle(Dr,Br,r),e.multiply(t,i,Dr),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Dr,n,r),e.multiply(t,i,Dr),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=br(dr(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,h=i.z,u=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,h=-h,u=-u),1-l>1e-6){var c=gr(l),f=vr(c);r=vr((1-n)*c)/f,s=vr(n*c)/f}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(Dr,i,s,a),e.slerp(Ir,n,r,a),e.slerp(t,Dr,Ir,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return br(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0?(i=1/br(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return ur.set(Mr,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,Mr))},e.fromViewUp=function(t,i,n){return ur.fromViewUp(Mr,i,n),e.normalize(t,e.fromMat3(t,Mr))},e.fromAxisAngle=function(t,e,i){var n=vr(i*=.5);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=yr(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=i-a-l,f=a-i-l,d=l-i-a,_=0,p=i+a+l;c>p&&(p=c,_=1),f>p&&(p=f,_=2),d>p&&(p=d,_=3);var m=.5*br(p+1),g=.25/m;switch(_){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){i*=Pr,n*=Pr;var r=vr(e*=Pr),s=yr(e),a=vr(i),o=yr(i),h=vr(n),u=yr(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=Pr,t.x=t.y=0,t.z=vr(e),t.w=yr(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x-i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x+n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,h=0,u=0,l=n*r+s*a;if(l>.499999)o=0,h=Zi(2*Sr(n,a)),u=90;else if(l<-.499999)o=0,h=-Zi(2*Sr(n,a)),u=-90;else{var c=r*r,f=s*s;o=Zi(Sr(2*n*a-2*r*s,1-n*n*2-2*f)),h=Zi(Sr(2*r*a-2*n*s,1-2*c-2*f)),u=Zi(wr(2*l)),i&&(o=-180*Tr(o+1e-6)+o,h=-180*Tr(h+1e-6)+h,u=180*Tr(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){ur.fromQuat(Mr,e),ur.toEuler(Mr,t),t.x=Zi(t.x),t.y=Zi(t.y),t.z=Zi(t.z)},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=ji),dr(t.x-e.x)<=i*_r(1,dr(t.x),dr(e.x))&&dr(t.y-e.y)<=i*_r(1,dr(t.y),dr(e.y))&&dr(t.z-e.z)<=i*_r(1,dr(t.z),dr(e.z))&&dr(t.w-e.w)<=i*_r(1,dr(t.w),dr(e.w))},e.angle=function(t,i){var n=pr(dr(e.dot(t,i)),1);return 2*gr(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var a=pr(r/Zi(s),1);return e.slerp(t,i,n,a)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,i){return void 0===i&&(i=ji),e.equals(this,t,i)},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){var i=this;return i.x+=e*(t.x-i.x),i.y+=e*(t.y-i.y),i.z+=e*(t.z-i.z),i.w+=e*(t.w-i.w),i},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return br(e*e+i*i+n*n+r*r)},i.lengthSqr=function(){var t=this,e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e}(Oe));lr=Cr,Cr.IDENTITY=Object.freeze(new lr);var Ar,Dr=new Cr,Ir=new Cr,Br=new Kn,Mr=new ur,Pr=.5*mr/180;function Er(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new Cr(t,e,i,n)}Fi.fastDefine("cc.Quat",Cr,{x:0,y:0,z:0,w:1}),C.Quat=Cr,C.quat=Er;var kr=t("b6",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])])),Or=Math.abs,Rr=Math.max,Fr=Math.sqrt,Lr=Math.sin,Vr=Math.cos,Nr=Math.tan,zr=t("aZ",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,d,_,p,m,g){var v;void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===d&&(d=0),void 0===_&&(_=0),void 0===p&&(p=0),void 0===m&&(m=0),void 0===g&&(g=1);var y=f(v=t.call(this)||this);return"object"==typeof e?(y.m00=e.m00,v.m01=e.m01,v.m02=e.m02,v.m03=e.m03,y.m04=e.m04,v.m05=e.m05,v.m06=e.m06,v.m07=e.m07,y.m08=e.m08,v.m09=e.m09,v.m10=e.m10,v.m11=e.m11,y.m12=e.m12,v.m13=e.m13,v.m14=e.m14,v.m15=e.m15):(y.m00=e,v.m01=i,v.m02=n,v.m03=r,y.m04=s,v.m05=a,v.m06=o,v.m07=h,y.m08=u,v.m09=l,v.m10=c,v.m11=d,y.m12=_,v.m13=p,v.m14=m,v.m15=g),v}s(e,t),e.clone=function(t){return new e(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)},e.copy=function(t,e){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,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,f,d,_,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=f,t.m12=d,t.m13=_,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.zero=function(t){return t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,i){var n=i.m00,r=i.m01,s=i.m02,a=i.m03,o=i.m04,h=i.m05,u=i.m06,l=i.m07,c=i.m08,f=i.m09,d=i.m10,_=i.m11,p=i.m12,m=i.m13,g=i.m14,v=i.m15,y=n*h-r*o,b=n*u-s*o,S=n*l-a*o,x=r*u-s*h,w=r*l-a*h,T=s*l-a*u,C=c*m-f*p,A=c*g-d*p,D=c*v-_*p,I=f*g-d*m,B=f*v-_*m,M=d*v-_*g,P=y*M-b*B+S*I+x*D-w*A+T*C;return 0===P?e.zero(t):(P=1/P,t.m00=(h*M-u*B+l*I)*P,t.m01=(s*B-r*M-a*I)*P,t.m02=(m*T-g*w+v*x)*P,t.m03=(d*w-f*T-_*x)*P,t.m04=(u*D-o*M-l*A)*P,t.m05=(n*M-s*D+a*A)*P,t.m06=(g*S-p*T-v*b)*P,t.m07=(c*T-d*S+_*b)*P,t.m08=(o*B-h*D+l*C)*P,t.m09=(r*D-n*B-a*C)*P,t.m10=(p*w-m*S+v*y)*P,t.m11=(f*S-c*w-_*y)*P,t.m12=(h*A-o*I-u*C)*P,t.m13=(n*I-r*A+s*C)*P,t.m14=(m*b-p*x-g*y)*P,t.m15=(c*x-f*b+d*y)*P,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*_)+(e*h-r*s)*(l*p-c*_)+(i*o-n*a)*(u*m-f*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*_-l*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,f=e.m09,d=e.m10,_=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,b=i.m01,S=i.m02,x=i.m03;return t.m00=y*n+b*o+S*c+x*p,t.m01=y*r+b*h+S*f+x*m,t.m02=y*s+b*u+S*d+x*g,t.m03=y*a+b*l+S*_+x*v,y=i.m04,b=i.m05,S=i.m06,x=i.m07,t.m04=y*n+b*o+S*c+x*p,t.m05=y*r+b*h+S*f+x*m,t.m06=y*s+b*u+S*d+x*g,t.m07=y*a+b*l+S*_+x*v,y=i.m08,b=i.m09,S=i.m10,x=i.m11,t.m08=y*n+b*o+S*c+x*p,t.m09=y*r+b*h+S*f+x*m,t.m10=y*s+b*u+S*d+x*g,t.m11=y*a+b*l+S*_+x*v,y=i.m12,b=i.m13,S=i.m14,x=i.m15,t.m12=y*n+b*o+S*c+x*p,t.m13=y*r+b*h+S*f+x*m,t.m14=y*s+b*u+S*d+x*g,t.m15=y*a+b*l+S*_+x*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,f=e.m06,d=e.m07,_=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=f,t.m07=d,t.m08=_,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+_*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+f*r+m*s+e.m14,t.m15=u*n+d*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(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+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Fr(r*r+s*s+a*a);if(Or(o)0?(n=2*Fr(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Fr(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Fr(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Fr(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,i,n,r){e.toSRT(t,i,n,r)},e.toSRT=function(t,e,i,n){i&&Kn.set(i,t.m12,t.m13,t.m14);var r=Kn.set(Ur,t.m00,t.m01,t.m02).length(),s=Kn.set(Ur,t.m04,t.m05,t.m06).length(),a=Kn.set(Ur,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=a),0!==r&&0!==s&&0!==a){Hr.m00=t.m00/r,Hr.m01=t.m01/r,Hr.m02=t.m02/r,Hr.m03=t.m04/s,Hr.m04=t.m05/s,Hr.m05=t.m06/s,Hr.m06=t.m08/a,Hr.m07=t.m09/a,Hr.m08=t.m10/a;var o=ur.determinant(Hr);n&&o<0&&(n.x*=-1),e&&(o<0&&(Hr.m00*=-1,Hr.m01*=-1,Hr.m02*=-1),Cr.fromMat3(e,Hr))}else e&&Cr.identity(e)},e.toEuler=function(t,e){return ur.set(Hr,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),ur.toEuler(Hr,e)},e.fromRTS=function(t,i,n,r){return e.fromSRT(t,i,n,r)},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,f=r*u,d=r*l,_=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,b=n.x,S=n.y,x=n.z;return t.m00=(1-(_+m))*b,t.m01=(f+y)*b,t.m02=(d-v)*b,t.m03=0,t.m04=(f-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*x,t.m09=(p-g)*x,t.m10=(1-(c+_))*x,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,i,n,r,s){return e.fromSRTOrigin(t,i,n,r,s)},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,f=s*u,d=s*l,_=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,b=h*c,S=n.x,x=n.y,w=n.z,T=r.x,C=r.y,A=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+b)*S,t.m02=(_-y)*S,t.m03=0,t.m04=(d-b)*x,t.m05=(1-(f+g))*x,t.m06=(m+v)*x,t.m07=0,t.m08=(_+y)*w,t.m09=(m-v)*w,t.m10=(1-(f+p))*w,t.m11=0,t.m12=i.x+T-(t.m00*T+t.m04*C+t.m08*A),t.m13=i.y+C-(t.m01*T+t.m05*C+t.m09*A),t.m14=i.z+A-(t.m02*T+t.m06*C+t.m10*A),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,f=r*a,d=r*o,_=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-_,t.m01=l+g,t.m02=f-m,t.m03=0,t.m04=l-g,t.m05=1-u-_,t.m06=d+p,t.m07=0,t.m08=f+m,t.m09=d-p,t.m10=1-u-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),h=1/(r-n),u=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Nr(e/2),l=1/(n-r),c=s?u/i:u,f=(s?u:u*i)*o,d=kr[h];return t.m00=c*d[0],t.m01=c*d[1],t.m02=0,t.m03=0,t.m04=f*d[2],t.m05=f*d[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,f=1/(s-a),d=-2*l,_=-2*c,p=(e+i)*l,m=(r+n)*c,g=kr[u];return t.m00=d*g[0],t.m01=d*g[1],t.m02=0,t.m03=0,t.m04=_*g[2],t.m05=_*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=f*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*f,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,f=a-i.z,d=1/Fr(l*l+c*c+f*f),_=h*(f*=d)-u*(c*=d),p=u*(l*=d)-o*f,m=o*c-h*l,g=c*(m*=d=1/Fr(_*_+p*p+m*m))-f*(p*=d),v=f*(_*=d)-l*m,y=l*p-c*_;return t.m00=_,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=f,t.m11=0,t.m12=-(_*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+f*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,f=e.m10,d=e.m11,_=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,b=i*u-s*a,S=n*h-r*o,x=n*u-s*o,w=r*u-s*h,T=l*p-c*_,C=l*m-f*_,A=l*g-d*_,D=c*m-f*p,I=c*g-d*p,B=f*g-d*m,M=v*B-y*I+b*D+S*A-x*C+w*T;return M?(M=1/M,t.m00=(o*B-h*I+u*D)*M,t.m01=(h*A-a*B-u*C)*M,t.m02=(a*I-o*A+u*T)*M,t.m03=0,t.m04=(r*I-n*B-s*D)*M,t.m05=(i*B-r*A+s*C)*M,t.m06=(n*A-i*I-s*T)*M,t.m07=0,t.m08=(p*w-m*x+g*S)*M,t.m09=(m*b-_*w-g*y)*M,t.m10=(_*x-p*b+g*v)*M,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){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},e.equals=function(t,e,i){return void 0===i&&(i=ji),Or(t.m00-e.m00)<=i*Rr(1,Or(t.m00),Or(e.m00))&&Or(t.m01-e.m01)<=i*Rr(1,Or(t.m01),Or(e.m01))&&Or(t.m02-e.m02)<=i*Rr(1,Or(t.m02),Or(e.m02))&&Or(t.m03-e.m03)<=i*Rr(1,Or(t.m03),Or(e.m03))&&Or(t.m04-e.m04)<=i*Rr(1,Or(t.m04),Or(e.m04))&&Or(t.m05-e.m05)<=i*Rr(1,Or(t.m05),Or(e.m05))&&Or(t.m06-e.m06)<=i*Rr(1,Or(t.m06),Or(e.m06))&&Or(t.m07-e.m07)<=i*Rr(1,Or(t.m07),Or(e.m07))&&Or(t.m08-e.m08)<=i*Rr(1,Or(t.m08),Or(e.m08))&&Or(t.m09-e.m09)<=i*Rr(1,Or(t.m09),Or(e.m09))&&Or(t.m10-e.m10)<=i*Rr(1,Or(t.m10),Or(e.m10))&&Or(t.m11-e.m11)<=i*Rr(1,Or(t.m11),Or(e.m11))&&Or(t.m12-e.m12)<=i*Rr(1,Or(t.m12),Or(e.m12))&&Or(t.m13-e.m13)<=i*Rr(1,Or(t.m13),Or(e.m13))&&Or(t.m14-e.m14)<=i*Rr(1,Or(t.m14),Or(e.m14))&&Or(t.m15-e.m15)<=i*Rr(1,Or(t.m15),Or(e.m15))};var i=e.prototype;return i.clone=function(){return new e(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)},i.set=function(t,e,i,n,r,s,a,o,h,u,l,c,f,d,_,p){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===_&&(_=0),void 0===p&&(p=1);var m=this;return"object"==typeof t?(m.m01=t.m01,m.m02=t.m02,m.m03=t.m03,m.m04=t.m04,m.m05=t.m05,m.m06=t.m06,m.m07=t.m07,m.m08=t.m08,m.m09=t.m09,m.m10=t.m10,m.m11=t.m11,m.m12=t.m12,m.m13=t.m13,m.m14=t.m14,m.m15=t.m15,m.m00=t.m00):(m.m01=e,m.m02=i,m.m03=n,m.m04=r,m.m05=s,m.m06=a,m.m07=o,m.m08=h,m.m09=u,m.m10=l,m.m11=c,m.m12=f,m.m13=d,m.m14=_,m.m15=p,m.m00=t),m},i.equals=function(t,e){void 0===e&&(e=ji);var i=1/0,n=this,r=n.m00,s=n.m01,a=n.m02,o=n.m03,h=n.m04,u=n.m05,l=n.m06,c=n.m07,f=n.m08,d=n.m09,_=n.m10,p=n.m11,m=n.m12,g=n.m13,v=n.m14,y=n.m15;return!(Or(r)===i||Or(s)===i||Or(a)===i||Or(o)===i||Or(h)===i||Or(u)===i||Or(l)===i||Or(c)===i||Or(f)===i||Or(d)===i||Or(_)===i||Or(p)===i||Or(m)===i||Or(g)===i||Or(v)===i||Or(y)===i)&&Or(r-t.m00)<=e*Rr(1,Or(r),Or(t.m00))&&Or(s-t.m01)<=e*Rr(1,Or(s),Or(t.m01))&&Or(a-t.m02)<=e*Rr(1,Or(a),Or(t.m02))&&Or(o-t.m03)<=e*Rr(1,Or(o),Or(t.m03))&&Or(h-t.m04)<=e*Rr(1,Or(h),Or(t.m04))&&Or(u-t.m05)<=e*Rr(1,Or(u),Or(t.m05))&&Or(l-t.m06)<=e*Rr(1,Or(l),Or(t.m06))&&Or(c-t.m07)<=e*Rr(1,Or(c),Or(t.m07))&&Or(f-t.m08)<=e*Rr(1,Or(f),Or(t.m08))&&Or(d-t.m09)<=e*Rr(1,Or(d),Or(t.m09))&&Or(_-t.m10)<=e*Rr(1,Or(_),Or(t.m10))&&Or(p-t.m11)<=e*Rr(1,Or(p),Or(t.m11))&&Or(m-t.m12)<=e*Rr(1,Or(m),Or(t.m12))&&Or(g-t.m13)<=e*Rr(1,Or(g),Or(t.m13))&&Or(v-t.m14)<=e*Rr(1,Or(v),Or(t.m14))&&Or(y-t.m15)<=e*Rr(1,Or(y),Or(t.m15))},i.strictEquals=function(t){var e=this;return e.m00===t.m00&&e.m01===t.m01&&e.m02===t.m02&&e.m03===t.m03&&e.m04===t.m04&&e.m05===t.m05&&e.m06===t.m06&&e.m07===t.m07&&e.m08===t.m08&&e.m09===t.m09&&e.m10===t.m10&&e.m11===t.m11&&e.m12===t.m12&&e.m13===t.m13&&e.m14===t.m14&&e.m15===t.m15},i.toString=function(){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]"},i.identity=function(){return e.identity(this)},i.zero=function(){return e.zero(this)},i.transpose=function(){var t=this,e=t.m01,i=t.m02,n=t.m03,r=t.m06,s=t.m07,a=t.m11;return t.m01=t.m04,t.m02=t.m08,t.m03=t.m12,t.m04=e,t.m06=t.m09,t.m07=t.m13,t.m08=i,t.m09=r,t.m11=t.m14,t.m12=n,t.m13=s,t.m14=a,t},i.invert=function(){var t=this,e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15,g=e*a-i*s,v=e*o-n*s,y=e*h-r*s,b=i*o-n*a,S=i*h-r*a,x=n*h-r*o,w=u*_-l*d,T=u*p-c*d,C=u*m-f*d,A=l*p-c*_,D=l*m-f*_,I=c*m-f*p,B=g*I-v*D+y*A+b*C-S*T+x*w;return 0===B?(t.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t):(B=1/B,t.m00=(a*I-o*D+h*A)*B,t.m01=(n*D-i*I-r*A)*B,t.m02=(_*x-p*S+m*b)*B,t.m03=(c*S-l*x-f*b)*B,t.m04=(o*C-s*I-h*T)*B,t.m05=(e*I-n*C+r*T)*B,t.m06=(p*y-d*x-m*v)*B,t.m07=(u*x-c*y+f*v)*B,t.m08=(s*D-a*C+h*w)*B,t.m09=(i*C-e*D-r*w)*B,t.m10=(d*S-_*y+m*g)*B,t.m11=(l*y-u*S-f*g)*B,t.m12=(a*T-s*A-o*w)*B,t.m13=(e*A-i*T+n*w)*B,t.m14=(_*v-d*b-p*g)*B,t.m15=(u*b-l*v+c*g)*B,t)},i.determinant=function(){var t=this,e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,f=t.m11,d=t.m12,_=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-f*p)-(e*o-n*s)*(l*m-f*_)+(e*h-r*s)*(l*p-c*_)+(i*o-n*a)*(u*m-f*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*_-l*d)},i.add=function(t){var e=this;return e.m00+=t.m00,e.m01+=t.m01,e.m02+=t.m02,e.m03+=t.m03,e.m04+=t.m04,e.m05+=t.m05,e.m06+=t.m06,e.m07+=t.m07,e.m08+=t.m08,e.m09+=t.m09,e.m10+=t.m10,e.m11+=t.m11,e.m12+=t.m12,e.m13+=t.m13,e.m14+=t.m14,e.m15+=t.m15,e},i.subtract=function(t){var e=this;return e.m00-=t.m00,e.m01-=t.m01,e.m02-=t.m02,e.m03-=t.m03,e.m04-=t.m04,e.m05-=t.m05,e.m06-=t.m06,e.m07-=t.m07,e.m08-=t.m08,e.m09-=t.m09,e.m10-=t.m10,e.m11-=t.m11,e.m12-=t.m12,e.m13-=t.m13,e.m14-=t.m14,e.m15-=t.m15,e},i.multiply=function(t){return e.multiply(this,this,t)},i.multiplyScalar=function(t){var e=this;return e.m00*=t,e.m01*=t,e.m02*=t,e.m03*=t,e.m04*=t,e.m05*=t,e.m06*=t,e.m07*=t,e.m08*=t,e.m09*=t,e.m10*=t,e.m11*=t,e.m12*=t,e.m13*=t,e.m14*=t,e.m15*=t,e},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this,s=r.m00,a=r.m01,o=r.m02,h=r.m03,u=r.m04,l=r.m05,c=r.m06,f=r.m07,d=r.m08,_=r.m09,p=r.m10,m=r.m11;return r.m12=s*e+u*i+d*n+r.m12,r.m13=a*e+l*i+_*n+r.m13,r.m14=o*e+c*i+p*n+r.m14,r.m15=h*e+f*i+m*n+r.m15,r},i.scale=function(t){var e=t.x,i=t.y,n=t.z,r=this;return r.m00*=e,r.m01*=e,r.m02*=e,r.m03*=e,r.m04*=i,r.m05*=i,r.m06*=i,r.m07*=i,r.m08*=n,r.m09*=n,r.m10*=n,r.m11*=n,r},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=Fr(i*i+n*n+r*r);if(Or(s)0?(r=1/Zr(r),t.x=i*r,t.y=n*r):(t.x=0,t.y=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof Kn?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*$i()*Yr;return t.x=Jr(i)*e,t.y=Kr(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=ji),jr(t.x-e.x)<=i*qr(1,jr(t.x),jr(e.x))&&jr(t.y-e.y)<=i*qr(1,jr(t.y),jr(e.y))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y,n=e.x*e.x+e.y*e.y;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y)/Zr(i*n);return r=Yi(r,-1,1),Qr(r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,i){return void 0===i&&(i=ji),e.equals(this,t,i)},i.equals2f=function(t,e,i){return void 0===i&&(i=ji),jr(this.x-t)<=i*qr(1,jr(this.x),jr(t))&&jr(this.y-e)<=i*qr(1,jr(this.y),jr(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=Yi(this.x,t.x,e.x),this.y=Yi(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&st(16359),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&st(16360),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Zr(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this,e=t.x,i=t.y,n=e*e+i*i;return n>0&&(n=1/Zr(n),t.x*=n,t.y*=n),t},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/Zr(e*i);return n=Yi(n,-1,1),Qr(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return $r(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=Kr(t),r=Jr(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},i.toVec3=function(){return new Kn(this.x,this.y,0)},e}(Oe));function rs(t,e){return new ns(t,e)}Gr=ns,ns.ZERO=Object.freeze(new Gr(0,0)),ns.ONE=Object.freeze(new Gr(1,1)),ns.NEG_ONE=Object.freeze(new Gr(-1,-1)),ns.UNIT_X=Object.freeze(new Gr(1,0)),ns.UNIT_Y=Object.freeze(new Gr(0,1)),Fi.fastDefine("cc.Vec2",ns,{x:0,y:0}),C.Vec2=ns,C.v2=rs,_t(ns,"Vec2",[{name:"sub",newName:"subtract",target:ns,targetName:"Vec2"},{name:"mul",newName:"multiply",target:ns,targetName:"Vec2"},{name:"div",newName:"divide",target:ns,targetName:"Vec2"},{name:"dist",newName:"distance",target:ns,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:ns,targetName:"Vec2"},{name:"mag",newName:"len",target:ns,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:ns,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:ns,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:ns,targetName:"Vec2"}]),_t(ns.prototype,"Vec2",[{name:"mag",newName:"length",target:ns.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:ns.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:ns.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:ns.prototype,targetName:"Vec2"}]),_t(Kn,"Vec3",[{name:"sub",newName:"subtract",target:Kn,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Kn,targetName:"Vec3"},{name:"div",newName:"divide",target:Kn,targetName:"Vec3"},{name:"dist",newName:"distance",target:Kn,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Kn,targetName:"Vec3"},{name:"mag",newName:"len",target:Kn,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Kn,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Kn,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Kn,targetName:"Vec3"}]),_t(Kn.prototype,"Vec3",[{name:"mag",newName:"length",target:Kn.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Kn.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Kn.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Kn.prototype,targetName:"Vec3"}]),_t(kn,"Vec4",[{name:"sub",newName:"subtract",target:kn,targetName:"Vec4"},{name:"mul",newName:"multiply",target:kn,targetName:"Vec4"},{name:"div",newName:"divide",target:kn,targetName:"Vec4"},{name:"dist",newName:"distance",target:kn,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:kn,targetName:"Vec4"},{name:"mag",newName:"len",target:kn,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:kn,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:kn,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:kn,targetName:"Vec4"}]),_t(kn.prototype,"Vec4",[{name:"mag",newName:"length",target:kn.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:kn.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:kn.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:kn.prototype,targetName:"Vec4"}]),_t(Cr,"Quat",[{name:"mag",newName:"len",target:Cr,targetName:"Quat"},{name:"mul",newName:"multiply",target:Cr,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:Cr,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:Cr,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Cr,targetName:"Quat"}]),_t(Cr.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:Cr.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Cr.prototype,targetName:"Quat"}]),_t(nr,"Color",[{name:"sub",newName:"subtract",target:nr,targetName:"Color"},{name:"mul",newName:"multiply",target:nr,targetName:"Color"},{name:"div",newName:"divide",target:nr,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:nr,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&e.y<=t.y&&e.y+e.height>=t.y},i.containsRect=function(t){var e=this;return e.x<=t.x&&e.x+e.width>=t.x+t.width&&e.y<=t.y&&e.y+e.height>=t.y+t.height},i.transformMat4=function(t){var e=this,i=e.x,n=e.y,r=i+e.width,s=n+e.height,a=t.m00*i+t.m04*n+t.m12,o=t.m01*i+t.m05*n+t.m13,h=t.m00*r+t.m04*n+t.m12,u=t.m01*r+t.m05*n+t.m13,l=t.m00*i+t.m04*s+t.m12,c=t.m01*i+t.m05*s+t.m13,f=t.m00*r+t.m04*s+t.m12,d=t.m01*r+t.m05*s+t.m13,_=ls(a,h,l,f),p=us(a,h,l,f),m=ls(o,u,c,d),g=us(o,u,c,d);return e.x=_,e.y=m,e.width=p-_,e.height=g-m,e},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this,a=s.x,o=s.y,h=a+s.width,u=o+s.height;e.x=t.m00*a+t.m04*o+t.m12,e.y=t.m01*a+t.m05*o+t.m13,r.x=t.m00*h+t.m04*o+t.m12,r.y=t.m01*h+t.m05*o+t.m13,i.x=t.m00*a+t.m04*u+t.m12,i.y=t.m01*a+t.m05*u+t.m13,n.x=t.m00*h+t.m04*u+t.m12,n.y=t.m01*h+t.m05*u+t.m13},n(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new ns(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new ns(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new os(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(Oe));function fs(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new cs(t,e,i,n)}Fi.fastDefine("cc.Rect",cs,{x:0,y:0,width:0,height:0}),C.Rect=cs,C.rect=fs;var ds=t("bx",Float64Array),_s=t("by",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new ds(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(Oe)),ps=Object.freeze({__proto__:null,AffineTransform:as,Color:nr,EPSILON:ji,HALF_PI:Hi,MATH_FLOAT_ARRAY:ds,Mat3:ur,Mat4:zr,MathBase:_s,Quat:Cr,Rect:cs,Size:os,TWO_PI:Wi,Vec2:ns,Vec3:Kn,Vec4:kn,absMax:fn,absMaxComponent:cn,approx:Xi,bits:F,clamp:Yi,clamp01:Qi,color:rr,enumerableProps:dn,equals:qi,floatToHalf:yn,halfToFloat:bn,inverseLerp:ln,lerp:Ki,mat4:Wr,nextPow2:on,pingPong:un,preTransforms:kr,pseudoRandom:rn,pseudoRandomRange:sn,pseudoRandomRangeInt:an,quat:Er,random:$i,randomRange:en,randomRangeInt:nn,rect:fs,repeat:hn,setRandGenerator:tn,size:hs,toDegree:Zi,toRadian:Ji,v2:rs,v3:Jn,v4:On});t("aK",ps);var ms=new Kn,gs=new Kn,vs=new Kn,ys=new Kn,bs=new Kn,Ss=new Kn,xs=new Array(3),ws=new Array(3);function Ts(t,e){return Kn.dot(e.n,t)-e.d}function Cs(t,e,i){return Kn.copy(t,e),Kn.subtract(bs,i.center,i.halfExtents),Kn.add(Ss,i.center,i.halfExtents),t.x=t.xSs.x?Ss.x:t.x,t.y=t.y>Ss.y?Ss.y:t.y,t.z=t.z>Ss.z?Ss.z:t.z,t}function As(t,e,i){Kn.set(ms,i.orientation.m00,i.orientation.m01,i.orientation.m02),Kn.set(gs,i.orientation.m03,i.orientation.m04,i.orientation.m05),Kn.set(vs,i.orientation.m06,i.orientation.m07,i.orientation.m08),xs[0]=ms,xs[1]=gs,xs[2]=vs,ws[0]=i.halfExtents.x,ws[1]=i.halfExtents.y,ws[2]=i.halfExtents.z,Kn.subtract(ys,e,i.center),Kn.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Kn.dot(ys,xs[n]);r>ws[n]&&(r=ws[n]),r<-ws[n]&&(r=-ws[n]),t.x+=r*xs[n].x,t.y+=r*xs[n].y,t.z+=r*xs[n].z}return t}var Ds=Object.freeze({__proto__:null,point_plane:Ts,pt_point_aabb:Cs,pt_point_line:function(t,e,i,n){Kn.subtract(ms,i,n);var r=ms.clone(),s=Kn.lengthSqr(r);if(0===s)Kn.copy(t,i);else{Kn.subtract(ms,e,i);var a=Kn.dot(ms,r)/s;a<0?Kn.copy(t,i):a>1?Kn.copy(t,n):Kn.scaleAndAdd(t,i,r,a)}},pt_point_obb:As,pt_point_plane:function(t,e,i){var n=Ts(e,i);return Kn.subtract(t,e,Kn.multiplyScalar(t,i.n,n))}}),Is=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=2,this.s=new Kn(t,e,i),this.e=new Kn(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return Kn.copy(t.s,e.s),Kn.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return Kn.copy(t.s,e),Kn.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return Kn.distance(t.s,t.e)},t.prototype.length=function(){return Kn.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Bs=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this._type=1,this.o=new Kn(t,e,i),this.d=new Kn(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return Kn.copy(t.o,e.o),Kn.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return Kn.copy(t.o,e),Kn.normalize(t.d,Kn.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){Kn.normalize(t,this.d),Kn.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Ms=new Kn,Ps=new Kn,Es=new Kn,ks=new Kn;function Os(t){return Math.max(Math.max(t.x,t.y),t.z)}var Rs,Fs,Ls,Vs,Ns,zs=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._type=4,this._center=new Kn(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return Kn.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return Kn.multiplyScalar(t.center,Kn.add(Ms,e,i),.5),t.radius=.5*Kn.subtract(Ms,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){Kn.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Kn.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){Kn.transformMat4(r.center,this.center,t),r.radius=this.radius*Os(n)},e.translateAndRotate=function(t,e,i){Kn.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Os(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),Kn.subtract(Ps,t,this.center);var e=Ps.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,Kn.multiplyScalar(Ps,Ps,i/e),Kn.add(this.center,this.center,Ps)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;Kn.subtract(Vs,t.o,e.a);var s=Kn.dot(Vs,Ls)*r;if(s<0||s>1)return 0;Kn.cross(Ns,Vs,Rs);var a=Kn.dot(t.d,Ns)*r;if(a<0||s+a>1)return 0;var o=Kn.dot(Fs,Ns)*r;return o<0?0:o}),Hs=function(){var t=new Kn(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;Kn.subtract(t,r,s);var h=t.lengthSqr(),u=Kn.dot(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),f=hp?0:_>0?_:p}var qs=function(){var t=new Kn,e=new Kn,i=new Kn,n=new Kn,r=new Kn,s=new Kn,a=new Kn,o=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,f){o[0]=f.halfExtents.x,o[1]=f.halfExtents.y,o[2]=f.halfExtents.z,t=f.center,e=c.o,i=c.d,Kn.set(n,f.orientation.m00,f.orientation.m01,f.orientation.m02),Kn.set(r,f.orientation.m03,f.orientation.m04,f.orientation.m05),Kn.set(s,f.orientation.m06,f.orientation.m07,f.orientation.m08),Kn.subtract(a,t,e),h[0]=Kn.dot(n,i),h[1]=Kn.dot(r,i),h[2]=Kn.dot(s,i),u[0]=Kn.dot(n,a),u[1]=Kn.dot(r,a),u[2]=Kn.dot(s,a);for(var d=0;d<3;++d){if(0===h[d]){if(-u[d]-o[d]>0||-u[d]+o[d]<0)return 0;h[d]=1e-7}l[2*d+0]=(u[d]+o[d])/h[d],l[2*d+1]=(u[d]-o[d])/h[d]}var _=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||_>p?0:_>0?_:p}}(),Xs=function(){var t=new Kn,e=new Kn,i=new Kn,n=new Kn,r=new Kn,s=new Kn,a=new Kn,o=new zs;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,f=Kn.subtract(e,c,l);if(f.length()=0&&I<=1?T:I<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Pa.raySphere(h,o)):I>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Pa.raySphere(h,o)):0}}(),Ys=function(){var t=new Kn(0,0,0);return function(e,i){Kn.subtract(t,e.e,e.s);var n=-Ts(e.s,i)/Kn.dot(t,i.n);return n<0||n>1?0:n}}(),Qs=function(){var t=new Kn(0,0,0),e=new Kn(0,0,0),i=new Kn(0,0,0),n=new Kn(0,0,0),r=new Kn(0,0,0),s=new Kn(0,0,0);return function(a,o,h){Kn.subtract(t,o.b,o.a),Kn.subtract(e,o.c,o.a),Kn.subtract(i,a.s,a.e),Kn.cross(r,t,e);var u=Kn.dot(i,r);if(u<=0)return 0;Kn.subtract(n,a.s,o.a);var l=Kn.dot(n,r);if(l<0||l>u)return 0;Kn.cross(s,i,n);var c=Kn.dot(e,s);if(c<0||c>u)return 0;var f=-Kn.dot(t,s);if(f<0||c+f>u)return 0;if(h){var d=1/u,_=1-(c*=d)-(f*=d);Kn.set(h,o.a.x*_+o.b.x*c+o.c.x*f,o.a.y*_+o.b.y*c+o.c.y*f,o.a.z*_+o.b.z*c+o.c.z*f)}return 1}}(),Ks=new Bs;function Js(t,e){Ks.o.set(t.s),Kn.subtract(Ks.d,t.e,t.s),Ks.d.normalize();var i=Ws(Ks,e);return i<=t.length()?i:0}function Zs(t,e){Ks.o.set(t.s),Kn.subtract(Ks.d,t.e,t.s),Ks.d.normalize();var i=qs(Ks,e);return i<=t.length()?i:0}function $s(t,e){Ks.o.set(t.s),Kn.subtract(Ks.d,t.e,t.s),Ks.d.normalize();var i=Hs(Ks,e);return i<=t.length()?i:0}var ta,ea,ia,na,ra=(ta=new Kn,ea=new Kn,ia=new Kn,na=new Kn,function(t,e){return Kn.subtract(ta,t.center,t.halfExtents),Kn.add(ea,t.center,t.halfExtents),Kn.subtract(ia,e.center,e.halfExtents),Kn.add(na,e.center,e.halfExtents),ta.x<=na.x&&ea.x>=ia.x&&ta.y<=na.y&&ea.y>=ia.y&&ta.z<=na.z&&ea.z>=ia.z});function sa(t,e,i){Kn.set(i[0],t.x,e.y,e.z),Kn.set(i[1],t.x,e.y,t.z),Kn.set(i[2],t.x,t.y,e.z),Kn.set(i[3],t.x,t.y,t.z),Kn.set(i[4],e.x,e.y,e.z),Kn.set(i[5],e.x,e.y,t.z),Kn.set(i[6],e.x,t.y,e.z),Kn.set(i[7],e.x,t.y,t.z)}function aa(t,e,i,n,r,s){Kn.set(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),Kn.set(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),Kn.set(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),Kn.set(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),Kn.set(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),Kn.set(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),Kn.set(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),Kn.set(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function oa(t,e){for(var i=Kn.dot(e,t[0]),n=i,r=1;r<8;++r){var s=Kn.dot(e,t[r]);i=sn?s:n}return[i,n]}var ha,ua,la,ca,fa,da=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Kn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Kn(0,0,0),n[r]=new Kn(0,0,0);var s=new Kn,a=new Kn;return function(e,r){Kn.set(t[0],1,0,0),Kn.set(t[1],0,1,0),Kn.set(t[2],0,0,1),Kn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Kn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Kn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Kn.cross(t[6+3*o],t[o],t[3]),Kn.cross(t[7+3*o],t[o],t[4]),Kn.cross(t[7+3*o],t[o],t[5]);Kn.subtract(s,e.center,e.halfExtents),Kn.add(a,e.center,e.halfExtents),sa(s,a,i),aa(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=oa(i,t[h]),l=oa(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),_a=function(t,e){var 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),n=Kn.dot(e.n,t.center);return n+ie.d?0:1},pa=function(t,e){for(var i=0;in.halfExtents.x?e++:t[u].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;ln.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;cn.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),ga=(ha=new Kn(0,0,0),ua=new ur,function(t,e){return Kn.subtract(ha,e,t.center),Kn.transformMat3(ha,ha,ur.transpose(ua,t.orientation)),i=ha,n=t.halfExtents,Math.abs(i.x)e.d?0:1}),ya=function(t,e){for(var i=0;ir.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var f=0;fr.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var d=0;dr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),Sa=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Kn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Kn(0,0,0),n[r]=new Kn(0,0,0);return function(e,r){Kn.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),Kn.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),Kn.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),Kn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Kn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Kn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Kn.cross(t[6+3*s],t[s],t[3]),Kn.cross(t[7+3*s],t[s],t[4]),Kn.cross(t[8+3*s],t[s],t[5]);aa(e.center,e.halfExtents,t[0],t[1],t[2],i),aa(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=oa(i,t[a]),h=oa(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),xa=function(){for(var t=new zs,e=new Kn,i=new Kn,n=new Kn,r=new Array(8),s=0;s<8;s++)r[s]=new Kn;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Kn;return function(s,o){if(0===Kn.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),Pa.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,aa(s.center,s.halfExtents,e,i,n,r);var h=a,u=Kn.copy(h[0],e),l=Kn.copy(h[1],i),c=Kn.copy(h[2],n);Kn.subtract(h[3],o.center,s.center).normalize();var f=Kn.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);f.normalize(),Kn.cross(h[5],u,f),Kn.cross(h[6],l,f),Kn.cross(h[7],c,f);for(var d=0;d<8;++d){var _=oa(r,h[d]),p=Kn.dot(h[d],o.ellipseCenter0),m=Kn.dot(h[d],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>_[1]||_[0]>y)return 0}return 1}}(),wa=function(t,e){var i=Kn.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},Ta=function(t,e){for(var i=0;io)){Kn.add(ca,s,Kn.multiplyScalar(ca,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+fa[i]){var l=e.planes[u];if(Kn.dot(l.n,ca)1?Kn.squaredDistance(i.center,n.ellipseCenter1)y&&(h=y,u=g+_,b=p)),u<0?(u=0,-m<0?h=0:-m>d?h=y:(h=-m,y=d)):u>b&&(u=b,-m+_<0?h=0:-m+_>d?h=y:(h=-m+_,y=d));var S=Math.abs(h)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){zr.invert(Oa,t),zr.transpose(Oa,Oa),kn.set(Ra,this.n.x,this.n.y,this.n.z,-this.d),kn.transformMat4(Ra,Ra,Oa),Kn.set(this.n,Ra.x,Ra.y,Ra.z),this.d=-Ra.w},n(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),La=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===h&&(h=0),this._type=64,this.a=new Kn(t,e,i),this.b=new Kn(n,r,s),this.c=new Kn(a,o,h)}return t.create=function(e,i,n,r,s,a,o,h,u){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,a,o,h,u)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return Kn.copy(t.a,e.a),Kn.copy(t.b,e.b),Kn.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return Kn.copy(t.a,e),Kn.copy(t.b,i),Kn.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,h,u){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}();At({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var Va=function(){function t(){this._poolHandle=-1,za.addContainer(this)}return t.prototype.destroy=function(){za.removeContainer(this)},t}(),Na=function(){function t(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var e=t.prototype;return e.addContainer=function(t){-1===t._poolHandle&&(t._poolHandle=this._pools.length,this._pools.push(t))},e.removeContainer=function(t){-1!==t._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=t._poolHandle,ye(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;tthis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}(),za=new Na,Ga=t("bz",function(t){function e(e,i,n,r){var s;(s=t.call(this)||this)._freePool=[],s._ctor=e,s._dtor=n||null,s._elementsPerBatch=Math.max(i,1),s._shrinkThreshold=r?M(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var a=0;a>1>=this._shrinkThreshold?t>>1:Math.floor((t-this._shrinkThreshold+1)/2),this._dtor)for(var i=this._nextAvail-e+1;i<=this._nextAvail;++i)this._dtor(this._freePool[i]);this._nextAvail-=e,this._freePool.length=this._nextAvail+1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&st(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(Va)),Ua=t("bA",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._count=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},n(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(Va)),Ha=t("bB",function(t){function e(e,i){var n;return(n=t.call(this)||this).length=0,n._initSize=0,n.array=new Array(e),n._initSize=e,n._compareFn=i,n}s(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e=0;--t)this.callbackInfos[t]||ro(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),uo=new Ga((function(){return new ho}),16),lo=t("d4",function(){function t(){this._callbackTable=Gt(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=uo.alloc());var s=oo.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(l=!0,c="",f=0);var _=go.UNKNOWN;-1!==a.appVersion.indexOf("Win")?_=go.WINDOWS:l?_=go.IOS:-1!==a.appVersion.indexOf("Mac")?_=go.OSX:-1!==a.appVersion.indexOf("X11")&&-1===a.appVersion.indexOf("Linux")?_=go.LINUX:u?_=go.ANDROID:-1===a.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(_=go.LINUX),r.os=_,r.osVersion=c,r.osMainVersion=f,r.browserType=_o.UNKNOWN;var p=/wechat|weixin|micromessenger/i.exec(o)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(o)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),m=p?p[0].toLowerCase():go.UNKNOWN;("safari"===m&&u||"qq"===m&&/android.*applewebkit/i.test(o))&&(m=_o.ANDROID);var g={micromessenger:_o.WECHAT,wechat:_o.WECHAT,weixin:_o.WECHAT,trident:_o.IE,edge:_o.EDGE,"360 aphone":_o.BROWSER_360,mxbrowser:_o.MAXTHON,"opr/":_o.OPERA,ubrowser:_o.UC,huaweibrowser:_o.HUAWEI};r.browserType=g[m]||m,r.browserVersion="";var v=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(o);v||(v=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(o)),r.browserVersion=v?v[4]:"",r.isXR=!1;var y,b=document.createElement("canvas");b.getContext("2d");try{y=b.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){y=!1}if(r.os===go.IOS){var w,T=null===(w=/ applewebkit\/(\d+)/.exec(o))||void 0===w?void 0:w[1];"string"==typeof T&&Number.parseInt(T)>=604&&(y=!0)}else if(r.browserType===_o.SAFARI){var C,A=null===(C=/ version\/(\d+)/.exec(o))||void 0===C?void 0:C[1];"string"==typeof A&&Number.parseInt(A)>=14&&(y=!0)}var D=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||S,I=void 0!==document.documentElement.onmouseup||S,B=void 0!==navigator.xr,M=function(){if((r.os===go.IOS||r.os===go.OSX)&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){return!1}return!1}();return r._featureMap=((n={})[yo.WEBP]=y,n[yo.IMAGE_BITMAP]=!1,n[yo.WEB_VIEW]=!0,n[yo.VIDEO_PLAYER]=!0,n[yo.SAFE_AREA]=!1,n[yo.HPE]=!1,n[yo.INPUT_TOUCH]=D,n[yo.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||S,n[yo.EVENT_MOUSE]=I,n[yo.EVENT_TOUCH]=D||I,n[yo.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,n[yo.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||B,n[yo.EVENT_HANDLE]=x,n[yo.EVENT_HMD]=B,n[yo.EVENT_HANDHELD]=B,n[yo.WASM]=M,n),r._initPromise.push(r._supportsImageBitmapPromise()),r._registerEvent(),r}s(e,t);var i=e.prototype;return i._supportsImageBitmapPromise=function(){var t=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var e=document.createElement("canvas");e.width=e.height=2;var i=createImageBitmap(e,{});if(i instanceof Promise)return i.then((function(e){t._setFeature(yo.IMAGE_BITMAP,!0),null==e||e.close()}))}return Promise.resolve()},i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._setFeature=function(t,e){return this._featureMap[t]=e},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){window.close()},i.close=function(){this.emit("close")},e}(fo),xo=new So,wo=/(\.[^\.\/\?\\]*)(\?.*)?$/,To=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Co=/[^\.\/]+\/\.\.\//;function Ao(){for(var t="",e=arguments.length,i=new Array(e),n=0;n0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return t;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r}function Mo(t){var e=To.exec(t);return e?e[2]:""}function Po(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function Eo(t,e,i){if(0===e.indexOf("."))return Po(t,e);var n=t.indexOf("?"),r="",s=i?Do(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function ko(t){var e=t=String(t);do{e=t,t=t.replace(Co,"")}while(e.length!==t.length);return t}function Oo(t){return t.replace(/[\/\\]$/,"")}function Ro(){return xo.os===go.WINDOWS?"\\":"/"}t("bI",Object.freeze({__proto__:null,_normalize:ko,basename:Bo,changeBasename:Eo,changeExtname:Po,dirname:Mo,extname:Do,getSeperator:Ro,join:Ao,mainFileName:Io,stripSep:Oo}));var Fo=new Kn;function Lo(t,e,i,n){n||(n=new Kn),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function Vo(t,e,i){return i||(i=new Kn),t.worldToScreen(e,i),i.x/=C.view.getScaleX(),i.y/=C.view.getScaleY(),i}var No=t("bS",{WorldNode3DToLocalNodeUI:Lo,WorldNode3DToWorldNodeUI:Vo});C.pipelineUtils=No,_t(C.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;iwindow.innerHeight;this.isFrameRotated=xo.isMobile&&(e&&t===Le.PORTRAIT||!e&&t===Le.LANDSCAPE)},e._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void st(9201);var t,e,i=C.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h0&&st(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),Ho.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){Y(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return Ho.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){X(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){Ho.on(t,e,i)},e.once=function(t,e,i){Ho.once(t,e,i)},e.off=function(t,e,i){Ho.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return Ho.devicePixelRatio}},{key:"windowSize",get:function(){return Ho.windowSize},set:function(t){Ho.windowSize=t}},{key:"resolution",get:function(){return Ho.resolution}},{key:"supportsFullScreen",get:function(){return Ho.supportFullScreen}}]),t}(),jo=t("cm",new Wo);C.screen=jo;var qo=t("cn",{Feature:yo,hasFeature:function(t){return xo.hasFeature(t)},NetworkType:mo,Language:po,OS:go,Platform:vo,BrowserType:_o,isNative:xo.isNative,isBrowser:xo.isBrowser,isMobile:xo.isMobile,isLittleEndian:xo.isLittleEndian,platform:xo.platform,language:xo.language,languageCode:xo.nativeLanguage,os:xo.os,osVersion:xo.osVersion,osMainVersion:xo.osMainVersion,browserType:xo.browserType,browserVersion:xo.browserVersion,isXR:xo.isXR,windowPixelResolution:jo.windowSize,capabilities:{canvas:!0,opengl:!0,webp:xo.hasFeature(yo.WEBP),imageBitmap:xo.hasFeature(yo.IMAGE_BITMAP),touches:xo.hasFeature(yo.INPUT_TOUCH),mouse:xo.hasFeature(yo.EVENT_MOUSE),keyboard:xo.hasFeature(yo.EVENT_KEYBOARD),accelerometer:xo.hasFeature(yo.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return xo.networkType},getBatteryLevel:function(){return xo.getBatteryLevel()},garbageCollect:function(){xo.triggerGC()},isObjectValid:function(t){return null!=t},__isWebIOS14OrIPadOS14Env:!1,dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="supports webp: "+qo.hasFeature(yo.WEBP)+"\r\n",t+="supports bitmap: "+qo.hasFeature(yo.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+qo.hasFeature(yo.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+qo.hasFeature(yo.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+qo.hasFeature(yo.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+qo.hasFeature(yo.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",q(t+="Using "+(C.game.renderType===C.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){xo.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return xo.init()})).then((function(){try{var e=qo.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){st(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}t.__isWebIOS14OrIPadOS14Env=(qo.os===go.IOS||qo.os===go.OSX)&&xo.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return xo.now()},restartVM:function(){xo.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=C.view,i=Ho.safeAreaEdge;t&&(Ho.orientation===Ne.ORIENTATION_PORTRAIT?i.topQo.x&&(Qo.x=t.x),t.y>Qo.y&&(Qo.y=t.y),t.z>Qo.z&&(Qo.z=t.z),Kn.add(Ko,Yo,Qo),this.center.set(Kn.multiplyScalar(Ko,Ko,.5)),this.halfExtents.set(Qo.x-Ko.x,Qo.y-Ko.y,Qo.z-Ko.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return dh(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return dh(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,ph(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=dh(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},n(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function ph(t){return t.every((function(t,e,i){return 0===e||t>i[e-1]||Xi(t,i[e-1],1e-6)}))}function mh(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),l=h*h*h,c=u*u+l,f=0;if(vh(c)){if(vh(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(c<0){var _=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(_),r[1]=-p*Math.cos(_+Math.PI/3),r[2]=-p*Math.cos(_-Math.PI/3),f=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),v=-Math.cbrt(m+u);r[0]=g+v,f=1}for(var y=1/3*s,b=0;b-gh&&t>3},n=i.storageUnit,r=Cu(i.elementType),s=new(Au(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:t*t*(3-2*t)}function ul(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}C._decorator=wu;var ll=bl(Eu,ku),cl=bl(Ru,Fu),fl=bl(Vu,Nu),dl=bl(Gu,Uu),_l=bl(Wu,ju),pl=bl(Xu,Yu),ml=bl(Ku,Ju),gl=bl($u,tl),vl=bl(il,nl),yl=bl(sl,al);function bl(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var Sl,xl=Object.freeze({__proto__:null,backIn:il,backInOut:rl,backOut:nl,backOutIn:vl,bounceIn:sl,bounceInOut:ol,bounceOut:al,bounceOutIn:yl,circIn:Ku,circInOut:Zu,circOut:Ju,circOutIn:ml,constant:Mu,cubicIn:Ru,cubicInOut:Lu,cubicOut:Fu,cubicOutIn:cl,elasticIn:$u,elasticInOut:el,elasticOut:tl,elasticOutIn:gl,expoIn:Xu,expoInOut:Qu,expoOut:Yu,expoOutIn:pl,fade:ul,linear:Pu,quadIn:Eu,quadInOut:Ou,quadOut:ku,quadOutIn:ll,quartIn:Vu,quartInOut:zu,quartOut:Nu,quartOutIn:fl,quintIn:Gu,quintInOut:Hu,quintOut:Uu,quintOutIn:dl,sineIn:Wu,sineInOut:qu,sineOut:ju,sineOutIn:_l,smooth:hl});t("cF",xl),t("d3",{LINEAR:0,CONSTANT:1,QUAD_IN:2,QUAD_OUT:3,QUAD_IN_OUT:4,QUAD_OUT_IN:5,CUBIC_IN:6,CUBIC_OUT:7,CUBIC_IN_OUT:8,CUBIC_OUT_IN:9,QUART_IN:10,QUART_OUT:11,QUART_IN_OUT:12,QUART_OUT_IN:13,QUINT_IN:14,QUINT_OUT:15,QUINT_IN_OUT:16,QUINT_OUT_IN:17,SINE_IN:18,SINE_OUT:19,SINE_IN_OUT:20,SINE_OUT_IN:21,EXPO_IN:22,EXPO_OUT:23,EXPO_IN_OUT:24,EXPO_OUT_IN:25,CIRC_IN:26,CIRC_OUT:27,CIRC_IN_OUT:28,CIRC_OUT_IN:29,ELASTIC_IN:30,ELASTIC_OUT:31,ELASTIC_IN_OUT:32,ELASTIC_OUT_IN:33,BACK_IN:34,BACK_OUT:35,BACK_IN_OUT:36,BACK_OUT_IN:37,BOUNCE_IN:38,BOUNCE_OUT:39,BOUNCE_IN_OUT:40,BOUNCE_OUT_IN:41,SMOOTH:42,FADE:43});var wl,Tl=((Sl={})[1]=Mu,Sl[0]=Pu,Sl[2]=Eu,Sl[3]=ku,Sl[4]=Ou,Sl[5]=ll,Sl[6]=Ru,Sl[7]=Fu,Sl[8]=Lu,Sl[9]=cl,Sl[10]=Vu,Sl[11]=Nu,Sl[12]=zu,Sl[13]=fl,Sl[14]=Gu,Sl[15]=Uu,Sl[16]=Hu,Sl[17]=dl,Sl[18]=Wu,Sl[19]=ju,Sl[20]=qu,Sl[21]=_l,Sl[22]=Xu,Sl[23]=Yu,Sl[24]=Qu,Sl[25]=pl,Sl[26]=Ku,Sl[27]=Ju,Sl[28]=Zu,Sl[29]=ml,Sl[30]=$u,Sl[31]=tl,Sl[32]=el,Sl[33]=gl,Sl[34]=il,Sl[35]=nl,Sl[36]=rl,Sl[37]=vl,Sl[38]=sl,Sl[39]=al,Sl[40]=ol,Sl[41]=yl,Sl[42]=hl,Sl[43]=ul,Sl);function Cl(t){return Tl[t]}E(255),E(65280);var Al,Dl,Il,Bl=function(t){function e(){var e;return(e=t.call(this)||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=0,e}return s(e,t),n(e,[{key:"interpolationMode",get:function(){return 255&this._flags},set:function(t){this._flags&=-256,this._flags|=0|t}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(xu);function Ml(t){var e=new Bl;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[Wa];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,l&&(e[Wa]=l)}return e}Fi.fastDefine("cc.RealKeyframeValue",Bl,((wl={interpolationMode:0,tangentWeightMode:0,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:0})[Wa]=void 0,wl)),Fi.Attr.setClassAttr(Bl,Wa,"editorOnly",!0),(Al=Bl,null!==(Il=(Dl=Al)[Gh])&&void 0!==Il?Il:Dl[Gh]={}).uniquelyReferenced=!0;var Pl=t("cr",function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=1,e.postExtrapolation=1,e}s(e,t);var i=e.prototype;return i.evaluate=function(t){var e=this._times,i=this._values,n=e.length;if(0===n)return 0;var r=e[0],s=e[n-1];if(ts){var h=this.postExtrapolation,u=i[n-1];if(1===h||n<2)return u.value;switch(h){case 0:return nc(s,u.value,e[n-2],i[n-2].value,t);case 2:t=ec(t,r,s);break;case 3:t=ic(t,r,s);break;default:return u.value}}var l=dh(e,t);if(l>=0)return i[l].value;var c=~l,f=c-1,d=e[f],_=i[f],p=e[c];return rc(d,_,p,i[c],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Ml(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Ml(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Ml(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return Xi(i.value,e,t)}))},i[Iu]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Ol+Ol+Rl+Fl*r+Zl*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Ol,s.setUint8(a,this.postExtrapolation),a+=Ol,s.setUint32(a,r,!0),a+=Rl,i.forEach((function(t,e){return s.setFloat32(a+Fl*e,t,!0)})),a+=Fl*r;for(var o,h=p(n);!(o=h()).done;){var u=o.value;a=$l(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[Wa]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Bu]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=Ol,this.postExtrapolation=n.getUint8(r),r+=Ol;var s=n.getUint32(r,!0);r+=Rl;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Fl*e,!0)}));r+=Fl*s;for(var o=new Array(s),h=0;h>El;return e.easingMethod=s,n}function ec(t,e,i){return e+hn(t-e,i-e)}function ic(t,e,i){return e+un(t-e,i-e)}function nc(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function rc(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case 1:return e.value;case 0:var a=0===e.easingMethod?r:Cl(e.easingMethod)(r);return Ki(e.value,n.value,a);case 2:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=!!(2&e.tangentWeightMode),c=n.leftTangent,f=n.leftTangentWeight,d=!!(1&n.tangentWeightMode);if(l||d){var _=0;if(l)_=u;else{var p=s,m=s*h;_=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),v=Math.cos(g)*_+t,y=Math.sin(g)*_+e.value,b=0;if(d)b=f;else{var S=s,x=s*c;b=Math.sqrt(S*S+x*x)*o}var w=Math.atan(c),T=(v-t)/s,C=(-Math.cos(w)*b+i-t)/s,A=y,D=-Math.sin(w)*b+n.value,I=[0,0,0],B=ac(I,mh(0-r,3*T,3*C-6*T,3*(T-C)+1,I),r);return sc(e.value,A,D,n.value,B)}var M=e.value+o*h*s,P=n.value-o*c*s;return sc(e.value,M,P,n.value,r)}}function sc(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function ac(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}function oc(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}C.bezier=oc;var hc,uc,lc,cc,fc,dc,_c,pc,mc,gc=Math.cos,vc=Math.acos,yc=Math.max,bc=2*Math.PI,Sc=Math.sqrt;function xc(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function wc(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,l=3*(e-t[2]),c=1/(-a+u-l+(e-1)),f=1/3,d=(h-6*o+l)*c,_=d*f,p=(-h+u)*c,m=(3*p-d*d)*f,g=m*f,v=(2*d*d*d-9*d*p+a*c*27)/27,y=v/2,b=y*y+g*g*g;if(b<0){var S=-m*f,x=Sc(S*S*S),w=-v/(2*x),T=vc(w<-1?-1:w>1?1:w),C=2*xc(x);return n=C*gc(T*f)-_,r=C*gc((T+bc)*f)-_,s=C*gc((T+2*bc)*f)-_,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?yc(n,r,s):yc(n,r):s>=0&&s<=1?yc(n,s):n:r>=0&&r<=1?s>=0&&s<=1?yc(r,s):r:s}if(0===b)return r=-(i=y<0?xc(-y):-xc(y))-_,(n=2*i-_)>=0&&n<=1?r>=0&&r<=1?yc(n,r):n:r;var A=Sc(b);return(i=xc(-y+A))-xc(y+A)-_}function Tc(t,e){var i=wc(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}C.bezierByTime=Tc,t("cw",{SLERP:0,CONSTANT:1});var Cc=Bh("cc.QuatKeyframeValue")(hc=qh((uc=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=lc&&lc(),this.value=cc&&cc(),this.easingMethod=fc&&fc(),this.value=i?Cr.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},lc=yh(uc.prototype,"interpolationMode",[Uh],(function(){return 0})),cc=yh(uc.prototype,"value",[Uh],(function(){return Cr.clone(Cr.IDENTITY)})),fc=yh(uc.prototype,"easingMethod",[Uh],(function(){return 0})),hc=uc))||hc)||hc;function Ac(t){return new Cc(t)}var Dc,Ic=t("cv",Bh("cc.QuatCurve")((_c=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=pc&&pc(),e.postExtrapolation=mc&&mc(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new Cr);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return e;var h=n[0],u=n[o-1];if(tu){var c=r[o-1];switch(s){case 2:t=h+hn(t-h,u-h);break;case 3:t=h+un(t-h,u-h);break;default:return Cr.copy(e,c.value)}}var f=dh(n,t);if(f>=0)return Cr.copy(e,r[f].value);var d=~f,_=d-1,p=n[_],m=r[_],g=n[d],v=r[d],y=(t-p)/(g-p);switch(m.interpolationMode){default:case 1:return Cr.copy(e,m.value);case 0:var b=m.easingMethod,S=0===b?y:Array.isArray(b)?Tc(b,y):Cl(b)(y);return Cr.slerp(e,m.value,v.value,S)}},i.addKeyFrame=function(e,i){var n=new Cc(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Ac(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Ac(t[1])})))}},i[Iu]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=kc*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Oc+4*Fc:Oc)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Bc+Mc+Pc*s+4*Ec*s+o+a+0)),l=0,c=0;r&&(c|=1),u.setUint32(l,c,!0),l+=Bc,u.setUint32(l,s,!0),l+=Mc,i.forEach((function(t,e){return u.setFloat32(l+Pc*e,t,!0)})),l+=Pc*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Ec*e;u.setFloat32(o+0*Ec,n,!0),u.setFloat32(o+1*Ec,r,!0),u.setFloat32(o+2*Ec,s,!0),u.setFloat32(o+3*Ec,a,!0)})),l+=4*Ec*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,Rc),++l,u.setFloat32(l+0*Fc,e[0],!0),u.setFloat32(l+1*Fc,e[1],!0),u.setFloat32(l+2*Fc,e[2],!0),u.setFloat32(l+3*Fc,e[3],!0),l+=4*Fc):(u.setUint8(l,e),++l)}));var f=l;l+=a;var d=f;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=kc)}));var _=new Uint8Array(u.buffer);t.writeProperty("bytes",_)}else t.writeThis()},i[Bu]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=Bc;var a=1&s,o=n.getUint32(r,!0);r+=Mc;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Pc*e,!0)})),u=r+=Pc*o;r+=4*Ec*o;var l=Array.from({length:o},(function(t,e){var i=u+4*Ec*e,s=n.getFloat32(i+0*Ec,!0),a=n.getFloat32(i+1*Ec,!0),o=n.getFloat32(i+2*Ec,!0),h=n.getFloat32(i+3*Ec,!0),l=n.getUint8(r);++r;var c=Ac({value:{x:s,y:a,z:o,w:h}});return l!==Rc?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Fc,!0),n.getFloat32(r+1*Fc,!0),n.getFloat32(r+2*Fc,!0),n.getFloat32(r+3*Fc,!0)],r+=4*Fc),c}));if(a){var c=n.getUint8(r);++r;for(var f=0;f=0)return this._values[e];var i=Yi(~e-1,0,this._values.length-1);return this._values[i]},e}(_h))||Dc),Vc=Me({Blend:0,Fixed:1}),Nc=t("cy",(function(){this.color=nr.WHITE.clone(),this.time=0}));Fi.fastDefine("cc.ColorKey",Nc,{color:nr.WHITE.clone(),time:0}),Fi.Attr.setClassAttr(Nc,"color","visible",!0),Fi.Attr.setClassAttr(Nc,"time","visible",!0);var zc=t("cz",(function(){this.alpha=1,this.time=0}));Fi.fastDefine("cc.AlphaKey",zc,{alpha:1,time:0}),Fi.Attr.setClassAttr(zc,"alpha","visible",!0),Fi.Attr.setClassAttr(zc,"time","visible",!0);var Gc=t("cA",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=Vc.Blend}var e=t.prototype;return e.setKeys=function(t,e){this.colorKeys=t,this.alphaKeys=e},e.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.evaluateFast(new nr,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t.a=this.getAlpha(e),t},e.randomColor=function(){return this.getRandomColor(new nr)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc($i()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc($i()*this.alphaKeys.length)];return t.set(e.color),t.a=i.alpha,t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=hn(e,1+ji);for(var r=1;r=s&&ei[h].time&&nr.lerp(t,i[h].color,nr.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?nr.copy(t,i[0].color):nr.copy(t,nr.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=hn(t,1+ji);for(var n=1;n=r&&te[o].time?Ki(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());Gc.Mode=Vc,Fi.fastDefine("cc.Gradient",Gc,{colorKeys:[],alphaKeys:[],mode:Vc.Blend}),Fi.Attr.setClassAttr(Gc,"colorKeys","visible",!0),Fi.Attr.setClassAttr(Gc,"alphaKeys","visible",!0),Fi.Attr.setClassAttr(Gc,"mode","visible",!0);var Uc=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Fi.fastDefine("cc.Keyframe",Uc,{time:0,value:0,inTangent:0,outTangent:0});var Hc=function(){function t(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return t.prototype.evaluate=function(t){return Wc(t-this.time,this.coefficient)},t}();function Wc(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var jc=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Pl)this._curve=t;else{var e=new Pl;this._curve=e,e.preExtrapolation=2,e.postExtrapolation=1,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]])}this.cachedKey=new Hc}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case 2:r=hn(t-a,o-a)+a;break;case 3:r=un(t-a,o-a)+a;break;default:r=Yi(t,a,o)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1e)return a}else for(var o=0;o<3;o++){var h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,l=0,c=n;c-l>1;)u=Math.floor((l+c)/2),i.getKeyframeTime(u)>=e?c=u:l=u;return l},n(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new Uc;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:2,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Xc(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=qc(t)}},{key:"postWrapMode",get:function(){return Xc(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=qc(t)}}]),t}();function qc(t){switch(t){default:case 0:case 1:case 8:return 1;case 22:return 3;case 2:return 2}}function Xc(t){switch(t){default:case 0:case 1:return 8;case 3:return 22;case 2:return 2}}function Yc(){var t=new Pl;return t.assignSorted([[0,{interpolationMode:2,value:1}],[1,{interpolationMode:2,value:1}]]),t}jc.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Fi.fastDefine("cc.AnimationCurve",jc,{_curve:null});var Qc=4294967295,Kc=new Kn,Jc=new Kn,Zc=new Kn,$c=new Kn,tf=function(){function t(t,e){void 0===t&&(t=2),void 0===e&&(e=[]),this._type=void 0,this._knots=[],this._type=1024,this._mode=t;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){Ie(this._knots,t),this._knots.splice(t,1)},e.setKnot=function(t,e){Ie(this._knots,t),this._knots[t].set(e)},e.getKnot=function(t){return Ie(this._knots,t),this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=Qc),e=Yi(e,0,1);var n=this.getSegments();if(0===n)return new Kn;if(i===Qc){var r=1/n;i=Math.floor(e/r),e=e%r/r}var s=this._knots;if(i>=n)return new Kn(s[s.length-1]);switch(this._mode){case 0:return t.calcLinear(s[i],s[i+1],e);case 1:var a=4*i;return t.calcBezier(s[a],s[a+1],s[a+2],s[a+3],e);case 2:var o=i>0?s[i-1]:s[i],h=i+2e.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},n(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());df.Priority=Me({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var _f=new It("Scheduler"),pf=function(){function t(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n}return t.get=function(e,i,n,r){var s=t._listEntries.pop();return s?(s.target=e,s.priority=i,s.paused=n,s.markedForDeletion=r):s=new t(e,i,n,r),s},t.put=function(e){t._listEntries.length<20&&(e.target=null,t._listEntries.push(e))},t}();pf._listEntries=[];var mf=function(){function t(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n}return t.get=function(e,i,n,r){var s=t._hashUpdateEntries.pop();return s?(s.list=e,s.entry=i,s.target=n,s.callback=r):s=new t(e,i,n,r),s},t.put=function(e){t._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,t._hashUpdateEntries.push(e))},t}();mf._hashUpdateEntries=[];var gf=function(){function t(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s}return t.get=function(e,i,n,r,s,a){var o=t._hashTimerEntries.pop();return o?(o.timers=e,o.target=i,o.timerIndex=n,o.currentTimer=r,o.currentTimerSalvaged=s,o.paused=a):o=new t(e,i,n,r,s,a),o},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();gf._hashTimerEntries=[];var vf=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null}t.get=function(){return t._timers.pop()||new t},t.put=function(e){t._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,t._timers.push(e))};var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._timesExecuted=0,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===C.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},t}();vf._timers=[];var yf=t("cq",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Gt(!0),e._hashForTimers=Gt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}s(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.id=_f.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else ot(1510)}},i.unscheduleForTimer=function(t,e){var i=e.uuid||e.id,n=this._hashForTimers[i],r=n.timers;if(r&&0!==r.length)for(var s=r.length-1;s>=0;s--){var a=r[s];if(a===t)return r.splice(s,1),vf.put(a),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTargetSalvaged=!0))}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];null!=i&&i.entry&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else ot(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(null!=i&&i.timers){var n=i.timers;i.currentTimer&&n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)(i=r[e]).target&&this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++}},i.isScheduled=function(t,e){ut(Boolean(t),1508),ut(Boolean(e),1509);var i=e.uuid||e.id;if(!i)return ot(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target))}if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target))}return s},i.resumeTargets=function(t){if(t)for(var e=0;e=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function Tf(){}C.easing=xl,Tf.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},Tf.prototype.targetOff=function(t){this.removeAll(t)};var Cf=Object.freeze({__proto__:null,ExtraEventMethods:Tf,syncNodeValues:function(t){var e=t._lpos;t.setPositionForJS(e.x,e.y,e.z);var i=t._lscale;t.setScaleForJS(i.x,i.y,i.z);var n=t._lrot;t.setRotationForJS(n.x,n.y,n.z,n.w);var r=t._euler;t.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function t(e){if(e){var i=e.children;if(i){var n=i.length;if(n){e._setChildren(i);for(var r=0;r0&&!(t&t-1)}var O_=Math.ceil;function R_(t,e,i,n){if(!M_[t].isCompressed)return e*i*n*M_[t].size;switch(t){case 56:case 57:case 58:case 59:case 72:case 73:case 74:case 75:case 79:case 80:case 85:case 86:case 88:return O_(e/4)*O_(i/4)*8*n;case 60:case 61:case 62:case 63:case 64:case 65:case 69:case 68:case 70:case 71:case 77:case 76:case 81:case 82:case 89:case 103:return O_(e/4)*O_(i/4)*16*n;case 66:case 67:return O_(e/4)*O_(i/4)*32*n;case 83:case 84:case 87:return O_(e/8)*O_(i/4)*8*n;case 90:case 104:return O_(e/5)*O_(i/4)*16*n;case 91:case 105:return O_(e/5)*O_(i/5)*16*n;case 92:case 106:return O_(e/6)*O_(i/5)*16*n;case 93:case 107:return O_(e/6)*O_(i/6)*16*n;case 94:case 108:return O_(e/8)*O_(i/5)*16*n;case 95:case 109:return O_(e/8)*O_(i/6)*16*n;case 96:case 110:return O_(e/8)*O_(i/8)*16*n;case 97:case 111:return O_(e/10)*O_(i/5)*16*n;case 98:case 112:return O_(e/10)*O_(i/6)*16*n;case 99:case 113:return O_(e/10)*O_(i/8)*16*n;case 100:case 114:return O_(e/10)*O_(i/10)*16*n;case 101:case 115:return O_(e/12)*O_(i/10)*16*n;case 102:case 116:return O_(e/12)*O_(i/12)*16*n;default:return 0}}function F_(t,e,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var L_=[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];function V_(t){return L_[t]||0}function N_(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case 1:case 3:switch(e){case 1:default:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array}case 2:case 4:switch(e){case 1:default:return Int8Array;case 2:return Int16Array;case 4:return Int32Array}case 6:return 2===e?Uint16Array:Float32Array}return Float32Array}function z_(t){switch(t){case 56:case 57:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 65:case 69:case 68:case 70:case 71:case 66:case 67:case 72:case 73:case 74:case 75:case 79:case 80:case 77:case 76:case 81:case 82:case 85:case 86:case 88:case 89:case 103:return{width:4,height:4};case 83:case 84:case 87:return{width:8,height:4};case 90:case 104:return{width:5,height:4};case 91:case 105:return{width:5,height:5};case 92:case 106:return{width:6,height:5};case 93:case 107:return{width:6,height:6};case 94:case 108:return{width:8,height:5};case 95:case 109:return{width:8,height:6};case 96:case 110:return{width:8,height:8};case 97:case 111:return{width:10,height:5};case 98:case 112:return{width:10,height:6};case 99:case 113:return{width:10,height:8};case 100:case 114:return{width:10,height:10};case 101:case 115:return{width:12,height:10};case 102:case 116:return{width:12,height:12};default:return{width:1,height:1}}}function G_(t,e){return O_(t/e)*e}var U_=Object.freeze({__proto__:null,API:Rf,AccessFlagBit:od,Address:Zf,Attribute:n_,AttributeName:B_,BarrierType:Sd,BindingMappingInfo:Ld,BlendFactor:ed,BlendOp:id,BufferBarrierInfo:__,BufferFlagBit:Uf,BufferInfo:zd,BufferTextureCopy:kd,BufferUsageBit:Gf,BufferViewInfo:Gd,ClearFlagBit:bd,Color:Rd,ColorAttachment:a_,ColorMask:nd,CommandBufferInfo:S_,CommandBufferType:yd,ComparisonFunc:$f,CullMode:dd,DESCRIPTOR_BUFFER_TYPE:P_,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:E_,DRAW_INFO_SIZE:28,DepthStencilAttachment:o_,DescriptorSetInfo:v_,DescriptorSetLayoutBinding:m_,DescriptorSetLayoutInfo:g_,DescriptorType:md,DeviceCaps:Td,DeviceInfo:Nd,DeviceOptions:Cd,DispatchInfo:Hd,DrawInfo:Ud,DynamicStateFlagBit:_d,DynamicStates:D_,DynamicStencilStates:A_,Extent:Id,Feature:Lf,Filter:Jf,Format:Vf,FormatFeatureBit:Yf,FormatInfo:T_,FormatInfos:M_,FormatSize:R_,FormatSurfaceSize:F_,FormatType:Nf,FramebufferInfo:p_,GFXObject:I_,GeneralBarrierInfo:f_,GetTypeSize:V_,IndirectBuffer:Wd,InputAssemblerInfo:s_,InputState:b_,IsPowerOf2:k_,LoadOp:sd,MarkerInfo:Fd,MemoryAccessBit:Hf,MemoryStatus:C_,MemoryUsageBit:Wf,ObjectType:kf,Offset:Ad,PassType:xd,PipelineBindPoint:ud,PipelineLayoutInfo:y_,PolygonMode:cd,PrimitiveMode:ld,QueryPoolInfo:w_,QueryType:vd,QueueInfo:x_,QueueType:gd,Rect:Dd,RenderPassInfo:l_,ResolveMode:hd,ResourceRange:c_,SampleCount:Qf,SamplerInfo:Xd,ShadeModel:fd,ShaderInfo:r_,ShaderStage:i_,ShaderStageFlagBit:rd,Size:wd,Status:Of,StencilFace:pd,StencilOp:td,StoreOp:ad,SubpassDependency:u_,SubpassInfo:h_,SurfaceTransform:Ff,SwapchainInfo:Vd,TextureBarrierInfo:d_,TextureBlit:Ed,TextureCopy:Pd,TextureFlagBit:Xf,TextureInfo:jd,TextureSubresLayers:Bd,TextureSubresRange:Md,TextureType:jf,TextureUsageBit:qf,TextureViewInfo:qd,Type:zf,Uniform:Yd,UniformBlock:Qd,UniformInputAttachment:e_,UniformSampler:Jd,UniformSamplerTexture:Kd,UniformStorageBuffer:t_,UniformStorageImage:$d,UniformTexture:Zd,Viewport:Od,VsyncMode:Kf,alignTo:G_,formatAlignment:z_,getTypedArrayConstructor:N_}),H_=function(t){function e(){var e;return(e=t.call(this,2)||this)._usage=0,e._memUsage=0,e._size=0,e._stride=1,e._count=0,e._flags=0,e._isBufferView=!1,e}return s(e,t),n(e,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),e}(I_),W_=function(t){function e(){var e;return(e=t.call(this,13)||this)._queue=null,e._type=0,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),e}(I_),j_=function(){function t(){this._gfxAPI=0,this._renderer="",this._vendor="",this._features=new Array(10),this._formatFeatures=new Array(117),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new C_,this._caps=new Td,this._bindingMappingInfo=new Ld,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=35}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return 1},n(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"swapchainFormat",get:function(){return this._swapchainFormat}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();j_.canvas=void 0;var q_=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=t.capabilities,i=new Uint8Array(64);if(i.fill(255),e.maxTextureSize>=2){this._texture2D=t.createTexture(new jd(1,12,35,2,2,0));var n=new kd(0,0,0,new Ad(0,0,0),new Id(2,2,1));t.copyBuffersToTexture([i],this._texture2D,[n])}if(e.maxTextureSize>=2){this._textureCube=t.createTexture(new jd(3,12,35,2,2,0,6));var r=new kd(0,0,0,new Ad(0,0,0),new Id(2,2,1));t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([i],this._textureCube,[r]),r.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([i],this._textureCube,[r])}if(e.max3DTextureSize>=2){this._texture3D=t.createTexture(new jd(2,12,35,2,2,0,1,1,1,2));var s=new kd(0,0,0,new Ad(0,0,0),new Id(2,2,2),new Bd(0,0,1));t.copyBuffersToTexture([i],this._texture3D,[s])}if(e.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new jd(5,12,35,2,2,0,2));var a=new kd(0,0,0,new Ad(0,0,0),new Id(2,2,1),new Bd(0,0,1));t.copyBuffersToTexture([i],this._texture2DArray,[a]),a.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([i],this._texture2DArray,[a])}}return t.prototype.getTexture=function(t){switch(t){case 1:return this._texture2D;case 2:return this._texture3D;case 3:return this._textureCube;case 5:return this._texture2DArray;default:return null}},t}(),X_=function(t){function e(){var e;return(e=t.call(this,1)||this)._transform=0,e._colorTexture=null,e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),e}(I_),Y_=function(t){function e(){var e;return(e=t.call(this,5)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e._width=0,e._height=0,e}return s(e,t),n(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"width",get:function(){var t,e;return this.colorTextures.length>0?null!==(t=null===(e=this.colorTextures[0])||void 0===e?void 0:e.width)&&void 0!==t?t:this._width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){var t,e;return this.colorTextures.length>0?null!==(t=null===(e=this.colorTextures[0])||void 0===e?void 0:e.height)&&void 0!==t?t:this._height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),e}(I_),Q_=function(t){function e(){var e;return(e=t.call(this,12)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Ud,e}s(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h>2&3,e.mipFilter=t>>4&3,e.addressU=t>>6&3,e.addressV=t>>8&3,e.addressW=t>>10&3,e.maxAnisotropy=t>>12&31,e.cmpFunc=t>>17&7,e},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(I_),hp=function(t){function e(){var e;return(e=t.call(this,7)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}},{key:"stages",get:function(){return this._stages}}]),e}(I_),up=function(t){function e(){var e;return(e=t.call(this,3)||this)._info=new jd,e._viewInfo=new qd,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return s(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},n(e,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),e}(I_),lp=function(t){function e(e,i){var n;return(n=t.call(this,16)||this)._info=new f_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return wf(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(I_),cp=function(t){function e(e,i){var n;return(n=t.call(this,17)||this)._info=new d_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.range.mipLevel,e+=t.range.levelCount,e+=t.range.firstSlice,e+=t.range.numSlices,e+=t.range.basePlane,e+=t.range.planeCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,wf(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(I_),fp=function(t){function e(e,i){var n;return(n=t.call(this,18)||this)._info=new __,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,wf(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(I_),dp={Device:j_,Swapchain:X_,Buffer:H_,Texture:up,Sampler:op,Shader:hp,InputAssembler:Q_,RenderPass:ap,Framebuffer:Y_,DescriptorSet:K_,DescriptorSetLayout:J_,PipelineLayout:Z_,PipelineState:rp,CommandBuffer:W_,Queue:sp,GeneralBarrier:lp,TextureBarrier:cp,BufferBarrier:fp,RasterizerState:$_,BlendState:ip,BlendTarget:ep,DepthStencilState:tp,PipelineStateInfo:np};Object.assign(dp,U_),T.gfx=dp;var _p={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var pp in _p){var mp=_p[pp];!0===mp?mp=pp.slice(3):!1===mp&&(mp=pp),_t(T,"cc",[{name:pp,newName:mp,target:T.gfx,targetName:"cc.gfx"}])}pt(T,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),pt(Lf,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(11) & 1;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(8) & 1;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(11) & (1 | 2)) === (1 | 2);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(8) & (1 | 2)) === (1 | 2);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(11) & 4;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(8) & 4;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(48) !== 0;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(25) !== 0;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(72) !== 0;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(73) !== 0;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(56) !== 0;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(83) !== 0;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== 0;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(24) !== 0;"}]),pt(a_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),pt(o_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),_t(j_.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var gp=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=-1,this._deviceInitialized=!1}var e=t.prototype;return e._tryInitializeWebGPUDevice=function(t,e){var i=this;return this._deviceInitialized?Promise.resolve(!0):t?(this._gfxDevice=new t,new Promise((function(t,n){i._gfxDevice.initialize(e).then((function(e){i._deviceInitialized=e,t(e)})).catch((function(t){n(t)}))}))):Promise.resolve(!1)},e._tryInitializeDeviceSync=function(t,e){return!!this._deviceInitialized||(t&&(this._gfxDevice=new t,this._deviceInitialized=this._gfxDevice.initialize(e)),this._deviceInitialized)},e.init=function(t,e){var i=this;if(this.initialized)return!0;var n=Ve.querySettings(Fe.Category.RENDERING,"renderMode");this._canvas=t,this._canvas&&(this._canvas.oncontextmenu=function(){return!1}),this._renderType=this._determineRenderType(n),this._deviceInitialized=!1;var r=new Nd(e);if(1===this._renderType||2===this._renderType){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),qo.browserType===_o.UC&&(s=!1),j_.canvas=t,2===this._renderType&&T.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(T.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&T.WebGL2Device&&this._tryInitializeDeviceSync(T.WebGL2Device,r),T.WebGLDevice&&this._tryInitializeDeviceSync(T.WebGLDevice,r),T.EmptyDevice&&this._tryInitializeDeviceSync(T.EmptyDevice,r),this._initSwapchain()}else 4===this._renderType&&T.EmptyDevice&&(this._tryInitializeDeviceSync(T.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(ot(16337),this._renderType=-1,!1)},e._initSwapchain=function(){var t=new Vd(1,this._canvas),e=jo.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._supportWebGPU=function(){return"gpu"in globalThis.navigator},e._determineRenderType=function(t){("number"!=typeof t||t>4||t<0)&&(t=0);var e=0,i=!1;if(1===t?(e=0,i=!0):0===t||4===t?(e=this._supportWebGPU()?2:1,i=!0):2===t?(e=1,i=!0):3===t&&(e=4,i=!0),!i)throw new Error(ct(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),vp=new gp;t("aH",Object.freeze({__proto__:null,API:Rf,AccessFlagBit:od,Address:Zf,Attribute:n_,AttributeName:B_,BarrierType:Sd,BindingMappingInfo:Ld,BlendFactor:ed,BlendOp:id,BlendState:ip,BlendTarget:ep,Buffer:H_,BufferBarrierInfo:__,BufferFlagBit:Uf,BufferInfo:zd,BufferTextureCopy:kd,BufferUsageBit:Gf,BufferViewInfo:Gd,ClearFlagBit:bd,Color:Rd,ColorAttachment:a_,ColorMask:nd,CommandBuffer:W_,CommandBufferInfo:S_,CommandBufferType:yd,ComparisonFunc:$f,CullMode:dd,DESCRIPTOR_BUFFER_TYPE:P_,DESCRIPTOR_DYNAMIC_TYPE:10,DESCRIPTOR_SAMPLER_TYPE:E_,DRAW_INFO_SIZE:28,DefaultResource:q_,DepthStencilAttachment:o_,DepthStencilState:tp,DescriptorSet:K_,DescriptorSetInfo:v_,DescriptorSetLayout:J_,DescriptorSetLayoutBinding:m_,DescriptorSetLayoutInfo:g_,DescriptorType:md,Device:j_,DeviceCaps:Td,DeviceInfo:Nd,DeviceManager:gp,DeviceOptions:Cd,DispatchInfo:Hd,DrawInfo:Ud,DynamicStateFlagBit:_d,DynamicStates:D_,DynamicStencilStates:A_,Extent:Id,Feature:Lf,Filter:Jf,Format:Vf,FormatFeatureBit:Yf,FormatInfo:T_,FormatInfos:M_,FormatSize:R_,FormatSurfaceSize:F_,FormatType:Nf,Framebuffer:Y_,FramebufferInfo:p_,GFXObject:I_,GeneralBarrier:lp,GeneralBarrierInfo:f_,GetTypeSize:V_,IndirectBuffer:Wd,InputAssembler:Q_,InputAssemblerInfo:s_,InputState:b_,IsPowerOf2:k_,LegacyRenderMode:{AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGPU:4},LoadOp:sd,MarkerInfo:Fd,MemoryAccessBit:Hf,MemoryStatus:C_,MemoryUsageBit:Wf,ObjectType:kf,Offset:Ad,PassType:xd,PipelineBindPoint:ud,PipelineLayout:Z_,PipelineLayoutInfo:y_,PipelineState:rp,PipelineStateInfo:np,PolygonMode:cd,PrimitiveMode:ld,QueryPoolInfo:w_,QueryType:vd,Queue:sp,QueueInfo:x_,QueueType:gd,RasterizerState:$_,Rect:Dd,RenderPass:ap,RenderPassInfo:l_,RenderType:{UNKNOWN:-1,CANVAS:0,WEBGL:1,WEBGPU:2,OPENGL:3,HEADLESS:4},ResolveMode:hd,ResourceRange:c_,SampleCount:Qf,Sampler:op,SamplerInfo:Xd,ShadeModel:fd,Shader:hp,ShaderInfo:r_,ShaderStage:i_,ShaderStageFlagBit:rd,Size:wd,Status:Of,StencilFace:pd,StencilOp:td,StoreOp:ad,SubpassDependency:u_,SubpassInfo:h_,SurfaceTransform:Ff,Swapchain:X_,SwapchainInfo:Vd,Texture:up,TextureBarrier:cp,TextureBarrierInfo:d_,TextureBlit:Ed,TextureCopy:Pd,TextureFlagBit:Xf,TextureInfo:jd,TextureSubresLayers:Bd,TextureSubresRange:Md,TextureType:jf,TextureUsageBit:qf,TextureViewInfo:qd,Type:zf,Uniform:Yd,UniformBlock:Qd,UniformInputAttachment:e_,UniformSampler:Jd,UniformSamplerTexture:Kd,UniformStorageBuffer:t_,UniformStorageImage:$d,UniformTexture:Zd,Viewport:Od,VsyncMode:Kf,alignTo:G_,deviceManager:vp,formatAlignment:z_,getTypedArrayConstructor:N_}));var yp=new kn;function bp(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount,h=t.worldMatrix,u=h.m00,l=h.m01,c=h.m02,f=h.m03,d=h.m04,_=h.m05,p=h.m06,m=h.m07,g=h.m12,v=h.m13,y=h.m14,b=h.m15;yp.set(n.r/255,n.g/255,n.b/255,n.a/255);for(var S=0,x=0;x>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}var xp={},wp=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=Gt(!0),this._count=0)}var e=t.prototype;return e.add=function(t,e){return t in this._map||this._count++,this._map[t]=e},e.get=function(t){return this._map[t]},e.has=function(t){return t in this._map},e.remove=function(t){var e=this._map[t];return t in this._map&&(delete this._map[t],this._count--),e},e.clear=function(){0!==this._count&&(this._map=Gt(!0),this._count=0)},e.forEach=function(t){for(var e in this._map)t(this._map[e],e)},e.find=function(t){for(var e in this._map)if(t(this._map[e],e))return this._map[e];return null},e.destroy=function(){this._map=null},n(t,[{key:"map",get:function(){return this._map}},{key:"count",get:function(){return this._count}}]),t}(),Tp=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;nthis.pipes.length?(st(4921),this):(this.pipes.splice(e,0,t),this)},e.append=function(t){return this.pipes.push(t),this},e.remove=function(t){return this.pipes.splice(t,1),this},e.sync=function(t){var e=this.pipes;if(0===e.length)return null;t.isFinished=!1;for(var i=0,n=e.length;i>2],Lp[Vp[n++]]=Rp[(3&r)<<2|s>>4],Lp[Vp[n++]]=Rp[15&s]}return t.replace(e,Lp.join(""))}var zp=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Gp(t){var e=zp.exec(t);return e?e[1]:""}function Up(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=Ip.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),jp(t,e)}function Hp(t){return!!t&&(t instanceof T.SceneAsset||t instanceof T.Scene)}function Wp(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function jp(t,e){var i=Op.create({input:t,options:e}),n=[];try{for(var r,s=p(Pp.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=p(i.output);!(h=u()).done;)h.value.recycle();Y(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var qp,Xp,Yp,Qp,Kp,Jp,Zp=Object.freeze({__proto__:null,decodeUuid:Np,getUrlWithUuid:Up,getUuidFromURL:Gp,isScene:Hp,normalize:Wp,transform:jp}),$p=Uh,tm=kh,em=t("d_",Bh("cc.Asset")((Xp=function(t){function e(e){var i;return void 0===e&&(e=""),(i=t.call(this,e)||this).loaded=!0,i._native=Yp&&Yp(),i._nativeUrl="",i._file=null,i._ref=0,Object.defineProperty(f(i),"_uuid",{value:"",writable:!0}),i}s(e,t),e.deserialize=function(t){return T.deserialize(t)};var i=e.prototype;return i.toString=function(){return this.nativeUrl},i.serialize=function(){},i._setRawAsset=function(t,e){void 0===e&&(e=!0),this._native=!1!==e?t||"":"/"+t},i.addRef=function(){return this._ref++,this},i.decRef=function(t){return void 0===t&&(t=!0),this._ref>0&&this._ref--,t&&T.assetManager.getReleaseManager().tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return K(ct(12101,this._uuid)),t.prototype.destroy.call(this)},n(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=Up(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Up(this._uuid,{__nativeName__:t,nativeExt:Do(t),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"nativeAsset",get:function(){return this._file}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(co(eo)),Yp=yh(Xp.prototype,"_native",[$p],(function(){return""})),y(Xp.prototype,"_nativeAsset",[tm],Object.getOwnPropertyDescriptor(Xp.prototype,"_nativeAsset"),Xp.prototype),qp=Xp))||qp);em.prototype.createNode=null,T.Asset=em;var im=1346981187,nm=Me({PVR:0,PKM:1,ASTC:2});function rm(t,e){return 4===t?89:5===t?4===e?90:91:6===t?5===e?92:93:8===t?5===e?94:6===e?95:96:10===t?5===e?97:6===e?98:8===e?99:100:10===e?101:102}function sm(t,e){return t[e]<<8|t[e+1]}function am(t){return!!(qo.hasFeature(qo.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var om,hm,um,lm,cm,fm,dm,_m,pm,mm,gm,vm=t("e4",Bh("cc.ImageAsset")((Jp=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0);try{for(var i,n=8+4*t.length,r=0,s=p(t);!(i=s()).done;)r+=i.value.byteLength;r+=n,e=new Uint8Array(r);var a=new DataView(e.buffer,e.byteOffset,e.byteLength);a.setUint32(0,im,!0),a.setUint32(4,t.length,!0);for(var o=n,h=0;h0){var u=new Uint8Array(s,o,h),l=new Uint8Array(r._data.byteLength+u.byteLength);l.set(r._data),l.set(u,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,o);r.width=e>0?r.width:a[7],r.height=e>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var c=i+a[0],f=n-a.byteLength;if(n>0){var d=new Uint8Array(s,c,f),_=new Uint8Array(r._data.byteLength+d.byteLength);_.set(r._data),_.set(d,r._data.byteLength),r._data=_,r.mipmapLevelDataSize[e]=f}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[1],r.height=e>0?r.height:a[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16),o=sm(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var l=new Uint8Array(s,h,u),c=new Uint8Array(r._data.byteLength+l.byteLength);c.set(r._data),c.set(l,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:sm(a,12),r.height=e>0?r.height:sm(a,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],h=a[5],u=a[6];if((o<3||o>6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=rm(o,h),c=i+16,f=n-16;if(n>0){var d=new Uint8Array(s,c,f),_=new Uint8Array(r._data.byteLength+d.byteLength);_.set(r._data),_.set(d,r._data.byteLength),r._data=_,r.mipmapLevelDataSize[e]=f}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=e>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=l};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=35,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=p(n);!(e=h()).done;){var u=e.value,l=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=u,l._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),t.push(l)}else t.push(this);return t},e.reset=function(t){am(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},e.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(am(this.data)){var e;null===(e=this.data)||void 0===e||e.close()}return t.prototype.destroy.call(this)},e._serialize=function(){},e._deserialize=function(t){var e="";"string"==typeof t?e=t:(this._width=t.w,this._height=t.h,e=t.fmt);for(var n,r=vp.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Ne.SUPPORT_TEXTURE_FORMATS,l=p(s);!(n=l()).done;){var c=n.value.split("@"),f=parseInt(c[0],void 0),d=i.extnames[f]||c[0],_=u.indexOf(d);if(-1!==_&&_=72&&this._format<=102||this._format>=1024&&this._format<=1026}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(em),Jp.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Jp._sharedPlaceHolderCanvas=null,y((Kp=Jp).prototype,"_nativeAsset",[Su],Object.getOwnPropertyDescriptor(Kp.prototype,"_nativeAsset"),Kp.prototype),Qp=Kp))||Qp);T.ImageAsset=vm,ke(Vf);var ym,bm,Sm,xm=new It("Tex"),wm=Bh("cc.TextureBase")((gm=function(t){function e(){var e;return(e=t.call(this)||this)._format=um&&um(),e._minFilter=lm&&lm(),e._magFilter=cm&&cm(),e._mipFilter=fm&&fm(),e._wrapS=dm&&dm(),e._wrapT=_m&&_m(),e._wrapR=pm&&pm(),e._anisotropy=mm&&mm(),e._width=1,e._height=1,e._samplerInfo=new Xd,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=xm.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=wf(e._id,666),e}s(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){t=Math.min(t,16),this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&null!==(e=T.director.root)&&void 0!==e&&e.batcher2D&&T.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):ot(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return vp.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?35:t},i._getGFXPixelFormat=function(t){return 1026===t?t=72:1025===t?t=85:1024===t&&(t=83),t},n(e,[{key:"isCompressed",get:function(){return this._format>=72&&this._format<=102||this._format>=1024&&this._format<=1026}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(em),gm.PixelFormat={RGB565:47,RGB5A1:49,RGBA4444:50,RGB888:24,RGB32F:32,RGBA8888:35,BGRA8888:36,RGBA32F:44,A8:1,I8:2,AI8:3,RGB_PVRTC_2BPPV1:83,RGBA_PVRTC_2BPPV1:84,RGB_A_PVRTC_2BPPV1:1024,RGB_PVRTC_4BPPV1:85,RGBA_PVRTC_4BPPV1:86,RGB_A_PVRTC_4BPPV1:1025,RGB_ETC1:72,RGBA_ETC1:1026,RGB_ETC2:73,RGBA_ETC2:77,RGBA_ASTC_4x4:89,RGBA_ASTC_5x4:90,RGBA_ASTC_5x5:91,RGBA_ASTC_6x5:92,RGBA_ASTC_6x6:93,RGBA_ASTC_8x5:94,RGBA_ASTC_8x6:95,RGBA_ASTC_8x8:96,RGBA_ASTC_10x5:97,RGBA_ASTC_10x6:98,RGBA_ASTC_10x8:99,RGBA_ASTC_10x10:100,RGBA_ASTC_12x10:101,RGBA_ASTC_12x12:102},gm.WrapMode={REPEAT:0,CLAMP_TO_EDGE:2,MIRRORED_REPEAT:1,CLAMP_TO_BORDER:3},gm.Filter={NONE:0,LINEAR:2,NEAREST:1},um=yh((hm=gm).prototype,"_format",[Uh],(function(){return 35})),lm=yh(hm.prototype,"_minFilter",[Uh],(function(){return 2})),cm=yh(hm.prototype,"_magFilter",[Uh],(function(){return 2})),fm=yh(hm.prototype,"_mipFilter",[Uh],(function(){return 0})),dm=yh(hm.prototype,"_wrapS",[Uh],(function(){return 0})),_m=yh(hm.prototype,"_wrapT",[Uh],(function(){return 0})),pm=yh(hm.prototype,"_wrapR",[Uh],(function(){return 0})),mm=yh(hm.prototype,"_anisotropy",[Uh],(function(){return 0})),om=hm))||om;T.TextureBase=wm;var Tm=t("ea",Bh("cc.Script")(ym=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(em))||ym);T._Script=Tm;var Cm=t("eb",Bh("cc.JavaScript")(bm=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Tm))||bm);T._JavaScript=Cm;var Am,Dm,Im,Bm,Mm,Pm,Em,km=t("ec",Bh("cc.TypeScript")(Sm=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Tm))||Sm);T._TypeScript=km;var Om,Rm,Fm,Lm,Vm,Nm,zm,Gm,Um,Hm,Wm,jm=t("ds",Bh("cc.ClickEvent")((Dm=function(){function t(){this.target=Im&&Im(),this.component=Bm&&Bm(),this._componentId=Mm&&Mm(),this.handler=Pm&&Pm(),this.customEventData=Em&&Em()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?C.macro.REPEAT_FOREVER:i,n=n||0;var r=C.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&C.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){C.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Ut(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=C.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Xm}},{key:"internalUpdate",get:function(){return this.update}},{key:"internalLateUpdate",get:function(){return this.lateUpdate}},{key:"internalPreload",get:function(){return this.__preload}},{key:"internalOnLoad",get:function(){return this.onLoad}},{key:"internalStart",get:function(){return this.start}},{key:"internalOnEnable",get:function(){return this.onEnable}},{key:"internalOnDisable",get:function(){return this.onDisable}},{key:"internalOnDestroy",get:function(){return this.onDestroy}}]),e}(eo),Gm.EventHandler=jm,Gm._executionOrder=0,Gm._requireComponent=null,Gm.system=null,y((Lm=Gm).prototype,"__scriptAsset",[Rm],Object.getOwnPropertyDescriptor(Lm.prototype,"__scriptAsset"),Lm.prototype),Vm=yh(Lm.prototype,"node",[Uh],(function(){return null})),Nm=yh(Lm.prototype,"_enabled",[Uh],(function(){return!0})),zm=yh(Lm.prototype,"__prefab",[Uh],(function(){return null})),Fm=Lm))||Fm));Lt(Ym,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),C.Component=Ym;var Qm=t("dQ",Bh("cc.MissingScript")((Hm=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Wm&&Wm(),e}return s(e,t),e.safeFindClass=function(t){var e=fe(t);if(e)return e;T.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){st(4600,this.node.name)},e}(Ym),Wm=yh(Hm.prototype,"_$erialized",[Uh,Wh],(function(){return null})),Um=Hm))||Um);T._MissingScript=Qm;try{var Km=Qm.__values__;0!==Km.length&&"_$erialized"===Km[Km.length-1]||(ot(16338),ot(16339,Km.join(", ")))}catch(ws){ot(16340,""+ws)}var Jm=function(){function t(t,e){this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Zm(t){var e=t;return{chunks:e.chunks,document:e.document}}function $m(t){if(t.length<16)throw new eg(ct(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new eg(ct(13100));var i=e.getUint32(4,!0);if(1!==i)throw new eg(ct(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new eg(ct(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=tg(s);try{a=JSON.parse(o)}catch(t){throw new eg(t)}for(var h=[];n0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Bu]?e._deserialize?e._deserialize(t.content,this):T.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=te(i);r&&n._deserializeInto(t,e,r)}};e[Bu](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=ng(0,i);try{if(i===Qm){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(ot(16341),ot(16342,r.join(", ")));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||ot(16343,JSON.stringify(i))}}}catch(t){ot(16344,""+t)}Lt(i,"__deserialize__",n,!0)}n(this,t,e,i)},e._deserializeAndAssignField=function(t,e,i){var n=e.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)t[i]=r;else{var s,a=this._serializedData[n];t[i]=this._deserializeObject(a,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,t,i)}}else{var o=e.__uuid__;if(o){var h=e.__expectedType__;this.result.push(t,i,o,h)}else t[i]=this._deserializeObject(e,-1)}return!1},e._deserializeObjectField=function(t){var e=t.__id__;if("number"==typeof e){var i=this.deserializedList[e];if(i)return i;var n=this._serializedData[e];return this._deserializeObject(n,e,void 0,void 0)}if(t.__uuid__)throw t.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(t,-1)},e._fillPlainObject=function(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"object"!=typeof n?"__type__"!==i&&(t[i]=n):n?this._deserializeAndAssignField(t,n,i)&&(t[i]=null):t[i]=null}},e._deserializeFastDefinedObject=function(t,e,i){if(i===T.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===T.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==T.Color){if(i===T.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=Fi.Attr.getClassAttrs(i),r=i.__values__,s=0;s=0?a[i[h]]=o:a[~h]=o}for(;r=0?u[i[c]]=l:u[~c]=l}}function Cg(t,e){for(var i=t[4][e[xg]],n=i[Sg],r=new(0,n[vg]),s=n[yg],a=n[bg],o=i[i.length-1],h=Sg+1;h=0?e[i]=t[5][n]:t[7][3*~n]=e}function Ig(t){return function(e,i,n,r){for(var s=0;s=0){var c=o[u];e[a]=Ag(t,c,l)}else(0,Pg[u=~u])(t,e,a,l)}return r}function kg(t,e,i){return t||i(e),Object}function Og(t,e,i,n,r,s,a){var o=t(e);if(!o){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||kg(s,n,a);return e[i]=r,new r}}(i,n,e));o=kg(s,e,a)}i[n]=o}function Rg(t,e,i,n){for(var r=i||fe,s=t[3],a=0;a=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}function Vg(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof Gg}return!1}function Ng(t,e,i){var n;e.init(t),null!==(n=i)&&void 0!==n||(i={});var r=t[0],s=!1;if("object"==typeof r&&(s=r.preprocessed,r=r.version),r>=1,n++;return n}function tv(t){return t&&!(t&t-1)}function ev(t,e,i){return!(6===t.gfxAPI)||tv(e)&&tv(i)}var iv,nv,rv,sv,av,ov=Bh("cc.SimpleTexture")(Kg=function(t){function e(){var e;return(e=t.call(this)||this)._gfxTexture=null,e._gfxTextureView=null,e._mipmapLevel=1,e._textureWidth=0,e._textureHeight=0,e._baseLevel=0,e._maxLevel=1e3,e}s(e,t);var i=e.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),t.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=e)){var n=this._getGFXDevice();if(n){var r=Zg[0];r.texExtent.width=this._textureWidth>>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,Zg):n.copyTexImagesToTexture([t],this._gfxTexture,Zg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ne.CLEANUP_IMAGE_CACHE)){var r=Jg.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(ye(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){ut(t<=e,3124),this._setMipRange(t,e);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=0;0!==this._mipFilter&&ev(t,this._width,this._height)&&(this._mipmapLevel=$g(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=1));var i=this._getGfxTextureCreateInfo({usage:22,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel0){var i=this._generatedMipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(t,e,i,n,r,s){void 0===i&&(i=35),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=void 0),!(t>=this._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;t.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r1)for(var n=0;nthis._width&&(this._x=2,this._y=this._nextY),this._y+o+2>this._nextY&&(this._nextY=this._y+o+2),this._nextY>this._height)return null;T.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.removeSpriteFrame=function(t){Se(this._innerSpriteFrames,t)},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nextY=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e19||i<0)st(16365);else{var n=1<19||e<0)st(16366);else{var i=1<31||e<0?(st(16368),""):t.Enum[1<0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r0&&i._findChildComponents(s._children,e,n)}},e.getWritableComponents=function(){return this._components},e._updateScene=function(){null==this._parent?ot(1640,this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Zt(this,t)},e.getParent=function(){return this._parent},e.modifyParent=function(t){this._parent=t},e.setParent=function(t,e){if(void 0===e&&(e=!1),e&&this.updateWorldTransform(),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit("parent-changed",i),i&&!(i._objFlags&Rv)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit("child-removed",this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit("child-added",this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return q("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i=0?t:e.length+t;var i=e.indexOf(this);t!==i&&(e.splice(i,1),t0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=Nv(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=Nv(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=Nv(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=Nv(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=de(t)))throw C._RF.peek()&&ot(3808,t),TypeError(ct(3807,t))}else{if(!t)throw TypeError(ct(3804));e=t}if("function"!=typeof e)throw TypeError(ct(3809));if(!ee(e,C.Component))throw TypeError(ct(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n=0;){if(a=(e=ey[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r=0;)Kn.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=ey[--n];return t},e.setWorldPosition=function(t,e,i){var n=this._pos;void 0===e?Kn.copy(n,t):Kn.set(n,t,e,i);var r=this._parent,s=this._lpos;r?(r.updateWorldTransform(),Kn.transformMat4(s,n,zr.invert($v,r._mat))):Kn.copy(s,n),this.invalidateChildren(1),1&this._eventMask&&this.emit("transform-changed",1)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?Kn.copy(t,this._pos):Kn.copy(new Kn,this._pos)},e.setWorldRotation=function(t,e,i,n){var r=this._rot;void 0===e?Cr.copy(r,t):Cr.set(r,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),Cr.multiply(this._lrot,Cr.conjugate(this._lrot,this._parent._rot),r)):Cr.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(2),1&this._eventMask&&this.emit("transform-changed",2)},e.setWorldRotationFromEuler=function(t,e,i){Cr.fromEuler(Qv,t,e,i),this.setWorldRotation(Qv)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?Cr.copy(t,this._rot):Cr.copy(new Cr,this._rot)},e.setWorldScale=function(t,e,i){var n=this._parent;n&&this.updateWorldTransform();var r=this._scale;void 0===e?Kn.copy(r,t):Kn.set(r,t,e,i);var s=0;if(n){var a=Kn.set(Yv,this._mat.m00,this._mat.m01,this._mat.m02).length(),o=Kn.set(Yv,this._mat.m04,this._mat.m05,this._mat.m06).length(),h=Kn.set(Yv,this._mat.m08,this._mat.m09,this._mat.m10).length();0===a?(Xv.x=r.x,this._mat.m00=1,s=2):Xv.x=r.x/a,0===o?(Xv.y=r.y,this._mat.m05=1,s=2):Xv.y=r.y/o,0===h?(Xv.z=r.z,this._mat.m10=1,s=2):Xv.z=r.z/h,zr.scale($v,this._mat,Xv),zr.multiply(ty,zr.invert(ty,n._mat),$v),ur.fromQuat(Zv,Cr.conjugate(Jv,this._lrot)),ur.multiplyMat4(Zv,Zv,ty);var u=this._lscale;u.x=Kn.set(Xv,Zv.m00,Zv.m01,Zv.m02).length(),u.y=Kn.set(Xv,Zv.m03,Zv.m04,Zv.m05).length(),u.z=Kn.set(Xv,Zv.m06,Zv.m07,Zv.m08).length(),0!==u.x&&0!==u.y&&0!==u.z||(s=2)}else Kn.copy(this._lscale,r);this.invalidateChildren(4|s),1&this._eventMask&&this.emit("transform-changed",4|s)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?Kn.copy(t,this._scale):Kn.copy(new Kn,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new zr;return zr.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new zr;return zr.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new zr;return zr.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=2,void 0!==t.w?(Cr.copy(this._lrot,t),this._eulerDirty=!0):(Kn.copy(this._euler,t),Cr.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(Kn.copy(this._lpos,e),n|=1),i&&(Kn.copy(this._lscale,i),n|=4),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit("transform-changed",n))},e.isTransformDirty=function(){return 0!==this._transformFlags},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){ny+=1},i.clearNodeArray=function(){i.ClearFrame0},set:function(t){t?this._objFlags|=Fv:this._objFlags&=~Fv}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&C.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"prefab",get:function(){return this._prefab}},{key:"id",set:function(t){this._id=t}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(t){this._siblingIndex=t}},{key:"position",get:function(){return this._lpos},set:function(t){this.setPosition(t)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(Cr.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this.eulerAngles.z},set:function(t){Kn.set(this._euler,0,0,t),Cr.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(2),1&this._eventMask&&this.emit("transform-changed",2)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){zr.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(7),this._eulerDirty=!0,1&this._eventMask&&this.emit("transform-changed",7)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Kn.transformQuat(new Kn,Kn.FORWARD,this.worldRotation)},set:function(t){var e=t.length();Kn.multiplyScalar(Xv,t,-1/e),Cr.fromViewUp(Qv,Xv),this.setWorldRotation(Qv)}},{key:"up",get:function(){return Kn.transformQuat(new Kn,Kn.UP,this.worldRotation)}},{key:"right",get:function(){return Kn.transformQuat(new Kn,Kn.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility!==t&&(this._mobility=t,this.emit("mobility-changed"))}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer!==t&&(this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit("layer-changed",this._layer))}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===ny?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=ny,this._hasChangedFlags=t}}]),i}(eo),Ev.idGenerator=Vv,Ev._stacks=[[]],Ev._stackId=0,Ev.EventType=Ov,Ev.NodeSpace=_v,Ev.TransformDirtyBit=pv,Ev.TransformBit=pv,Ev.reserveContentsForAllSyncablePrefabTag=iy,Ev.ClearFrame=0,Ev.ClearRound=1e3,y((bv=Ev).prototype,"_persistNode",[kh],Object.getOwnPropertyDescriptor(bv.prototype,"_persistNode"),bv.prototype),Sv=yh(bv.prototype,"_parent",[Uh],(function(){return null})),xv=yh(bv.prototype,"_children",[Uh],(function(){return[]})),wv=yh(bv.prototype,"_active",[Uh],(function(){return!0})),Tv=yh(bv.prototype,"_components",[Uh],(function(){return[]})),Cv=yh(bv.prototype,"_prefab",[Uh],(function(){return null})),Av=yh(bv.prototype,"_lpos",[Uh],(function(){return new Kn})),Dv=yh(bv.prototype,"_lrot",[Uh],(function(){return new Cr})),Iv=yh(bv.prototype,"_lscale",[Uh],(function(){return new Kn(1,1,1)})),Bv=yh(bv.prototype,"_mobility",[Uh],(function(){return kv.Static})),Mv=yh(bv.prototype,"_layer",[Uh],(function(){return fv.Enum.DEFAULT})),Pv=yh(bv.prototype,"_euler",[Uh],(function(){return new Kn})),y(bv.prototype,"eulerAngles",[gv],Object.getOwnPropertyDescriptor(bv.prototype,"eulerAngles"),bv.prototype),y(bv.prototype,"mobility",[vv],Object.getOwnPropertyDescriptor(bv.prototype,"mobility"),bv.prototype),yv=bv))||yv));C.Node=ry;var sy=t("e6",Bh("cc.TextureCube")((qv=function(t){function e(){var e;return(e=t.call(this)||this).isRGBE=Uv&&Uv(),e._mipmapAtlas=Hv&&Hv(),e._mipmapMode=Wv&&Wv(),e._mipmaps=jv&&jv(),e._generatedMipmaps=[],e}s(e,t);var i=e.prototype;return i._setMipmapParams=function(t){var e=this;if(this._generatedMipmaps=t,this._setMipmapLevel(this._generatedMipmaps.length),this._generatedMipmaps.length>0){var i=this._generatedMipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){ay(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.isUsingOfflineMipmaps=function(){return 2===this._mipmapMode},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s=this._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;ay(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;s1&&t.forEach((function(t){var i={front:t.front.extractMipmap0(),back:t.back.extractMipmap0(),left:t.left.extractMipmap0(),right:t.right.extractMipmap0(),top:t.top.extractMipmap0(),bottom:t.bottom.extractMipmap0()};e.push(i)}));this._setMipmapParams(e)}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(D.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(){var t=r[h];ay(n,(function(n,r){a.clearRect(0,0,i.width,i.height);var s=n.data;a.drawImage(s,0,0);var o=a.getImageData(t.left,t.top,t.width,t.height),h=new vm({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h>>26},hS=function(t){return(t&rS)>>>20},uS=function(t){return(t&sS)>>>12},lS=function(t){return 4095&t},cS=function(t,e){return 67108863&t|e<<26&nS},fS=((Xb={})[0]=function(t,e,i){return void 0===i&&(i=0),st(12010,i)},Xb[5]=function(t,e,i){return void 0===i&&(i=0),t[i]},Xb[6]=function(t,e,i){return void 0===i&&(i=0),ns.fromArray(e,t,i)},Xb[7]=function(t,e,i){return void 0===i&&(i=0),Kn.fromArray(e,t,i)},Xb[8]=function(t,e,i){return void 0===i&&(i=0),kn.fromArray(e,t,i)},Xb[13]=function(t,e,i){return void 0===i&&(i=0),t[i]},Xb[14]=function(t,e,i){return void 0===i&&(i=0),ns.fromArray(e,t,i)},Xb[15]=function(t,e,i){return void 0===i&&(i=0),Kn.fromArray(e,t,i)},Xb[16]=function(t,e,i){return void 0===i&&(i=0),kn.fromArray(e,t,i)},Xb[21]=function(t,e,i){return void 0===i&&(i=0),ur.fromArray(e,t,i)},Xb[25]=function(t,e,i){return void 0===i&&(i=0),zr.fromArray(e,t,i)},Xb),dS=((Yb={})[0]=function(t,e,i){return void 0===i&&(i=0),st(12010,i)},Yb[5]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Yb[6]=function(t,e,i){return void 0===i&&(i=0),ns.toArray(t,e,i)},Yb[7]=function(t,e,i){return void 0===i&&(i=0),Kn.toArray(t,e,i)},Yb[8]=function(t,e,i){return void 0===i&&(i=0),kn.toArray(t,e,i)},Yb[13]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Yb[14]=function(t,e,i){return void 0===i&&(i=0),ns.toArray(t,e,i)},Yb[15]=function(t,e,i){return void 0===i&&(i=0),Kn.toArray(t,e,i)},Yb[16]=function(t,e,i){return void 0===i&&(i=0),kn.toArray(t,e,i)},Yb[21]=function(t,e,i){return void 0===i&&(i=0),ur.toArray(t,e,i)},Yb[25]=function(t,e,i){return void 0===i&&(i=0),zr.toArray(t,e,i)},Yb),_S=((Qb={})[5]=function(t){return"number"==typeof t},Qb[13]=function(t){return"number"==typeof t},Qb[6]=function(t){return!!(t instanceof ns)},Qb[14]=function(t){return!!(t instanceof ns)},Qb[7]=function(t){return!!(t instanceof Kn)},Qb[15]=function(t){return!!(t instanceof Kn)},Qb[8]=function(t){return!!(t instanceof kn)},Qb[16]=function(t){return!!(t instanceof kn||t instanceof nr||t instanceof Cr)},Qb[21]=function(t){return!!(t instanceof ur)},Qb[25]=function(t){return!!(t instanceof zr)},Qb),pS=[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])];function mS(t){switch(t){case 1:case 5:case 9:case 13:return pS[0];case 2:case 6:case 10:case 14:return pS[1];case 4:case 8:case 12:case 16:return pS[2];case 25:return pS[3];case 28:return"default-texture";case 31:return"default-cube-texture";case 29:return"default-array-texture";case 30:return"default-3d-texture"}return pS[0]}function gS(t){switch(t){case 28:return"-texture";case 31:return"-cube-texture";case 29:return"-array-texture";case 30:return"-3d-texture";default:return"-unknown"}}function vS(t,e){for(var i=Object.entries(e),n=!1,r=0;r>2)*o.count}for(var h=0;h31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}function PS(t){var e=Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a0&&this.shaders.length>0},e}(em),HS._effects={},HS._layoutValid=!0,NS=yh((VS=HS).prototype,"techniques",[Uh],(function(){return[]})),zS=yh(VS.prototype,"shaders",[Uh],(function(){return[]})),GS=yh(VS.prototype,"combinations",[Uh],(function(){return[]})),US=yh(VS.prototype,"hideInEditor",[Uh,Wh],(function(){return!1})),LS=VS))||LS);T.EffectAsset=qS;var XS=function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)},YS=function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var a=0,o=e.length;a0&&ex(t)>0)){Cp.remove(i);for(var n=Jg.getDeps(i),r=0,s=n.length;rthis._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},t._handleQueue=function(t,e){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(Ke(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}},{key:"handlers",get:function(){return this._downloaders}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();kx._instance=void 0;var Ox,Rx,Fx,Lx,Vx,Nx,zx=kx.instance,Gx=kx.instance,Ux=t("e3",Bh("cc.JsonAsset")((Rx=function(t){function e(){var e;return(e=t.call(this)||this).json=Fx&&Fx(),e}return s(e,t),e}(em),Fx=yh(Rx.prototype,"json",[Uh],(function(){return null})),Ox=Rx))||Ox);T.JsonAsset=Ux;var Hx,Wx,jx=t("e2",Bh("cc.TextAsset")((Vx=function(t){function e(){var e;return(e=t.call(this)||this).text=Nx&&Nx(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(em),Nx=yh(Vx.prototype,"text",[Uh],(function(){return""})),Lx=Vx))||Lx);T.TextAsset=jx;var qx=t("d$",Bh("cc.BufferAsset")((Wx=function(t){function e(){var e;return(e=t.call(this)||this)._buffer=null,e}s(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(em),y(Wx.prototype,"_nativeAsset",[Su],Object.getOwnPropertyDescriptor(Wx.prototype,"_nativeAsset"),Wx.prototype),Hx=Wx))||Hx);function Xx(t,e,i,n){var r=null,s=null;try{(r=new vm)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function Yx(t,e,i,n){var r=new Ux;r.json=e,n(null,r)}function Qx(t,e,i,n){var r=new jx;r.text=e,n(null,r)}function Kx(t,e,i,n){var r=new qx;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Jx(t,e,i,n){var r=new em;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Zx(t,i,n,r){var s=Ip.get(i.name);s||(s="resources"===i.name?vx:new gx,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}T.BufferAsset=qx;var $x=function(){function t(){this._creating=new wp,this._producers={".png":Xx,".jpg":Xx,".bmp":Xx,".jpeg":Xx,".gif":Xx,".ico":Xx,".tiff":Xx,".webp":Xx,".image":Xx,".pvr":Xx,".pkm":Xx,".astc":Xx,".txt":Qx,".xml":Qx,".vsh":Qx,".fsh":Qx,".atlas":Qx,".tmx":Qx,".tsx":Qx,".fnt":Qx,".json":Yx,".ExportJson":Yx,".binary":Kx,".bin":Kx,".dbbin":Kx,".skel":Kx,bundle:Zx,default:Jx}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?Zt(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,a=this._producers[i]||this._producers.default,o=Cp.get(t);if(n.reloadAsset||!o){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),a(t,e,n,(function(e,i){!e&&i instanceof em&&(i._uuid=t,ux(t,i,n.cacheAsset));for(var r=s._creating.remove(t),a=0,o=r.length;a0){var a=Op.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:Op.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&rw(t),e(n)}});Mp.async(a)}else i&&rw(t),e()}))}function rw(t){for(var e=t.output,i=0,n=e.length;i0&&(this.downloader.maxConcurrency=r),this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(e,i,n),this.parser.init(),this.dependUtil.init();var s=t.importBase||Ve.querySettings("assets","importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var a=t.nativeBase||Ve.querySettings("assets","nativeBase")||"";a&&a.endsWith("/")&&(a=a.substr(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=Ve.querySettings("assets","projectBundles")||[];var o=Ve.querySettings("assets","assetsOverrides")||{};for(var h in o)this.assetsOverrideMap.set(h,o[h])},e.getBundle=function(t){return Ip.get(t)||null},e.removeBundle=function(t){t._destroy(),Ip.remove(t.name)},e.loadAny=function(t,e,i,n){var r=dx(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=Op.create({input:t,onProgress:a,onComplete:mx(o),options:s});Bp.async(h)},e.preloadAny=function(t,e,i,n){var r=dx(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=Op.create({input:t,onProgress:a,onComplete:mx(o),options:s});Mp.async(h)},e.loadRemote=function(t,e,i){var n=dx(e,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(t)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:t},r,null,(function(e,i){e?(Y(e.message,e.stack),s&&s(e,i)):tw.create(t,i,r.ext||Do(t),r,(function(t,e){s&&s(t,e)}))}))):mx(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=dx(e,void 0,i),r=n.options,s=n.onComplete,a=Bo(t);this.bundles.has(a)?mx(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(Y(e.message,e.stack),s&&s(e,i)):tw.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){nx.tryRelease(t,!0)},e.releaseUnusedAssets=function(){Cp.forEach((function(t){nx.tryRelease(t)}))},e.releaseAll=function(){Cp.forEach((function(t){nx.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"files",get:function(){return this._files}},{key:"main",get:function(){return Ip.get("main")||null}},{key:"resources",get:function(){return Ip.get("resources")||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());bw._instance=void 0,bw.Pipeline=Tp,bw.Task=Op,bw.Cache=wp,bw.RequestItem=_w,bw.Bundle=gx,bw.BuiltinBundleName={INTERNAL:"internal",RESOURCES:"resources",MAIN:"main",START_SCENE:"start-scene"},bw.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},bw.Downloader=kx,bw.Parser=hw,bw.DependUtil=Qg;var Sw=t("ed",T.assetManager=bw.instance);T.AssetManager=bw;var xw,ww,Tw=t("ek",function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)e[a]=0,e[a+1]=0,e[a+2]=0,e[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var h=new Uint8Array(1024);a=0;for(var u=0;u<256;u++)h[a]=221,h[a+1]=221,h[a+2]=221,h[a+3]=255,a+=4;a=0;for(var l=0;l<8;l++){for(var c=0;c<8;c++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}a+=32;for(var f=0;f<8;f++){for(var d=0;d<8;d++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var _={width:2,height:2,_data:e,_compressed:!1,format:35},p={width:2,height:2,_data:i,_compressed:!1,format:35},m={width:2,height:2,_data:n,_compressed:!1,format:35},g={width:2,height:2,_data:r,_compressed:!1,format:35},v={width:2,height:2,_data:s,_compressed:!1,format:35},y={width:16,height:16,_data:h,_compressed:!1,format:35},b=new vm(_),S=new hv;S._uuid="black-texture",S.image=b,t[S._uuid]=S;var x=new vm(p),w=new hv;w._uuid="empty-texture",w.image=x,t[w._uuid]=w;var C=new sy;C._uuid="black-cube-texture",C.setMipFilter(1),C.image={front:new vm(_),back:new vm(_),left:new vm(_),right:new vm(_),top:new vm(_),bottom:new vm(_)},t[C._uuid]=C;var A=new vm(m),D=new hv;D._uuid="grey-texture",D.image=A,t[D._uuid]=D;var I=new sy;I._uuid="grey-cube-texture",I.setMipFilter(1),I.image={front:new vm(m),back:new vm(m),left:new vm(m),right:new vm(m),top:new vm(m),bottom:new vm(m)},t[I._uuid]=I;var B=new vm(g),M=new hv;M._uuid="white-texture",M.image=B,t[M._uuid]=M;var P=new sy;P._uuid="white-cube-texture",P.setMipFilter(1),P.image={front:new vm(g),back:new vm(g),left:new vm(g),right:new vm(g),top:new vm(g),bottom:new vm(g)},t[P._uuid]=P;var E=new vm(v),k=new hv;k._uuid="normal-texture",k.image=E,t[k._uuid]=k;var O=new vm(y),R=new hv;R._uuid="default-texture",R.image=O,t[R._uuid]=R;var F=new sy;if(F.setMipFilter(1),F._uuid="default-cube-texture",F.image={front:new vm(y),back:new vm(y),left:new vm(y),right:new vm(y),top:new vm(y),bottom:new vm(y)},t[F._uuid]=F,T.SpriteFrame){var L=new T.SpriteFrame,V=b,N=new hv;N.image=V,L.texture=N,L._uuid="default-spriteframe",t[L._uuid]=L}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=Ve.querySettings("engine","builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){Sw.loadBundle("internal",(function(s){s?r(s):Sw.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,nx.addIgnoredAsset(e),e instanceof T.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t=1024)&&m.lightingMap.objectID===a.objectID&&m.useReflectionProbeType===l&&m.reflectionProbeCubemap.objectID===o.objectID&&m.reflectionProbePlanarMap.objectID===h.objectID&&m.reflectionProbeBlendCubemap.objectID===u.objectID&&m.stride===r){if(m.count>=m.capacity){m.capacity<<=1;var g=m.stride*m.capacity,v=m.data;m.data=new Uint8Array(g),m.data.set(v),m.vb.resize(g)}return m.shader=c,m.descriptorSet=f,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new zd(10,3,32*r,r)),b=new Uint8Array(32*r),S=s.vertexBuffers.slice(),x=s.attributes.slice(),w=s.indexBuffer,T=0;T>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h>2)*a,c=0;c+u.length<=l;c+=u.length)o.set(u,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),a=t.getBindingFromHandle(n),o=this._properties[e],h=o&&o.value,u=(r="string"==typeof h?Cw.get(""+h+gS(s)):h||Cw.get(mS(s)))&&r.getGFXTexture(),l=o&&void 0!==o.samplerHash?op.unpackFromHash(o.samplerHash):r&&r.getSamplerInfo(),c=this._device.getSampler(l);this._descriptorSet.bindSampler(a,c,i||0),this._descriptorSet.bindTexture(a,u,i||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(T.rendering)for(var t,e=p(this._shaderInfo.descriptors[1].samplerTextures);!(t=e()).done;)for(var i=t.value,n=0;n=0;--e)if(t[e].window.swapchain)return}Hw._PSOHashMap=new Map,new Od,new Dd;var qw=new kn,Xw=t("e8",(Ow=Bh("cc.Material"),Rw=fu(qS),Ow((Lw=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=Vw&&Vw(),e._techIdx=Nw&&Nw(),e._defines=zw&&zw(),e._states=Gw&&Gw(),e._props=Uw&&Uw(),e._passes=[],e._hash=0,e}s(e,t),e.getHash=function(t){for(var e,i=0,n=p(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?st(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(t),this._update())},i.reset=function(t){this.initialize(t)},i.destroy=function(){return this._doDestroy(),t.prototype.destroy.call(this)},i.recompileShaders=function(){st(16370,this.name)},i.overridePipelineStates=function(){st(16371,this.name)},i.onLoaded=function(){this._update()},i.resetUniforms=function(t){void 0===t&&(t=!0),this._props.length=this._passes.length;for(var e=0;e=this._passes.length&&st(16372,i);var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||st(16373,t)},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r=this._passes.length)return st(16372,e),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i0},n(e,[{key:"effectAsset",get:function(){return this._effectAsset}},{key:"effectName",get:function(){return this._effectAsset?this._effectAsset.name:""}},{key:"technique",get:function(){return this._techIdx}},{key:"passes",get:function(){return this._passes}},{key:"hash",get:function(){return this._hash}},{key:"parent",get:function(){return null}},{key:"owner",get:function(){return null}}]),e}(em),Vw=yh(Lw.prototype,"_effectAsset",[Rw],(function(){return null})),Nw=yh(Lw.prototype,"_techIdx",[Uh],(function(){return 0})),zw=yh(Lw.prototype,"_defines",[Uh],(function(){return[]})),Gw=yh(Lw.prototype,"_states",[Uh],(function(){return[]})),Uw=yh(Lw.prototype,"_props",[Uh],(function(){return[]})),Fw=Lw))||Fw));T.Material=Xw;var Yw=Me({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),Qw=Me({Planar:0,ShadowMap:1}),Kw=Me({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),Jw=Me({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),Zw=Me({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),$w=Qw.ShadowMap+1,tT=function(){function t(){this.fixedSphere=new zs(0,0,0,.01),this.maxReceived=4,this._matLight=new zr,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=$w,this._distance=0,this._planeBias=1,this._normal=new Kn(0,1,0),this._shadowColor=new nr(0,0,0,76),this._size=new ns(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new Xw,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:$w,this.normal=t.planeDirection,this.distance=t.planeHeight,this.planeBias=t.planeBias,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===Qw.Planar)this._updatePlanarInfo();else{var t=T.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=T.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new Xw,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=T.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:$w,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){Kn.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();tT.MAX_FAR=2e3,tT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),T.Shadows=tT;var eT=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._dontNotify=!1,n._parent=e,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r0)for(var h=0;h=0&&s.node.getWritableComponents().splice(a,1)}}}function II(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var h=o.pop();if(!h)continue;for(var u=0;u0){var g=p.pop();if(!g)return;for(var v=0;vMath.abs(e)?t:-e},e}(nB),hB=function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new oB({positive:i.right,negative:i.left}),i.yAxis=new oB({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new ns(this.xAxis.getValue(),this.yAxis.getValue())},e}(rB);!function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new oB({positive:i.right,negative:i.left}),i.yAxis=new oB({positive:i.up,negative:i.down}),i.zAxis=new oB({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new Kn(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(sB);var uB,lB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(nB),cB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(hB),fB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(hB),dB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(aB),_B=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(sB),pB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(nB),mB="left",gB="right",vB=[];!function(t){t[t.HAND_LEFT=1]="HAND_LEFT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.AIM_RIGHT=5]="AIM_RIGHT"}(uB||(uB={}));var yB,bB,SB,xB,wB,TB=function(){function t(t){var e;this._deviceId=-1,this._connected=!1,this._webPoseState=((e={})[uB.HAND_LEFT]={position:Kn.ZERO,orientation:Cr.IDENTITY},e[uB.HAND_RIGHT]={position:Kn.ZERO,orientation:Cr.IDENTITY},e[uB.AIM_LEFT]={position:Kn.ZERO,orientation:Cr.IDENTITY},e[uB.AIM_RIGHT]={position:Kn.ZERO,orientation:Cr.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){xo.hasFeature(yo.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&&ye(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(e){t._intervalId=setInterval((function(){C.director&&C.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)},t._updateGamepadCnt=function(){for(var e=0,i=0,n=t._cachedWebGamepads.length;i.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}for(var c=s.axes,f=0;f.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}}},t._scanGamepads=function(){vB.length=0,t._scanWebGamepads(vB),t._scanWebXRGamepads(vB);for(var e=0;e0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._updateWebPoseState=function(t){t.code!==uB.HAND_LEFT&&t.code!==uB.AIM_LEFT&&t.code!==uB.HAND_RIGHT&&t.code!==uB.AIM_RIGHT||(this._webPoseState[t.code]={position:new Kn(t.position.x,t.position.y,t.position.z),orientation:new Cr(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var e=this;this._buttonNorth=new lB,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[3].value:0},this._buttonEast=new lB,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[1].value:0},this._buttonWest=new lB,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[2].value:0},this._buttonSouth=new lB,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[0].value:0},this._buttonL1=new lB,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new lB,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[6].value:0},this._buttonL3=new lB,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[10].value:0},this._buttonR1=new lB,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new lB,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[7].value:0},this._buttonR3=new lB,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[11].value:0},this._buttonShare=new lB,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new lB,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new lB;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new lB;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new lB;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new lB;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new cB({up:i,down:n,left:r,right:s});var a=new lB;a.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).negative:0};var o=new lB;o.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).positive:0};var h=new lB;h.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).negative:0};var u=new lB;u.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).positive:0},this._leftStick=new fB({up:a,down:o,left:h,right:u});var l=new lB;l.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).negative:0};var c=new lB;c.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).positive:0};var f=new lB;f.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).negative:0};var d=new lB;d.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).positive:0},this._rightStick=new fB({up:l,down:c,left:f,right:d}),this._buttonStart=new lB,this._buttonStart.getValue=function(){return 0},this._gripLeft=new lB,this._gripLeft.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(mB);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._gripRight=new lB,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(gB);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new _B,this._handLeftPosition.getValue=function(){return e._webPoseState[uB.HAND_LEFT].position},this._handLeftOrientation=new dB,this._handLeftOrientation.getValue=function(){return e._webPoseState[uB.HAND_LEFT].orientation},this._handRightPosition=new _B,this._handRightPosition.getValue=function(){return e._webPoseState[uB.HAND_RIGHT].position},this._handRightOrientation=new dB,this._handRightOrientation.getValue=function(){return e._webPoseState[uB.HAND_RIGHT].orientation},this._aimLeftPosition=new _B,this._aimLeftPosition.getValue=function(){return e._webPoseState[uB.AIM_LEFT].position},this._aimLeftOrientation=new dB,this._aimLeftOrientation.getValue=function(){return e._webPoseState[uB.AIM_LEFT].orientation},this._aimRightPosition=new _B,this._aimRightPosition.getValue=function(){return e._webPoseState[uB.AIM_RIGHT].position},this._aimRightOrientation=new dB,this._aimRightOrientation.getValue=function(){return e._webPoseState[uB.AIM_RIGHT].orientation}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();TB.all=[],TB.xr=null,TB._eventTarget=new fo,TB._cachedWebGamepads=[],TB._cachedWebXRGamepadMap=null,TB._intervalId=-1,TB._totalGamepadCnt=0,function(t){t[t.BUTTON_EAST=0]="BUTTON_EAST",t[t.BUTTON_SOUTH=1]="BUTTON_SOUTH",t[t.BUTTON_WEST=2]="BUTTON_WEST",t[t.BUTTON_NORTH=3]="BUTTON_NORTH",t[t.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",t[t.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",t[t.TRIGGER_LEFT=6]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",t[t.GRIP_LEFT=8]="GRIP_LEFT",t[t.GRIP_RIGHT=9]="GRIP_RIGHT",t[t.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",t[t.LEFT_STICK_UP=11]="LEFT_STICK_UP",t[t.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",t[t.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",t[t.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",t[t.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",t[t.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",t[t.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",t[t.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",t[t.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",t[t.ROKID_MENU=20]="ROKID_MENU",t[t.ROKID_START=21]="ROKID_START"}(yB||(yB={})),function(t){t[t.KET_CLICK=0]="KET_CLICK",t[t.KET_STICK=1]="KET_STICK",t[t.KET_GRAB=2]="KET_GRAB",t[t.KET_TOUCH=3]="KET_TOUCH"}(bB||(bB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.L1=5]="L1",t[t.R1=6]="R1",t[t.MINUS=7]="MINUS",t[t.PLUS=8]="PLUS",t[t.L3=9]="L3",t[t.R3=10]="R3",t[t.MENU=11]="MENU",t[t.START=12]="START",t[t.TRIGGER_LEFT=13]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=14]="TRIGGER_RIGHT"}(SB||(SB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.X=1]="X",t[t.Y=2]="Y",t[t.LEFT_STICK_X=3]="LEFT_STICK_X",t[t.LEFT_STICK_Y=4]="LEFT_STICK_Y",t[t.RIGHT_STICK_X=5]="RIGHT_STICK_X",t[t.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",t[t.L2=7]="L2",t[t.R2=8]="R2",t[t.LEFT_GRIP=9]="LEFT_GRIP",t[t.RIGHT_GRIP=10]="RIGHT_GRIP"}(xB||(xB={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.LEFT_TRIGGER=5]="LEFT_TRIGGER",t[t.RIGHT_TRIGGER=6]="RIGHT_TRIGGER",t[t.LEFT_THUMBSTICK=7]="LEFT_THUMBSTICK",t[t.RIGHT_THUMBSTICK=8]="RIGHT_THUMBSTICK"}(wB||(wB={}));var CB,AB={1:yB.BUTTON_EAST,2:yB.BUTTON_SOUTH,3:yB.BUTTON_NORTH,4:yB.BUTTON_WEST,9:yB.BUTTON_LEFT_STICK,10:yB.BUTTON_RIGHT_STICK,11:yB.ROKID_MENU,12:yB.ROKID_START,13:yB.BUTTON_TRIGGER_LEFT,14:yB.BUTTON_TRIGGER_RIGHT},DB=function(){function t(){var t,e,i=this;this._eventTarget=new fo,this._nativeButtonState=((t={})[yB.BUTTON_SOUTH]=0,t[yB.BUTTON_EAST]=0,t[yB.BUTTON_WEST]=0,t[yB.BUTTON_NORTH]=0,t[yB.BUTTON_TRIGGER_LEFT]=0,t[yB.BUTTON_TRIGGER_RIGHT]=0,t[yB.TRIGGER_LEFT]=0,t[yB.TRIGGER_RIGHT]=0,t[yB.GRIP_LEFT]=0,t[yB.GRIP_RIGHT]=0,t[yB.LEFT_STICK_UP]=0,t[yB.LEFT_STICK_DOWN]=0,t[yB.LEFT_STICK_LEFT]=0,t[yB.LEFT_STICK_RIGHT]=0,t[yB.RIGHT_STICK_UP]=0,t[yB.RIGHT_STICK_DOWN]=0,t[yB.RIGHT_STICK_LEFT]=0,t[yB.RIGHT_STICK_RIGHT]=0,t[yB.BUTTON_LEFT_STICK]=0,t[yB.BUTTON_RIGHT_STICK]=0,t[yB.ROKID_MENU]=0,t[yB.ROKID_START]=0,t),this._nativeTouchState=((e={})[wB.UNDEFINE]=0,e[wB.A]=0,e[wB.B]=0,e[wB.X]=0,e[wB.Y]=0,e[wB.LEFT_TRIGGER]=0,e[wB.RIGHT_TRIGGER]=0,e[wB.LEFT_THUMBSTICK]=0,e[wB.RIGHT_THUMBSTICK]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(t){var e=t,n=e.detail.keyEventType,r=e.detail.stickAxisCode,s=e.detail.stickAxisValue,a=e.detail.stickKeyCode,o=e.detail.isButtonPressed,h=e.detail.touchCode,u=e.detail.touchValue;if(n===bB.KET_CLICK){var l=AB[a];i._nativeButtonState[l]=o?1:0}else if(n===bB.KET_STICK||n===bB.KET_GRAB){var c,f,d;switch(r){case xB.LEFT_STICK_X:c=yB.LEFT_STICK_LEFT,f=yB.LEFT_STICK_RIGHT,d=i._axisToButtons(s);break;case xB.LEFT_STICK_Y:c=yB.LEFT_STICK_DOWN,f=yB.LEFT_STICK_UP,d=i._axisToButtons(s);break;case xB.RIGHT_STICK_X:c=yB.RIGHT_STICK_LEFT,f=yB.RIGHT_STICK_RIGHT,d=i._axisToButtons(s);break;case xB.RIGHT_STICK_Y:c=yB.RIGHT_STICK_DOWN,f=yB.RIGHT_STICK_UP,d=i._axisToButtons(s);break;case xB.L2:i._nativeButtonState[yB.TRIGGER_LEFT]=s;break;case xB.R2:i._nativeButtonState[yB.TRIGGER_RIGHT]=s;break;case xB.LEFT_GRIP:i._nativeButtonState[yB.GRIP_LEFT]=s;break;case xB.RIGHT_GRIP:i._nativeButtonState[yB.GRIP_RIGHT]=s}c&&f&&d&&(i._nativeButtonState[c]=d.negative,i._nativeButtonState[f]=d.positive)}else if(n===bB.KET_TOUCH)switch(h){case wB.A:case wB.B:case wB.X:case wB.Y:case wB.LEFT_TRIGGER:case wB.RIGHT_TRIGGER:case wB.LEFT_THUMBSTICK:case wB.RIGHT_THUMBSTICK:i._nativeTouchState[h]=u}i._eventTarget.emit("handle-input",new QI("handle-input",i))}))}var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){var t=this;this._buttonNorth=new lB,this._buttonNorth.getValue=function(){return t._nativeButtonState[yB.BUTTON_NORTH]},this._buttonEast=new lB,this._buttonEast.getValue=function(){return t._nativeButtonState[yB.BUTTON_EAST]},this._buttonWest=new lB,this._buttonWest.getValue=function(){return t._nativeButtonState[yB.BUTTON_WEST]},this._buttonSouth=new lB,this._buttonSouth.getValue=function(){return t._nativeButtonState[yB.BUTTON_SOUTH]},this._buttonTriggerLeft=new lB,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[yB.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new lB,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[yB.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new lB,this._triggerLeft.getValue=function(){return t._nativeButtonState[yB.TRIGGER_LEFT]},this._triggerRight=new lB,this._triggerRight.getValue=function(){return t._nativeButtonState[yB.TRIGGER_RIGHT]},this._gripLeft=new lB,this._gripLeft.getValue=function(){return t._nativeButtonState[yB.GRIP_LEFT]},this._gripRight=new lB,this._gripRight.getValue=function(){return t._nativeButtonState[yB.GRIP_RIGHT]},this._buttonLeftStick=new lB,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[yB.BUTTON_LEFT_STICK]};var e=new lB;e.getValue=function(){return t._nativeButtonState[yB.LEFT_STICK_UP]};var i=new lB;i.getValue=function(){return t._nativeButtonState[yB.LEFT_STICK_DOWN]};var n=new lB;n.getValue=function(){return t._nativeButtonState[yB.LEFT_STICK_LEFT]};var r=new lB;r.getValue=function(){return t._nativeButtonState[yB.LEFT_STICK_RIGHT]},this._leftStick=new fB({up:e,down:i,left:n,right:r}),this._buttonRightStick=new lB,this._buttonRightStick.getValue=function(){return t._nativeButtonState[yB.BUTTON_RIGHT_STICK]};var s=new lB;s.getValue=function(){return t._nativeButtonState[yB.RIGHT_STICK_UP]};var a=new lB;a.getValue=function(){return t._nativeButtonState[yB.RIGHT_STICK_DOWN]};var o=new lB;o.getValue=function(){return t._nativeButtonState[yB.RIGHT_STICK_LEFT]};var h=new lB;h.getValue=function(){return t._nativeButtonState[yB.RIGHT_STICK_RIGHT]},this._rightStick=new fB({up:s,down:a,left:o,right:h}),this._buttonOptions=new lB,this._buttonOptions.getValue=function(){return t._nativeButtonState[yB.ROKID_MENU]},this._buttonStart=new lB,this._buttonStart.getValue=function(){return t._nativeButtonState[yB.ROKID_START]},this._handLeftPosition=new _B,this._handLeftPosition.getValue=function(){return Kn.ZERO},this._handLeftOrientation=new dB,this._handLeftOrientation.getValue=function(){return Cr.IDENTITY},this._handRightPosition=new _B,this._handRightPosition.getValue=function(){return Kn.ZERO},this._handRightOrientation=new dB,this._handRightOrientation.getValue=function(){return Cr.IDENTITY},this._aimLeftPosition=new _B,this._aimLeftPosition.getValue=function(){return Kn.ZERO},this._aimLeftOrientation=new dB,this._aimLeftOrientation.getValue=function(){return Cr.IDENTITY},this._aimRightPosition=new _B,this._aimRightPosition.getValue=function(){return Kn.ZERO},this._aimRightOrientation=new dB,this._aimRightOrientation.getValue=function(){return Cr.IDENTITY},this._touchButtonA=new pB,this._touchButtonA.getValue=function(){return t._nativeTouchState[wB.A]},this._touchButtonB=new pB,this._touchButtonB.getValue=function(){return t._nativeTouchState[wB.B]},this._touchButtonX=new pB,this._touchButtonX.getValue=function(){return t._nativeTouchState[wB.X]},this._touchButtonY=new pB,this._touchButtonY.getValue=function(){return t._nativeTouchState[wB.Y]},this._touchButtonTriggerLeft=new pB,this._touchButtonTriggerLeft.getValue=function(){return t._nativeTouchState[wB.LEFT_TRIGGER]},this._touchButtonTriggerRight=new pB,this._touchButtonTriggerRight.getValue=function(){return t._nativeTouchState[wB.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new pB,this._touchButtonThumbStickLeft.getValue=function(){return t._nativeTouchState[wB.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new pB,this._touchButtonThumbStickRight.getValue=function(){return t._nativeTouchState[wB.RIGHT_THUMBSTICK]}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"touchButtonA",get:function(){return this._touchButtonA}},{key:"touchButtonB",get:function(){return this._touchButtonB}},{key:"touchButtonX",get:function(){return this._touchButtonX}},{key:"touchButtonY",get:function(){return this._touchButtonY}},{key:"touchButtonTriggerLeft",get:function(){return this._touchButtonTriggerLeft}},{key:"touchButtonTriggerRight",get:function(){return this._touchButtonTriggerRight}},{key:"touchButtonThumbStickLeft",get:function(){return this._touchButtonThumbStickLeft}},{key:"touchButtonThumbStickRight",get:function(){return this._touchButtonThumbStickRight}}]),t}();!function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(CB||(CB={}));var IB,BB=function(){function t(){var t;this._eventTarget=new fo,this._intervalId=-1,this._webPoseState=((t={})[CB.VIEW_LEFT]={position:Kn.ZERO,orientation:Cr.IDENTITY},t[CB.VIEW_RIGHT]={position:Kn.ZERO,orientation:Cr.IDENTITY},t[CB.HEAD_MIDDLE]={position:Kn.ZERO,orientation:Cr.IDENTITY},t),this._initInputSource(),this._registerEvent()}var e=t.prototype;return e._ensureDirectorDefined=function(){var t=this;return new Promise((function(e){t._intervalId=setInterval((function(){C.director&&C.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},e._registerEvent=function(){var t=this;this._ensureDirectorDefined().then((function(){C.director.on(C.Director.EVENT_BEGIN_FRAME,t._scanHmd,t)})).catch((function(){}))},e._scanHmd=function(){var t,e=null===(t=globalThis.__globalXR)||void 0===t?void 0:t.webxrHmdPoseInfos;if(e){for(var i=0;iNe.TOUCH_TIMEOUT&&(et(2302,t.getID()),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),FB=function(){function t(){this._canvas=void 0,this._eventTarget=new fo,xo.hasFeature(yo.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||X("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback("touch-start")),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback("touch-move")),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback("touch-end")),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback("touch-cancel"))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var f=new XI(s,!1,t,RB.getAllTouches());e._eventTarget.emit(t,f)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new cs(e.x,e.y,e.width,e.height):new cs(0,0,0,0)},e._getLocation=function(t,e){if(globalThis.__globalXR&&globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new ns(t.clientX,t.clientY);var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(Ho.isFrameRotated){var r=i;i=e.height-n,n=r}var s=Ho.devicePixelRatio;return new ns(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e.dispatchEventsInCache=function(){},t}(),LB=function(){function t(t){this.priority=0,this._inputEventTarget=t}var e=t.prototype;return e.onThrowException=function(){},e.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),VB=((IB={})["mouse-down"]="touch-start",IB["mouse-move"]="touch-move",IB["mouse-up"]="touch-end",IB),NB=t("eB",function(){function t(){this._eventTarget=new fo,this._touchInput=new FB,this._mouseInput=new kB,this._keyboardInput=new EB,this._accelerometerInput=new eB,this._handleInput=new DB,this._hmdInput=new BB,this._handheldInput=new MB,this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new LB(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),TB._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.getTouch=function(t){return RB.getTouch(t)},e.getAllTouches=function(){return RB.getAllTouches()},e.getTouchCount=function(){return RB.getTouchCount()},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=VB[t.type],i=RB.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new XI(n,!1,e,"touch-end"===e?[]:n);r.windowId=t.windowId,"touch-end"===e&&RB.releaseTouch(0),this._dispatchEventTouch(r)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i8?ot(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),rM.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(rM)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(t){this._instancedSHIndex=t}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(t){this._useReflectionProbeType=t}}]),t}(),aM=new zr,oM=[{name:"CC_RECEIVE_SHADOW",value:!0}],hM=[{name:"CC_USE_LIGHTMAP",value:1}],uM=[{name:"CC_USE_LIGHTMAP",value:2}],lM=[{name:"CC_LIGHT_MAP_VERSION",value:2}],cM=[{name:"CC_USE_LIGHT_PROBE",value:!0}],fM=new Xd(2,2,0,2,2,2),dM=new Xd(2,2,2,2,2,2),_M=function(){function t(){this.type=0,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(56),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=On(),this._tetrahedronIndex=-1,this._lastWorldBoundCenter=Jn(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._receiveDirLight=!0,this._shadowBias=0,this._shadowNormalBias=0,this._reflectionProbeId=-1,this._reflectionProbeBlendId=-1,this._reflectionProbeBlendWeight=0,this._enabled=!0,this._visFlags=fv.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=vp.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=fv.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},e.destroy=function(){for(var t=this._subModels,e=0;e=0?o.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(zr.toArray(this._localData,r,0),zr.invert(aM,r),zr.transpose(aM,aM),zr.toArray(this._localData,aM,16),this._localBuffer.update(this._localData))}},e.invalidateLocalData=function(){this._localDataUpdated=!0},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=T.director.root.pipeline.pipelineSceneData.lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i=0?n.updateInstancedSH(this._localSHData,r):e=!0}e&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},e.clearSHUBOs=function(){if(this._localSHData){for(var t=0;t<28;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,ji)){var e=[],i=new kn,n=T.director.root.pipeline.pipelineSceneData.lightProbes;if(this._lastWorldBoundCenter.set(t),this._tetrahedronIndex=n.data.getInterpolationWeights(t,this._tetrahedronIndex,i),n.data.getInterpolationSHCoefficients(this._tetrahedronIndex,i,e)&&this._localSHData){var r=T.internal.SH;r.reduceRinging(e,n.reduceRinging),r.updateUBOData(this._localSHData,0,e),this.updateSHBuffer()}}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=th.create()),this._worldBounds||(this._worldBounds=th.create()),th.fromPoints(this._modelBounds,t,e),this._worldBounds.copy(this._modelBounds))},e._createSubModel=function(){return new sM},e.initSubModel=function(t,e,i){this.initialize(),null==this._subModels[t]?this._subModels[t]=this._createSubModel():this._subModels[t].destroy(),this._subModels[t].initialize(e,i.passes,this.getMacroPatches(t)),this._updateAttributesAndBinding(t)},e.setSubModelMesh=function(t,e){this._subModels[t]&&(this._subModels[t].subMesh=e)},e.setSubModelMaterial=function(t,e){this._subModels[t]&&(this._subModels[t].passes=e.passes,this._updateAttributesAndBinding(t))},e.onGlobalPipelineStateChanged=function(){for(var t=this._subModels,e=0;e1?dM:fM),r=this._subModels,s=0;s15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}var vM,yM={DIRECTIONAL:0,SPHERE:1,SPOT:2,POINT:3,RANGED_DIRECTIONAL:4,UNKNOWN:5},bM=function(t){return 4*Math.PI*Math.PI*t*t},SM=function(){function t(){this._baked=!1,this._color=Jn(1,1,1),this._colorTemp=6550,this._colorTempRGB=Jn(1,1,1),this._finalColor=Jn(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=5,this._visibility=Kb}var e=t.prototype;return e.initialize=function(){this.color=Jn(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},n(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t),this._useColorTemperature&&Kn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&Kn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,gM(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&Kn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=2)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),xM=new Kn(0,0,-1),wM=new Kn,TM=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Kn(1,-1,-1),e._illuminanceHDR=Sy.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=Kw.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=Jw.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=Zw.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=0,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Sy.SUN_ILLUM,this.direction=new Kn(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Kn.transformQuat(wM,xM,this._node.worldRotation))},i.activate=function(){var t=T.director.root,e=t.pipeline;this._shadowEnabled?(this._shadowFixedArea||!e.pipelineSceneData.csmSupported?e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&e.pipelineSceneData.csmSupported?(e.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,e.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},n(e,[{key:"direction",get:function(){return this._dir},set:function(t){Kn.normalize(this._dir,t)}},{key:"illuminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this.activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this.activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,tT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,tT.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this.activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this.activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,tT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t}}]),e}(SM),CM=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=new Kn,e._aabb=th.create(),e._type=1,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/bM(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;th.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(SM),AM=new Kn(0,0,-1),DM=new Cr,IM=new zr,BM=new zr,MM=new zr,PM=new zr,EM=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Kn(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._angleAttenuationStrength=0,e._pos=new Kn,e._aabb=th.create(),e._frustum=oh.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=Kw.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._type=2,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/bM(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Kn(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Kn.transformQuat(this._dir,AM,this._node.getWorldRotation(DM)),Kn.normalize(this._dir,this._dir),th.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(IM),zr.invert(IM,IM),zr.perspective(BM,this._angle,1,.001,this._range),zr.multiply(MM,BM,IM),this._frustum.update(MM,PM),this._needUpdate=!1)},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(SM),kM=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=Jn(),e._aabb=th.create(),e._type=3,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/bM(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;th.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(SM),OM=new Kn(0,0,-1),RM=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Kn(0,0,-1),e._pos=new Kn(0,0,0),e._scale=new Kn(1,1,1),e._right=new Kn(1,0,0),e._illuminanceHDR=Sy.SUN_ILLUM,e._illuminanceLDR=1,e._type=4,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Sy.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),Kn.transformQuat(this._dir,OM,this._node.worldRotation),Kn.transformQuat(this._right,Kn.RIGHT,this._node.worldRotation))},n(e,[{key:"direction",get:function(){return this._dir}},{key:"right",get:function(){return this._right}},{key:"position",get:function(){return this._pos}},{key:"scale",get:function(){return this._scale}},{key:"illuminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}}]),e}(SM),FM=new a_;FM.format=35;var LM=new o_;LM.format=55;var VM=new l_([FM],LM),NM={width:1,height:1,renderPassInfo:VM},zM=t("e9",Bh("cc.RenderTexture")(vM=function(t){function e(){var e;return(e=t.call(this)||this)._window=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name||"",this._width=t.width,this._height=t.height,this._initWindow(t)},i.reset=function(t){this.initialize(t)},i.destroy=function(){if(this._window){var e=T.director.root;null==e||e.destroyWindow(this._window),this._window=null}return t.prototype.destroy.call(this)},i.resize=function(t,e){this._width=Math.floor(Yi(t,1,2048)),this._height=Math.floor(Yi(e,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(e,i){var n=e;this._width=n.w,this._height=n.h,this._name=n.n,t.prototype._deserialize.call(this,n.base,i)},i.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},i.onLoaded=function(){this._initWindow()},i._initWindow=function(t){var e=T.director.root;NM.title=this._name,NM.width=this._width,NM.height=this._height,NM.renderPassInfo=t&&t.passInfo?t.passInfo:VM,NM.externalResLow=t&&t.externalResLow?t.externalResLow:0,NM.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,NM.externalFlag=t&&t.externalFlag?t.externalFlag:0,NM.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),FM.barrier=vp.gfxDevice.getGeneralBarrier(new f_(128,128)),this._window?(this._window.destroy(),this._window.initialize(vp.gfxDevice,NM)):this._window=e.createWindow(NM)},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){t=t||0,e=e||0,i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return ot(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),XM=function(){function t(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=Jn(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=vp.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(1===t.projectionType&&(e=Kn.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(t.node.worldPosition))),this.distanceToScreenUsagePercentage(t,e,this.getWorldSpaceSize())):0;var e},e.distanceToScreenUsagePercentage=function(t,e,i){return 1===t.projectionType?i*t.matProj.m05/(2*e):i*t.matProj.m05*.5},e.getWorldSpaceSize=function(){var t=this.node.scale;return Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.objectSize},n(t,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),t}(),YM=Object.freeze({__proto__:null,Ambient:Sy,CSMLevel:Jw,CSMOptimizationMode:Zw,Camera:nM,CameraAperture:qB,CameraFOVAxis:WB,CameraISO:XB,CameraProjection:jB,CameraShutter:YB,CameraType:{DEFAULT:-1,LEFT_EYE:0,RIGHT_EYE:1,MAIN:2},CameraUsage:{EDITOR:0,GAME_VIEW:1,SCENE_VIEW:2,PREVIEW:3,GAME:100},ColorTemperatureToRGB:gM,DirectionalLight:TM,EnvironmentLightingType:sT,FOG_TYPE_NONE:uT,Fog:lT,FogType:hT,LODData:qM,LODGroup:XM,Light:SM,LightType:yM,Model:_M,ModelType:{DEFAULT:0,SKINNING:1,BAKED_SKINNING:2,BATCH_2D:3,PARTICLE_BATCH:4,LINE:5},Octree:pM,PCFType:Kw,PointLight:kM,PostSettings:OA,ProbeClearFlag:UM,ProbeType:HM,RangedDirectionalLight:RM,ReflectionProbe:jM,SKYBOX_FLAG:8,ShadowSize:Yw,ShadowType:Qw,Shadows:tT,Skin:mM,SkyBoxFlagValue:{VALUE:8},Skybox:aT,SphereLight:CM,SpotLight:EM,SubModel:sM,ToneMappingType:kA,TrackingType:{NO_TRACKING:0,POSITION_AND_ROTATION:1,POSITION:2,ROTATION:3},nt2lm:bM}),QM=function(){function t(t){this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,this._root=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._lodStateCache=new JM(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){for(var t,e=p(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=p(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},n(t,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),t}(),KM=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},JM=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=p(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e,i=p(this._renderScene.cameras);!(e=i()).done;){var n=e.value;if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=0;e0){if(t.node.hasChangedFlags>0)for(var n,r=p(e._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(t);a||(a=new KM,s[1].set(t,a)),a.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var o=e._levelModels.get(t);if(o){o.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=p(i);!(h=u()).done;){var l=h.value,f=o.get(l);f&&f.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=p(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return 0}for(var d,_=!1,m=p(e._lodStateInCamera);!(d=m()).done;){var g=d.value,v=g[1].get(t);v||(v=new KM,g[1].set(t,v));var y=g[0].node.hasChangedFlags,b=t.node.hasChangedFlags;if(y>0||b>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var S=t.getVisibleLODLevel(g[0]);S!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=S,_=!0)}}var x=e._levelModels.get(t);if(!x)return 0;t.isLockLevelChanged()?(t.resetLockChangeFlag(),x.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))})),_=!0):_&&e._lodStateInCamera.forEach((function(i){var n=i.get(t);if(n&&n.usedLevel!==n.lastUsedLevel){var r=x.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),_&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,a=x.get(s);a&&a.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},d=p(this._renderScene.lodGroups);!(c=d()).done;)f()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),ZM=((GM={})[Le.PORTRAIT]=0,GM[Le.LANDSCAPE_RIGHT]=1,GM[Le.PORTRAIT_UPSIDE_DOWN]=2,GM[Le.LANDSCAPE_LEFT]=3,GM),$M=0,tP=function(){var t=e.prototype;function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null,this._renderWindowId=$M++,this._isResized=!0,this._colorName="Color"+this._renderWindowId,this._depthStencilName="DepthStencil"+this._renderWindowId}return t.isRenderWindowResized=function(){return this._isResized},t.setRenderWindowResizeHandled=function(){this._isResized=!1},e.registerCreateFunc=function(t){t._createWindowFun=function(){return new e}},t.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;i1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?this._doWebXRFrameMove():(this._frameMoveBegin(),this._frameMoveProcess(),this._frameMoveEnd())},e.createWindow=function(t){var e=this._createWindowFun(this);return e.initialize(this.device,t),this._windows.push(e),e},e.destroyWindow=function(t){for(var e=0;e=0;g--){var v=i[g];(0===a&&1===v.cameraType||1===a&&0===v.cameraType)&&i.splice(g,1)}this._frameMoveEnd()}}},e._frameMoveBegin=function(){for(var t=0;t0){this._device.acquire([vp.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a0){t.emit(e.EVENT_BEFORE_COMMIT),i.sort((function(t,e){return t.priority-e.priority}));for(var n=0;n0&&(this._fixedFPS=t)}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),t}());T.Root=iP,Fi.Attr.setClassAttr(jm,"target","type","Object"),Fi.Attr.setClassAttr(jm,"target","ctor",ry);var nP,rP=new Ga((function(){return new Array(16)}),3),sP=null,aP=new ns,oP=["touch-start","touch-move","touch-end","touch-cancel"],hP=["mouse-down","mouse-enter","mouse-move","mouse-leave","mouse-up","mouse-wheel"],uP=function(){function t(t){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._isMouseLeaveWindow=!1,this._node=t}var e=t.prototype;return e.setEnabled=function(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit(2),i&&n.length>0)for(var r=0;r=0;--n)if((e=r[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,r),t.propagationStopped))return void rP.free(r);if(t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(r.length=0,this.getBubblingTargets(t.type,r),t.eventPhase=3,n=0;n0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==oP.indexOf(t)},e._isMouseEvent=function(t){return-1!==hP.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t>>1;r<=s;a=r+s>>>1){var o=t[a],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(hn)s=a-1;else{if(!(u0&&(t.array.sort(bP),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(bP),this._invoke(e),e.array.length=0)},e}(yP),xP=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=gP(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=gP(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(yP);function wP(t,e,i){var n="var a=it.array;for(it.i=0;it.i=0?_P(this._deferredComps,e):(!t.internalStart||t._objFlags&pP||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&mP)){if(t.internalOnEnable){if(e)return void e.add(t);if(t.internalOnEnable(),!t.node.activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&mP&&(t.internalOnDisable&&t.internalOnDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.internalStart||t._objFlags&pP||this.startInvoker.add(t),"function"==typeof t.internalUpdate&&this.updateInvoker.add(t),"function"==typeof t.internalLateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=jP+this.globalVariables.join(",")+";");var n=Pf(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new ry,this.data.name="(Missing Node)";var i=new C._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;PI(t),BI(t)},e}(em),sE.OptimizationPolicy=hE,sE.OptimizationPolicyThreshold=3,iE=yh((eE=sE).prototype,"data",[Uh],(function(){return null})),nE=yh(eE.prototype,"optimizationPolicy",[Uh],(function(){return hE.AUTO})),rE=yh(eE.prototype,"persistent",[Uh],(function(){return!1})),tE=eE))||tE);Lt(uE,"_utils",NI),C.Prefab=uE,Ht(C,"cc._Prefab","Prefab");var lE=function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,ye(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(Se(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers,e=0;e1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:_E,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return Sw.assets.has(t)?{content:Sw.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h=Do(t);h&&!vx.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),vx.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=Do(e);n&&!vx.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),vx.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;vx.loadDir(t,s,a,(function(e,i){var n=[];e||(n=vx.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return Cp.has(t)?Cp.get(t):vx.get(t,e)},e.getResCount=function(){return Cp.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return Jg.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({url:t},n)}};for(var n in t)i();Gx.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({content:t},n)}};for(var n in t)i();uw.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;eg.x?t[b]:g.x,g.y=t[b+1]>g.y?t[b+1]:g.y,v.x=t[b]g.x?t[b]:g.x,g.y=t[b+1]>g.y?t[b+1]:g.y,g.z=t[b+2]>g.z?t[b+2]:g.z,v.x=t[b]1&&t.csmOptimizationMode===Zw.RemoveDuplicates)if(this._level>=h-1)JE=this._castLightViewBoundingBox.halfExtents.z,KE=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-KE)+JE;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(QE.set(c.x,c.y,c.z+l+r),Kn.transformMat4(QE,QE,FE),zr.fromRT(FE,t.node.rotation,QE),zr.invert(LE,FE),!i){var f=.5*s,d=.5*a;zr.ortho(VE,-f,f,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),zr.multiply(zE,VE,o),Kn.transformMat4(HE,QE,zE);var _=2/e;WE.set(_,_);var p=HE.x%WE.x,m=HE.y%WE.y;jE.set(HE.x-p,HE.y-m,HE.z),zr.invert(GE,zE),Kn.transformMat4(qE,jE,GE),zr.fromRT(FE,t.node.rotation,qE),zr.invert(LE,FE),zr.multiply(NE,VE,LE),zr.copy(this._matShadowView,LE),zr.copy(this._matShadowProj,VE),zr.copy(this._matShadowViewProj,NE)}oh.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,FE)},n(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),t}(),$E=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new kn,i._calculateAtlas(e),i}s(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=T.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},n(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(ZE),tk=function(){function t(){this._castShadowObjects=[],this._layerObjects=new Ha(64),this._layers=[],this._levelCount=0,this._specialLayer=new ZE(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(RE,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,RE,o,h),a.createMatrix(e,r,!1)}n===Jw.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,zr.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),zr.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),zr.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,RE,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();zr.fromRT(t,r,n)}},n(t,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),t}(),ek=t("df",function(){function t(){this.fog=new lT,this.ambient=new Sy,this.skybox=new aT,this.shadows=new tT,this.csmLayers=new tk,this.octree=new pM,this.skin=new mM,this.postSettings=new OA,this.lightProbes=C.internal.LightProbes?new C.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null,this._shadingScale=1}var e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=0;e<6;e++){this._geometryRendererMaterials[e]=new Xw,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"internal/builtin-geometry-renderer",technique:e});for(var i=0;i0&&(this._occlusionQueryShader=t.passes[0].getShaderVariant())}},e.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},e.updatePipelineSceneData=function(){},e.destroy=function(){var t,e,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(t=this._occlusionQueryInputAssembler)||void 0===t||t.destroy(),this._occlusionQueryInputAssembler=null,null===(e=this._occlusionQueryVertexBuffer)||void 0===e||e.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null},e._createOcclusionQueryIA=function(){var t=this._device,e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1]);this._occlusionQueryVertexBuffer=t.createBuffer(new zd(10,1,96,12)),this._occlusionQueryVertexBuffer.update(e);var i=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]);this._occlusionQueryIndicesBuffer=t.createBuffer(new zd(6,1,72,2)),this._occlusionQueryIndicesBuffer.update(i);var n=[new n_("a_position",32)],r=new s_(n,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(r)},n(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),ik=hs(),nk=((EE={})[Ne.ORIENTATION_AUTO]=Le.AUTO,EE[Ne.ORIENTATION_LANDSCAPE]=Le.LANDSCAPE,EE[Ne.ORIENTATION_PORTRAIT]=Le.PORTRAIT,EE),rk=t("h7",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=hs(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=fs(),e._visibleRect=fs(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=sk,n=ak;return e._rpExactFit=new _k(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new _k(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new _k(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new _k(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new _k(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}s(e,t);var i=e.prototype;return i.init=function(){var t=jo.windowSize,e=t.width,i=t.height;this._designResolutionSize.width=e,this._designResolutionSize.height=i,this._viewportRect.width=e,this._viewportRect.height=i,this._visibleRect.width=e,this._visibleRect.height=i,ik.width=this._visibleRect.width,ik.height=this._visibleRect.height,Xo&&Xo.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=Ve.querySettings("screen","designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||_k.FIXED_HEIGHT),jo.on("window-resize",this._updateAdaptResult,this),jo.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){Ho.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){Ho.orientation=nk[t]},i.adjustViewportMeta=function(){},i.enableRetina=function(t){this._retinaEnabled=!!t},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(t){t!==this._autoFullScreen&&(this._autoFullScreen=t,t&&jo.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){Ho.resolutionScale=1;var i=Ho.devicePixelRatio,n=new os(t*i,e*i);jo.windowSize=n},i.getCanvasSize=function(){return jo.windowSize},i.getFrameSize=function(){var t=Ho.devicePixelRatio,e=jo.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=Ho.devicePixelRatio;jo.windowSize=new os(t*i,e*i)},i.getVisibleSize=function(){return new os(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new os(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new ns(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new ns(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof _k)this._resolutionPolicy=t;else{var e=_k;t===e.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),t===e.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),t===e.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),t===e.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),t===e.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(t){this._updateResolutionPolicy(t);var e=pk.getDesignResolutionSize();pk.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),ik.width=this._visibleRect.width,ik.height=this._visibleRect.height,Xo&&Xo.init(this._visibleRect),this.emit("design-resolution-changed")}else ot(2200)},i.getDesignResolutionSize=function(){return new os(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return Ho.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new ns);var r=Ho.devicePixelRatio*(t-i.left),s=Ho.devicePixelRatio*(i.top+i.height-e);return Ho.isFrameRotated?(n.x=jo.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(t,e,i){var n;T.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&e>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):Q(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(co(df)));rk.instance=void 0;var sk=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=T.game.canvas;if(t){var e=jo.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();sk.EQUAL_TO_FRAME=void 0,sk.PROPORTION_TO_FRAME=void 0;var ak=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=_k.UNKNOWN}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new cs(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},n(t,[{key:"strategy",get:function(){return this._strategy}}]),t}(),ok=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){Ho.isProportionalToFrame=!1,this._setupCanvas()},e}(sk),hk=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){Ho.isProportionalToFrame=!0,this._setupCanvas()},e}(sk);sk.EQUAL_TO_FRAME=new ok,sk.PROPORTION_TO_FRAME=new hk;var uk=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=_k.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=jo.windowSize,n=i.width,r=i.height,s=n/e.width,a=r/e.height;return this._buildResult(n,r,n,r,s,a)},e}(ak),lk=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=_k.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=jo.windowSize,s=r.width,a=r.height,o=e.width,h=e.height,u=s/o,l=a/h,c=0;return ue){var r=n;n=i,i=r}this.scaleSize=t/e>16/9?e/n:t/i},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain;zr.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*t;var a=Fu(Qi(this._curTime/e.totalTime)),o=1,h=1;"custom"===this.settings.background.type&&(this.settings.policy===_k.FIXED_WIDTH?(o=r,h=r/this.bgImage.width*this.bgImage.height):this.settings.policy===_k.FIXED_HEIGHT?(o=s/this.bgImage.height*this.bgImage.width,h=s):this.settings.policy===_k.SHOW_ALL?this.bgImage.width/this.bgHeight>r/s?(o=r,h=r/this.bgImage.width*this.bgImage.height):(o=s/this.bgImage.height*this.bgImage.width,h=s):this.settings.policy===_k.NO_BORDER?this.bgImage.width/this.bgImage.height>r/s?(o=s/this.bgImage.height*this.bgImage.width,h=s):(o=r,h=r/this.bgImage.width*this.bgImage.height):(o=r,h=s),this.bgMat.setProperty("resolution",mk.set(r,s),0),this.bgMat.setProperty("scale",mk.set(o,h),0),this.bgMat.setProperty("translate",mk.set(.5*r,.5*s),0),this.bgMat.setProperty("percent",1),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update());var u=s*this.logoYTrans;if("none"!==this.settings.logo.type&&(h=.185*s*e.displayRatio,o=this.logoWidth*(.185*s/this.logoHeight)*e.displayRatio,this.logoMat.setProperty("resolution",mk.set(r,s),0),this.logoMat.setProperty("scale",mk.set(o,h),0),this.logoMat.setProperty("translate",mk.set(r*this.logoXTrans,u),0),this.logoMat.setProperty("percent",a),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update()),"default"===this.settings.logo.type&&this.watermarkMat){var l=this.watermarkTexture.width,c=this.watermarkTexture.height;o=l,h=c;var f=u-(.5*this.logoHeight*e.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*c;this.watermarkMat.setProperty("resolution",mk.set(r,s),0),this.watermarkMat.setProperty("scale",mk.set(o,h),0),this.watermarkMat.setProperty("translate",mk.set(r*this.textXTrans,f),0),this.watermarkMat.setProperty("percent",a),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},t.initBG=function(){var t=this.device;this.bgMat=new Xw,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new Xd;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new jd(1,6,35,this.bgImage.width,this.bgImage.height));var i=this.bgMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.bgTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new kd;s.texExtent.width=this.bgImage.width,s.texExtent.height=this.bgImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},t.initLogo=function(){var t=this.device;this.logoMat=new Xw,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new Xd;e.addressU=2,e.addressV=2,e.addressW=2,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new jd(1,6,35,this.logoImage.width,this.logoImage.height));var i=this.logoMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.logoTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new kd;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s]);var a=this.logoImage.width/this.logoImage.height;a<1?(this.logoWidth=this.logoWidthTemp,this.logoHeight=this.logoWidthTemp/a):(this.logoWidth=this.logoHeightTemp*a,this.logoHeight=this.logoHeightTemp)},t.initWaterMark=function(){var t=D.document.createElement("canvas");t.height=this.textHeight*this.scaleSize,t.style.width=""+t.width,t.style.height=""+t.height;var e="Created with Cocos",i=t.getContext("2d");i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070";var n=i.measureText(e).width+10;t.width=n,i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070",i.fillText(e,t.width/2,0);var r=new kd;r.texExtent.width=t.width,r.texExtent.height=t.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new jd(1,6,35,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new Xw,this.watermarkMat.initialize({effectName:"util/splash-screen"});var s=this.watermarkMat.passes[0],a=s.getBinding("mainTexture");s.bindTexture(a,this.watermarkTexture),s.descriptorSet.update()},t.frame=function(){var t=this.device,e=this.swapchain;if(!qo.isXR||xr.entry.isRenderAllowable())for(var i=qo.isXR?2:1,n=0;n=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins}}]),e}();gk._ins=null,T.internal.SplashScreen=gk;var vk=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),C.rendering&&C.rendering.enableEffectImport&&t?new Promise((function(i,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="arraybuffer",r.onload=function(){e._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());C.effectSettings=vk;var yk=t("dV",function(t){function i(){var e;return(e=t.call(this)||this).frame=null,e.container=null,e.canvas=null,e.renderType=-1,e.eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e.config={},e.onStart=null,e.frameTime=1e3/60,e._isCloning=!1,e._inited=!1,e._engineInited=!1,e._rendererInitialized=!1,e._paused=!0,e._pausedByEngine=!1,e._frameRate=60,e._pacer=null,e._initTime=0,e._startTime=0,e._deltaTime=0,e._useFixedDeltaTime=!1,e._shouldLoadLaunchScene=!0,e.onPreBaseInitDelegate=new bo,e.onPostBaseInitDelegate=new bo,e.onPreInfrastructureInitDelegate=new bo,e.onPostInfrastructureInitDelegate=new bo,e.onPreSubsystemInitDelegate=new bo,e.onPostSubsystemInitDelegate=new bo,e.onPreProjectInitDelegate=new bo,e.onPostProjectInitDelegate=new bo,e}s(i,t);var r=i.prototype;return r.setFrameRate=function(t){this.frameRate=t},r.getFrameRate=function(){return this.frameRate},r.step=function(){wE.tick(this._calculateDT(!0))},r.pauseByEngine=function(){this._paused||(this._pausedByEngine=!0,this.pause())},r.resumeByEngine=function(){this._pausedByEngine&&(this.resume(),this._pausedByEngine=!1)},r.pause=function(){var t;this._paused||(this._paused=!0,null===(t=this._pacer)||void 0===t||t.stop(),this.emit(i.EVENT_PAUSE))},r.resume=function(){var t;this._paused&&(zB._clearEvents(),this._paused=!1,null===(t=this._pacer)||void 0===t||t.start(),this.emit(i.EVENT_RESUME))},r.isPaused=function(){return this._paused},r.restart=function(){var t=this;return new Promise((function(t){wE.once("director_end_frame",(function(){return t()}))})).then((function(){wE.reset(),T.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0})).then((function(){return gk.createInstance().init()})).then((function(){t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){xo.close()},r.on=function(t,e,i,n){return this.canRegisterEvent(t)&&e.call(i),this.eventTargetOn(t,e,i,n)},r.once=function(t,e,i){return this.canRegisterEvent(t)?e.call(i):this.eventTargetOnce(t,e,i)},r.canRegisterEvent=function(t){return this._engineInited&&t===i.EVENT_ENGINE_INITED||this._inited&&t===i.EVENT_GAME_INITED||this._rendererInitialized&&t===i.EVENT_RENDERER_INITED},r.init=function(t){var n=this;return this._compatibleWithOldParams(t),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){J(t.debugMode||0)})).then((function(){return qo.init()})).then((function(){n._initEvents()})).then((function(){return Ve.init(t.settingsPath,t.overrideSettings)})).then((function(){return n.emit(i.EVENT_POST_BASE_INIT),n.onPostBaseInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_INFRASTRUCTURE_INIT),n.onPreInfrastructureInitDelegate.dispatch()})).then((function(){Ne.init(),n._initXR();var t={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};return t&&(n.canvas=t.canvas,n.frame=t.frame,n.container=t.container),jo.init(),If.init(),vp.init(n.canvas,Cy)})).then((function(){if(Ve.querySettings("rendering","customPipeline")){if(!T.rendering)return void ot(12109);Ne.CUSTOM_PIPELINE_NAME||(Ne.CUSTOM_PIPELINE_NAME="Builtin")}else T.rendering=void 0;Sw.init(),Cw.init(),fv.init(),n.initPacer()})).then((function(){return n.emit(i.EVENT_POST_INFRASTRUCTURE_INIT),n.onPostInfrastructureInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_SUBSYSTEM_INIT),n.onPreSubsystemInitDelegate.dispatch()})).then((function(){return vk.init(Ve.querySettings("rendering","effectSettingsPath"))})).then((function(){if(T.rendering&&T.rendering.enableEffectImport)if(3!==Ve.querySettings("rendering","renderMode")){var t=vk.data;null!==t?T.rendering.init(vp.gfxDevice,t):ot(1102)}else T.rendering.init(vp.gfxDevice,null)})).then((function(){var t=Ve.querySettings("scripting","scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return wE.init(),Cw.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){q("Cocos Creator v"+A),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var t=Ve.querySettings("plugins","jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return e="src/"+t,new Promise((function(t,i){var n;function r(t){t.filename===e&&(n=t.error)}window.addEventListener("error",r);var s=document.createElement("script");s.charset="utf-8",s.async=!0,s.crossOrigin="anonymous",s.addEventListener("error",(function(){window.removeEventListener("error",r),i(Error("Error loading "+e))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):t()})),s.src=e.replace("#","%23"),document.head.appendChild(s)}));var e}))})),e})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return Cw.compileBuiltinMaterial(),gk.createInstance().init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){var t;if(void 0===globalThis.__globalXR&&(globalThis.__globalXR={}),globalThis.__globalXR.webxrCompatible=null!==(t=Ve.querySettings("xr","webxrCompatible"))&&void 0!==t&&t,qo.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=Ve.querySettings("rendering","msaa"))&&void 0!==e?e:1,r=null!==(i=Ve.querySettings("rendering","renderingScale"))&&void 0!==i?i:1;xr.entry.setMultisamplesRTT(n),xr.entry.setRenderingScale(r)}},r._compatibleWithOldParams=function(t){var e=t.overrideSettings=t.overrideSettings||{};"showFPS"in t&&(e.profiling=e.profiling||{},e.profiling.showFPS=t.showFPS),"frameRate"in t&&(e.screen=e.screen||{},e.screen.frameRate=t.frameRate),"renderMode"in t&&(e.rendering=e.rendering||{},e.rendering.renderMode=t.renderMode),"renderPipeline"in t&&(e.rendering=e.rendering||{},e.rendering.renderPipeline=t.renderPipeline),"assetOptions"in t&&(e.assets=e.assets||{},Object.assign(e.assets,t.assetOptions)),"customJointTextureLayouts"in t&&(e.animation=e.animation||{},e.animation.customJointTextureLayouts=t.customJointTextureLayouts),"physics"in t&&(e.physics=e.physics||{},Object.assign(e.physics,t.physics)),"orientation"in t&&(e.screen=e.screen||{},e.screen.orientation=t.orientation),"exactFitScreen"in t&&(e.screen=e.screen||{},e.screen.exactFitScreen=t.exactFitScreen)},r._loadPreloadAssets=function(){var t=Ve.querySettings("assets","preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){Sw.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=Ve.querySettings("assets","preloadBundles");return t?Promise.all(t.map((function(t){var e=t.bundle,i=t.version;return new Promise((function(t,n){var r={};i&&(r.version=i),Sw.loadBundle(e,r,(function(e){e?n(e):t()}))}))}))):Promise.resolve([])},r.run=function(t){t&&(this.onStart=t),this._inited&&this.resume()},r._calculateDT=function(t){if(this._useFixedDeltaTime=t,t)return this._startTime=performance.now(),this.frameTime/1e3;var e=performance.now();return this._deltaTime=e>this._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var t=this;if(this._inited)if(gk.instance&&!gk.instance.isFinished)gk.instance.update(this._calculateDT(!1));else if(this._shouldLoadLaunchScene){gk.releaseInstance(),this._shouldLoadLaunchScene=!1;var e,i=Ve.querySettings("launch","launchScene");i?wE.loadScene(i,(function(){var e;et(1103,i),t._initTime=performance.now(),wE.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),wE.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else wE.tick(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=Ve.querySettings("screen","frameRate"))&&void 0!==t?t:60;Q("number"==typeof e),this._pacer=new CE,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){xo.on("show",this._onShow,this),xo.on("hide",this._onHide,this),xo.on("close",this._onClose,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r._onClose=function(){this.emit(i.EVENT_CLOSE),xo.exit()},r.addPersistRootNode=function(t){wE.addPersistRootNode(t)},r.removePersistRootNode=function(t){wE.removePersistRootNode(t)},r.isPersistRootNode=function(t){return wE.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=Ve.querySettings("rendering","customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){wE.root.setRenderPipeline(t)?(this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)):ot(1222)},r._safeEmit=function(t){this.emit(t)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(fo));yk.EVENT_HIDE="game_on_hide",yk.EVENT_SHOW="game_on_show",yk.EVENT_LOW_MEMORY="game_on_low_memory",yk.EVENT_GAME_INITED="game_inited",yk.EVENT_ENGINE_INITED="engine_inited",yk.EVENT_RENDERER_INITED="renderer_inited",yk.EVENT_PRE_BASE_INIT="pre_base_init",yk.EVENT_POST_BASE_INIT="post_base_init",yk.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",yk.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",yk.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",yk.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",yk.EVENT_PRE_PROJECT_INIT="pre_project_init",yk.EVENT_POST_PROJECT_INIT="post_project_init",yk.EVENT_RESTART="game_on_restart",yk.EVENT_PAUSE="game_on_pause",yk.EVENT_RESUME="game_on_resume",yk.EVENT_CLOSE="game_on_close",yk.RENDER_TYPE_CANVAS=0,yk.RENDER_TYPE_WEBGL=1,yk.RENDER_TYPE_OPENGL=2,yk.RENDER_TYPE_HEADLESS=3,yk.DEBUG_DT_THRESHOLD=1,T.Game=yk;var bk=t("dW",T.game=new yk);mt(xE.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),pt(xE.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]),_t(wE,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return Sw.main?null===(e=Sw.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),mt(bk,"game",[{name:"collisionMatrix"},{name:"groupList"}]),_t(bk,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return Sw.main&&Sw.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var Sk=t("a5",function(t){function e(){var e;return(e=t.call(this)||this)._atlases=[],e._atlasIndex=-1,e._maxAtlasCount=5,e._textureSize=2048,e._maxFrameSize=512,e._textureBleeding=!0,e._enabled=!1,e}s(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return!t&&this._atlasIndex=this._maxAtlasCount||!t||t.original)return null;if(!t.packable)return null;var e=t.texture.getSamplerInfo();if(2!==e.minFilter||2!==e.magFilter||0!==e.mipFilter)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i?i.insertSpriteFrame(t):null;return!n&&this._atlasIndex=0;e--)this._atlases[e].removeSpriteFrame(t);var i=t.original._texture;this.deleteAtlasTexture(i)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e.original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),wE.on("director_before_scene_launch",this.beforeSceneLoad,this)):(this.reset(),wE.off("director_before_scene_launch",this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(df));Sk.instance=void 0;var xk=t("a6",Sk.instance=new Sk);wE.registerSystem("dynamicAtlasManager",xk,0),T.internal.dynamicAtlasManager=xk;var wk={positions:"a_position",normals:"a_normal",uvs:"a_texCoord",colors:"a_color"},Tk=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}();function Ck(t,e){return new Ak(t,e)}var Ak=function(){function t(t,e){if(this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;n60?this._subMeshRenderings[n]=new Ik(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new Dk(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&e?i+1:i),height:1<d&&(d=t[u]),t[u]<_&&(_=t[u]);for(e=1<>=1;for(c=n<<16|u,l=o;l>>=1){case 0:var n=this.input,a=this.a,u=this.c,l=this.b,c=n.length,f=e,_=u.length,p=e;switch(this.d=this.f=0,a+1>=c&&t(Error("invalid uncompressed block header: LEN")),f=n[a++]|n[a++]<<8,a+1>=c&&t(Error("invalid uncompressed block header: NLEN")),f===~(n[a++]|n[a++]<<8)&&t(Error("invalid uncompressed block header: length verify")),a+f>n.length&&t(Error("input buffer is broken")),this.e){case o:for(;l+f>u.length;){if(f-=p=_-l,r)u.set(n.subarray(a,a+p),l),l+=p,a+=p;else for(;p--;)u[l++]=n[a++];this.b=l,u=E(this),l=this.b}break;case h:for(;l+f>u.length;)u=k(this,{m:2});break;default:t(Error("invalid inflate mode"))}if(r)u.set(n.subarray(a,a+f),l),l+=f,a+=f;else for(;f--;)u[l++]=n[a++];this.a=a,this.b=l,this.c=u;break;case 1:switch(this.e){case h:P(this,C,D);break;case o:M(this,C,D);break;default:t(Error("invalid inflate mode"))}break;case 2:var m,g,v,y,b=I(this,5)+257,S=I(this,5)+1,x=I(this,4)+4,w=new(r?Uint8Array:Array)(d.length),T=e,A=e,O=e,R=e,F=e;for(F=0;FY&&(this.c.length=Y),X=this.c),this.buffer=X;default:t(Error("invalid inflate mode"))}};var l,c,f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=r?new Uint16Array(f):f,_=[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],p=r?new Uint16Array(_):_,m=[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],g=r?new Uint8Array(m):m,v=[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],y=r?new Uint16Array(v):v,b=[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],S=r?new Uint8Array(b):b,x=new(r?Uint8Array:Array)(288);for(l=0,c=x.length;l=l?8:255>=l?9:279>=l?7:8;var w,T,C=s(x),A=new(r?Uint8Array:Array)(30);for(w=0,T=A.length;w>3)>=a.length&&t(Error("input buffer is broken"));s>>i,e.d=s-i,e.a=o,n}function B(e,i){for(var n,r,s=e.f,a=e.d,o=e.input,h=e.a,u=o.length,l=i[0],c=i[1];a=u);)s|=o[h++]<>>16)>a&&t(Error("invalid code length: "+r)),e.f=s>>r,e.d=a-r,e.a=h,65535&n}function M(t,e,i){var n=t.c,r=t.b;t.l=e;for(var s,a,o,h,u=n.length-258;256!==(s=B(t,e));)if(256>s)r>=u&&(t.b=r,n=E(t),r=t.b),n[r++]=s;else for(h=p[a=s-257],0=u&&(t.b=r,n=E(t),r=t.b);h--;)n[r]=n[r++-o];for(;8<=t.d;)t.d-=8,t.a--;t.b=r}function P(t,e,i){var n=t.c,r=t.b;t.l=e;for(var s,a,o,h,u=n.length;256!==(s=B(t,e));)if(256>s)r>=u&&(u=(n=k(t)).length),n[r++]=s;else for(h=p[a=s-257],0u&&(u=(n=k(t)).length);h--;)n[r]=n[r++-o];for(;8<=t.d;)t.d-=8,t.a--;t.b=r}function E(t){var e,i,n=new(r?Uint8Array:Array)(t.b-32768),s=t.b-32768,a=t.c;if(r)n.set(a.subarray(32768,n.length));else for(e=0,i=n.length;ee;++e)a[e]=a[s+e];return t.b=32768,a}function k(t,e){var i,n,s,a=t.input.length/t.a+1|0,o=t.input,h=t.c;return e&&("number"==typeof e.m&&(a=e.m),"number"==typeof e.r&&(a+=e.r)),n=2>a?(s=(o.length-t.a)/t.l[2]/2*258|0)>>0;var r=e;if("string"==typeof r){var s,a,o=r.split("");for(s=0,a=o.length;s>>0;r=o}for(var h,u=1,l=0,c=r.length,f=0;0>>0&&t(Error("invalid adler-32 checksum"))}return e};var R=8;n("Zlib.Inflate",O),n("Zlib.Inflate.prototype.decompress",O.prototype.i);var F,L,V,N,z={ADAPTIVE:u.p,BLOCK:u.q};if(Object.keys)F=Object.keys(z);else for(L in F=[],V=0,z)F[V++]=L;for(V=0,N=F.length;V=65536){st(10001,R,65536);continue}k>>=1,O>>=1}M=T.createBuffer(new zd(4,1,O,k)),A.push(M),P=new(jk(E.stride))(w,E.offset,E.count),E.stride!==k&&(P=jk(k).from(P)),M.update(P)}var F=B.vertexBundelIndices.map((function(t){return C[t]})),L=[];if(B.vertexBundelIndices.length>0)for(var V=B.vertexBundelIndices[0],N=this._struct.vertexBundles[V].attributes,z=0;z=this._struct.primitives.length)st(14201);else{var i=[];if(e.positions.length>0&&i.push(e.positions),e.normals&&e.normals.length>0&&i.push(e.normals),e.uvs&&e.uvs.length>0&&i.push(e.uvs),e.tangents&&e.tangents.length>0&&i.push(e.tangents),e.colors&&e.colors.length>0&&i.push(e.colors),e.customAttributes)for(var n=0;n0&&(m.set(g),v.update(g,_)),c.view.count=d,h.vertexCount=d}if(a.indexView){var y=a.indexView,b=y.stride,S=2===b?e.indices16.length:e.indices32.length,x=S*b,w=new Uint8Array(this._data.buffer,y.offset,x),T=2===b?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,x):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,x),C=o.indexBuffer;s.maxSubMeshIndices,x>0&&(w.set(T),C.update(T,x)),y.count=S,h.indexCount=S}if(e.minPos&&e.maxPos){var A=new Kn(e.minPos.x,e.minPos.y,e.minPos.z),D=new Kn(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new th),th.fromPoints(r.bounds[t],A,D);for(var I,B=new Kn,M=new Kn,P=p(r.bounds);!(I=P()).done;){var E=I.value;E&&(E.getBoundary(B,M),Kn.min(A,B,A),Kn.max(D,M,D))}this._struct.minPosition=new Kn(A.x,A.y,A.z),this._struct.maxPosition=new Kn(D.x,D.y,D.z)}o.invalidateGeometricInfo()}else st(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){Kn.transformMat4(Xk,qk,n[_]),i[_]=!0;var p=e[_];Kn.min(p.center,p.center,Xk),Kn.max(p.halfExtents,p.halfExtents,Xk)}}}}for(var m=0;m=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?6:2===i.indexView.stride?9:12,s=$k(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n,r=p(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new zd(8,1,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:Yk})},i.releaseData=function(){this._data=Yk},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=wf(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(em),Gk=yh(zk.prototype,"_struct",[Uh],(function(){return{vertexBundles:[],primitives:[]}})),Uk=yh(zk.prototype,"_hash",[Uh],(function(){return 0})),Hk=yh(zk.prototype,"_allowDataAccess",[Uh],(function(){return!0})),Nk=zk))||Nk);function Kk(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var u,l=p(t.attributes);!(u=l()).done;){var c=u.value;if("a_position"===c.name){n=c;break}}n||(n=rO[0]),r.push(n);var f=M_[n.format];o=Math.max(o,Math.floor(h.length/f.count)),a.push({offset:s,data:h,attribute:n}),s+=f.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var d,_=p(t.attributes);!(d=_()).done;){var m=d.value;if("a_normal"===m.name){n=m;break}}n||(n=rO[1]);var g=M_[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/g.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=g.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=p(t.attributes);!(v=y()).done;){var b=v.value;if("a_texCoord"===b.name){n=b;break}}n||(n=rO[2]);var S=M_[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/S.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=S.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var x,w=p(t.attributes);!(x=w()).done;){var T=x.value;if("a_tangent"===T.name){n=T;break}}n||(n=rO[3]);var C=M_[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/C.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=C.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var A,D=p(t.attributes);!(A=D()).done;){var I=A.value;if("a_color"===I.name){n=I;break}}n||(n=rO[4]);var B=M_[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/B.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=B.size}if(t.customAttributes)for(var M=0;M0){var i=t%e;if(0!==i)return e-i}return 0}function hO(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new n_("a_position",32,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new n_("a_normal",32,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new n_("a_texCoord",21,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new n_("a_tangent",44,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new n_("a_color",44,!1,s++,!1,0)),e.customAttributes)for(var a=0;a0?x=2:e.indices32&&e.indices32.length>0&&(x=4),x>0){c+=oO(c,x);var w=n.maxSubMeshIndices*x,T={offset:c,length:w,count:0,stride:x};_.indexView=T,c+=w}l.push(_)}var C={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};C.bounds.length=n.maxSubMeshes;var A={struct:{vertexBundles:u,primitives:l,dynamic:C},data:new Uint8Array(c)};return i||(i=new Qk),i.reset(A),i.initialize(),i.updateSubMesh(t,e),i}var uO,lO,cO=function(){function t(){}return t.createMesh=function(t,e,i){return aO(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return hO(t,e,i,n)},t.decodeMesh=function(t){return eO(t)},t.inflateMesh=function(t){return iO(t)},t}(),fO=Object.freeze({__proto__:null,MeshUtils:cO,createMesh:aO,find:dP,mapBuffer:PE,readBuffer:ME,readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,a=s.primitives[e],o=p(a.vertexBundelIndices);!(i=o()).done;)for(var h,u=i.value,l=s.vertexBundles[u],c=l.view.offset,f=l.view,d=f.length,_=f.stride,m=p(l.attributes);!(h=m()).done;){var g=h.value,v=wk[g.name];v&&(n[v]=(n[v]||[]).concat(ME(r,g.format,c,d,_))),c+=M_[g.format].size}var y=a.indexView;return n.indices=ME(r,Vf["R"+8*y.stride+"UI"],y.offset,y.length),n},toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},writeBuffer:BE});t("a9",fO);var dO,_O,pO,mO=Jn(),gO=Wr(),vO=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],yO=(t("c",{UV_UPDATED:"uv_updated"}),t("d",Bh("cc.SpriteFrame")((lO=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=fs(),e._trimmedBorder=On(),e._offset=rs(),e._originalSize=hs(),e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=rs(.5,.5),e._meshType=0,e._extrude=0,e._customOutLine=[],e._mesh=null,e._minPos=Jn(),e._maxPos=Jn(),e}s(e,t),e.createWithImage=function(t){var i=t instanceof vm?t:new vm(t),n=new hv;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(ot(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(ot(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&xk&&xk.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,e=this.texture,i=e.width,n=e.height,r=this._capInsets[0],s=this._capInsets[2],a=t.width-r-s,o=this._capInsets[1],h=this._capInsets[3],u=t.height-o-h,l=this.uvSliced;if(l.length=0,this._rotated){vO[0].u=t.x/i,vO[1].u=(t.x+h)/i,vO[2].u=(t.x+h+u)/i,vO[3].u=(t.x+t.height)/i,vO[3].v=t.y/n,vO[2].v=(t.y+r)/n,vO[1].v=(t.y+r+a)/n,vO[0].v=(t.y+t.width)/n;for(var c=0;c<4;++c)for(var f=vO[c],d=0;d<4;++d){var _=vO[3-d];l.push({u:f.u,v:_.v})}}else{vO[0].u=t.x/i,vO[1].u=(t.x+r)/i,vO[2].u=(t.x+r+a)/i,vO[3].u=(t.x+t.width)/i,vO[3].v=t.y/n,vO[2].v=(t.y+o)/n,vO[1].v=(t.y+o+u)/n,vO[0].v=(t.y+t.height)/n;for(var p=0;p<4;++p)for(var m=vO[p],g=0;g<4;++g){var v=vO[g];l.push({u:v.u,v:m.v})}}this.emit("uv_updated",this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVX?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,f=0===s?0:t.y/s,d=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=d,i[2]=c,i[3]=f,i[4]=l,i[5]=d,i[6]=l,i[7]=f):this._isFlipUVX?(i[0]=c,i[1]=f,i[2]=c,i[3]=d,i[4]=l,i[5]=f,i[6]=l,i[7]=d):this._isFlipUVY?(i[0]=l,i[1]=d,i[2]=l,i[3]=f,i[4]=c,i[5]=d,i[6]=c,i[7]=f):(i[0]=l,i[1]=f,i[2]=l,i[3]=d,i[4]=c,i[5]=f,i[6]=c,i[7]=d)}else{var _=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=_,e[3]=g,e[4]=p,e[5]=m,e[6]=_,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=_,e[3]=m,e[4]=p,e[5]=g,e[6]=_,e[7]=g):this._isFlipUVY?(e[0]=_,e[1]=g,e[2]=p,e[3]=g,e[4]=_,e[5]=m,e[6]=p,e[7]=m):(e[0]=_,e[1]=m,e[2]=p,e[3]=m,e[4]=_,e[5]=g,e[6]=p,e[7]=g);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,b=0===s?1:(t.y+t.height)/s,S=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=b,i[6]=v,i[7]=b):this._isFlipUVX?(i[0]=y,i[1]=b,i[2]=v,i[3]=b,i[4]=y,i[5]=S,i[6]=v,i[7]=S):this._isFlipUVY?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=b,i[6]=y,i[7]=b):(i[0]=v,i[1]=b,i[2]=y,i[3]=b,i[4]=v,i[5]=S,i[6]=y,i[7]=S)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=xk;if(t){var e=this._texture;if(e instanceof hv&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=D.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new cs(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=rs(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=hs(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=rs(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:Jn(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:Jn(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,u=0;u0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,PO.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}()),kO=new EO(100),OO=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,RO=/^[!,.:;'}\]%\?>、‘“》?。,!]/,FO=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,LO=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,VO=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function NO(t){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)}function zO(t){var e=t.charCodeAt(0);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}function GO(t,e,i){var n=(i||t.font)+"🎮"+e,r=kO.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return kO.put(n,a),a}function UO(t){for(var e=t.length,i=0,n=0,r=0;r=55296&&n<=56319&&(n=t.charCodeAt(r+1))>=56320&&n<=57343?((r+2>=e||8205!==t.charCodeAt(r+2))&&i++,r++):i++);return i}function HO(t,e){for(var i=t.length,n=0,r=0,s=0,a=0,o=0;o=55296&&a<=56319&&(n++,(a=t.charCodeAt(o+1))>=56320&&a<=57343)){if(n++,o+2>=i||8205!==t.charCodeAt(o+2)){if(e===r)return t.slice(s,s+n);s+=n,r++,n=0}o++}else{if(e===r)return t.charAt(o);s=o+1,r++,n=0}else n++;return""}function WO(t,e){var i=HO(t,e);if(1===i.length)return""+i.charCodeAt(0);for(var n="",r=0;r=t.length)return t.length;for(var i=e,n=t[i];i>=0&&("‍"===n&&(n=t[--i]),n>="\udc00"&&n<="\udfff"&&i-1>=0&&(n=t[--i]),n>="\ud800"&&n<="\udbff")&&i-1>=0&&"‍"===t[i-1];)n=t[--i];return i}function qO(t,e){for(var i=e,n=e,r=t[n];n="\ud800"&&r<="\udbff"&&(i++,r=t[++n])),r>="\ud800"&&r<="\udbff")i++,r=t[++n];else{if(!(r>="\udc00"&&r<="\udfff"))break;if(r=t[++n],!(nn?r=n:r+=1}return t.substring(n,r)}function YO(t){return VO.exec(t)}function QO(t){return LO.exec(t)}function KO(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=XO(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=XO(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var f=OO.exec(o);u=o,h=e-n(o=XO(s,a+=l=f?f[0].length:1))}0==(a-=l)?(a=1,u=XO(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=XO(s,2));var d=XO(s,0,a),_=void 0;RO.test(u||o)&&(0==(a-=(_=FO.exec(d))?_[0].length:0)&&(a=1),u=XO(s,a),d=XO(s,0,a)),VO.test(u)&&(_=LO.exec(d))&&d!==_[0]&&(u=XO(s,a-=_[0].length),d=XO(s,0,a)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var JO,ZO=D.document,$O=null,tR=-1,eR="BES bswy:->@123丁ぁᄁ",iR=Object.create(null),nR=[],rR=3e3,sR=function(){if(void 0===JO)if("FontFace"in D){var t=/Gecko.*Firefox\/(\d+)/.exec(D.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(D.navigator.userAgent)&&/Apple/.exec(D.navigator.vendor);JO=t?parseInt(t[1],10)>42:!e}else JO=!1;return JO};function aR(){for(var t=!0,e=Date.now(),i=nR.length-1;i>=0;i--){var n=nR[i],r=n.fontFamilyName;if(e-n.startTime>rR)st(4933,r),n.onComplete(null,r),nR.splice(i,1);else{var s=n.refWidth,a="40px "+r;$O.font=a,s!==GO($O,eR,a)?(nR.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(tR),tR=-1)}function oR(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=rR?n():ZO.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,rR)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){st(4933,e),i(null,e)}))}function hR(t,e,i){var n=uR(t);if(iR[n])i(null,n);else{if(!$O){var r=ZO.createElement("canvas");r.width=100,r.height=100,$O=r.getContext("2d")}var s="40px "+n,a=ZO.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",ZO.body.appendChild(a);var h=ZO.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",ZO.body.appendChild(h),sR())oR(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:GO($O,eR,s),onComplete:i,startTime:Date.now()};nR.push(l),-1===tR&&(tR=setInterval(aR,100))}iR[n]=a}}function uR(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}function lR(t,e,i,n){var r=new AO;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Gx.register({".font":hR,".eot":hR,".ttf":hR,".woff":hR,".svg":hR,".ttc":hR}),tw.register({".font":lR,".eot":lR,".ttf":lR,".woff":lR,".svg":lR,".ttc":lR});var cR,fR,dR,_R,pR,mR,gR,vR,yR,bR=/^(click)(\s)*=|(param)(\s)*=/,SR=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,xR=t("D",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/</g,"<"]),this._specialSymbolArray.push([/>/g,">"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=SR.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=SR.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring(7).trim()){var f,d=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=d.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),f=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+f):"color"===n?c.color=f:"width"===n&&(c.width=parseInt(f)),e.event&&"param"===n&&(e.event[n]=f.replace(/^"|"$/g,"")),i=d.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-1&&(n=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=bR.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=bR.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=p(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),wR=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},TR=function(){function t(t){this.letterDefinitions={},this.texture=t}var e=t.prototype;return e.addLetterDefinitions=function(t,e){this.letterDefinitions[t]=e},e.cloneLetterDefinition=function(){for(var t={},e=0,i=Object.keys(this.letterDefinitions);e=Ne.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),BR=nr.WHITE.clone(),MR="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",PR=MO(),ER=function(){function t(t,e){this.image=null,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.char=t,this.labelInfo=e,this.hash=""+WO(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,IR.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=IR.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){var t=this.labelInfo.fontScale;this.context.font=this.labelInfo.fontDesc;var e=GO(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+DO)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*DO*t/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new vm),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height,r=e.fontScale;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=MR,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,a=i/2,o=n/2+s*BO+s*PR,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||BR;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,a,o)}t.fillText(this.char,a,o)}},t}(),kR=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=35),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new kd;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else st(16363)}},e}(hv),OR=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new kR;i.initWithSize(t,e),this.fontDefDictionary=new TR(i),this._halfBleed=1,this._width=t,this._height=e,wE.on("director_before_scene_launch",this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=wE.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return st(12100),null;if(!this.fontDefDictionary.texture)return null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new wR;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset();var t=this.fontDefDictionary;t&&t.texture&&(t.texture.destroy(),t.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new kR;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=WO(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new ER(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),RR={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:nr.WHITE.clone(),isOutlined:!1,out:nr.WHITE.clone(),margin:0,fontScale:1};function FR(t){var e=t.color.toHEX(),i="";return t.isOutlined&&t.margin>0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}var LR=[new n_("a_position",32)],VR=[new n_("a_position",32),new n_("a_color",44)],NR=[new n_("a_position",32),new n_("a_texCoord",21),new n_("a_color",44)],zR=[new n_("a_position",32),new n_("a_texCoord",21),new n_("a_color",35,!0)],GR=[new n_("a_position",32),new n_("a_texCoord",21),new n_("a_color",44),new n_("a_color2",44)],UR=[new n_("a_position",32),new n_("a_texCoord",21),new n_("a_color",35,!0),new n_("a_color2",35,!0)];function HR(t){for(var e=0,i=0;i>2,this._initVDataCount,this._floatsPerVertex,ct(9005),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;tthis._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){var t=qo.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,a=this.indexOffset,o=0;o>2),l=new Uint16Array(this.iData.buffer,0,a),c=h.vertexBuffers[0];s>c.size&&c.resize(s),c.update(u),2*a>h.indexBuffer.size&&h.indexBuffer.resize(2*a),h.indexBuffer.update(l)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(qo.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=4*this._floatsPerVertex,s=t.createBuffer(new zd(10,3,r,r));n=t.createBuffer(new zd(6,3,2,2)),i=[s],this._iaInfo=new s_(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),qR=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=WR(e)>>2,this._vertexFormatBytes=4*this._floatsPerVertex}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),XR=new Ga((function(){return{offset:0,length:0}}),32),YR=function(){function t(t,e,i,n,r,s){this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),QR=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ne.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}s(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;ethis._vCount||e>this._iCount)return ot(9004,i),null;for(var n,r=null,s=0,a=-1,o=null,h=0;h=i){o=n[u],s=h,a=u;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,i>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,i),new YR(this,s,r,l,c,e)}return null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),XR.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){ut(this._buffers.length===this._freeLists.length,9003);var t=new jR,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=XR.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),wE.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},n(e,[{key:"id",get:function(){return this._id}}]),e}(qR);QR.IB_SCALE=4,QR.ID_COUNT=0;var KR,JR,ZR,$R,tF,eF,iF,nF,rF,sF,aF,oF=function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=0,this._subNode=null,this._render2dBuffer=null,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,4),i+=4,this._uint16SharedBuffer=new Uint16Array(e,i,2),i+=4,this._uint32SharedBuffer=new Uint32Array(e,i,5)}var e=t.prototype;return e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}]),t}(),hF=WR(NR)>>2,uF=t("u",function(){function t(t){void 0===t&&(t=NR),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=NR,this._drawInfoType=0,this._multiOwner=!1,this._batcher=null,this._floatStride=t===NR?hF:WR(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(){},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},n(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=wE.root.batcher2D),this._batcher}}]),t}()),lF=t("v",function(t){function e(e,i){var n;return void 0===e&&(e=NR),void 0===i&&(i=null),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}s(e,t),e.add=function(t,i){void 0===t&&(t=NR),void 0===i&&(i=null);var n=new e(t,i);return i||(i=wE.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=wf(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.clear=function(){this.resize(0,0),this._data.length=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=wE.root.device;return new QR(n,t,e,i)},n(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){for(var i=e.length;i>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new zd(10,1,i,i))),this._indexBuffer||(this._indexBuffer=t.createBuffer(new zd(6,1,2,2))),this._iaInfo=new s_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Ua((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},n(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(uF)),fF=new ns,dF=new ns,_F=new Kn,pF=new zr,mF=new zr,gF=new zr,vF=new zr(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),yF=new cs,bF=t("f",Bh("cc.UITransform")(KR=Ph(110)(KR=Eh((tF=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=ZR&&ZR(),e._anchorPoint=$R&&$R(),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiTransformComp=this},i.onLoad=function(){this.node.parent&&e.insertChangeMap(this.node.parent)},i.onEnable=function(){this.node.on("parent-changed",this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off("parent-changed",this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i,n,r=this._contentSize;if(void 0===e){if(Xi(t.width,r.width,ji)&&Xi(t.height,r.height,ji))return;i=t.width,n=t.height}else{if(Xi(t,r.width,ji)&&Xi(e,r.height,ji))return;i=t,n=e}r.width=i,r.height=n,this.node.emit("size-changed"),this._markRenderDataDirty()},i.setAnchorPoint=function(t,e){var i=this._anchorPoint;if(void 0===e){if(t.x===i.x&&t.y===i.y)return;i.x=t.x,i.y=t.y}else{if(t===i.x&&e===i.y)return;i.x=t,i.y=e}this.node.emit("anchor-changed",this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=fF,r=dF,s=this._getRenderScene().cameras,a=0;a=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=_F,s=fF,a=dF,o=this._getRenderScene().cameras,h=0;h=0&&a.y>=0&&a.x<=i&&a.y<=n&&(l=this._maskTest(s)),l)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&oh.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(gF),zr.invert(pF,gF),e||(e=new Kn),Kn.transformMat4(e,t,pF)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(gF),e||(e=new Kn),Kn.transformMat4(e,t,gF)},i.getBoundingBox=function(){var t=new cs;return this._selfBoundingBox(t),zr.fromSRT(mF,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(mF),t},i.getBoundingBoxToWorld=function(){for(var t=new cs,i=this.node.children,n=0;n=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){t&&t instanceof iT&&ot(12012),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){kF.parent=this._materials[t],kF.owner=this,kF.subModelIdx=t;var e=new iT(kF);kF.parent=null,kF.owner=null,kF.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){st(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setSharedMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getSharedMaterial(0)!==this._customMaterial&&this.setSharedMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setSharedMaterial(t,0),2!==this.stencilStage&&6!==this.stencilStage||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){if(this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler){this._assembler.updateColor(this);var t=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),t!==this._renderFlag){var e=this.renderData;e&&(e.vertDirty=!0)}}},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function PL(t,e){return Math.ceil(t/e)*e}var EL,kL,OL,RL,FL,LL,VL,NL,zL=function(){function t(t){this._format=0,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new kd,this._region1=new kd,this._region2=new kd,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=M_[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=N_(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,ML(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,ML(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),GL=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(0===this._dataType[e]?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}(),HL={POSITION:0,UV:3,COLOR:5,COUNT:9},WL=new UL(3,((EL={})[0]=1,EL[3]=1,EL[5]=0,EL[9]=2,EL),((kL={})[0]=3,kL[3]=2,kL[5]=4,kL[9]=1,kL),HL),jL={DIRTY_FLAG:0,LAYER:1,WORLD_SCALE:2,WORLD_POSITION:5,WORLD_ROTATION:8,WORLD_MATRIX:12,LOCAL_SCALE:28,LOCAL_POSITION:31,LOCAL_ROTATION:34,COUNT:38},qL=new UL(0,((OL={})[0]=0,OL[1]=0,OL[2]=1,OL[5]=1,OL[8]=1,OL[12]=1,OL[28]=1,OL[31]=1,OL[34]=1,OL[38]=2,OL),((RL={})[0]=1,RL[1]=1,RL[2]=3,RL[5]=3,RL[8]=4,RL[12]=16,RL[28]=3,RL[31]=3,RL[34]=4,RL[38]=1,RL),jL),XL={PRIORITY:0,STAGE:1,PHASE:2,PRIMITIVE:3,BATCHING_SCHEME:4,DYNAMIC_STATE:5,HASH:6,COUNT:7},YL=new UL(1,((FL={})[0]=0,FL[1]=0,FL[2]=0,FL[3]=0,FL[4]=0,FL[5]=0,FL[6]=0,FL[7]=2,FL),((LL={})[0]=1,LL[1]=1,LL[2]=1,LL[3]=1,LL[4]=1,LL[5]=1,LL[6]=1,LL[7]=1,LL),XL),QL={CENTER:0,HALFEXTENTS:3,COUNT:6},KL=new UL(2,((VL={})[0]=1,VL[3]=1,VL[6]=2,VL),((NL={})[0]=3,NL[3]=3,NL[6]=1,NL),QL);pt(QM.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),pt(QM.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),pt(_M.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var JL={};pt(JL,"CameraVisFlags",[{name:"GENERAL"}]),_t(JL,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:fv.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:fv.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:fv.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:fv.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:fv.BitMask,targetName:"UI_2D"}]),C.CameraVisFlags=JL;var ZL={};pt(ZL,"VisibilityFlags",[{name:"GENERAL"}]),_t(ZL,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:fv.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:fv.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:fv.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:fv.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:fv.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:fv.Enum,targetName:"UI_2D"}]),C.VisibilityFlags=ZL,_t(Pw.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),pt(nM.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),pt(tT.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),pt(EM.prototype,"SpotLight.prototype",[{name:"aspect"}]),_t(sM.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),pt(sM.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var $L=function(t){if(void 0===BL[t]){var e=1<=2*nV)l=2*nV;else for(;l<0;)l+=2*nV;else if(hV(l)>=2*nV)l=2*-nV;else for(;l>0;)l-=2*nV;for(h=0|sV(1,rV(hV(l)/(.5*nV)+.5,5)),c=hV(4/3*(1-aV(o=l/h/2))/oV(o)),a||(c=-c),x=0;x<=h;x++)_=e+(f=aV(u=r+l*(x/h)))*n,p=i+(d=oV(u))*n,m=-d*n*c,g=f*n*c,0===x?t.moveTo(_,p):t.bezierCurveTo(v+b,y+S,_-m,p-g,_,p),v=_,y=p,b=m,S=g}function fV(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*lV,e-n*lV,i+r,e,i+r),t.bezierCurveTo(e+n*lV,i+r,e+n,i+r*lV,e+n,i),t.bezierCurveTo(e+n,i-r*lV,e+n*lV,i-r,e,i-r),t.bezierCurveTo(e-n*lV,i-r,e-n,i-r*lV,e-n,i),t.close()}function dV(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=rV(s,.5*hV(n))*uV(n),o=rV(s,.5*hV(r))*uV(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-lV),e+a*(1-lV),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-lV),i+r,e+n,i+r-o*(1-lV),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-lV),e+n-a*(1-lV),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-lV),i,e,i+o*(1-lV),e,i+o),t.close()}}function _V(t,e,i,n,r,s,a,o,h,u,l){var c,f,d,_,p,m,g,v,y,b,S,x,w,T,C,A;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(d=.5*(n+s))),v=.5*((f=.5*(i+r))+(_=.5*(r+a))),((C=hV((n-o)*(T=h-i)-(r-h)*(w=o-e)))+(A=hV((s-o)*T-(a-h)*w)))*(C+A)0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(1===this.type){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){3!==this._type?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(_N);if(!t){var e=this.node;t=this._sprite=e.addComponent(_N)}}this._sprite.stencilStage=this.inverted?6:2,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(tN);if(!t){var e=this.node;t=this._graphics=e.addComponent(tN)}t.lineWidth=1;var i=nr.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?6:2},i._updateGraphics=function(){if(this._graphics&&(0===this._type||1===this._type)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(0===this._type)e.rect(a,o,n,r);else if(1===this._type){for(var h=yN(new Kn(a+n/2,o+r/2,0),new Kn(n/2,r/2,0),this._segments),u=0;up?0:_>0?_:p}T.Canvas=Pz,pt(t("U",Bh("cc.UIComponent")(Dz=Mh(bF)(Dz=Ph(110)(Dz=Eh(Dz=function(t){function e(){var e;return(e=t.call(this)||this)._lastParent=null,e.stencilStage=0,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){},i.onDisable=function(){},i.onDestroy=function(){this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null)},i.postUpdateAssembler=function(){},i.markForUpdateRenderData=function(){},i.setNodeDirty=function(){},i.setTextureDirty=function(){},e}(Ym))||Dz)||Dz)||Dz)||Dz).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),_t(Pz.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){var t;return null===(t=this._cameraComponent)||void 0===t?void 0:t.camera}},{name:"clearFlag",newName:"cameraComponent.clearFlags",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearFlags:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearFlags=t)}},{name:"color",newName:"cameraComponent.clearColor",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearColor:nr.BLACK},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearColor=t)}},{name:"priority",newName:"cameraComponent.priority",customGetter:function(){return this._cameraComponent?this._cameraComponent.priority:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.priority=t)}},{name:"targetTexture",newName:"cameraComponent.targetTexture",customGetter:function(){return this._cameraComponent?this._cameraComponent.targetTexture:null},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.targetTexture=t)}},{name:"visibility",newName:"cameraComponent.visibility",customGetter:function(){return this._cameraComponent?this._cameraComponent.visibility:0}}]),mt(bF.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),T.UITransformComponent=bF,ue(bF,"cc.UITransformComponent"),ue(VF,"cc.RenderComponent"),T.CanvasComponent=Pz,ue(Pz,"cc.CanvasComponent"),T.internal.Renderable2D=VF,ue(VF,"cc.Renderable2D");var kz,Oz,Rz,Fz,Lz,Vz,Nz,zz,Gz=(kz=La.create(),Oz={distance:1/0,doubleSided:!1,mode:2},Rz=0,Fz=function(t,e,i,n,r,s){1===t?(Rz>e||0===Rz)&&(Rz=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(Rz=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},Lz=function(t,e,i,n,r){if(7===i)for(var s=e.length,a=0;ar.distance)&&(Fz(r.mode,l,o,h,u,r.result),2===r.mode))return l}else if(8===i)for(var c=e.length-2,f=0,d=0;dr.distance)&&(Fz(r.mode,g,_,p,m,r.result),2===r.mode))return g}else if(9===i){var v=e.length-1,y=3*e[0];Kn.set(kz.a,t[y],t[y+1],t[y+2]);for(var b=1;br.distance)&&(Fz(r.mode,w,y,S,x,r.result),2===r.mode))return w}}return Rz},function(t,e,i){if(Rz=0,0===e.geometricInfo.positions.length)return Rz;var n=void 0===i?Oz:i;if(Ez(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo,a=s.positions,o=s.indices;Lz(a,o,r,t,n)}return Rz}),Uz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:2};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!Ez(i,o,h))return t;for(var u=0;uc)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),2===s.mode)return c}return t&&1===s.mode&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Hz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:2},i=new Bs,n=new zr;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Pa.rayAABB(r,h))return t;Bs.copy(i,r),s.node&&(zr.invert(n,s.node.getWorldMatrix(n)),Kn.transformMat4(i.o,r.o,n),Kn.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;lf)&&(t=f,o.subIndices&&(o.subIndices[0]=l));else if(t=f,o.subIndices&&o.subIndices.push(l),2===o.mode)return f}return t&&1===o.mode&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();Pa.rayModel=Hz,Pa.raySubMesh=Gz,Pa.rayMesh=Uz,Aw("specular-pass");var Wz,jz,qz,Xz,Yz,Qz,Kz,Jz,Zz,$z,tG,eG,iG,nG,rG,sG,aG=t("dO",Bh("cc.ModelRenderer")((Nz=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=zz&&zz(),e._models=[],e._priority=0,e}s(e,t);var i=e.prototype;return i._collectModels=function(){return this._models},i.onEnable=function(){this._updatePriority()},i._attachToScene=function(){},i._detachFromScene=function(){},i._onVisibilityChange=function(){},i._updatePriority=function(){if(this._models.length>0)for(var t=0;tc;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a)}for(var f=1e3,d=1;f&&r0&&(d=_[0].length),s+=d,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),f--}for(;f&&a.length>=2&&h.x>c;)s-=d,a=n.substring(r,s),this._calculateSize(h,e,a),d=1,f--;if(a.length>=2){var p=QO(a);p&&p.length>0&&a!==p[0]&&(s-=p[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),this._calculateSize(u,e,o),this._calculateSize(h,e,a),f--,u.x<2048&&h.x=0;e--){var i=t[e];if(i.name===RG||i.name===FG){i.parent=null;var n=GG(i.name);n.node=i,i.name===RG?(n.comp=i.getComponent(DL),NG.put(n)):(n.comp=i.getComponent(_N),zG.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==RG&&i.name!==FG||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(DL);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var u=KO(t,n,this._maxWidth,this._measureText(i)),l=0;l1&&l0?(o*=a=l/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else st(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+DO)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=HO(t,e);if(NO(n)||zO(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case 0:break;case 1:u-=this._linesWidth[h-1]/2;break;case 2:u-=this._linesWidth[h-1]}var l=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(_N)){var c=o.node.position.clone(),f=this._lineHeight,d=this._lineHeight*(1+DO);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=f+(d-f)/2;break;case.5:c.y+=d/2;break;default:c.y+=(d-f)/2}if(o.imageOffset){var _=o.imageOffset.split(",");if(1===_.length&&_[0]){var p=parseFloat(_[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===_.length){var m=parseFloat(_[0]),g=parseFloat(_[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(DL);if(v&&v.enableOutline){var y=o.node.position.clone();y.y-=v.outlineWidth,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return nr[e]?nr[e]:(new nr).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(DL);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(i.color?e.color=this._convertLiteralColorValue(i.color):e.color=this._fontColor,e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(DL);r||(r=t.node.addComponent(DL)),r.enableOutline=!0,r.outlineColor=this._convertLiteralColorValue(i.outline.color),r.outlineWidth=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof CO&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=p(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=this._fontColor,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontColor",get:function(){return this._fontColor},set:function(t){this._fontColor!==t&&(this._fontColor=t,this._updateTextDefaultColor())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(Ym),kG.HorizontalAlign=wL,kG.VerticalAlign=TL,y((vG=kG).prototype,"horizontalAlign",[cG],Object.getOwnPropertyDescriptor(vG.prototype,"horizontalAlign"),vG.prototype),y(vG.prototype,"verticalAlign",[fG],Object.getOwnPropertyDescriptor(vG.prototype,"verticalAlign"),vG.prototype),y(vG.prototype,"fontColor",[dG],Object.getOwnPropertyDescriptor(vG.prototype,"fontColor"),vG.prototype),y(vG.prototype,"font",[_G],Object.getOwnPropertyDescriptor(vG.prototype,"font"),vG.prototype),y(vG.prototype,"cacheMode",[pG],Object.getOwnPropertyDescriptor(vG.prototype,"cacheMode"),vG.prototype),y(vG.prototype,"imageAtlas",[mG],Object.getOwnPropertyDescriptor(vG.prototype,"imageAtlas"),vG.prototype),yG=yh(vG.prototype,"_lineHeight",[Uh],(function(){return 40})),bG=yh(vG.prototype,"_string",[Uh],(function(){return"RichText"})),SG=yh(vG.prototype,"_horizontalAlign",[Uh],(function(){return 0})),xG=yh(vG.prototype,"_verticalAlign",[Uh],(function(){return 0})),wG=yh(vG.prototype,"_fontSize",[Uh],(function(){return 40})),TG=yh(vG.prototype,"_fontColor",[Uh],(function(){return nr.WHITE.clone()})),CG=yh(vG.prototype,"_maxWidth",[Uh],(function(){return 0})),AG=yh(vG.prototype,"_fontFamily",[Uh],(function(){return"Arial"})),DG=yh(vG.prototype,"_font",[Uh],(function(){return null})),IG=yh(vG.prototype,"_isSystemFontUsed",[Uh],(function(){return!0})),BG=yh(vG.prototype,"_userDefinedFont",[Uh],(function(){return null})),MG=yh(vG.prototype,"_cacheMode",[Uh],(function(){return 0})),PG=yh(vG.prototype,"_imageAtlas",[Uh],(function(){return null})),EG=yh(vG.prototype,"_handleTouchEvent",[Uh],(function(){return!0})),gG=vG))||gG)||gG));T.RichText=WG;var jG,qG=t("m",Bh("cc.UIMeshRenderer")(HG=Ph(110)(HG=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=0,e._renderData=null,e._renderEntity=new LF(1),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){cE.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){cE.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):st(16378,this.node?this.node.name:"")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)a=CU(s,t[s],t[s+1],a);return a&&yU(a,a.next)&&(AU(a),a=a.next),a}function oU(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!yU(i,i.next)&&0!==vU(i.prev,i,i.next))i=i.next;else{if(AU(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function hU(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&dU(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?lU(t,n,r,s):uU(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),AU(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?hU(t=cU(t,e,i),e,i,n,r,s,2):2===a&&fU(t,e,i,n,r,s):hU(oU(t),e,i,n,r,s,1);break}}}function uU(t){var e=t.prev,i=t,n=t.next;if(vU(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(mU(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&vU(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function lU(t,e,i,n){var r=t.prev,s=t,a=t.next;if(vU(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=pU(o,h,e,i,n),f=pU(u,l,e,i,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&mU(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&vU(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&mU(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&vU(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function cU(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!yU(r,s)&&bU(r,n,n.next,s)&&xU(r,s)&&xU(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),AU(n),AU(n.next),n=t=s),n=n.next}while(n!==t);return n}function fU(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&gU(a,o)){var h=TU(a,o);return a=oU(a,a.next),h=oU(h,h.next),hU(a,e,i,n,r,s),void hU(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function dU(t,e,i,n){var r=t;do{null===r.z&&(r.z=pU(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,_U(r)}function _U(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1);return t}function pU(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function mU(t,e,i,n,r,s,a,o){return(r-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function gU(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!SU(t,e)&&xU(t,e)&&xU(e,t)&&wU(t,e)}function vU(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function yU(t,e){return t.x===e.x&&t.y===e.y}function bU(t,e,i,n){return!!(yU(t,e)&&yU(i,n)||yU(t,n)&&yU(i,e))||vU(t,e,i)>0!=vU(t,e,n)>0&&vU(i,n,t)>0!=vU(i,n,e)>0}function SU(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&bU(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function xU(t,e){return vU(t.prev,t,t.next)<0?vU(t,e,t.next)>=0&&vU(t,t.prev,e)>=0:vU(t,e,t.prev)<0||vU(t,t.next,e)<0}function wU(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}function TU(t,e){var i=new sU(t.i,t.x,t.y),n=new sU(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function CU(t,e,i,n){var r=new sU(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function AU(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function DU(t,e,i,n){for(var r=0,s=e,a=i-n;s80*i){a=h=t[0],o=u=t[1];for(var d=i;dh&&(h=l),c>u&&(u=c);f=Math.max(h-a,u-o)}return hU(r,s,i,a,o,f),s}for(var BU=Math.PI,MU=Math.min,PU=Math.max,EU=Math.ceil,kU=Math.acos,OU=Math.cos,RU=Math.sin,FU=Math.atan2,LU=null,VU=null,NU=new nr,zU=[],GU=0;GU<4;GU++)zU.push(new Kn);function UU(t,e,i){var n=2*kU(t/(t+i));return PU(2,EU(e/n))}function HU(t,e,i){return ti?i:t}var WU={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!VU)return null;var i=VU.getRenderDataList(),n=i[VU.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++VU.dataOffset,VU.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var b=1/_;b>600&&(b=600),f.dmx*=b,f.dmy*=b}f.dx*c.dy-c.dx*f.dy>0&&(f.flags|=2),_*(p=PU(11,MU(c.len,f.len)*r))*p<1&&(f.flags|=8),1&f.flags&&(_*n*n<1||0===i||1===i)&&(f.flags|=4),12&f.flags&&h.bevel++,c=f,f=u[d+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;hm&&(g-=2*BU),this._vSet(f,d,1),this._vSet(u-s*n,e.y-a*n,-1);for(var v=HU(EU((m-g)/BU)*r,2,r),y=0;yXU||n.canvasSize.height>XU)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=XU/o;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,a){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,a)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,a))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&tu?o:u}var l=o,c=(s.length+DO)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=l+i.canvasPadding.width*this._fontScale,i.canvasSize.height=c+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(l+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(c+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case 2:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case 1:this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case 3:this._calculateWrapText(r,t,e,i);var f=(i.parsedString.length+DO)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=f+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(f+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),a=0,o=0,h=0,u=e.actualFontSize;if(i.wrapping){var l=n.nodeContentSize.width*this._fontScale,c=n.nodeContentSize.height*this._fontScale;if(l<0||c<0)return;o=c+1;for(var f=0,d=0|e.actualFontSize+1,_=0;f>1)<=0){et(4003);break}u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;ac?d=_-1:f=_}0===f?et(4003):(u=f,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(o=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),a=0;a1&&i.hasShadow,a=this._measureText(this._context,i.fontDesc),o=0,h=0,u=0;u0&&this._isVerticalClamp(t,e,i,n,this)&&this._shrinkLabelToContentSize(t,e,i,n,this._isVerticalClamp),t.fontSize>0&&this._isHorizontalNeedShrink(e,i)&&this._shrinkLabelToContentSize(t,e,i,n,this._isHorizontalClamp)),this._parsedString(i,n)},e._parsedString=function(t,e){for(var i=[],n="",r=0,s=0,a=UO(e);r0&&h>0&&A+_.w*t.bmfontScale>e.maxLineWidth&&!zO(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,x=!0;break}w.x=A,w.y=u-_.offsetY*t.bmfontScale,this._recordLetterInfo(w,m,C,o),C+1w.y-_.h*t.bmfontScale&&(y=w.y-_.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,m),null!=t.fntConfig?et(16354,t.fntConfig.atlasName,m):et(16355,t.fontFamily,m);else this._recordPlaceholderInfo(C,m)}x||(h=S,fy&&(d=y),l<(c=b)&&(l=c),p+=g)}else e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}return e.linesWidth.push(c),e.numberOfLines=o+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(l.toFixed(2))+2*RR.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*RR.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,f>0&&(e.tailoredTopY=i.nodeContentSize.height+f),d<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+d),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new KU;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+WO(e,0)+RR.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new KU;this._lettersInfo.push(r)}var s=""+WO(e,0)+RR.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=RR.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=HO(i,n);if(NO(s)||"\n"===s||zO(s))return 1;var a=1,o=RR.fontAtlas.getLetterDefinitionForChar(s,RR);if(!o)return a;for(var h=o.xAdvance*t.bmfontScale+e.spacingX,u=n+1;ue.maxLineWidth&&!zO(s)&&e.maxLineWidth>0)return a;if(h+=o.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||zO(s)||NO(s))break;a++}return a},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case 0:for(var n=0;ni.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=UO(n);a0)if(e.wrapping){if(e.linesWidth[c]>i.nodeContentSize.width&&(l>i.nodeContentSize.width||l<0)){s=!0;break}}else if(l>i.nodeContentSize.width){s=!0;break}}}return s},e._isHorizontalNeedShrink=function(t,e){for(var i=0,n=t.linesWidth.length;ie.nodeContentSize.width)return!0;return!1},e._shrinkLabelToContentSize=function(t,e,i,n,r){for(var s=0,a=0|t.actualFontSize,o=0;s>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?a=o-1:s=o}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var a=t.spriteFrame?t.spriteFrame.texture:RR.fontAtlas.getTexture(),o=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,l=UO(r);u0){if(d>e.tailoredTopY){var _=d-e.tailoredTopY;this._tmpRect.y+=_,this._tmpRect.height-=_,d-=_}d-this._tmpRect.height*t.bmfontScale0&&this._isHorizontalClamped(e,i,m,p)&&1===e.overFlow&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),v=c.x+e.linesOffsetX[c.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,a,this._tmpRect,g,v-o,d-h)}}else st(16353)}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),a=s.x+(n.width-r.width)/2,o=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-o,this._tmpRect.y=h+r.y-a,this._tmpRect.y<0&&(this._tmpRect.height+=o)}else this._tmpRect.x+=r.x-a,this._tmpRect.y+=r.y+o;return i},t}();JU.instance=void 0,JU.instance=new JU;var ZU=new OR(64,64),$U=new TR(null),tH=null,eH=null,iH=null,nH=null,rH=null,sH={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=iH?iH.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var a=r.overflow;e.overFlow=a,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,0===a?(e.wrapping=!1,i.nodeContentSize.width+=2*RR.margin,i.nodeContentSize.height+=2*RR.margin):3===a?(e.wrapping=!0,i.nodeContentSize.height+=2*RR.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,RR.lineHeight=r.lineHeight,RR.fontSize=r.fontSize,t.spriteFrame=nH,t.fntConfig=iH,t.fontFamily=RR.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&tH!==t){if(t.renderData.vertDirty){eH=(tH=t).node._uiProps.uiTransformComp;var e=t.renderData,i=JU.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=pk.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,eH),this._updateLabelInfo(t),n.fontDesc=RR.fontDesc,i.processingString(!0,n,r,s,t.string),a.quadCount=0,i.generateRenderInfo(!0,n,r,s,a,t.string,this.generateVertexData),e.dataLength!==a.quadCount&&(this.resetRenderData(t),e.dataLength=a.quadCount,e.resize(e.dataLength,e.dataLength/2*3));for(var o=e.data,h=0,u=a.quadCount;h0?(RR.isOutlined=!0,RR.margin=t.outlineWidth,RR.out=t.outlineColor.clone(),RR.out.a=t.outlineColor.a*t.color.a/255):(RR.isOutlined=!1,RR.margin=0)},_getFontFamily:function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},_updateLabelInfo:function(t){RR.fontDesc=this._getFontDesc(),RR.color=t.color,RR.hash=FR(RR)},_getFontDesc:function(){return RR.fontSize.toString()+"px "+RR.fontFamily}}),lH=new nr(255,255,255,255),cH={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;lH.a=255*e._uiProps.opacity,bp(e,0,t.renderData,lH)}},updateColor:function(){}};Jt(cH,uH),DL.Overflow;var fH={updateProcessingData:function(t,e,i,n,r,s){t.isSystemFontUsed=r.useSystemFont,t.fontSize=r.fontSize,i.nodeContentSize.width=i.canvasSize.width=s.width,i.nodeContentSize.height=i.canvasSize.height=s.height,e.lineHeight=r.lineHeight,e.overFlow=r.overflow,0===r.overflow?e.wrapping=!1:3===r.overflow?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight,r.enableOutline&&r.outlineWidth>0?(t.isOutlined=!0,t.outlineColor.set(r.outlineColor),t.outlineWidth=r.outlineWidth):t.isOutlined=!1,r.enableShadow&&(r.shadowBlur>0||!Xi(r.shadowOffset.x,0)||!Xi(r.shadowOffset.y,0))?(t.hasShadow=!0,t.shadowColor.set(r.shadowColor),t.shadowBlur=r.shadowBlur,t.shadowOffsetX=r.shadowOffset.x,t.shadowOffsetY=r.shadowOffset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},getAssemblerData:function(){var t=DL._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&DL._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=JU.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=pk.getScaleX(),this.updateProcessingData(n,r,s,a,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,a,t.string,this.generateVertexData);var o=t.renderData;o.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=o.data;h[0]=a.vertexBuffer[0],h[1]=a.vertexBuffer[1],h[2]=a.vertexBuffer[2],h[3]=a.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,a=i.uiTransAnchorX*r,o=i.uiTransAnchorY*s;n[0].x=-a,n[0].y=-o,n[1].x=r-a,n[1].y=-o,n[2].x=-a,n[2].y=s-o,n[3].x=r-a,n[3].y=s-o},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(1!==t.cacheMode||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;xk.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(1===t.cacheMode){var e=t.ttfSpriteFrame;xk.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},dH=nr.WHITE.clone(),_H=Uint16Array.from([0,1,2,1,3,2]),pH={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)nr.toArray(i,dH,n),n+=9;return e.chunk.setIndexBuffer(_H),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,u=n.length,l=0;l1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,h=0,u=0,l=0,c=0,f=0,d=0,_=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,l=f=h,_=m=(o.x+o.height)/s,d=g=u,c=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,l=_=h,f=m=(o.x+o.width)/s,c=d=u,p=g=o.y/a),t.fillType){case 0:r[3]=l+(f-l)*e,r[4]=c+(d-c)*e,r[12]=l+(f-l)*i,r[13]=c+(d-c)*i,r[21]=_+(m-_)*e,r[22]=p+(g-p)*e,r[30]=_+(m-_)*i,r[31]=p+(g-p)*i;break;case 1:r[3]=l+(_-l)*e,r[4]=c+(p-c)*e,r[12]=f+(m-f)*e,r[13]=d+(g-d)*e,r[21]=l+(_-l)*i,r[22]=c+(p-c)*i,r[30]=f+(m-f)*i,r[31]=d+(g-d)*i;break;default:ot(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,u=-o,l=-h,c=s-o,f=a-h,d=0;switch(t.fillType){case 0:d=u+(c-u)*i,u+=(c-u)*e,c=d;break;case 1:d=l+(f-l)*i,l+=(f-l)*e,f=d;break;default:ot(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=f,n[3].x=c,n[3].y=f},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(vH);for(var i,n=p(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(gH);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,l=gH.m03*h+gH.m07*u+gH.m15;l=l?1/l:1,r[s=a*i]=(gH.m00*h+gH.m04*u+gH.m12)*l,r[s+1]=(gH.m01*h+gH.m05*u+gH.m13)*l,r[s+2]=(gH.m02*h+gH.m06*u+gH.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},bH=2*Math.PI,SH=1e-6,xH=new zr,wH=[new ns,new ns,new ns,new ns],TH=new Array(4),CH=new Array(8),AH=[new ns,new ns,new ns,new ns],DH=[new ns,new ns,new ns,new ns],IH=new ns,BH=[new ns,new ns,new ns,new ns],MH=null;function PH(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>SH?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>SH?h:0)){if(u=o/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var f=r.y+u*(e-r.x);a[2].x=e,a[2].y=f}}if(0!==o){if(l=h/o,(n-r.y)*o>0){var d=r.x+l*(n-r.y);a[3].x=d,a[3].y=n}if((i-r.y)*o>0){var _=r.x+l*(i-r.y);a[1].x=_,a[1].y=i}}}function EH(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,u=n-s,l=TH;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,f=IH.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,d=IH.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;wH[0].x=wH[3].x=a,wH[1].x=wH[2].x=h,wH[0].y=wH[1].y=o,wH[2].y=wH[3].y=u;for(var _=0,p=BH;_0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function RH(t,e,i,n,r){var s=TH,a=s[0],o=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,FH((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),FH((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),FH((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function FH(t,e,i,n){var r=CH,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var LH={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;xk.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=bH)+(s*=bH);EH(t),kH(e),PH(TH[0],TH[2],TH[1],TH[3],IH,r,AH),PH(TH[0],TH[2],TH[1],TH[3],IH,r+s,DH);for(var o=0,h=0;h<4;++h){var u=BH[h];if(u)if(s>=bH)i.dataLength=o+3,RH(n,o,IH,wH[u.x],wH[u.y]),o+=3;else{var l=OH(IH,wH[u.x]),c=OH(IH,wH[u.y]);c=a||(l>=r?(i.dataLength=o+3,RH(n,o,IH,wH[u.x],c>=a?DH[h]:wH[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,RH(n,o,IH,AH[h],wH[u.y]),o+=3):(i.dataLength=o+3,RH(n,o,IH,AH[h],DH[h]),o+=3))),l+=bH,c+=bH}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){MH=null,MH=new Uint16Array(t);for(var e=0,i=0;i1?1:p,m=Number.isNaN(m)||m>1?1:m,d=d<0?0:d,_=_<0?0:_,zH[0].x=-a,zH[0].y=-o,zH[1].x=u*p-a,zH[1].y=f*m-o,zH[2].x=zH[1].x+d,zH[2].y=zH[1].y+_,zH[3].x=r-a,zH[3].y=s-o;for(var g=0;g<4;g++)for(var v=0;v<4;v++){var y=4*g+v;y0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var eW={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,u=a.width-o-h,l=i.insetTop,c=i.insetBottom,f=a.height-l-c,d=r-o-h,_=s-l-c;d=d>0?d:0,_=_>0?_:0;var p=0===u?d:d/u,m=0===f?_:_/f,g=tW(i),v=Math.ceil(m+g),y=Math.ceil(p+g);e.dataLength=4*v*y,this.updateVerts(t,d,_,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;$H=new Uint16Array(t);for(var i=0,n=0;n1?1:o.width/(p+m),x=o.height/(v+y)>1?1:o.height/(v+y);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=b>0?Math.floor(1e3*i)/1e3%b==0?b:i%b:i,ZH.length=0,JH=Math.max(n+1,r+1);for(var w=0;w=r?c-d:C*g-d,ZH[C].y=C>=n?f-_:C*b-_;else for(var A=0;A1&&A0?p*S-d+g*(A-1):p+e-d:A===r-1?ZH[A].x=p*S-d+s+g*(A-2):A>=r&&(ZH[A].x=Math.min(p+e+m,c)-d),0===A?ZH[A].y=-_:1===A?ZH[A].y=y*x-_:A>1&&A0?y*x-_+b*(A-1):y+i-_:A===n-1?ZH[A].y=y*x-_+a+b*(A-2):A>=n&&(ZH[A].y=Math.min(y+i+v,f)-_);for(var D=0,I=0,B=0,M=0,P=0;Pb?i>=(T>0?U:U+1)*b?1:N%1:N;for(var H=0;Hg?e>=(T>0?H:H+1)*g?1:V%1:V,O?(0===T?(z[0]=qH.u,z[1]=qH.u,z[2]=qH.u+(XH.u-qH.u)*L,G[0]=HH.v,G[1]=HH.v+(WH.v-HH.v)*F,G[2]=HH.v):(0===U?(z[0]=UH.u,z[1]=UH.u,z[2]=qH.u):U0){var h=a.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(a._handleEventTouch(t),"touch-end"!==t.type&&"touch-cancel"!==t.type||(ve(a.claimedTouchIdList,h),t.preventSwallow||this._removeClaimedTouch(s+1,n.getID())),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._removeClaimedTouch=function(t,e){for(var i=this._pointerEventProcessorList,n=i.length,r=t;re)for(;e0){for(var t=this._meshDataArray.length,e=0;e0){Sp(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),nW.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=Cw.get("default-clear-stencil"),this._maskClearModel=T.director.root.createModel(_M);var t=WR(LR),e=vp.gfxDevice,i=e.createBuffer(new zd(10,1,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new zd(6,1,12,2)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new OE([i],LR,7,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=nW.sharedManager;e.pushMask(1);var i=e.clear(t),n=null,r=0,s=this._maskClearMtl;s&&(n=e.getStencilStage(i,s),r=e.getStencilHash(i));var a=this._maskClearModel,o=T.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h=0;a--){var o=i[a],h=t[o];t.splice(o,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i>>0},t.getLayerIndex=function(t){void 0===t&&(t=0);var e=0;return this.indexMap.has(t)?e=this.indexMap.get(t):ot(2105),e},t.getLayerIndexByName=function(t){var e=this.getLayerByName(t);return this.getLayerIndex(e)},t.getLayerName=function(t){void 0===t&&(t=0);var e="";return this.nameMap.has(t)?e=this.nameMap.get(t):ot(2105),e},t.getLayerByName=function(t){for(var e=this.nameMap.size,i=this.nameMap.keys(),n=0,r=0;r=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},e.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},e.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;n0&&this.bindposes.length>0},n(e,[{key:"joints",get:function(){return this._joints},set:function(t){this._joints=t}},{key:"bindposes",get:function(){return this._bindposes},set:function(t){this._bindposes=t}},{key:"inverseBindposes",get:function(){if(!this._invBindposes){this._invBindposes=[];for(var t=0;tJw.LEVEL_1},set:function(t){this._csmLevel=t?Jw.LEVEL_4:Jw.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,tT.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(sY),kq=yh(Eq.prototype,"_illuminanceHDR",[aY,Xj],(function(){return 65e3})),Oq=yh(Eq.prototype,"_illuminanceLDR",[oY],(function(){return 65e3*nM.standardExposureValue})),Rq=yh(Eq.prototype,"_shadowEnabled",[oY],(function(){return!1})),Fq=yh(Eq.prototype,"_shadowPcf",[oY],(function(){return Kw.HARD})),Lq=yh(Eq.prototype,"_shadowBias",[oY],(function(){return 1e-5})),Vq=yh(Eq.prototype,"_shadowNormalBias",[oY],(function(){return 0})),Nq=yh(Eq.prototype,"_shadowSaturation",[oY],(function(){return 1})),zq=yh(Eq.prototype,"_shadowDistance",[oY],(function(){return 50})),Gq=yh(Eq.prototype,"_shadowInvisibleOcclusionRange",[oY],(function(){return 200})),Uq=yh(Eq.prototype,"_csmLevel",[oY],(function(){return Jw.LEVEL_4})),Hq=yh(Eq.prototype,"_csmLayerLambda",[oY],(function(){return.75})),Wq=yh(Eq.prototype,"_csmOptimizationMode",[oY],(function(){return Zw.RemoveDuplicates})),jq=yh(Eq.prototype,"_csmAdvancedOptions",[oY],(function(){return!1})),qq=yh(Eq.prototype,"_csmLayersTransition",[oY],(function(){return!1})),Xq=yh(Eq.prototype,"_csmTransitionRange",[oY],(function(){return.05})),Yq=yh(Eq.prototype,"_shadowFixedArea",[oY],(function(){return!1})),Qq=yh(Eq.prototype,"_shadowNear",[oY],(function(){return.1})),Kq=yh(Eq.prototype,"_shadowFar",[oY],(function(){return 10})),Jq=yh(Eq.prototype,"_shadowOrthoSize",[oY],(function(){return 5})),y(Eq.prototype,"illuminance",[Yj],Object.getOwnPropertyDescriptor(Eq.prototype,"illuminance"),Eq.prototype),y(Eq.prototype,"shadowEnabled",[Qj,Kj],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowEnabled"),Eq.prototype),y(Eq.prototype,"shadowPcf",[Jj,Zj],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowPcf"),Eq.prototype),y(Eq.prototype,"shadowBias",[$j,tq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowBias"),Eq.prototype),y(Eq.prototype,"shadowNormalBias",[eq,iq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowNormalBias"),Eq.prototype),y(Eq.prototype,"shadowSaturation",[nq,rq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowSaturation"),Eq.prototype),y(Eq.prototype,"shadowDistance",[sq,aq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowDistance"),Eq.prototype),y(Eq.prototype,"shadowInvisibleOcclusionRange",[oq,hq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowInvisibleOcclusionRange"),Eq.prototype),y(Eq.prototype,"csmLevel",[uq,lq],Object.getOwnPropertyDescriptor(Eq.prototype,"csmLevel"),Eq.prototype),y(Eq.prototype,"enableCSM",[cq,fq],Object.getOwnPropertyDescriptor(Eq.prototype,"enableCSM"),Eq.prototype),y(Eq.prototype,"csmLayerLambda",[dq,_q],Object.getOwnPropertyDescriptor(Eq.prototype,"csmLayerLambda"),Eq.prototype),y(Eq.prototype,"csmOptimizationMode",[pq,mq],Object.getOwnPropertyDescriptor(Eq.prototype,"csmOptimizationMode"),Eq.prototype),y(Eq.prototype,"shadowFixedArea",[gq,vq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowFixedArea"),Eq.prototype),y(Eq.prototype,"shadowNear",[yq,bq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowNear"),Eq.prototype),y(Eq.prototype,"shadowFar",[Sq,xq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowFar"),Eq.prototype),y(Eq.prototype,"shadowOrthoSize",[wq,Tq],Object.getOwnPropertyDescriptor(Eq.prototype,"shadowOrthoSize"),Eq.prototype),y(Eq.prototype,"csmAdvancedOptions",[Cq,Aq],Object.getOwnPropertyDescriptor(Eq.prototype,"csmAdvancedOptions"),Eq.prototype),y(Eq.prototype,"csmLayersTransition",[Dq,Iq],Object.getOwnPropertyDescriptor(Eq.prototype,"csmLayersTransition"),Eq.prototype),y(Eq.prototype,"csmTransitionRange",[Bq,Mq],Object.getOwnPropertyDescriptor(Eq.prototype,"csmTransitionRange"),Eq.prototype),Pq=Eq))||Pq)),cY=t("ag",(Zq=Bh("cc.SphereLight"),$q=Hh("_luminance"),tX=fu(hi),eX=fu(hi),iX=fu(nY),nX=fu(ui),rX=fu(ui),Zq((aX=function(t){function e(){var e;return(e=t.call(this)||this)._size=oX&&oX(),e._luminanceHDR=hX&&hX(),e._luminanceLDR=uX&&uX(),e._term=lX&&lX(),e._range=cX&&cX(),e._lightType=CM,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=1,this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*bM(this._size):this._luminanceLDR},set:function(t){var e=0;T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/bM(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(sY),oX=yh(aX.prototype,"_size",[Uh],(function(){return.15})),hX=yh(aX.prototype,"_luminanceHDR",[Uh,$q],(function(){return 1700/bM(.15)})),uX=yh(aX.prototype,"_luminanceLDR",[Uh],(function(){return 1700/bM(.15)*nM.standardExposureValue*nM.standardLightMeterScale})),lX=yh(aX.prototype,"_term",[Uh],(function(){return nY.LUMINOUS_FLUX})),cX=yh(aX.prototype,"_range",[Uh],(function(){return 1})),y(aX.prototype,"luminousFlux",[tX],Object.getOwnPropertyDescriptor(aX.prototype,"luminousFlux"),aX.prototype),y(aX.prototype,"luminance",[eX],Object.getOwnPropertyDescriptor(aX.prototype,"luminance"),aX.prototype),y(aX.prototype,"term",[iX],Object.getOwnPropertyDescriptor(aX.prototype,"term"),aX.prototype),y(aX.prototype,"size",[nX],Object.getOwnPropertyDescriptor(aX.prototype,"size"),aX.prototype),y(aX.prototype,"range",[rX],Object.getOwnPropertyDescriptor(aX.prototype,"range"),aX.prototype),sX=aX))||sX)),fY=fu,dY=Uh,_Y=Hh,pY=kh,mY=t("ah",(fX=Bh("cc.SpotLight"),dX=_Y("_luminance"),_X=fY(nY),pX=fY(ui),mX=pY({group:{name:"DynamicShadowSettings",displayOrder:1}}),gX=fY(li),vX=pY({group:{name:"DynamicShadowSettings",displayOrder:2}}),yX=fY(Kw),bX=pY({group:{name:"DynamicShadowSettings",displayOrder:3}}),SX=fY(ui),xX=pY({group:{name:"DynamicShadowSettings",displayOrder:4}}),wX=fY(ui),fX((CX=function(t){function e(){var e;return(e=t.call(this)||this)._size=AX&&AX(),e._luminanceHDR=DX&&DX(),e._luminanceLDR=IX&&IX(),e._term=BX&&BX(),e._range=MX&&MX(),e._spotAngle=PX&&PX(),e._angleAttenuationStrength=EX&&EX(),e._shadowEnabled=kX&&kX(),e._shadowPcf=OX&&OX(),e._shadowBias=RX&&RX(),e._shadowNormalBias=FX&&FX(),e._lightType=EM,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=2,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this.angleAttenuationStrength=this._angleAttenuationStrength,this._light){var e=this._light;e.luminanceHDR=this._luminanceHDR,e.luminanceLDR=this._luminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias}},n(e,[{key:"luminousFlux",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*bM(this._size):this._luminanceLDR},set:function(t){var e=0;T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/bM(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=Ji(t))}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._light&&(this._light.angleAttenuationStrength=t)}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(sY),AX=yh(CX.prototype,"_size",[dY],(function(){return.15})),DX=yh(CX.prototype,"_luminanceHDR",[dY,dX],(function(){return 1700/bM(.15)})),IX=yh(CX.prototype,"_luminanceLDR",[dY],(function(){return 1700/bM(.15)*nM.standardExposureValue*nM.standardLightMeterScale})),BX=yh(CX.prototype,"_term",[dY],(function(){return nY.LUMINOUS_FLUX})),MX=yh(CX.prototype,"_range",[dY],(function(){return 1})),PX=yh(CX.prototype,"_spotAngle",[dY],(function(){return 60})),EX=yh(CX.prototype,"_angleAttenuationStrength",[dY],(function(){return 0})),kX=yh(CX.prototype,"_shadowEnabled",[dY],(function(){return!1})),OX=yh(CX.prototype,"_shadowPcf",[dY],(function(){return Kw.HARD})),RX=yh(CX.prototype,"_shadowBias",[dY],(function(){return 1e-5})),FX=yh(CX.prototype,"_shadowNormalBias",[dY],(function(){return 0})),y(CX.prototype,"term",[_X],Object.getOwnPropertyDescriptor(CX.prototype,"term"),CX.prototype),y(CX.prototype,"size",[pX],Object.getOwnPropertyDescriptor(CX.prototype,"size"),CX.prototype),y(CX.prototype,"shadowEnabled",[mX,gX],Object.getOwnPropertyDescriptor(CX.prototype,"shadowEnabled"),CX.prototype),y(CX.prototype,"shadowPcf",[vX,yX],Object.getOwnPropertyDescriptor(CX.prototype,"shadowPcf"),CX.prototype),y(CX.prototype,"shadowBias",[bX,SX],Object.getOwnPropertyDescriptor(CX.prototype,"shadowBias"),CX.prototype),y(CX.prototype,"shadowNormalBias",[xX,wX],Object.getOwnPropertyDescriptor(CX.prototype,"shadowNormalBias"),CX.prototype),TX=CX))||TX));t("ai",(LX=Bh("cc.PointLight"),VX=Hh("_luminance"),NX=fu(hi),zX=fu(hi),GX=fu(nY),UX=fu(ui),LX((WX=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=jX&&jX(),e._luminanceLDR=qX&&qX(),e._term=XX&&XX(),e._range=YX&&YX(),e._lightType=kM,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=3,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*bM(1):this._luminanceLDR},set:function(t){var e=0;T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/bM(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(sY),jX=yh(WX.prototype,"_luminanceHDR",[Uh,VX],(function(){return 1700/bM(.15)})),qX=yh(WX.prototype,"_luminanceLDR",[Uh],(function(){return 1700/bM(.15)*nM.standardExposureValue*nM.standardLightMeterScale})),XX=yh(WX.prototype,"_term",[Uh],(function(){return nY.LUMINOUS_FLUX})),YX=yh(WX.prototype,"_range",[Uh],(function(){return 1})),y(WX.prototype,"luminousFlux",[NX],Object.getOwnPropertyDescriptor(WX.prototype,"luminousFlux"),WX.prototype),y(WX.prototype,"luminance",[zX],Object.getOwnPropertyDescriptor(WX.prototype,"luminance"),WX.prototype),y(WX.prototype,"term",[GX],Object.getOwnPropertyDescriptor(WX.prototype,"term"),WX.prototype),y(WX.prototype,"range",[UX],Object.getOwnPropertyDescriptor(WX.prototype,"range"),WX.prototype),HX=WX))||HX)),t("aj",(QX=Bh("cc.RangedDirectionalLight"),KX=Hh("_illuminance"),JX=fu(hi),QX(($X=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=tY&&tY(),e._illuminanceLDR=eY&&eY(),e._lightType=RM,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=4,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return T.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){T.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(sY),tY=yh($X.prototype,"_illuminanceHDR",[kh,KX],(function(){return 65e3})),eY=yh($X.prototype,"_illuminanceLDR",[Uh],(function(){return 65e3*nM.standardExposureValue})),y($X.prototype,"illuminance",[JX],Object.getOwnPropertyDescriptor($X.prototype,"illuminance"),$X.prototype),ZX=$X))||ZX)),T.LightComponent=sY,ue(sY,"cc.LightComponent"),T.DirectionalLightComponent=lY,ue(lY,"cc.DirectionalLightComponent"),T.SphereLightComponent=cY,ue(cY,"cc.SphereLightComponent"),T.SpotLightComponent=mY,ue(mY,"cc.SpotLightComponent"),_t(mY.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),_t(cY.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),_t(sY.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var gY=Symbol("BakeNodeCurves"),vY=t("g1",function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&T.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[gY](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}());vY.pool=new Map;var yY=new zr;function bY(t,e,i){for(zr.identity(i);t!==e;)zr.fromRTS(yY,t.rotation,t.position,t.scale),zr.multiply(i,yY,i),t=t.parent;return i}var SY=new Xd(1,1,0,2,2,2),xY=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function wY(t){return 2&t.getFormatFeatures(44)?44:35}function TY(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new Cr,new Cr,new Kn,new Cr,new Kn;var CY=new Kn,AY=new Kn,DY=new Kn,IY=new Kn,BY=new zr,MY=new zr,PY=new th,EY=Number.MAX_SAFE_INTEGER,kY=function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=wY(this._device);this._formatSize=M_[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new zL(t),this._pool.initialize({format:e,roundUpFn:TY}),this._customPool=new zL(t),this._customPool.initialize({format:e,roundUpFn:TY})}var e=t.prototype;return e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e0&&t.refCount--,!t.refCount&&t.readyToBeDeleted){var e=t.skeletonHash^t.clipHash;(void 0!==this._chunkIdxMap.get(e)?this._customPool:this._pool).free(t.handle),this._textureBuffers.get(e)===t&&this._textureBuffers.delete(e)}},e.releaseSkeleton=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.skeletonHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e.releaseAnimationClip=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.clipHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e._createAnimInfos=function(t,e,i){for(var n=[],r=t.joints,s=t.bindposes,a=r.length,o=vY.getOrExtract(e),h=0;h0;){t=RY[--i],RY[i]=null;var r=t.node;zr.fromRTS(t.local,r.rotation,r.position,r.scale),n=zr.multiply(t.world,n,t.local)}return n}function VY(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(FY.has(s)){n=FY.get(s);break}n={node:t,local:new zr,world:new zr,stamp:-1,parent:null},FY.set(s,n),RY[r++]=n,t=t.parent,n=null}for(;r>0;)i=RY[--r],RY[r]=null,i.parent=n,n=i;return n}function NY(t){for(var e=FY.get(t.uuid)||null;e;)FY.delete(e.node.uuid),e=e.parent}var zY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],GY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function UY(t,e,i,n){for(var r=0;r=0&&(e.push(r),t.push(a))}}var HY=new Kn,WY=new Kn,jY=new Kn,qY=new Kn,XY=new zr,YY=new th,QY=function(){this._format=44,this._textures=[],this._buffers=[]};QY.WIDTH=256,QY.HEIGHT=3;var KY,JY,ZY,$Y,tQ,eQ,iQ,nQ,rQ,sQ,aQ,oQ,hQ,uQ,lQ,cQ,fQ,dQ,_Q,pQ,mQ,gQ,vQ,yQ,bQ,SQ,xQ,wQ,TQ,CQ,AQ,DQ,IQ=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new QY,e._realTimeTextureMode=!1,e.type=1,e}s(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e=0?a.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(BQ):BQ},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,a=0;a=0&&s.length>0){var a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(oj),PQ=t("ak",(KY=Bh("cc.SkinnedMeshRenderer"),JY=Ph(100),ZY=fu(jj),$Y=fu(ry),tQ=fu(jj),eQ=fu(ry),KY(iQ=JY((nQ=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=rQ&&rQ(),e._skinningRoot=sQ&&sQ(),e._clip=null,e.associatedAnimation=null,e._modelType=MQ,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),this.associatedAnimation),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?MQ:IQ;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(T.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setSharedMaterial=function(e,i){t.prototype.setSharedMaterial.call(this,e,i),this._modelType===IQ&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n&&n.enabledInHierarchy?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},n(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){t!==this._skinningRoot&&(this._skinningRoot=t,this._tryBindAnimation(),this._update())}},{key:"model",get:function(){return this._model}}]),e}(Dj),rQ=yh(nQ.prototype,"_skeleton",[ZY],(function(){return null})),sQ=yh(nQ.prototype,"_skinningRoot",[$Y],(function(){return null})),y(nQ.prototype,"skeleton",[tQ],Object.getOwnPropertyDescriptor(nQ.prototype,"skeleton"),nQ.prototype),y(nQ.prototype,"skinningRoot",[eQ],Object.getOwnPropertyDescriptor(nQ.prototype,"skinningRoot"),nQ.prototype),iQ=nQ))||iQ)||iQ)),EQ=new n_("a_batch_id",11),kQ=new n_("a_batch_uv",21),OQ=M_[EQ.format].size+M_[kQ.format].size,RQ=t("am",(aQ=Bh("cc.SkinnedMeshUnit"),oQ=fu(Qk),hQ=fu(jj),uQ=fu(Xw),lQ=fu(PQ),aQ((fQ=function(){function t(){this.mesh=dQ&&dQ(),this.skeleton=_Q&&_Q(),this.material=pQ&&pQ(),this._localTransform=mQ&&mQ(),this._offset=gQ&&gQ(),this._size=vQ&&vQ()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){ns.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){ns.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getSharedMaterial(0),t.skinningRoot&&bY(t.node,t.skinningRoot,this._localTransform))}}]),t}(),dQ=yh(fQ.prototype,"mesh",[oQ],(function(){return null})),_Q=yh(fQ.prototype,"skeleton",[hQ],(function(){return null})),pQ=yh(fQ.prototype,"material",[uQ],(function(){return null})),mQ=yh(fQ.prototype,"_localTransform",[Uh],(function(){return new zr})),gQ=yh(fQ.prototype,"_offset",[Uh],(function(){return new ns(0,0)})),vQ=yh(fQ.prototype,"_size",[Uh],(function(){return new ns(1,1)})),y(fQ.prototype,"copyFrom",[lQ],Object.getOwnPropertyDescriptor(fQ.prototype,"copyFrom"),fQ.prototype),cQ=fQ))||cQ)),FQ=new zr;new zr;var LQ,VQ,NQ,zQ,GQ,UQ,HQ,WQ,jQ,qQ,XQ,YQ,QQ,KQ,JQ,ZQ,$Q,tK=new Kn,eK=t("al",(yQ=Bh("cc.SkinnedMeshBatchRenderer"),bQ=Ph(100),SQ=fu([ci]),xQ=fu([RQ]),yQ(wQ=bQ((TQ=function(t){function e(){var e;return(e=t.call(this)||this).atlasSize=CQ&&CQ(),e.batchableTextureNames=AQ&&AQ(),e.units=DQ&&DQ(),e._textures={},e._batchMaterial=null,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this.cook()},i.onDestroy=function(){for(var e in this._textures)this._textures[e].destroy();this._textures={},this._mesh&&(this._mesh.destroy(),this._mesh=null),t.prototype.onDestroy.call(this)},i._onMaterialModified=function(e){this.cookMaterials(),t.prototype._onMaterialModified.call(this,e,this.getMaterialInstance(e))},i.cook=function(){this.cookMaterials(),this.cookSkeletons(),this.cookMeshes()},i.cookMaterials=function(){var t=this;this._batchMaterial||(this._batchMaterial=this.getSharedMaterial(0));var e=this.getMaterialInstance(0);if(e&&this._batchMaterial&&this._batchMaterial.effectAsset){e.copy(this._batchMaterial),this.resizeAtlases();for(var i=e.effectAsset.techniques[e.technique],n=function(n){var r=i.passes[n];if(!r.properties)return 1;var s=function(i){if(r.properties[i].type>=26){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var a=[],o=0;o=0)return 1;t.push(i),e.push(zr.multiply(new zr,r.bindposes[a]||zr.IDENTITY,FQ))},a=0;at[i]?1:t[e]0&&d.copyBuffersToTexture(s,f,a),n.length>0&&d.copyTexImagesToTexture(n,f,r)},i.createTexture=function(t){var e=new hv;return e.setFilters(2,2),e.setMipFilter(1),e.reset({width:this.atlasSize,height:this.atlasSize,format:35}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:35})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;rthis._renderers.length)&&(t=this._renderers.length),this._renderers.splice(t,0,e);var i=!1;return e.model&&(i=!0,this._LODData.addModel(e.model)),this._modelAddedCallback&&i&&this._modelAddedCallback(),e},e.deleteRenderer=function(t){var e,i=this._renderers.splice(t,1),n=i.length>0?null===(e=i[0])||void 0===e?void 0:e.model:null;return n&&this._LODData.eraseModel(n),i[0]},e.getRenderer=function(t){return this._renderers[t]||null},e.setRenderer=function(t,e){t<0||t>=this.rendererCount?Y("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},n(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;ithis.lodCount)&&(t=this.lodCount),i||(i=new nK),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=iK[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return X("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(X("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(X("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?X("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new Kn,e=new Kn,i=null,n=new Kn,r=0;r0&&this._lodGroup.lodCount<1&&this._LODs.forEach((function(e,i){e.lodData.screenUsagePercentage=e.screenUsagePercentage;var n=e.renderers;if(null!==n&&n.length>0)for(var r=0;r1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;1===t.probeType&&(i=this._usePlanarModels);for(var n,r=p(i.entries());!(n=r()).done;){var s=n.value;s[1]===t&&e.push(s[0])}return e},e._removeDependentModels=function(t){for(var e,i=p(this._useCubeModels.keys());!(e=i()).done;){var n=e.value,r=this._useCubeModels.get(n);void 0!==r&&r===t&&(this._useCubeModels.delete(n),this.selectReflectionProbe(n))}for(var s,a=p(this._usePlanarModels.keys());!(s=a()).done;){var o=s.value,h=this._usePlanarModels.get(o);void 0!==h&&h===t&&(this._usePlanarModels.delete(o),this.selectPlanarReflectionProbe(o))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(Dj);if(n&&(n.updateProbeCubemap(e?e.cubemap:null),n.updateReflectionProbeId(e&&e.cubemap?e.getProbeId():-1),e&&(n.updateReflectionProbeDataMap(this._dataTexture),this._isUsedBlending(t)))){var r=this._getBlendProbe(t);this._updateBlendProbeInfo(t,e,r)}}},e._updatePlanarMapOfModel=function(t,e,i){var n=t.node.getComponent(Dj);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return 3===t.reflectionProbeType||4===t.reflectionProbeType},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(Dj);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),4===t.reflectionProbeType&&r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))))}},e._updateBlendCubemap=function(t,e){var i=t.node;if(i&&this._isUsedBlending(t)){var n=i.getComponent(Dj);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=Kn.distance(t.node.worldPosition,e.node.worldPosition),r=Kn.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return 3===t.reflectionProbeType?0:4===t.reflectionProbeType?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new Kn,n=new Kn,r=new Kn,s=new Kn;if(Kn.subtract(i,t.center,t.halfExtents),Kn.add(n,t.center,t.halfExtents),Kn.subtract(r,e.center,e.halfExtents),Kn.add(s,e.center,e.halfExtents),i.x<=s.x&&n.x>=r.x&&i.y<=s.y&&n.y>=r.y&&i.z<=s.z&&n.z>=r.z){var a=new Kn;Kn.multiplyScalar(a,t.halfExtents,2);var o=i.x+a.x<=s.x&&n.x+a.x>=r.x,h=i.x-a.x<=s.x&&n.x-a.x>=r.x,u=i.y+a.y<=s.y&&n.y+a.y>=r.y,l=i.y-a.y<=s.y&&n.y-a.y>=r.y,c=i.z+a.z<=s.z&&n.z+a.z>=r.z,f=i.z-a.z<=s.z&&n.z-a.z>=r.z,d=[];if(!o){var _=n.x-s.x;d.push(_/a.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/a.x)}if(!u){var m=n.y-s.y;d.push(m/a.y)}if(!l){var g=Math.abs(i.y-r.y);d.push(g/a.y)}if(!c){var v=n.z-s.z;d.push(v/a.z)}if(!f){var y=Math.abs(i.z-r.z);d.push(y/a.z)}return d.length>0?(d.sort((function(t,e){return e-t})),d[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function aK(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}sK.probeManager=void 0,sK.probeManager=new sK,T.internal.reflectionProbeManager=sK.probeManager;var oK=new Kn,hK=new Kn,uK=new Kn,lK=new Kn,cK=new Kn,fK=new Kn,dK=new Kn,_K=new Kn,pK=new Kn,mK=new Kn,gK=new Kn,vK=new Kn,yK=new Kn(0,0,0),bK=new Kn(0,0,0);function SK(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=.5*i,s=n.radialSegments||32,a=n.heightSegments||1,o=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;o&&(t>0&&u++,e>0&&u++);var l=(s+1)*(a+1);o&&(l+=(s+1)*u+s*u);var c=s*a*6;o&&(c+=s*u*3);var f=new Array(c),d=new Array(3*l),_=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new Kn(-m,-r,-m),v=new Kn(m,r,m),y=Math.sqrt(m*m+r*r),b=0,S=0;return function(){for(var n=[],o=t-e,u=o*o/i*Math.sign(o),l=0;l<=a;l++){for(var c=[],m=l/a,g=m*o+e,v=0;v<=s;++v){var y=v/s,x=y*h,w=Math.sin(x),T=Math.cos(x);d[3*b]=g*w,d[3*b+1]=m*i-r,d[3*b+2]=g*T,Kn.normalize(yK,Kn.set(bK,w,-u,T)),_[3*b]=yK.x,_[3*b+1]=yK.y,_[3*b+2]=yK.z,p[2*b]=2*(1-y)%1,p[2*b+1]=m,c.push(b),++b}n.push(c)}for(var C=0;C0&&x(!1),t>0&&x(!0)),{positions:d,normals:_,uvs:p,indices:f,minPos:g,maxPos:v,boundingRadius:y};function x(i){for(var n=i?t:e,a=i?1:-1,o=b,u=1;u<=s;++u)d[3*b]=0,d[3*b+1]=r*a,d[3*b+2]=0,_[3*b]=0,_[3*b+1]=a,_[3*b+2]=0,p[2*b]=.5,p[2*b+1]=.5,++b;for(var l=b,c=0;c<=s;++c){var m=c/s*h,g=Math.cos(m),v=Math.sin(m);d[3*b]=n*v,d[3*b+1]=r*a,d[3*b+2]=n*g,_[3*b]=0,_[3*b+1]=a,_[3*b+2]=0,p[2*b]=.5-.5*v*a,p[2*b+1]=.5+.5*g,++b}for(var y=0;y0&&(n[n.length-1]=1),{positions:i,indices:n,minPos:{x:1,y:1,z:0},maxPos:{x:-1,y:-1,z:0},boundingRadius:1,primitiveMode:9}},cone:function(t,e,i){return void 0===t&&(t=.5),void 0===e&&(e=1),void 0===i&&(i={}),SK(0,t,e,i)},cylinder:SK,invWinding:function(t){for(var e=[],i=0;io?o<<16|a:a<<16|o;void 0===n[h]&&(n[h]=0,i.push(a,o))}return i},wireframed:function(t){var e=t.indices;if(!e)return t;if(t.primitiveMode&&7!==t.primitiveMode)return t;for(var i=[[0,1],[1,2],[2,0]],n=[],r={},s=0;sh?h<<16|o:o<<16|h;void 0===r[u]&&(r[u]=0,n.push(o,h))}return t.indices=n,t.primitiveMode=1,t}});t("fZ",kK);var OK=new Kn;function RK(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var FK,LK,VK,NK,zK,GK,UK,HK,WK,jK,qK,XK,YK,QK,KK,JK,ZK,$K,tJ,eJ,iJ,nJ,rJ,sJ=Object.freeze({__proto__:null,CharacterTriggerEventObject:{type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},CollisionEventObject:{type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},TriggerEventObject:{type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},VEC3_0:OK,absolute:RK,cylinder:SK,getWrap:function(t){return t.__cc_wrapper__},maxComponent:function(t){return Math.max(t.x,Math.max(t.y,t.z))},setWrap:function(t,e){t.__cc_wrapper__=e},shrinkPositions:function(t){var e=[],i={};if(t.length>=3){e[0]=t[0],e[1]=t[1],e[2]=t[2];for(var n=t.length,r=3;r0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit("play",this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit("stop",this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit("resume",this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit("pause",this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new gJ(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit("lastframe",this),t.set(e)),e.stopped&&(this.stop(),this.emit("finished",this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),36&~e||(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new gJ;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,l=4&this._wrapMode;l&&(u=this._needReverse(a));var c=u?-1:1;return this.speed<0&&(c*=-1),l&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){yJ().addAnimation(this)},i._onPauseOrStop=function(){yJ().removeAnimation(this)},n(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,this.repeatCount=2&t?1/0:1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=4&this._wrapMode,i=!(36&~this.wrapMode);this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(pJ));T.AnimationState=TJ,Bh(cJ+"EmbeddedAnimationClipPlayable")((SJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new lZ(new Pl)})))}}}]),e}(uZ),hZ=yh(oZ.prototype,"_channels",[dZ],(function(){return[]})),oZ));var _Z,pZ,mZ,gZ,vZ,yZ,bZ,SZ,xZ,wZ,TZ,CZ,AZ,DZ=function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n=t.passes.length)st(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(Pw.getTypeFromHandle(s)<26){var a=void 0===n?s:r.getHandle(i,n,13);return a?BZ(r,i)?{set:function(t){r.setUniformArray(a,t)}}:{set:function(t){r.setUniform(a,t)}}:void st(3943,t.name,e,i,n)}var o=Pw.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+gS(h.type):mS(h.type),l=Cw.get(u);return l||(X("Illegal texture default value: "+u+"."),l=Cw.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof wm&&r.bindSampler(o,vp.gfxDevice.getSampler(t.getSamplerInfo())))}}}st(3942,t.name,e,i)}}else st(3940,t)},t}(),mZ=yh(pZ.prototype,"passIndex",[Uh],(function(){return 0})),gZ=yh(pZ.prototype,"uniformName",[Uh],(function(){return""})),vZ=y(pZ.prototype,"channelIndex",[uu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),_Z=pZ))||_Z;function BZ(t,e){for(var i,n=p(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=p(i.value.members);!(r=s()).done;){var a=r.value;if(a.name===e)return a.count>1}return!1}var MZ,PZ,EZ,kZ,OZ,RZ=Bh("cc.animation.MorphWeightValueProxy")((bZ=function(){function t(){this.subMeshIndex=SZ&&SZ(),this.shapeIndex=xZ&&xZ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),SZ=yh(bZ.prototype,"subMeshIndex",[Uh],(function(){return 0})),xZ=yh(bZ.prototype,"shapeIndex",[Uh],(function(){return 0})),yZ=bZ))||yZ,FZ=Bh("cc.animation.MorphWeightsValueProxy")((TZ=function(){function t(){this.subMeshIndex=CZ&&CZ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),CZ=yh(TZ.prototype,"subMeshIndex",[Uh],(function(){return 0})),wZ=TZ))||wZ,LZ=Bh("cc.animation.MorphWeightsAllValueProxy")(AZ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s2?i-2:0),r=2;r>1},set:function(t){this._flags&=-7,this._flags|=t<<1}}]),t}(),D$=yh(A$.prototype,"_flags",[Uh],(function(){return 0})),C$=A$))||C$,N$=function(t){function e(e,i){var n;return(n=t.call(this,2)||this).resetMode=0,n._value=void 0,n.resetMode=i,n._value=e,n}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){this._value=t},e}(R$),z$=Bh("cc.animation.Vec3Variable")((B$=function(){function t(){this._value=M$&&M$()}return t.prototype[O$]=function(){return new G$(this.value)},n(t,[{key:"type",get:function(){return 4}},{key:"value",get:function(){return this._value},set:function(t){Kn.copy(this._value,t)}}]),t}(),M$=yh(B$.prototype,"_value",[Uh],(function(){return new Kn})),I$=B$))||I$,G$=function(t){function e(e){var i;return(i=t.call(this,4)||this)._value=new Kn,Kn.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){Kn.copy(this._value,t)},e}(R$),U$=Bh("cc.animation.QuatVariable")((E$=function(){function t(){this._value=k$&&k$()}return t.prototype[O$]=function(){return new H$(this._value)},n(t,[{key:"type",get:function(){return 5}},{key:"value",get:function(){return this._value},set:function(t){Cr.copy(this._value,t)}}]),t}(),k$=yh(E$.prototype,"_value",[Uh],(function(){return new Cr})),P$=E$))||P$,H$=function(t){function e(e){var i;return(i=t.call(this,5)||this)._value=new Cr,Cr.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){Cr.copy(this._value,t)},e}(R$);function W$(t,e){var i;switch(t){case 0:case 3:case 1:i=new F$(t);break;case 2:i=new V$;break;case 4:i=new z$;break;case 5:i=new U$;break;default:throw new Error("Unknown variable type "+t)}return void 0!==e&&(i.value=e),i}var j$,q$,X$,Y$,Q$,K$,J$=function(t){function e(e){var i;return(i=t.call(this,e+" transition is invalid")||this).name="TransitionRejectError",i}return s(e,t),e}(l(Error)),Z$=function(t){function e(e){return t.call(this,"Graph variable "+e+" is not defined")||this}return s(e,t),e}(l(Error)),$$=function(t){function e(e,i,n){return t.call(this,"Expect graph variable "+e+" to have type '"+i+"' instead of received '"+(null!=n?n:typeof n)+"'")||this}return s(e,t),e}(l(Error)),t0=eo.Flags.Destroyed,e0=eo.Flags.PersistentMask,i0=[];function n0(t){return"function"==typeof t._instantiate}function r0(t){var e;if(io(t)){if(n0(t))return T.game._isCloning=!0,e=t._instantiate(null,!0),T.game._isCloning=!1,e;if(t instanceof T.Asset)throw new TypeError(ct(6903))}return T.game._isCloning=!0,e=s0(t),T.game._isCloning=!1,e}function s0(t,e){var i;o0(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=i0.length;n=0&&this._bindings.splice(e,1)},i.moveArrayElementBindingForward=function(t,e,i){for(var n=this._bindings,r=[],s=0;s=e&&(r.push(a),n.splice(s,1))}for(var l=0,c=r;l=0?this._bindings[e]:void 0},i._findBindingIndex=function(t){return this._bindings.findIndex((function(e){return W0(e.inputPath,t)}))},i._emplaceBinding=function(t){var e=this._bindings.findIndex((function(e){return W0(e.inputPath,t.inputPath)}));e>=0?this._bindings[e]=t:this._bindings.push(t)},e}(xu),F0=yh(R0.prototype,"_bindings",[Uh],(function(){return[]})),O0=R0))||O0;function W0(t,e){var i=t[0],n=t[1],r=e[0],s=e[1];return i===r&&n===s}var j0=Bh(cJ+"PoseGraphNodeInputBinding")((V0=function(){function t(t,e,i){this._inputPath=N0&&N0(),this._producer=z0&&z0(),this._outputIndex=G0&&G0(),this._inputPath=t,this._producer=e,void 0!==i&&(this._outputIndex=i)}return n(t,[{key:"inputPath",get:function(){return this._inputPath}},{key:"producer",get:function(){return this._producer}},{key:"outputIndex",get:function(){return this._outputIndex}}]),t}(),N0=yh(V0.prototype,"_inputPath",[Uh],null),z0=yh(V0.prototype,"_producer",[Uh],null),G0=yh(V0.prototype,"_outputIndex",[Uh],(function(){return 0})),L0=V0))||L0,q0=function(t){function e(e){return t.call(this,"Can not add the specified "+e.toString()+" since it has already been added into another graph.")||this}return s(e,t),e}(l(Error)),X0=function(t){function e(e){return t.call(this,"Can not perform specified operation on "+e.toString()+" since it has not been added in to graph.")||this}return s(e,t),e}(l(Error)),Y0=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(xu),Q0=new WeakMap;function K0(t){var e=Q0.get(t);if(e)return e;var i={};return Q0.set(t,i),i}function J0(t){return function(e){if(ee(e,Y0)||(Y("This kind of decorator should only be applied to pose graph node classes."),0)){var i=K0(e);t(i)}}}var Z0=function(t){return J0((function(e){var i;Object.assign(null!==(i=e.appearance)&&void 0!==i?i:e.appearance={},t)}))};var $0=["arraySyncGroup"],t1=function(){function t(){this._classInputMap=new WeakMap}var e=t.prototype;return e.setPropertyNodeInputRecord=function(t,e,i){var n=this._classInputMap.get(t);n||(n={properties:{}},this._classInputMap.set(t,n)),i.arraySyncGroup;var r=c(i,$0),s=i.arraySyncGroup;if(s){var a,o;n.arraySyncGroups||(n.arraySyncGroups={});var h=null!==(o=(a=n.arraySyncGroups)[s])&&void 0!==o?o:a[s]={members:[]};h.members.includes(e)||h.members.push(e),r.arraySyncGroup=h}n.properties[e]=Object.freeze(r)},e.getInputKeys=function(t){var e=this,i=[];return function n(r){if(r){n(te(r));var s=e._classInputMap.get(r);if(s)for(var a=function(){var e=h[o][0];if(i.findIndex((function(t){var i=t[0];return e===i}))>=0)return 1;var n=t[e];if(Array.isArray(n))for(var r=0;r=a.length)return;var o,h,u=null!==(o=null===(h=s.getArrayElementDisplayName)||void 0===h?void 0:h.call(t,r))&&void 0!==o?o:s.displayName;return{type:s.type,displayName:u,deletable:!(s.arraySyncGroup&&s.arraySyncGroupFollower),insertPoint:!0}}return{type:s.type,displayName:s.displayName}}},e.hasInput=function(t,e){var i=e[0],n=e[1],r=void 0===n?-1:n;if(!this._getPropertyNodeInputRecord(t.constructor,i))return!1;var s=t[i];return!Array.isArray(s)||!(r<0||r>=s.length)},e.getInputInsertInfos=function(t){for(var e={},i=t.constructor;i;i=te(i)){var n=this._classInputMap.get(i);if(n)for(var r in n.properties){var s=n.properties[r],a=t[r];if(Array.isArray(a)){if(s.arraySyncGroup&&s.arraySyncGroupFollower)continue;e[r]={displayName:r}}}}return e},e.deleteInput=function(t,e,i){var n=i[0],r=i[1],s=void 0===r?-1:r,a=this._getPropertyNodeInputRecord(e.constructor,n);if(a){var o=e[n];if(Array.isArray(o)&&!(s<0||s>=o.length)){var h=a.arraySyncGroup;h?this._deleteInputInArraySyncGroup(t,e,h,o.length,s):i1(t,e,i)}}},e.insertInput=function(t,e,i){var n=i,r=this._getPropertyNodeInputRecord(e.constructor,n);if(r){var s=e[n];if(Array.isArray(s)){var a=s.length,o=r.arraySyncGroup;o?this._insertInputInArraySyncGroup(t,e,o,s.length,a):e1(t,e,[n,a],n1(r.type))}}},e._getPropertyNodeInputRecord=function(t,e){if(t){var i=this._classInputMap.get(t);if(i){var n=i.properties[e];if(n)return n}return this._getPropertyNodeInputRecord(te(t),e)}},e._insertInputInArraySyncGroup=function(t,e,i,n,r){for(var s=0;s=o.length||(n.deleteBinding(i),o.splice(a,1),n.moveArrayElementBindingForward(r,a+1,!0)))}function n1(t){switch(t){default:case 0:case 1:return 0;case 2:return!1;case 5:return null;case 3:return new Kn;case 4:return new Cr}}var r1,s1=new t1;ke({NO:0,LOCAL:1,COMPONENT:2});var a1,o1,h1,u1,l1,c1,f1=Bh(cJ+"PoseNode")(r1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rr)for(var h=r+1;h<=s;++h){var u=n[h],l=a.indexOf(u);a[o]=u,o=l}else if(r>s)for(var c=r-1;c>=s;--c){var f=n[c],d=a.indexOf(f);a[o]=f,o=d}a[o]=t,Af(n,r,s)}},e.copyTo=function(t){for(var e,i=t._states.filter((function(e){switch(e){case t._entryState:case t._exitState:case t._anyState:return!0;default:return!1}})),n=p(i);!(e=n()).done;){var r=e.value;t.remove(r)}for(var s,a=new Map,o=p(this._states);!(s=o()).done;){var h=s.value;switch(h){case this._entryState:a.set(h,t._entryState);break;case this._exitState:a.set(h,t._exitState);break;case this._anyState:a.set(h,t._anyState);break;default:if(h instanceof M0||h instanceof F2||h instanceof B2||h instanceof P2){if(h instanceof B2&&!t._allowEmptyStates)continue;var u=r0(h);t._addState(u),a.set(h,u)}}}for(var l,c=p(this._transitions);!(l=c()).done;){var f=l.value;if(t._allowEmptyStates||!(f.from instanceof B2||f.to instanceof B2)){var d=a.get(f.from),_=a.get(f.to),m=t.connect(d,_);m.conditions=f.conditions.map((function(t){return t.clone()})),f.copyTo(m)}}},e.clone=function(){var t=new i(this._allowEmptyStates);return this.copyTo(t),t},e._addState=function(t){return this._states.push(t),t},n(i,[{key:"allowEmptyStates",get:function(){return this._allowEmptyStates}},{key:"entryState",get:function(){return this._entryState}},{key:"exitState",get:function(){return this._exitState}},{key:"anyState",get:function(){return this._anyState}}]),i}(xu),$1=yh(Z1.prototype,"_states",[Uh],(function(){return[]})),t2=yh(Z1.prototype,"_transitions",[Uh],(function(){return[]})),e2=yh(Z1.prototype,"_entryState",[Uh],null),i2=yh(Z1.prototype,"_exitState",[Uh],null),n2=yh(Z1.prototype,"_anyState",[Uh],null),J1=Z1))||J1,F2=Bh("cc.animation.SubStateMachine")((s2=function(t){function e(e){var i;return(i=t.call(this)||this)._stateMachine=a2&&a2(),i._stateMachine=new R2(e),i}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),this._stateMachine.copyTo(e._stateMachine)},n(e,[{key:"stateMachine",get:function(){return this._stateMachine}}]),e}(v0),a2=yh(s2.prototype,"_stateMachine",[Uh],null),r2=s2))||r2,L2=Bh(cJ+"PoseGraphStash")((h2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1e-6){n=!1;break}this._findRatio=n?q2:dh}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());T.RatioSampler=U2;var H2=t("ax",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function j2(t,e){if("string"==typeof e){var i=xl[e];i?t=i(t):ot(3906,e)}else Array.isArray(e)&&(t=Tc(e,t));return t}function q2(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],h=t[a];n=(e-h)/(o-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.calculate=function(t,e,i){if(this._reset(),!(e>i)){var n=t.length;if(n){var r=t[0],s=t[n-1],a=0,o=0;if(e=s)a=n-1,o=0;else{var h=H3(t,e);a=h.index,o=h.ratio}var u=0,l=0;if(i=s)u=n-1,l=0;else{var c=H3(t,i);u=c.index,l=c.ratio}var f=!o,d=!l;a!==u||o!==l?(f||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=f?a:a+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=l)):f?(this.directKeyframesBegin=a,this.directKeyframesEnd=a+1):(this.preLerpIndex=a,this.preLerpRatio=o)}}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0},n(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var W3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),j3=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=s5(e.times,e.values,Kn,t,"position",r)),i&&(this._rotation=s5(i.times,i.values,Cr,t,"rotation",r)),n&&(this._scale=s5(n.times,n.values,Kn,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),q3=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=Q3(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),X3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluatorForAnimationGraph(e)})).filter((function(t){return!!t}))}var e=t.prototype;return e.destroy=function(){for(var t=this._nodeEvaluations,e=t.length,i=0;is)i.just=!0,i.index=n-1;else{var a=dh(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,u=t[h],l=t[o],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}var K3={uint8:Uint8Array,uint16:Uint16Array};function J3(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return 0;case 8:return 1}}var Z3,$3,t5,e5,i5=k3(cJ+"QuantizedFloatArray")((A3=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=D3&&D3(),this.min=I3&&I3(),this.extent=B3&&B3(),this.values=M3&&M3(),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+L3(e)+" "+L3(i)+" "+n.join(" ")},n(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),D3=yh(A3.prototype,"originalPrecision",[O3],null),I3=yh(A3.prototype,"min",[O3],null),B3=yh(A3.prototype,"extent",[O3],null),M3=yh(A3.prototype,"values",[O3],null),C3=A3))||C3;function n5(t,e){var i=K3[e],n=1<=0){var f=u.substring(0,c),d=h[f];d&&(l.parent=d)}}for(var _=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return q5(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[O5]=function(){this._embeddedPlayers.length=0},i.getAuxiliaryCurveNames_experimental=function(){return this._auxiliaryCurveEntries.map((function(t){return t.name}))},i.hasAuxiliaryCurve_experimental=function(t){return!!this._findAuxiliaryCurveEntry(t)},i.addAuxiliaryCurve_experimental=function(t){var e=this._findAuxiliaryCurveEntry(t);return e||((e=new D5).name=t,this._auxiliaryCurveEntries.push(e)),e.curve},i.getAuxiliaryCurve_experimental=function(t){return this._findAuxiliaryCurveEntry(t).curve},i.renameAuxiliaryCurve_experimental=function(t,e){var i=this._findAuxiliaryCurveEntry(t);i&&(i.name=e)},i.removeAuxiliaryCurve_experimental=function(t){xe(this._auxiliaryCurveEntries,(function(e){return e.name===t}))},i._trySyncLegacyData=function(){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData())},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,h=o.length,u=0;u=c&&t<=f?o?e!==u&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var d=t-c;a.instantiatedPlayer.setTime(d)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?(22&~s?h=n:e*=-1,o++):1===e&&h===n-1&&ra)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h=e.length||this._ignoreIndex===t))for(var i=e[t],n=i.events.length,r=0;r0?t/e:-t/e;if(o>=n){o=n,a=!0;var h=n-(0|n);0===h&&(h=1),t=h*e*(t>0?1:-1)}if(t>e){var u=t%e;t=0===u?e:u}else t<0&&0!=(t%=e)&&(t+=e);var l=!1,c=4&i;c&&(l=Z5(i,o));var f=l?-1:1;return c&&l&&(t=e-t),s.time=t,s.ratio=s.time/e,s.direction=f,s.stopped=a,s.iterations=o,s}function Z5(t,e){var i=!1;return 22&~t||(e-(0|e)==0&&e>0&&(e-=1),1&e&&(i=!i)),36&~t||(i=!i),i}var $5=new Kn,t4=new Kn,e4=new Cr;new Cr;var i4,n4,r4=function(){function t(){this._position=new Kn,this._rotation=new Cr,this._scale=Kn.clone(Kn.ONE)}return t.clone=function(e){var i=new t;return t.copy(i,e),i},t.setIdentity=function(t){return Kn.copy(t._position,Kn.ZERO),Cr.copy(t._rotation,Cr.IDENTITY),Kn.copy(t._scale,Kn.ONE),t},t.copy=function(t,e){return Kn.copy(t._position,e._position),Cr.copy(t._rotation,e._rotation),Kn.copy(t._scale,e._scale),t},t.equals=function(t,e,i){return Kn.equals(t._position,e._position,i)&&Cr.equals(t._rotation,e._rotation,i)&&Kn.equals(t._scale,e._scale,i)},t.strictEquals=function(t,e){return Kn.strictEquals(t._position,e._position)&&Cr.strictEquals(t._rotation,e._rotation)&&Kn.strictEquals(t._scale,e._scale)},t.lerp=function(e,i,n,r){return 0===r?t.copy(e,i):1===r?t.copy(e,n):(Kn.lerp(e._position,i._position,n._position,r),Cr.slerp(e._rotation,i._rotation,n._rotation,r),Kn.lerp(e._scale,i._scale,n._scale,r),e)},t.multiply=function(t,e,i){var n=Cr.multiply(e4,e._rotation,i._rotation),r=Kn.multiply($5,i._scale,e._scale),s=Kn.multiply(t4,i._position,e._scale);return Kn.transformQuat(s,s,e._rotation),Kn.add(s,s,e._position),Kn.copy(t._position,s),Cr.copy(t._rotation,n),Kn.copy(t._scale,r),t},t.invert=function(t,e){var i=t._rotation,n=t._scale,r=t._position;return Cr.invert(i,e._rotation),s4(n,e._scale,ji),Kn.negate(r,e._position),Kn.multiply(r,r,n),Kn.transformQuat(r,r,i),t},t.fromMatrix=function(t,e){return zr.toSRT(e,t._rotation,t._position,t._scale),t},t.toMatrix=function(t,e){return zr.fromSRT(t,e._rotation,e._position,e._scale)},n(t,[{key:"position",get:function(){return this._position},set:function(t){Kn.copy(this._position,t)}},{key:"rotation",get:function(){return this._rotation},set:function(t){Cr.copy(this._rotation,t)}},{key:"scale",get:function(){return this._scale},set:function(t){Kn.copy(this._scale,t)}}]),t}();function s4(t,e,i){var n=e.x,r=e.y,s=e.z;return Kn.set(t,Math.abs(n)<=i?0:1/n,Math.abs(r)<=i?0:1/r,Math.abs(s)<=i?0:1/s)}function a4(t,e,i){return Kn.subtract(t.position,e.position,i.position),l4(t.rotation,i.rotation,e.rotation),Kn.subtract(t.scale,e.scale,i.scale),t}X5=r4,r4.IDENTITY=Object.freeze(new X5),r4.ZERO=Object.freeze(function(){var t=new X5;return Kn.copy(t._position,Kn.ZERO),Cr.set(t._rotation,0,0,0,0),Kn.copy(t._scale,Kn.ZERO),t}()),r4.calculateRelative=(i4=new Cr,n4=new Kn,function(t,e,i){var n=Cr.invert(i4,i._rotation),r=s4(n4,i._scale,ji),s=Kn.subtract(t4,e._position,i._position);return Kn.transformQuat(s,s,n),Kn.multiply(s,s,r),Kn.copy(t._position,s),Cr.multiply(t._rotation,n,e._rotation),Kn.multiply(t._scale,e._scale,r),t});var o4,h4,u4=(o4=new Cr,function(t,e,i,n){Kn.scaleAndAdd(t.position,e.position,i.position,n);var r=Cr.slerp(o4,Cr.IDENTITY,i.rotation,n);return Cr.multiply(t.rotation,r,e.rotation),Kn.scaleAndAdd(t.scale,e.scale,i.scale,n),t}),l4=(h4=new Cr,function(t,e,i){var n=Cr.invert(h4,e);return Cr.multiply(t,i,n)}),c4=Object.freeze(function(){var t=new r4;return t.position=Kn.ZERO,t.rotation=Cr.IDENTITY,t.scale=Kn.ZERO,t}()),f4=function(){function t(t,e){this.transforms=void 0,this.auxiliaryCurves=void 0,this._poseTransformSpace=0,this.transforms=t,this.auxiliaryCurves=e}return t._create=function(e,i){return new t(e,i)},t}(),d4=function(){function t(t){this._involvedTransforms=new Uint16Array(t)}return n(t,[{key:"involvedTransforms",get:function(){return this._involvedTransforms}}]),t}();function _4(t,e,i,n){void 0===n&&(n=void 0),p4(t.transforms,e.transforms,i,n),b4(t.auxiliaryCurves,e.auxiliaryCurves,i)}function p4(t,e,i,n){void 0===n&&(n=void 0);var r=t.length;if(t.length,0!==i)if(1!==i)if(n)for(var s=0;s=r)return{done:!0,value:void 0};var o=i[s];e=null==o?void 0:o.getClipStatuses(t*n[s]),++s}}}},e.__evaluatePort=function(t,e,i){for(var n=this._childEvaluators.length,r=0,s=null,a=0;a5?h-5:0),l=5;l=e[e.length-1])t[t.length-1]=1;else{for(var n=0,r=1;ri){n=r;break}var s=e[n-1],a=e[n],o=a-s;t[n-1]=(a-i)/o,t[n]=(i-s)/o}}var V6,N6,z6=Bh,G6=Uh,U6=z6(cJ+"AnimationBlend1DItem")((u6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?t[n]=1:t.fill(1/e.length)}else{for(var r=-1,s=-1,a=-1,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=i.x,l=i.y,c=0;c0?_>=h&&(h=_,r=c):_>=o&&(o=_,s=c)}}var p=0;if(r<0||s<0)p=1;else{var m=(T=e[r],C=e[s],A=i,D=N6,(I=ns.cross(T,C))?(D.wA=ns.cross(A,C)/I,D.wB=ns.cross(A,T)/-I):(D.wA=0,D.wB=0),D),g=m.wA,v=m.wB,y=0,b=0,S=g+v;S>1?(y=g/S,b=v/S):S<0?(y=0,b=0,p=1):(y=g,b=v,p=1-S),t[r]=y,t[s]=b}if(p>0)if(a>=0)t[a]=p;else for(var x=p/t.length,w=0;w0&&t.forEach((function(e,i){return t[i]=e/a}))}var Y6,Q6,K6,J6,Z6,$6,t8,e8,i8,n8,r8=function(t,e,i,n,r){ns.subtract(n,i,t),ns.subtract(r,e,t)},s8=function(){function t(e){for(var i=t._ANGLE_MULTIPLIER,n=e.length,r=this._exampleMagnitudes=new Array(n).fill(0),s=this._exampleDirections=e.map((function(t,e){var i=ns.copy(new ns,t),n=ns.len(i);return r[e]=n,Xi(n,0,1e-5)||ns.multiplyScalar(i,i,1/n),i})),a=this._precomputedVIJs=new Float32Array(3*n*n),o=0;o0)for(var R=0;R=s)){this.setTransform(e,t);for(var a=e+1;a=0&&this._pages.length,this._pages[t].buffer},e.pushPage=function(t){var e=t[Z8];this._pages.length,e===this._pages.length&&this._pushNewPage(),this._pages.length;var i=this._pages[e];return++i.useCount,++t[Z8],i},e.popPage=function(t){var e=t[Z8]-1,i=this._pages[e];i.useCount,--i.useCount,--t[Z8],0===i.useCount&&(this._pages.length,this._pages.pop())},e.createAllocator=function(t){var e=new n7(this,t);return++this._allocatorCount,e},e.destroyAllocator=function(t){for(var e=t[Z8],i=0;ii[e-1]}))}var e=t.prototype;return e.createAllocator=function(t){var e=t,i=this._selectStackPageSize(e),n=this._stacks.get(i);return n||(n=new e7(this,i),this._stacks.set(i,n)),n.createAllocator(e)},e[$8]=function(t){for(var e,i=p(this._stacks);!(e=i()).done;){var n=e.value,r=n[0];if(n[1]===t){this._stacks.delete(r);break}}},e._selectStackPageSize=function(t){var e=dh(this._thresholds,t),i=t;return e>=0?i=this._thresholds[e]:(e=~e)===this._thresholds.length||(e>=0&&this._thresholds.length,i=this._thresholds[e]),i},n(t,[{key:"isEmpty",get:function(){return 0===this._stacks.size}}]),t}(),s7=function(){function t(t,e){this._poses=[],this._allocatedCount=0,this._memoryAllocator=void 0,this._transformCount=t,this._auxiliaryCurveCount=e;var i=a7(t,e,1);this._memoryAllocator=o7.createAllocator(i)}var e=t.prototype;return e.destroy=function(){this._allocatedCount;for(var t=0;t>S7},set:function(t){this._id&=b7,this._id|=t<=n)return null;r>=0&&e.length;var s=null!==(t=e[r])&&void 0!==t?t:e[r]=this._createPose(r);return s[g7].poseIndex=r,this._idleFlags&=~(1<=0&&e.length,e[i],this._idleFlags|=1<=0){var n=e[i];return++n.refCount,n.handle}for(var r=0,s=function(t){var i=e.findIndex((function(e){return e.node===t}));if(i>=0)return r=i+1,1},a=t.parent;a&&!s(a);a=a.parent);for(var o=r;o=0){var n=e[i];return++n.refCount,n.handle}var r=e.length,s=new M7(new U7(this,r),t);return e.push(s),s.handle},e.createEvaluationContext=function(){return this._bindStarted,new z7(this.transformCount,this.auxiliaryCurveCount,this._parentTable.slice(),this._origin)},e.resetPoseStashAllocator=function(t){this._bindStarted,t._reset(this.transformCount,this.auxiliaryCurveCount)},e.createTransformFilter=function(t){for(var e,i=this._origin,n=[],r=p(this._transformRecords);!(e=r()).done;){var s=e.value,a=s.node,o=s.handle,h=u(i,a);if(void 0===h)Y(a.getPathInHierarchy()+" is not a child of "+i.getPathInHierarchy());else if(t.isExcluded(h))continue;n.push(o.index)}return n.sort(),new d4(n);function u(t,e){for(var i=[],n=e;n;n=n.parent){if(n===t)return i.join("/");i.unshift(n.name)}}},e.fetchDefaultTransforms=function(t){var e=this._transformRecords.length;t.length;for(var i=0;i=0&&this._transformRecords.length;var e=this._transformRecords[t];e.refCount,--e.refCount},e._destroyAuxiliaryCurveHandle=function(t){t>=0&&this._auxiliaryCurveRecords.length;var e=this._auxiliaryCurveRecords[t];e.refCount,--e.refCount},e.startBind=function(){this._bindStarted=!0,this._transformCountBeforeBind=this._transformRecords.length,this._auxiliaryCurveCountBeforeBind=this._auxiliaryCurveRecords.length},e.endBind=function(){var t=this._transformRecords,e=this._auxiliaryCurveRecords,i=0;if(P7(t),t.length!==this._transformCountBeforeBind){i|=1;for(var n=t.length,r=0;r=0?n:-1}else{var r=t.findIndex((function(t){return t.node===i}));u[f]=r}},f=0;f0}));if(t.length,e!==t.length){for(var i=0;i=0;--i){var n=this._parentTable[i];if(!(n<0)){var r=e.getTransform(i,V7),s=e.getTransform(n,N7);r4.calculateRelative(r,r,s),e.setTransform(i,r)}}t._poseTransformSpace=0},e._convertPoseSpaceTransformToTargetSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case 0:1===r?r4.multiply(t,this._getComponentToWorldTransform(),t):r4.multiply(t,this._getLocalToWorldTransform(N7,i,n),t);break;case 1:1===r||r4.multiply(t,this._getLocalToComponentTransform(N7,i,n),t);break;case 2:if(1===r){var s=this._parentTable[n];if(s>=0){var a=i.transforms.getTransform(s,N7),o=r4.invert(a,a);r4.multiply(t,o,t)}}break;case 3:var h=i.transforms.getTransform(n,N7),u=r4.invert(h,h);r4.multiply(t,u,t)}return t},e._convertTransformToPoseTransformSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case 0:if(1===r){var s=r4.invert(N7,this._getComponentToWorldTransform());r4.multiply(t,s,t)}else{var a=this._getLocalToWorldTransform(N7,i,n),o=r4.invert(a,a);r4.multiply(t,o,t)}break;case 1:if(1===r);else{var h=this._getLocalToComponentTransform(N7,i,n),u=r4.invert(h,h);r4.multiply(t,u,t)}break;case 2:if(1===r){var l=this._parentTable[n];if(l>=0){var c=i.transforms.getTransform(l,N7);r4.multiply(t,c,t)}}break;case 3:var f=i.transforms.getTransform(n,N7);r4.multiply(t,f,t)}return t},e._getComponentToWorldTransform=function(){var t=this._cacheComponentToWorldTransform,e=this._componentNode;return t.position=e.worldPosition,t.rotation=e.worldRotation,t.scale=e.worldScale,t},e._getLocalToComponentTransform=function(t,e,i){var n=this._parentTable;r4.setIdentity(t);for(var r=n[i];r>=0;r=n[r]){var s=e.transforms.getTransform(r,V7);r4.multiply(t,s,t)}return t},e._getLocalToWorldTransform=function(t,e,i){return this._getLocalToComponentTransform(t,e,i),r4.multiply(t,this._getComponentToWorldTransform(),t),t},n(t,[{key:"allocatedPoseCount",get:function(){return this._poseAllocator.allocatedCount}},{key:"parentTable",get:function(){return this._parentTable}},{key:"_stackSize_debugging",get:function(){return this._poseAllocator.allocatedCount}}]),t}(),G7=function(){function t(t,e){this.index=-1,this._host=void 0,this._host=t,this.index=e}return t.prototype.destroy=function(){this._host._destroyTransformHandle(this.index)},t}(),U7=function(){function t(t,e){this.index=-1,this._host=void 0,this._host=t,this.index=e}return t.prototype.destroy=function(){this._host._destroyAuxiliaryCurveHandle(this.index)},t}(),H7=function(){function t(){this._context={deltaTime:0,indicativeWeight:0}}var e=t.prototype;return e.generate=function(t,e){return this._context.deltaTime=t,this._context.indicativeWeight=e,this._context},e.forkSubWeight=function(t,e){this._context.deltaTime=t.deltaTime,this._context.indicativeWeight=t.indicativeWeight*e},t}(),W7=function(){function t(){this._allocator=null}var e=t.prototype;return e._reset=function(t,e){this._allocator=new v7(t,e)},e.allocatePose=function(){return this._allocator,this._allocator.allocatePose()},e.destroyPose=function(t){return this._allocator,this._allocator.destroyPose(t)},n(t,[{key:"allocatedPoseCount",get:function(){return this._allocator,this._allocator.allocatedCount}}]),t}(),j7=Uh;Bh(cJ+"UnaryCondition")((R7=function(){function t(){this.operator=k7&&k7(),this.operand=O7&&O7()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.operand=this.operand.clone(),e},e[z2]=function(t){var e=this.operator,i=this.operand,n=new $7(e,!1),r=k6(t,i,1,n.setOperand,n);return n.reset(r),n},t}(),R7.Operator={TRUTHY:0,FALSY:1},k7=yh((E7=R7).prototype,"operator",[j7],(function(){return 0})),O7=yh(E7.prototype,"operand",[j7],(function(){return new E6})),E7));var q7,X7,Y7,Q7,K7,J7,Z7,$7=function(){function t(t,e){this._operator=t,this._operand=e,this._eval()}var e=t.prototype;return e.reset=function(t){this.setOperand(t)},e.setOperand=function(t){this._operand=t,this._eval()},e.eval=function(){return this._result},e._eval=function(){var t=this._operand;switch(this._operator){default:case 0:this._result=!!t;break;case 1:this._result=!t}},t}(),t9=function(){},e9=function(){for(var t=arguments.length,e=new Array(t),i=0;ir;case 5:return n>=r}},t}(),N9=Uh,z9=Bh(cJ+"TriggerCondition")((y9=function(){function t(){this.trigger=b9&&b9()}var e=t.prototype;return e.clone=function(){var e=new t;return e.trigger=this.trigger,e},e[z2]=function(t){var e=new G9(!1),i=t.getVar(this.trigger);return O6(i,this.trigger)&&(F6(i.type,this.trigger),e.setTrigger(i.bind(e.setTrigger,e))),e},t}(),b9=yh(y9.prototype,"trigger",[N9],(function(){return""})),v9=y9))||v9,G9=function(){function t(t){this._triggered=!1,this._triggered=t}var e=t.prototype;return e.setTrigger=function(t){this._triggered=t},e.eval=function(){return this._triggered},t}(),U9=Bh(cJ+"StateMachineComponent")(S9=function(){function t(){}var e=t.prototype;return e.onMotionStateEnter=function(){},e.onMotionStateExit=function(){},e.onMotionStateUpdate=function(){},e.onStateMachineEnter=function(){},e.onStateMachineExit=function(){},t}())||S9,H9=Bh(cJ+"MotionSyncInfo")((w9=function(){this.group=T9&&T9()},T9=yh(w9.prototype,"group",[Uh],(function(){return""})),x9=w9))||x9,W9=1e-5,j9=(C9=Bh(cJ+"PoseNodePlayMotion"),A9=J0((function(t){t.category="i18n:ENGINE.animation_graph.pose_graph_node_sub_categories.pose_nodes/"})),D9=function(t){return J0((function(e){e.factory=t}))}((L9=function(t){var e=new j9;return e.motion=t,e},{listEntries:function(){return[{arg:{type:"clip-motion"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_clip_motion"},{arg:{type:"animation-blend-1d"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_animation_blend_1d"},{arg:{type:"animation-blend-2d"},menu:"i18n:ENGINE.animation_graph.pose_graph_node_sub_menus.play_or_sample_animation_blend_2d"}]},create:function(t){var e=null;switch(t.type){case"clip-motion":e=new y6;break;case"animation-blend-1d":e=new H6;break;case"animation-blend-2d":e=new g8}return L9(e)}})),I9=Z0({themeColor:"#227F9B"}),B9=_1({type:0}),M9=_1({type:0}),C9(P9=A9(P9=D9(P9=I9((E9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rW9&&(r=e*this.speedMultiplier/n),i?i.notifyUpdate(r,t.indicativeWeight):this._workspace.normalizedTime+=r,this._workspace.lastIndicativeWeight=t.indicativeWeight}},i.doEvaluate=function(t){if(this._workspace){var e=this._runtimeSyncRecord?this._runtimeSyncRecord.getSyncedEnterTime():this._workspace.normalizedTime;return this._workspace.motionEvalPort.evaluate(e,t)}return t.pushDefaultedPose()},n(e,[{key:"lastIndicativeWeight",get:function(){var t,e;return null!==(t=null===(e=this._workspace)||void 0===e?void 0:e.lastIndicativeWeight)&&void 0!==t?t:0}},{key:"elapsedMotionTime",get:function(){var t,e;return null!==(t=null===(e=this._workspace)||void 0===e?void 0:e.normalizedTime)&&void 0!==t?t:0}}]),e}(f1),k9=yh(E9.prototype,"motion",[Uh],(function(){return new y6})),O9=yh(E9.prototype,"syncInfo",[Uh],(function(){return new H9})),R9=y(E9.prototype,"startTime",[Uh,B9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),F9=y(E9.prototype,"speedMultiplier",[Uh,M9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),P9=E9))||P9)||P9)||P9)||P9),q9=function(t,e){this.normalizedTime=0,this.lastIndicativeWeight=0,this.motionEval=t,this.motionEvalPort=e};function X9(t){return t instanceof f1||t instanceof d1}var Y9=function(){function t(t,e){this._rootPoseNode=t,this._countingPlayMotionNodes=e}var e=t.prototype;return e.bind=function(t){var e;null===(e=this._rootPoseNode)||void 0===e||e.bind(t)},e.settle=function(t){var e;null===(e=this._rootPoseNode)||void 0===e||e.settle(t)},e.reenter=function(){var t;null===(t=this._rootPoseNode)||void 0===t||t.reenter()},e.update=function(t){var e;null===(e=this._rootPoseNode)||void 0===e||e.update(t)},e.evaluate=function(t){var e,i;return null!==(e=null===(i=this._rootPoseNode)||void 0===i?void 0:i.evaluate(t,1))&&void 0!==e?e:null},e.countMotionTime=function(){var t=this._countingPlayMotionNodes;if(!t)return 0;for(var e=0,i=Number.NEGATIVE_INFINITY,n=0;ni&&(i=a,e=s)}return e},t}();function Q9(t,e,i){void 0===i&&(i=!1);var n=t.outputNode,r=t.getShell(n).getBindings();if(r.length,0===r.length)return new Y9(void 0,i?[]:void 0);var s=r[0];s.outputIndex,s.producer;var a=new Map,o=K9(t,s.producer,a,e);return new Y9(o,i?Array.from(a.values()).filter((function(t){return t instanceof j9})):void 0)}function K9(t,e,i,n){var r=t.getShell(e),s=i.get(e);if(s)return s;var a=r0(e);"__callOnAfterDeserializeRecursive"in a&&a.__callOnAfterDeserializeRecursive(),a instanceof d1&&a.link(n);for(var o,h=a,u=[],l=p(r.getBindings());!(o=l()).done;){var c=o.value,f=c.producer,d=c.outputIndex,_=c.inputPath;if(X9(f)){var m=K9(t,f,i,n);if(m instanceof f1)$9(h,_,m,d);else{var g=ntt(h,_,m,d);g&&u.push(g)}}else X("There's a input bound to a node with unrecognized type.")}var v,y=new J9(u);return h instanceof f1?(h._setDependencyEvaluation(y),v=h):v=new Z9(h,y),i.set(e,v),v}var J9=function(){function t(t){this._bindingEvaluations=void 0,this._bindingEvaluations=t}return t.prototype.evaluate=function(){for(var t,e=p(this._bindingEvaluations);!(t=e()).done;)t.value.evaluate()},t}(),Z9=function(){function t(t,e){this._outputs=void 0,this._node=t,this._dependency=e,this._outputs=new Array(t.outputCount)}var e=t.prototype;return e.getDefaultOutput=function(){return this.getOutput(0)},e.getOutput=function(t){return this._outputs[t]},e.evaluate=function(){var t=this._node;this._dependency.evaluate(),t.selfEvaluate(this._outputs)},n(t,[{key:"node",get:function(){return this._node}},{key:"outputCount",get:function(){return this._outputs.length}}]),t}();function $9(t,e,i,n){var r=e[0],s=e[1],a=void 0===s?-1:s;if(r in t)if(0===n){var o=t[r];if(a<0)return null!==o?void X("Invalid binding: consumer node's input "+r+" should be leaved as evaluation before evaluation."):void(t[r]=i);Array.isArray(o)?a>=o.length?X("Invalid binding: consumer node's input "+r+" have length "+o.length+" but the binding specified "+a):null===o[a]?o[a]=i:X("Invalid binding: consumer node's input "+r+"["+a+"] should be leaved as null before evaluation"):X("Invalid binding: consumer node's input "+r+" should be an array.")}else X("Node "+i.toString()+" does not have specified output "+n+".");else X("Invalid binding: consumer node has no property "+r)}var ttt,ett=function(){function t(t,e,i,n){this._consumerNode=t,this._consumerPropertyKey=e,this._producerRecord=i,this._producerOutputIndex=n}return t.prototype.evaluate=function(){this._producerRecord.evaluate(),this._consumerNode[this._consumerPropertyKey]=this._producerRecord.getOutput(this._producerOutputIndex)},t}(),itt=function(){function t(t,e,i,n,r){this._consumerNode=t,this._consumerPropertyKey=e,this._consumerElementIndex=i,this._producerRecord=n,this._producerOutputIndex=r}return t.prototype.evaluate=function(){this._producerRecord.evaluate(),this._consumerNode[this._consumerPropertyKey][this._consumerElementIndex]=this._producerRecord.getOutput(this._producerOutputIndex)},t}();function ntt(t,e,i,n){var r=e[0],s=e[1],a=void 0===s?-1:s;if(r in t){var o=t[r];if(a<0)return new ett(t,r,i,n);if(Array.isArray(o)){if(!(a>=o.length))return new itt(t,r,a,i,n);X("Invalid binding: consumer node's input "+r+" have length "+o.length+" but the binding specified "+a)}else X("Invalid binding: consumer node's input "+r+" should be an array.")}else X("Invalid binding: consumer node has no property "+r)}var rtt=function(){function t(t,e,i){this.passthroughWeight=1,this._motionStates=[],this._proceduralPoseStates=[],this._topLevelEntry=void 0,this._topLevelExit=void 0,this._currentNode=void 0,this._pendingTransitionPath=[],this._activatedTransitions=[],this._activatedTransitionPool=Att.createPool(4),this._updateContextGenerator=new H7,this._conditionEvaluationContext=new Ctt,this._additive=!1,this._additive=i.additive,this.name=e,this._controller=i.controller;var n=this._addStateMachine(t,null,i,e),r=n.entry,s=n.exit;this._topLevelEntry=r,this._topLevelExit=s,this._currentNode=r,r.increaseActiveReference(),this._resetTrigger=i.triggerResetter}var e=t.prototype;return e.settle=function(t){for(var e=this._proceduralPoseStates,i=e.length,n=0;n=16){st(14e3,16,"");break}var r=this._matchNextTransition(i);if(!r)break;var s=r.to,a=i;if(i=s,stt(s)){if(s===a)break;this._activateTransition(t,r),t.length=0}else t.push(r)}t.length=0},e._resetStateTickFlagsAndWeights=function(){var t=this._currentNode,e=this._activatedTransitions;t.resetTickFlagsAndWeight();for(var i=0;i=0;--i){var s=e[i],a=0===i?this._currentNode:e[i-1].destination;if(s.update(t,a),s.done){this._dropActivatedTransitions(r);break}var o=s.normalizedElapsedTime*n;s.destination.increaseAbsoluteWeight(o),n*=1-s.normalizedElapsedTime,r=i-1}this._currentNode.increaseAbsoluteWeight(n)},e._dropActivatedTransitions=function(t){var e=this._activatedTransitions,i=this._activatedTransitionPool;t>=0&&e.length;var n=t+1,r=e[t],s=r.destination;r.path.length;var a=r.path[r.path.length-1];a.endEventBinding&&this._emit(a.endEventBinding),this._callExitMethods(this._currentNode);for(var o=0;o<=t;++o){var h=e[o];o!==t&&h.destination.decreaseActiveReference();for(var u=o===t?h.path.length-1:h.path.length,l=0;l=0?e:1+e}var mtt,gtt,vtt,ytt,btt,Stt,xtt=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).kind=void 0,n.kind=i,n}return s(e,t),e}(htt),wtt=function(t){function e(e){var i;return(i=t.call(this,e)||this).kind=4,i}return s(e,t),e}(htt),Ttt=function(t){function e(e,i){var n;(n=t.call(this,e)||this).kind=5,n.elapsedTime=0,n.statusCache={progress:0},n._instantiatedPoseGraph=void 0,n._statusCache={progress:0},n._elapsedTime=0;var r=Q9(e.graph,i,!0);return r.bind(i),n._instantiatedPoseGraph=r,n._statusCache.progress=0,n}s(e,t);var i=e.prototype;return i.settle=function(t){this._instantiatedPoseGraph.settle(t)},i.reenter=function(){this._statusCache.progress=0,this._instantiatedPoseGraph.reenter()},i.update=function(t){this._elapsedTime+=t.deltaTime,this._instantiatedPoseGraph.update(t)},i.evaluate=function(t){var e;return null!==(e=this._instantiatedPoseGraph.evaluate(t))&&void 0!==e?e:null},i.getStatus=function(){return this._statusCache.progress=ptt(this._elapsedTime),this._statusCache},i.countMotionTime=function(){return this._instantiatedPoseGraph.countMotionTime()},e}(utt),Ctt=function(){function t(){this.sourceStateWeight=0,this._sourceState=void 0}var e=t.prototype;return e.set=function(t){this._sourceState=t,stt(t)?(t.activeReferenceCount,this.sourceStateWeight=t.absoluteWeight):this.sourceStateWeight=0},e.unset=function(){this._sourceState=void 0,this.sourceStateWeight=0},n(t,[{key:"sourceStateMotionTimeNormalized",get:function(){var t=this._sourceState;switch(t&&(3===t.kind||5===t.kind)&&t.activeReferenceCount,t.kind){case 3:return t.normalizedTime;case 5:return t.countMotionTime();default:return 0}}}]),t}(),Att=function(){function t(){this.normalizedElapsedTime=0,this.path=[],this._durationMultiplier=1}var e=t.prototype;return e.getAbsoluteDuration=function(t){return this._getAbsoluteDurationUnscaled(t)*this._durationMultiplier},e.update=function(t,e){if(stt(e)){var i=this.getAbsoluteDuration(e);if(i<=0)this.normalizedElapsedTime=1;else{var n=this.normalizedElapsedTime*i,r=i-n,s=Qi((n+Math.min(r,t))/i);this.normalizedElapsedTime=s}}else this.normalizedElapsedTime=1},t.createPool=function(e){return new Ga((function(){return new t}),e,void 0)},e.reset=function(t,e){var i=e.to;stt(i),this.normalizedElapsedTime=0,this.destination=i,this.path=[].concat(t,[e]);var n=i.activeReferenceCount;if(i.increaseActiveReference(),0===n)if(3===i.kind){var r=this.path[0],s=r.destinationStart,a=r.relativeDestinationStart?s:0===i.duration?0:s/i.duration;i.reenter(a)}else 5===i.kind&&i.reenter();i.activeReferenceCount,this._durationMultiplier=1-i.absoluteWeight},e._getAbsoluteDurationUnscaled=function(t){this.path.length;var e=this.path[0],i=e.duration;return e.normalizedDuration?(3===t.kind?t.duration:1)*i:i},n(t,[{key:"done",get:function(){return Xi(this.normalizedElapsedTime,1,1e-6)}}]),t}(),Dtt=function(){function t(){this._groups=[]}var e=t.prototype;return e.register=function(t){var e=t.group,i=this._groups.find((function(t){return t.name===e}));return i||(i=new Itt(e),this._groups.push(i)),i.addMember()},e.sync=function(){for(var t,e=p(this._groups);!(t=e()).done;)t.value.sync()},t}(),Itt=function(){function t(t){this._lastLeader=void 0,this._records=[],this.name=t}var e=t.prototype;return e.addMember=function(){var t=new Btt;return this._records.push(t),t},e.sync=function(){var t=this._records,e=t.length,i=this._lastLeader;if(this._lastLeader=void 0,!t.every((function(t){return!t.active}))){t.sort((function(t,e){var i=t.active?t.weight:-1;return(e.active?e.weight:-1)-i}));var n=0,r=t[0].weight;if(t[n]!==i)for(var s=0;s=0&&this._layerRecords.length,this._layerRecords[t].weight},i.setLayerWeight=function(t,e){t>=0&&this._layerRecords.length,this._layerRecords[t].weight=e},i.getLayerTopLevelStateMachineEvaluation=function(t){return this._layerRecords[t].stateMachineEvaluation},i.overrideClips=function(t){for(var e=this._layerRecords,i=e.length,n=0;n0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,h=s.rotation,u=s.eulerAngles;r&&(a&&1&r&&(e=a.result),o&&4&r&&(i=o.result),u&&8&r&&(n=u.result),h&&2&r&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},n(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),Xtt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=1,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=4,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=8,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=2,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new Wtt},i._createQuatBlendState=function(){return new jtt},e}(qtt),Ytt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new Xtt},e}(Utt);function Qtt(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;Kn.lerp(t,t,n,a)}}else Kn.copy(t,n);return s}function Ktt(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;Cr.slerp(t,e,n,a)}}else Cr.copy(t,n);return s}var Jtt=t("aB",Bh((Gtt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?this._crossFades.fastRemoveAt(e):ot(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i=0?this._anims.fastRemoveAt(e):ot(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(){var n=e[r];if(i._sockets.find((function(t){return t.target===n.target})))return 1;var s=t.getChildByPath(n.path),a=n.target&&s&&VY(s,t);a&&i._sockets.push({target:n.target,transform:a})},r=0;r=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(co(Ym)),het.EventType=bJ,y((ret=het).prototype,"clips",[tet],Object.getOwnPropertyDescriptor(ret.prototype,"clips"),ret.prototype),y(ret.prototype,"defaultClip",[eet],Object.getOwnPropertyDescriptor(ret.prototype,"defaultClip"),ret.prototype),set=yh(ret.prototype,"playOnLoad",[Uh],(function(){return!1})),aet=yh(ret.prototype,"_clips",[iet],(function(){return[]})),oet=yh(ret.prototype,"_defaultClip",[Uh],(function(){return null})),net=ret))||net)||net));function pet(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}T.Animation=_et,T.AnimationComponent=_et,ue(_et,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(uet||(uet={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}(cet||(cet={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(fet||(fet={}));var met=t("aG",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i=0;s--){var a=i[s];if("stop"===a.op){n.push(a);break}if("seek"===a.op)r||(n.push(a),r=!0);else{if(r){n.push(a);break}0===n.length&&n.push(a)}}t._operationQueue=n.reverse()}var vet,yet=0;function bet(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString()),get(t);var i=t._operationQueue[0];i&&bet(t,i)})).catch((function(){})))}function xet(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=Yi(t,0,this.duration)},n(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),Bet=function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}(),Met=new Bet,Pet=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Eet="on-context-running",ket=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new fo,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(Eet)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(Eet,t,e)},e.offRunning=function(t,e){this._eventTarget.off(Eet,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i,n){var r=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==r||r.catch(n)}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume){if("suspended"===i.state)i.resume().catch((function(t){X("runContext error",t)}));else if("running"===i.state)return void e();var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(t){X("onGesture resume error",t)}))};null==n||n.addEventListener("touchend",r,{capture:!0}),null==n||n.addEventListener("mouseup",r,{capture:!0})}else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},n(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();ket.support=!!Pet,ket.support&&(Cet=new ket);var Oet,Ret,Fet,Let,Vet=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=Cet.createBufferSource(t,!1);var n=Cet.createGain(e);this._bufferSourceNode.connect(n),Cet.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),Cet.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;Met.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(t){X("play error",t)}))},e.stop=function(){clearTimeout(this._currentTimer),Met.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.disconnect(),this._bufferSourceNode.buffer=null},n(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),Net=(Tet=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=fet.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new fo,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new Iet(t),this._gainNode=Cet.createGain(),Cet.connectContext(this._gainNode),this._src=e,bk.on(yk.EVENT_PAUSE,this._onInterruptedBegin,this),bk.on(yk.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){window.clearTimeout(this._currentTimer),this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),Met.tryReleasingCache(this._src),bk.off(yk.EVENT_PAUSE,this._onInterruptedBegin,this),bk.off(yk.EVENT_RESUME,this._onInterruptedEnd,this),this.offRunning()},t.load=function(e){return new Promise((function(i,n){t.loadNative(e).then((function(n){i(new t(n,e))})).catch(n)}))},t.loadNative=function(t){return new Promise((function(e,i){var n=Met.getCache(t);if(n)return Met.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?Cet.decodeAudioData(r.response).then((function(i){Met.addCache(t,i),e(i)})).catch((function(e){X("loadNative error",t,e)})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new Vet(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new met(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===fet.PLAYING&&this.pause().then((function(){t._state=fet.INTERRUPTED,t._eventTarget.emit(uet.INTERRUPTION_BEGIN)})).catch((function(t){X("_onInterruptedBegin error",t)}))},e._onInterruptedEnd=function(){var t=this;this._state===fet.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(uet.INTERRUPTION_END)})).catch((function(t){X("_onInterruptedEnd error",t)}))},e.offRunning=function(){this._runningCallback&&(Cet.offRunning(this._runningCallback),this._runningCallback=void 0)},e.seek=function(t){var e=this;return new Promise((function(i){e.offRunning(),e._audioTimer.seek(t),e._state===fet.PLAYING?e._doPlay().then(i).catch((function(t){X("seek error",t)})):i()}))},e.play=function(){return this.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){Cet.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},Cet.onceRunning(t._runningCallback),Cet.runContext().catch((function(t){X("doPlay error",t)})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=Cet.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.loop=this._loop,this._sourceNode.start(0,this._audioTimer.currentTime),this._state=fet.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(uet.ENDED),t._state=fet.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.disconnect(),this._sourceNode.buffer=null,this._sourceNode=void 0)}catch(t){}},e.pause=function(){return this.offRunning(),this._state===fet.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=fet.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=fet.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):(this._audioTimer.stop(),this._state=fet.STOPPED,Promise.resolve())},e.onInterruptionBegin=function(t){this._eventTarget.on(uet.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(uet.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(uet.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(uet.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(uet.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(uet.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return cet.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=Qi(t),this._volume=t,Cet.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}(),y(Tet.prototype,"seek",[xet],Object.getOwnPropertyDescriptor(Tet.prototype,"seek"),Tet.prototype),y(Tet.prototype,"play",[xet],Object.getOwnPropertyDescriptor(Tet.prototype,"play"),Tet.prototype),y(Tet.prototype,"pause",[xet],Object.getOwnPropertyDescriptor(Tet.prototype,"pause"),Tet.prototype),y(Tet.prototype,"stop",[xet],Object.getOwnPropertyDescriptor(Tet.prototype,"stop"),Tet.prototype),Tet),zet=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},n(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),Get=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==cet.DOM_AUDIO&&ket.support?Net.load(e).then((function(e){n(new t(e))})).catch(r):(ket.support||st(5201),Det.load(e).then((function(e){n(new t(e))})).catch(r))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==cet.DOM_AUDIO&&ket.support?Net.loadNative(t):(ket.support||st(5201),Det.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==cet.DOM_AUDIO&&ket.support?Net.loadOneShotAudio(t,e).then((function(t){n(new zet(t))})).catch(r):(ket.support||st(5201),Det.loadOneShotAudio(t,e).then((function(t){n(new zet(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},n(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();Get.maxAudioChannel=24;var Uet=t("aF",Bh("cc.AudioClip")((Let=function(t){function e(){var e;return(e=t.call(this)||this)._duration=Fet&&Fet(),e._loadMode=cet.UNKNOWN_AUDIO,e._meta=null,e._player=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i=t.prototype.destroy.call(this);return null===(e=this._player)||void 0===e||e.destroy(),this._player=null,this._meta&&(this._meta.player=null),i},i.validate=function(){return!!this._meta},i.getDuration=function(){return this._duration?this._duration:this._meta?this._meta.duration:0},i.getCurrentTime=function(){return this._player?this._player.currentTime:0},i.getVolume=function(){return this._player?this._player.volume:0},i.getLoop=function(){return!!this._player&&this._player.loop},i.setCurrentTime=function(t){var e;null===(e=this._player)||void 0===e||e.seek(t).catch((function(){}))},i.setVolume=function(t){this._player&&(this._player.volume=t)},i.setLoop=function(t){this._player&&(this._player.loop=t)},i.play=function(){var t;null===(t=this._player)||void 0===t||t.play().catch((function(){}))},i.pause=function(){var t;null===(t=this._player)||void 0===t||t.pause().catch((function(){}))},i.stop=function(){var t;null===(t=this._player)||void 0===t||t.stop().catch((function(){}))},i.playOneShot=function(t){void 0===t&&(t=1),this._nativeAsset&&Get.loadOneShotAudio(this._nativeAsset.url,t).then((function(t){t.play()})).catch((function(){}))},n(e,[{key:"duration",set:function(t){this._duration=t}},{key:"_nativeAsset",get:function(){return this._meta},set:function(t){this._meta=t,t?(this._loadMode=t.type,this._player=t.player):(this._meta=null,this._loadMode=cet.UNKNOWN_AUDIO,this._duration=0)}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,audioLoadMode:this.loadMode,ext:this._native,__isNative__:!0}}},{key:"loadMode",get:function(){return this._loadMode}},{key:"state",get:function(){return this._player?this._player.state:fet.INIT}}]),e}(em),Let.AudioType=cet,Fet=yh((Ret=Let).prototype,"_duration",[Uh],(function(){return 0})),y(Ret.prototype,"_nativeDep",[Su],Object.getOwnPropertyDescriptor(Ret.prototype,"_nativeDep"),Ret.prototype),Oet=Ret))||Oet);function Het(t,e,i){Get.load(t,{audioLoadMode:e.audioLoadMode}).then((function(e){var n={player:e,url:t,duration:e.duration,type:e.type};i(null,n)})).catch((function(t){i(t)}))}function Wet(t,e,i,n){var r=new Uet;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}T.AudioClip=Uet,Gx.register({".mp3":Het,".ogg":Het,".wav":Het,".m4a":Het}),tw.register({".mp3":Wet,".ogg":Wet,".wav":Wet,".m4a":Wet});var jet,qet,Xet,Yet,Qet,Ket,Jet,Zet,$et,tit,eit=new(function(){function t(){this._oneShotAudioInfoList=[],this._audioPlayerInfoList=[]}var e=t.prototype;return e._findIndex=function(t,e){return t.findIndex((function(t){return t.audio===e}))},e._tryAddPlaying=function(t,e){var i=this._findIndex(t,e);return i>-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof Get?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(ye(t,i),!0)},e.removePlaying=function(t){t instanceof Get?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0;)n+="/",n+=i[r];return n}function Lit(t,e,i){var n=t.N,r=i.split("/");if(0===r.length)return e;var s=e,a=0;""===r[0]&&(s=n,++a);for(var o=a;o!==r.length;++o){var h=r[o];if(""!==h&&"."!==h)if(".."!==h){if((s=t.locateChild(s,h))===n)return n}else{if(s===n)return n;s=t.getParent(s)}}return s}var Vit=function(){function t(){}return t.prototype.terminate=function(){return!1},t}();function Nit(t){var e=t.v().next();return e.done?t.N:e.value}var zit=function(t,e,i){this.v=void 0,this.e=void 0,this.iter=void 0,this.v=t,this.e=e,this.iter=i};function Git(t,e,i,n,r){var s=null,a=null,o=new Array;for(n.put(e,1),i.discoverVertex(e,t),a=t.oe(e),r.terminate(e,t)?o.push(new zit(e,null,null)):o.push(new zit(e,null,a));o.length;){var h=o.pop();if(e=h.v,s=h.e,a=h.iter,null!==s&&i.finishEdge(s,t),a)for(var u=a.next();!u.done;u=a.next()){var l=u.value,c=l.target;i.examineEdge(l,t);var f=n.get(c);if(0===f){if(i.treeEdge(l,t),s=l,o.push(new zit(e,s,a)),e=c,n.put(e,1),i.discoverVertex(e,t),a=t.oe(e),r.terminate(e,t))break}else 1===f?i.backEdge(l,t):i.forwardOrCrossEdge(l,t),i.finishEdge(l,t)}n.put(e,4),i.finishVertex(e,t)}}function Uit(t,e,i,n){if(void 0===n&&(n=null),null!==(n=n||Nit(t))&&0!==t.nv()){for(var r,s=p(t.v());!(r=s()).done;){var a=r.value;i.put(a,0),e.initializeVertex(a,t)}var o=new Vit;n!==Nit(t)&&(e.startVertex(n,t),Git(t,n,e,i,o));for(var h,u=p(t.v());!(h=u()).done;){var l=h.value;0===i.get(l)&&(e.startVertex(l,t),Git(t,l,e,i,o))}}}var Hit=function(){function t(){}var e=t.prototype;return e.initializeVertex=function(){},e.startVertex=function(){},e.discoverVertex=function(){},e.examineEdge=function(){},e.treeEdge=function(){},e.backEdge=function(){},e.forwardOrCrossEdge=function(){},e.finishEdge=function(){},e.finishVertex=function(){},t}(),Wit=function(){function t(t){this.g=void 0,this.g=t,this.N=t.N}var e=t.prototype;return e.edge=function(t,e){return this.g.reference(t,e)},e.source=function(t){return this.g.parent(t)},e.target=function(t){return this.g.child(t)},e.oe=function(t){return this.g.children(t)},e.od=function(t){return this.g.numChildren(t)},e.v=function(){return this.g.v()},e.nv=function(){return this.g.nv()},t}();function jit(t){t.x=0,t.y=0,t.z=0,t.w=0}function qit(t){t.left=0,t.top=0,t.width=0,t.height=0,t.minDepth=0,t.maxDepth=1}var Xit=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}return t.prototype.reset=function(t,e,i,n){this.x=t,this.y=e,this.z=i,this.w=n},t}(),Yit=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=""),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=7),void 0===a&&(a=new Rd),void 0===o&&(o=0),this.slotName1="",this.slotID=0,this.slotName=t,this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=a,this.shaderStageFlags=o}return t.prototype.reset=function(t,e,i,n,r,s,a){this.slotName=t,this.slotName1="",this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,jit(this.clearColor),this.slotID=0,this.shaderStageFlags=a},t}(),Qit=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=new Xit),void 0===s&&(s=0),this.plane=0,this.name=t,this.accessType=e,this.clearFlags=i,this.clearValueType=n,this.clearValue=r,this.shaderStageFlags=s}return t.prototype.reset=function(t,e,i,n,r){this.name=t,this.accessType=e,this.plane=0,this.clearFlags=i,this.clearValueType=n,this.clearValue.reset(0,0,0,0),this.shaderStageFlags=r},t}(),Kit=function(){function t(){this.dimension=0,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=0,this.sampleCount=1,this.textureFlags=0,this.flags=0,this.viewType=1}return t.prototype.reset=function(){this.dimension=0,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=0,this.sampleCount=1,this.textureFlags=0,this.flags=0,this.viewType=1},t}(),Jit=function(){function t(t){void 0===t&&(t=0),this.residency=t}return t.prototype.reset=function(t){this.residency=t},t}(),Zit=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.swapchain=t,this.isDepthStencil=e}return t.prototype.reset=function(t,e){this.swapchain=t,this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.isDepthStencil=e},t}(),$it=function(){function t(){this.states=0}return t.prototype.reset=function(){this.states=0},t}(),tnt=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),ent=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),int=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),nnt=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),rnt=function(){function t(){this.unused=0}return t.prototype.reset=function(){this.unused=0},t}(),snt=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[]}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0},t}(),ant=function(){this.o=[],this.i=[]},ont=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._subpasses=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new kit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Oit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Rit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this._names.length=0,this._subpasses.length=0,this.x.length=0},e.addVertex=function(t,e){var i=new ant,n=this.x.length;return this.x.push(i),this._names.push(t),this._subpasses.push(e),n},e.addEdge=function(t,e){return this.x[t].o.push(new Eit(e)),this.x[e].i.push(new Eit(t)),new Pit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getSubpass=function(t){return this._subpasses[t]},t}(),hnt=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0),this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[],this.viewport=new Od,this.showStatistics=!1,this.subpassID=t,this.count=e,this.quality=i}return t.prototype.reset=function(t,e,i){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0,qit(this.viewport),this.subpassID=t,this.count=e,this.quality=i,this.showStatistics=!1},t}(),unt=function(){function t(t){void 0===t&&(t=4294967295),this.rasterViews=new Map,this.computeViews=new Map,this.subpassID=t}return t.prototype.reset=function(t){this.rasterViews.clear(),this.computeViews.clear(),this.subpassID=t},t}(),lnt=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.attachmentIndexMap=new Map,this.textures=new Map,this.subpassGraph=new ont,this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport=new Od,this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.attachmentIndexMap.clear(),this.textures.clear(),this.subpassGraph.clear(),this.width=0,this.height=0,this.count=1,this.quality=0,qit(this.viewport),this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1},t}(),cnt=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.clearColors=[],this.clearDepth=0,this.clearStencil=0,this.renderPass=t,this.framebuffer=e}return t.prototype.reset=function(t,e){this.renderPass=t,this.framebuffer=e,this.clearColors.length=0,this.clearDepth=0,this.clearStencil=0},t}(),fnt=function(){function t(){this.format=0}return t.prototype.reset=function(){this.format=0},t}(),dnt=function(){function t(){this.textureView=null,this.format=0,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0}return t.prototype.reset=function(){this.textureView=null,this.format=0,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0},t}(),_nt=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},pnt=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._descs=[],this._traits=[],this._states=[],this._samplerInfo=[],this._valueIndex=new Map,this.renderPasses=new Map,this.nextFenceValue=0,this.version=0}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new kit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Oit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Rit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.renderPasses.clear(),this.nextFenceValue=0,this.version=0,this._valueIndex.clear(),this._names.length=0,this._descs.length=0,this._traits.length=0,this._states.length=0,this._samplerInfo.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,a,o){void 0===o&&(o=4294967295);var h=new _nt(t,e),u=this.x.length;return this.x.push(h),this._names.push(i),this._descs.push(n),this._traits.push(r),this._states.push(s),this._samplerInfo.push(a),this._valueIndex.set(i,u),4294967295!==o&&this.addEdge(o,u),u},e.addEdge=function(t,e){return this.x[t].o.push(new Eit(e)),this.x[e].i.push(new Eit(t)),new Pit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getDesc=function(t){return this._descs[t]},e.getTraits=function(t){return this._traits[t]},e.getStates=function(t){return this._states[t]},e.getSampler=function(t){return this._samplerInfo[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.managed(i.j);case 1:return t.managedBuffer(i.j);case 2:return t.managedTexture(i.j);case 3:return t.persistentBuffer(i.j);case 4:return t.persistentTexture(i.j);case 5:return t.framebuffer(i.j);case 6:return t.swapchain(i.j);case 7:return t.formatView(i.j);case 8:return t.subresourceView(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new kit(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.contains=function(t){return this._valueIndex.has(t)},e.vertex=function(t){return this._valueIndex.get(t)},e.find=function(t){var e=this._valueIndex.get(t);return void 0===e?4294967295:e},t}(),mnt=function(){function t(){this.computeViews=new Map,this.textures=new Map}return t.prototype.reset=function(){this.computeViews.clear(),this.textures.clear()},t}(),gnt=function(){function t(){this.resolvePairs=[]}return t.prototype.reset=function(){this.resolvePairs.length=0},t}(),vnt=function(){function t(){this.copyPairs=[],this.uploadPairs=[]}return t.prototype.reset=function(){this.copyPairs.length=0,this.uploadPairs.length=0},t}(),ynt=function(){function t(){this.movePairs=[]}return t.prototype.reset=function(){this.movePairs.length=0},t}(),bnt=function(){function t(){this.computeViews=new Map}return t.prototype.reset=function(){this.computeViews.clear()},t}(),Snt=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=7),void 0===i&&(i=new Rd),this.slotName=t,this.clearFlags=e,this.clearColor=i}return t.prototype.reset=function(t,e){this.slotName=t,this.clearFlags=e,jit(this.clearColor)},t}(),xnt=function(){function t(t,e,i){void 0===t&&(t=1),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.viewport=null,this.hint=t,this.phaseID=e,this.passLayoutID=i}return t.prototype.reset=function(t,e,i){this.hint=t,this.phaseID=e,this.passLayoutID=i,this.viewport=null},t}(),wnt=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=new _it),void 0===r&&(r=1),void 0===s&&(s=null),this.scene=t,this.camera=e,this.light=n,this.flags=i,this.cullingFlags=r,this.shadingLight=s}return t.prototype.reset=function(t,e,i,n,r){this.scene=t,this.camera=e,this.light.reset(null,0,!1,null),this.flags=i,this.cullingFlags=n,this.shadingLight=r},t}(),Tnt=function(){function t(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r}return t.prototype.reset=function(t,e,i,n,r){this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r},t}(),Cnt=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null),this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n}return t.prototype.reset=function(t,e,i,n){this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n},t}(),Ant=function(){function t(){this.constants=new Map,this.buffers=new Map,this.textures=new Map,this.samplers=new Map,this.custom=""}return t.prototype.reset=function(){this.constants.clear(),this.buffers.clear(),this.textures.clear(),this.samplers.clear(),this.custom=""},t}(),Dnt=function(t,e){this.o=[],this.i=[],this.c=[],this.p=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},Int=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._layoutNodes=[],this._data=[],this._valid=[],this.index=new Map,this.sortedVertices=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new kit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Oit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Rit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.index.clear(),this.sortedVertices.length=0,this._names.length=0,this._layoutNodes.length=0,this._data.length=0,this._valid.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,a){void 0===a&&(a=4294967295);var o=new Dnt(t,e),h=this.x.length;return this.x.push(o),this._names.push(i),this._layoutNodes.push(n),this._data.push(r),this._valid.push(s),4294967295!==a&&(this.x[a].c.push(new Eit(h)),o.p.push(new Eit(a))),h},e.addEdge=function(t,e){return this.x[t].o.push(new Eit(e)),this.x[e].i.push(new Eit(t)),new Pit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getLayout=function(t){return this._layoutNodes[t]},e.setLayout=function(t,e){this._layoutNodes[t]=e},e.getData=function(t){return this._data[t]},e.getValid=function(t){return this._valid[t]},e.setValid=function(t,e){this._valid[t]=e},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.rasterPass(i.j);case 1:return t.rasterSubpass(i.j);case 2:return t.computeSubpass(i.j);case 3:return t.compute(i.j);case 4:return t.resolve(i.j);case 5:return t.copy(i.j);case 6:return t.move(i.j);case 7:return t.raytrace(i.j);case 8:return t.queue(i.j);case 9:return t.scene(i.j);case 10:return t.blit(i.j);case 11:return t.dispatch(i.j);case 12:return t.clear(i.j);case 13:return t.viewport(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].c);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new kit(this.x[t].c.values(),t)},e.numChildren=function(t){return this.x[t].c.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].p;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.x[t].c.push(new Eit(e)),this.x[e].p.push(new Eit(t)),new Pit(t,e)},t}();function Bnt(t){return new Ua((function(){return new t}),16)}var Mnt=function(){function t(t){this.renderCommon=void 0,this.cv=Bnt(Xit),this.rv=Bnt(Yit),this.cv1=Bnt(Qit),this.rd=Bnt(Kit),this.rt=Bnt(Jit),this.rs=Bnt(Zit),this.rs1=Bnt($it),this.mb=Bnt(tnt),this.pb=Bnt(ent),this.mt=Bnt(int),this.pt=Bnt(nnt),this.mr=Bnt(rnt),this.s=Bnt(snt),this.sg=Bnt(ont),this.rs2=Bnt(hnt),this.cs=Bnt(unt),this.rp=Bnt(lnt),this.prpaf=Bnt(cnt),this.fv=Bnt(fnt),this.sv=Bnt(dnt),this.rg=Bnt(pnt),this.cp=Bnt(mnt),this.rp1=Bnt(gnt),this.cp1=Bnt(vnt),this.mp=Bnt(ynt),this.rp2=Bnt(bnt),this.cv2=Bnt(Snt),this.rq=Bnt(xnt),this.sd=Bnt(wnt),this.d=Bnt(Tnt),this.b=Bnt(Cnt),this.rd1=Bnt(Ant),this.rg1=Bnt(Int),this.renderCommon=t}var e=t.prototype;return e.reset=function(){this.cv.reset(),this.rv.reset(),this.cv1.reset(),this.rd.reset(),this.rt.reset(),this.rs.reset(),this.rs1.reset(),this.mb.reset(),this.pb.reset(),this.mt.reset(),this.pt.reset(),this.mr.reset(),this.s.reset(),this.sg.reset(),this.rs2.reset(),this.cs.reset(),this.rp.reset(),this.prpaf.reset(),this.fv.reset(),this.sv.reset(),this.rg.reset(),this.cp.reset(),this.rp1.reset(),this.cp1.reset(),this.mp.reset(),this.rp2.reset(),this.cv2.reset(),this.rq.reset(),this.sd.reset(),this.d.reset(),this.b.reset(),this.rd1.reset(),this.rg1.reset()},e.createClearValue=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.cv.add();return r.reset(t,e,i,n),r},e.createRasterView=function(t,e,i,n,r,s,a){void 0===t&&(t=""),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=7),void 0===a&&(a=0);var o=this.rv.add();return o.reset(t,e,i,n,r,s,a),o},e.createComputeView=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.cv1.add();return s.reset(t,e,i,n,r),s},e.createResourceDesc=function(){var t=this.rd.add();return t.reset(),t},e.createResourceTraits=function(t){void 0===t&&(t=0);var e=this.rt.add();return e.reset(t),e},e.createRenderSwapchain=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var i=this.rs.add();return i.reset(t,e),i},e.createResourceStates=function(){var t=this.rs1.add();return t.reset(),t},e.createManagedBuffer=function(t){void 0===t&&(t=null);var e=this.mb.add();return e.reset(t),e},e.createPersistentBuffer=function(t){void 0===t&&(t=null);var e=this.pb.add();return e.reset(t),e},e.createManagedTexture=function(t){void 0===t&&(t=null);var e=this.mt.add();return e.reset(t),e},e.createPersistentTexture=function(t){void 0===t&&(t=null);var e=this.pt.add();return e.reset(t),e},e.createManagedResource=function(){var t=this.mr.add();return t.reset(),t},e.createSubpass=function(){var t=this.s.add();return t.reset(),t},e.createSubpassGraph=function(){var t=this.sg.add();return t.clear(),t},e.createRasterSubpass=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0);var n=this.rs2.add();return n.reset(t,e,i),n},e.createComputeSubpass=function(t){void 0===t&&(t=4294967295);var e=this.cs.add();return e.reset(t),e},e.createRasterPass=function(){var t=this.rp.add();return t.reset(),t},e.createPersistentRenderPassAndFramebuffer=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=this.prpaf.add();return i.reset(t,e),i},e.createFormatView=function(){var t=this.fv.add();return t.reset(),t},e.createSubresourceView=function(){var t=this.sv.add();return t.reset(),t},e.createResourceGraph=function(){var t=this.rg.add();return t.clear(),t},e.createComputePass=function(){var t=this.cp.add();return t.reset(),t},e.createResolvePass=function(){var t=this.rp1.add();return t.reset(),t},e.createCopyPass=function(){var t=this.cp1.add();return t.reset(),t},e.createMovePass=function(){var t=this.mp.add();return t.reset(),t},e.createRaytracePass=function(){var t=this.rp2.add();return t.reset(),t},e.createClearView=function(t,e){void 0===t&&(t=""),void 0===e&&(e=7);var i=this.cv2.add();return i.reset(t,e),i},e.createRenderQueue=function(t,e,i){void 0===t&&(t=1),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295);var n=this.rq.add();return n.reset(t,e,i),n},e.createSceneData=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=null);var s=this.sd.add();return s.reset(t,e,i,n,r),s},e.createDispatch=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.d.add();return s.reset(t,e,i,n,r),s},e.createBlit=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null);var r=this.b.add();return r.reset(t,e,i,n),r},e.createRenderData=function(){var t=this.rd1.add();return t.reset(),t},e.createRenderGraph=function(){var t=this.rg1.add();return t.clear(),t},t}(),Pnt=function(){this.subpass=0},Ent=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.descriptorID=t,this.type=e,this.count=i}return t.prototype.reset=function(t,e,i){this.descriptorID=t,this.type=e,this.count=i},t}(),knt=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=0,this.descriptors=[],this.type=t,this.visibility=e,this.capacity=i}return t.prototype.reset=function(t,e,i){this.type=t,this.visibility=e,this.offset=0,this.capacity=i,this.descriptors.length=0},t}(),Ont=function(){function t(t,e,i,n,r){void 0===t&&(t=4294967295),void 0===e&&(e=0),void 0===i&&(i=[]),void 0===n&&(n=new Map),void 0===r&&(r=new Map),this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.slot=t,this.capacity=e,this.descriptorBlocks=i,this.uniformBlocks=n,this.bindingMap=r}return t.prototype.reset=function(t,e){this.slot=t,this.capacity=e,this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.descriptorBlocks.length=0,this.uniformBlocks.clear(),this.bindingMap.clear()},t}(),Rnt=function(){function t(t,e,i){void 0===t&&(t=new Ont),void 0===e&&(e=null),void 0===i&&(i=null),this.descriptorSetLayoutInfo=new g_,this.descriptorSetLayoutData=t,this.descriptorSetLayout=e,this.descriptorSet=i}return t.prototype.reset=function(t,e){this.descriptorSetLayoutData.reset(4294967295,0),this.descriptorSetLayoutInfo.bindings.length=0,this.descriptorSetLayout=t,this.descriptorSet=e},t}(),Fnt=function(){function t(){this.descriptorSets=new Map}return t.prototype.reset=function(){this.descriptorSets.clear()},t}(),Lnt=function(){function t(){this.descriptorBindings=new Map}return t.prototype.reset=function(){this.descriptorBindings.clear()},t}(),Vnt=function(){function t(){this.layoutData=new Map,this.bindingData=new Map}return t.prototype.reset=function(){this.layoutData.clear(),this.bindingData.clear()},t}(),Nnt=function(){function t(){this.passes=[]}return t.prototype.reset=function(){this.passes.length=0},t}(),znt=function(){function t(){this.techniques=new Map}return t.prototype.reset=function(){this.techniques.clear()},t}(),Gnt=function(){function t(){this.layout=new Fnt,this.pipelineLayout=null}return t.prototype.reset=function(){this.layout.reset(),this.pipelineLayout=null},t}(),Unt=function(){function t(){this.descriptorVisibility=new Map}return t.prototype.reset=function(){this.descriptorVisibility.clear()},t}(),Hnt=function(){function t(){this.rootSignature="",this.shaderPrograms=[],this.shaderIndex=new Map,this.pipelineLayout=null}return t.prototype.reset=function(){this.rootSignature="",this.shaderPrograms.length=0,this.shaderIndex.clear(),this.pipelineLayout=null},t}(),Wnt=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},jnt=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._updateFrequencies=[],this._layouts=[],this.valueNames=[],this.attributeIndex=new Map,this.constantIndex=new Map,this.shaderLayoutIndex=new Map,this.effects=new Map,this.constantMacros=""}var e=t.prototype;return e.edge=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new kit(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Oit(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Rit(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=p(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.valueNames.length=0,this.attributeIndex.clear(),this.constantIndex.clear(),this.shaderLayoutIndex.clear(),this.effects.clear(),this.constantMacros="",this._names.length=0,this._updateFrequencies.length=0,this._layouts.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s){void 0===s&&(s=4294967295);var a=new Wnt(t,e),o=this.x.length;return this.x.push(a),this._names.push(i),this._updateFrequencies.push(n),this._layouts.push(r),4294967295!==s&&this.addEdge(s,o),o},e.addEdge=function(t,e){return this.x[t].o.push(new Eit(e)),this.x[e].i.push(new Eit(t)),new Pit(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.getUpdate=function(t){return this._updateFrequencies[t]},e.setUpdate=function(t,e){this._updateFrequencies[t]=e},e.getLayout=function(t){return this._layouts[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.renderStage(i.j);case 1:return t.renderPhase(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=p(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new kit(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.locateChild=function(t,e){if(4294967295===t){for(var i,n=p(this.x.keys());!(i=n()).done;){var r=i.value;if(0===this.x[r].i.length&&this._names[r]===e)return r}return 4294967295}for(var s,a=p(this.x[t].o);!(s=a()).done;){var o=s.value.target;if(e===this._names[o])return o}return 4294967295},e.locate=function(t){return Lit(this,4294967295,t)},e.locateRelative=function(t,e){return void 0===e&&(e=4294967295),Lit(this,e,t)},e.path=function(t){return Fit(this,t)},t}();function qnt(t,e){e.descriptorID=t.n(),e.type=t.n(),e.count=t.n()}function Xnt(t,e){var i;e.type=t.n(),e.visibility=t.n(),e.offset=t.n(),e.capacity=t.n(),i=t.n(),e.descriptors.length=i;for(var n=0;n!==i;++n){var r=new Ent;qnt(t,r),e.descriptors[n]=r}}function Ynt(t,e){e.slot=t.n(),e.capacity=t.n(),e.uniformBlockCapacity=t.n(),e.samplerTextureCapacity=t.n();var i=0;i=t.n(),e.descriptorBlocks.length=i;for(var n=0;n!==i;++n){var r=new knt;Xnt(t,r),e.descriptorBlocks[n]=r}i=t.n();for(var s=0;s!==i;++s){var a=t.n(),o=new Qd;cit(t,o),e.uniformBlocks.set(a,o)}i=t.n();for(var h=0;h!==i;++h){var u=t.n(),l=t.n();e.bindingMap.set(u,l)}}function Qnt(t,e){Ynt(t,e.descriptorSetLayoutData),dit(t,e.descriptorSetLayoutInfo)}function Knt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new Rnt;Qnt(t,s),e.descriptorSets.set(r,s)}}function Jnt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorBindings.set(r,s)}}function Znt(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new Ont;Ynt(t,s),e.layoutData.set(r,s)}i=t.n();for(var a=0;a!==i;++a){var o=t.n(),h=new Lnt;Jnt(t,h),e.bindingData.set(o,h)}}function $nt(t,e){var i;i=t.n(),e.passes.length=i;for(var n=0;n!==i;++n){var r=new Vnt;Znt(t,r),e.passes[n]=r}}function trt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new Nnt;$nt(t,s),e.techniques.set(r,s)}}function ert(t,e){Knt(t,e.layout)}function irt(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorVisibility.set(r,s)}}function nrt(t,e){e.rootSignature=t.s();var i=0;i=t.n(),e.shaderPrograms.length=i;for(var n=0;n!==i;++n){var r=new Gnt;ert(t,r),e.shaderPrograms[n]=r}i=t.n();for(var s=0;s!==i;++s){var a=t.s(),o=t.n();e.shaderIndex.set(a,o)}}function rrt(t,e){var i=t.n();t.n(),t.n(),t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n(),a=t.s(),o=t.n(),h=new Fnt;switch(Knt(t,h),r){case 0:var u=new Unt;irt(t,u),e.addVertex(0,u,a,o,h,s);break;case 1:var l=new Hnt;nrt(t,l),e.addVertex(1,l,a,o,h,s)}}var c=0;c=t.n(),e.valueNames.length=c;for(var f=0;f!==c;++f)e.valueNames[f]=t.s();c=t.n();for(var d=0;d!==c;++d){var _=t.s(),p=t.n();e.attributeIndex.set(_,p)}c=t.n();for(var m=0;m!==c;++m){var g=t.s(),v=t.n();e.constantIndex.set(g,v)}c=t.n();for(var y=0;y!==c;++y){var b=t.s(),S=t.n();e.shaderLayoutIndex.set(b,S)}c=t.n();for(var x=0;x!==c;++x){var w=t.s(),T=new znt;trt(t,T),e.effects.set(w,T)}}var srt=function(){function t(t){this.colors=void 0,this.colors=new Array(t)}var e=t.prototype;return e.get=function(t){return this.colors[t]},e.put=function(t,e){this.colors[t]=e},t}();function art(t){switch(t){case 1:case 5:case 9:case 13:return 1;case 6:case 14:case 10:case 2:return 2;case 15:case 3:case 11:case 7:return 3;case 4:case 16:case 12:case 8:case 17:return 4;case 18:case 20:return 6;case 19:case 23:return 8;case 21:return 9;case 22:case 24:return 12;case 25:return 16;default:return 0}}function ort(t,e){var i=1;return 1&t||0!==e||(i=8&t?1:0),6&~t&&1===e&&(2&t||(i=0),4&t||(i=0)),i}function hrt(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=void 0),s=s||new Dd;var a=t?t.viewport:new Dd(0,0,1,1),o=e,h=i;if(s.x=a.x*o,s.y=a.y*h,s.width=a.width*o,s.height=a.height*h,n)switch(n.type){case 0:var u=n;if(u.shadowFixedArea||u.csmLevel===Jw.LEVEL_1)s.x=0,s.y=0,s.width=o,s.height=h;else{var l=T.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*o,s.y=l>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*o,s.height=.5*h}break;case 2:s.x=0,s.y=0,s.width=o,s.height=h}return s}function urt(t,e,i,n,r){var s="Camera"+r,a=i.renderArea(),o=a.x,h=a.y,u=i.camera,l="reflectionProbePassColor"+s,c="reflectionProbePassDS"+s;e.containsResource(l)||(e.addRenderWindow(l,35,o,h,n),e.addDepthStencil(c,55,o,h,3)),e.updateRenderWindow(l,n),e.updateDepthStencil(c,o,h);var f=e.addRenderPass(o,h,"default");f.name="ReflectionProbePass"+r,f.setViewport(new Od(0,0,o,h)),f.addRenderTarget(l,ort(u.clearFlag,0),0,new Rd(u.clearColor.x,u.clearColor.y,u.clearColor.z,u.clearColor.w)),f.addDepthStencil(c,ort(u.clearFlag,1),0,u.clearDepth,u.clearStencil,u.clearFlag);var d=f.addQueue(1,"reflect-map"),_=new _it;_.probe=i,d.addSceneOfCamera(t,_,8193),lrt(d,u,e)}function lrt(t,e,i){var n=T.director.root.pipeline,r=i.pipelineSceneData,s=r.skybox;t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),t.setVec4("cc_cameraPos",new kn(e.position.x,e.position.y,e.position.z,n.getCombineSignY())),t.setVec4("cc_surfaceTransform",new kn(e.surfaceTransform,0,Math.cos(Ji(s.getRotationAngle())),Math.sin(Ji(s.getRotationAngle())))),t.setVec4("cc_screenScale",new kn(r.shadingScale,r.shadingScale,1/r.shadingScale,1/r.shadingScale)),t.setVec4("cc_exposure",new kn(e.exposure,1/e.exposure,r.isHDR?1:0,1/nM.standardExposureValue))}function crt(t,e,i){i instanceof H_?t.bindBuffer(e,i):i instanceof up?t.bindTexture(e,i):i instanceof op&&t.bindSampler(e,i)}function frt(t,e,i){crt(t,e,i)}function drt(t,e){for(var i,n=p(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}new th(0,0,0,.5,.5,.5),new th,new(function(){function t(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array,this.validLights=[]}return t.prototype.reset=function(){this.shadowEnabled=!1,this.mainLightShadowNames.length=0,this.spotLightShadowNames.length=0,this.validLights.length=0},t}());var _rt=function(){function t(t,e){void 0===e&&(e=2),this.buffers=[],this.currBuffIdx=0,this.device=void 0,this.currUniform=void 0,this._root=void 0;var i=(this._root=T.director.root).device;this.device=i,this.currUniform=new Float32Array(t/4);for(var n=0;nt.length)return n;for(var r=Math.min(e.length,t.length-i),s=0;s=this.instanceBuffers.length&&this.instanceBuffers.push(new Dw(t)),this.passInstances.set(t,n);var r=this.instanceBuffers[n];r.pass=t,r.instances}this.instanceBuffers[this.passInstances.get(t)].merge(e,i)},e.clear=function(){this.passInstances.clear(),this.instanceBuffers.forEach((function(t){t.clear()}))},e.sort=function(){},e.uploadBuffers=function(t){for(var e,i=p(this.passInstances.entries());!(e=i()).done;){var n=e.value;n[0];var r=n[1],s=this.instanceBuffers[r];s.hasPendingModels&&s.uploadBuffers(t)}},e.recordCommandBuffer=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=null);for(var s,a=p(this.instanceBuffers);!(s=a()).done;){var o=s.value;if(o.hasPendingModels){var h=o.instances,u=o.pass;e.bindDescriptorSet(1,u.descriptorSet);for(var l,c=null,f=p(h);!(l=f()).done;){var d=l.value;if(d.count){var _=Hw.getOrCreatePipelineState(vp.gfxDevice,u,d.shader,t,d.ia);c!==_&&(e.bindPipelineState(_),c=_),i&&e.bindDescriptorSet(0,i,[n]),r?e.bindDescriptorSet(2,d.descriptorSet,r):e.bindDescriptorSet(2,d.descriptorSet,o.dynamicOffsets),e.bindInputAssembler(d.ia),e.draw(d.ia)}}}}},t}(),ist=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=void 0,this.lightBoundsCulledResultID=void 0,this.renderQueueTarget=void 0,this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i}return t.prototype.update=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i},t}();function nst(t,e,i,n,r,s){var a;if(r&&s&&(a=Hw.getOrCreatePipelineState(vp.gfxDevice,i,r,e,s)),a){var o=s;t.bindPipelineState(a),t.bindDescriptorSet(1,i.descriptorSet),t.bindDescriptorSet(2,n),t.bindInputAssembler(o),t.draw(o)}}var rst=function(){function t(){this.probeQueue=new Qrt,this.opaqueQueue=new tst,this.transparentQueue=new tst,this.opaqueInstancingQueue=new est,this.transparentInstancingQueue=new est,this.camera=null,this.sceneFlags=0,this.lightByteOffset=4294967295}var e=t.prototype;return e.sort=function(){this.opaqueQueue.sortOpaqueOrCutout(),this.transparentQueue.sortTransparent(),this.opaqueInstancingQueue.sort(),this.transparentInstancingQueue.sort()},e.update=function(){this.probeQueue.clear(),this.opaqueQueue.clear(),this.transparentQueue.clear(),this.opaqueInstancingQueue.clear(),this.transparentInstancingQueue.clear(),this.camera=null,this.sceneFlags=0,this.lightByteOffset=4294967295},e.empty=function(){return this.opaqueQueue.empty()&&this.transparentQueue.empty()&&this.opaqueInstancingQueue.empty()&&this.transparentInstancingQueue.empty()},e.recordCommands=function(t,e,i){var n=4294967295===this.lightByteOffset?null:[this.lightByteOffset];3&i&&(this.opaqueQueue.recordCommandBuffer(vp.gfxDevice,e,t,null,0,n),this.opaqueInstancingQueue.recordCommandBuffer(e,t,null,0,n)),4&i&&(this.transparentInstancingQueue.recordCommandBuffer(e,t,null,0,n),this.transparentQueue.recordCommandBuffer(vp.gfxDevice,e,t,null,0,n))},t}(),sst=4294967295;function ast(t){switch(t){case 0:return 1;case 1:return 2;case 2:return 16;case 3:return 32;case 4:return 64;case 5:return 4;case 6:return 8;case 7:return 128;case 8:return 256;default:return Y("DescriptorType not found"),256}}function ost(t){switch(t){case 1:return 0;case 2:return 1;case 16:return 2;case 32:return 3;case 64:return 4;case 4:return 5;case 8:return 6;case 128:return 7;case 256:return 8;default:return Y("DescriptorTypeOrder not found"),8}}function hst(t,e){return t.locateChild(t.N,e||"default")}function ust(t,e,i){return t.locateChild(e,i)}function lst(t,e,i){return void 0===i?t.locateChild(e,"default"):"number"==typeof i?t.locateChild(e,i.toString()):t.locateChild(e,i)}var cst,fst,dst=new Map([["cc_lightPos",1],["cc_lightColor",1],["cc_lightSizeRangeAngle",1],["cc_lightDir",1],["cc_lightBoundingSizeVS",1]]);function _st(t){for(var e,i=0,n=p(t);!(e=n()).done;){var r=e.value;if(r.count)i+=V_(r.type)*r.count;else{var s=dst.get(r.name);if(void 0===s)if("cc_joints"!==r.name)Y("Invalid uniform count: "+r.name);else{var a=V_(r.type)*Zy.LAYOUT.members[0].count;Q(a!==Zy.SIZE),i+=a}else i+=V_(r.type)*s}}return Q(!!i),i}function pst(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e4*i.updateFrequency+1e3*i.parameterType+100*i.descriptorType+i.visibility-(1e4*n.updateFrequency+1e3*n.parameterType+100*n.descriptorType+n.visibility)}function mst(t,e){var i=t.attributeIndex.get(e);if(void 0===i){var n=t.valueNames.length;return t.attributeIndex.set(e,n),t.valueNames.push(e),n}return i}function gst(t,e){for(var i=0;i=t.valueNames.length?"":t.valueNames[e]}var kst=function(){this.frustumCullingKeyRecycle=new Ua((function(){return new Gst}),8),this.frustumCullingsRecycle=new Ua((function(){return new Xst}),8),this.lightBoundsCullingRecycle=new Ua((function(){return new Hst}),8),this.lightBoundsCullingResultRecycle=new Ua((function(){return new Wst}),8),this.lightBoundsCullingKeyRecycle=new Ua((function(){return new Ust}),8),this.renderQueueRecycle=new Ua((function(){return new rst}),8),this.renderQueueQueryRecycle=new Ua((function(){return new ist}),8)},Ost=fv.makeMaskExclude([fv.BitMask.UI_2D,fv.BitMask.UI_3D,fv.BitMask.GIZMOS,fv.BitMask.EDITOR,fv.BitMask.SCENE_GIZMO,fv.BitMask.PROFILER]),Rst=new WeakMap,Fst="",Lst=0;function Vst(t){return Rst.has(t)||Rst.set(t,++Lst),Rst.get(t)}function Nst(t,e,i){void 0===i&&(i=-1),Fst="";var n=t.camera,r=t.light.light,s=t.light.level,a=t.light.probe,o=t.shadingLight;return Fst+=Prt(n?Vst(n):0),Fst+=Prt(a?Vst(a):0),Fst+=Prt(-1===i&&r?Vst(r):0),Fst+=Prt(-1!==i&&o?Vst(o):0),Fst+=Prt(-1===i?s:0),Fst+=Prt(e?1:0),Fst+=Prt(i)}var zst,Gst=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.sceneData=null,this.castShadows=!1,this.sceneData=t,this.castShadows=e}return t.prototype.update=function(t,e){this.sceneData=t,this.castShadows=e},t}(),Ust=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=null,this.frustumCullingID=-1,this.sceneData=t,this.frustumCullingID=e}return t.prototype.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=t,this.frustumCullingID=e},t}(),Hst=function(){function t(){this.resultKeyIndex=new Map,this.resultIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}(),Wst=function(){function t(){this.instances=new Array,this.lightByteOffset=4294967295}return t.prototype.update=function(){return this.instances.length=0,this.lightByteOffset=4294967295,this},t}();function jst(t,e,i){return t+"-"+e+"-"+i}function qst(t){var e=t.split("-");return[parseInt(e[0]),parseInt(e[1]),parseInt(e[2])]}var Xst=function(){function t(){this.resultIndex=new Map,this.resultKeyIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}();function Yst(t,e){return t&&(e&t.layer)===t.layer}function Qst(t,e){return!!(e&t.visFlags)}function Kst(t,e){return Yst(t.node,e)||Qst(t,e)}function Jst(t){return krt((t.node.layer&Ost)===t.node.layer||Ost&t.visFlags)}var Zst=new th;function $st(t,e,i){var n=t.worldBounds,r=zst.shadows;return i&&r.type===Qw.Planar?(th.transform(Zst,n,r.matLight),!Pa.aabbFrustum(Zst,e)):!Pa.aabbFrustum(n,e)}function tat(t,e,i,n,r,s){var a,o,h=zst.skybox,u=h.model,l=e.visibility,c=8&e.clearFlag;!n&&h&&h.enabled&&u&&c&&s.push(u);for(var f,d=p(t.models);!(f=d()).done;){var _=f.value;if(_.enabled&&_.node&&(!n||_.castShadow)&&!t.isCulledByLod(e,_)){var m=_.worldBounds;if(r)if(0===r.probeType){if(!Kst(_,l))continue;if(m&&(a=m,o=r.boundingBox,!Pa.aabbWithAABB(a,o)))continue;s.push(_)}else Jst(_)&&s.push(_);else{if(!Kst(_,l))continue;if(m&&$st(_,i,n))continue;s.push(_)}}}}var eat=new Kn;function iat(t,e){var i=0;return e.node&&(Kn.subtract(eat,e.worldBounds?e.worldBounds.center:e.node.worldPosition,t.position),i=Kn.dot(eat,t.forward)),i}function nat(t,e,i,n,r,s,a){var o=a.probeQueue;n&&o.addToProbeQueue(s,t);for(var h=s.subModels,u=h.length,l=zst.skybox.model,c=iat(r,s),f=0;fthis.lightBoundsCullingResults.length&&this.lightBoundsCullingResults.push(this.cullingPools.lightBoundsCullingResultRecycle.add().update()),r.resultIndex.set(a,h);var u=this.cullingPools.lightBoundsCullingKeyRecycle.add();return u.update(t,e),r.resultKeyIndex.set(a,u),h},e.getOrCreateFrustumCulling=function(t){var e=this.renderGraph.j(t),i=e.scene,n=this.frustumCullings.get(i);if(!n){var r=this.cullingPools.frustumCullingsRecycle.add();r.update(),this.frustumCullings.set(i,r),n=this.frustumCullings.get(i)}var s=krt(8&e.flags),a=Nst(e,s),o=n.resultIndex.get(a);if(void 0!==o)return o;var h=this.numFrustumCulling++;this.numFrustumCulling>this.frustumCullingResults.length&&this.frustumCullingResults.push([]),n.resultIndex.set(a,h);var u=this.cullingPools.frustumCullingKeyRecycle.add();return u.update(e,s),n.resultKeyIndex.set(a,u),h},e.getOrCreateRenderQueue=function(t,e,i){var n=this.renderQueueIndex.get(t);if(void 0!==n)return this.renderQueues[n].sceneFlags|=e&this.kDrawMask,n;var r=this.numRenderQueues++;if(this.numRenderQueues>this.renderQueues.length){var s=this.cullingPools.renderQueueRecycle.add();s.update(),this.renderQueues.push(s)}var a=this.renderQueues[r];return this.renderQueueIndex.set(t,r),a.camera=i,a.sceneFlags=e&this.kAllMask,r},e.collectCullingQueries=function(t){for(var e,i=p(t.v());!(e=i()).done;){var n=e.value;if(t.h(9,n)&&t.getValid(n)){var r=t.j(n);if(r.scene){var s=this.getOrCreateFrustumCulling(n),a=this.getOrCreateLightBoundsCulling(r,s),o=t.getParent(n),h=jst(s,a,t.j(o).phaseID),u=this.getOrCreateRenderQueue(h,r.flags,r.camera),l=this.cullingPools.renderQueueQueryRecycle.add();l.update(s,a,u),this.renderQueueQueryIndex.set(n,l)}}}},e.uploadInstancing=function(t){for(var e=0;e!==this.numRenderQueues;++e){var i=this.renderQueues[e];i.opaqueInstancingQueue.uploadBuffers(t),i.transparentInstancingQueue.uploadBuffers(t)}},e._getPhaseIdFromScene=function(t){var e=this.renderGraph,i=e.getParent(t);return e.j(i).phaseID},e.getBuiltinShadowFrustum=function(t,e,i,n){var r=t.csmLayers,s=i.csmLevel,a=t.shadows;return a.type===Qw.Planar?e.frustum:(a.enabled&&a.type===Qw.ShadowMap&&i&&i.node&&r.update(t,e),i.shadowFixedArea||s===Jw.LEVEL_1?r.specialLayer.validFrustum:r.layers[n].validFrustum)},e.batchFrustumCulling=function(t){for(var e,i=p(this.frustumCullings);!(e=i()).done;)for(var n,r=e.value,s=r[0],a=r[1],o=p(a.resultIndex);!(n=o()).done;){var h=n.value,u=h[0],l=h[1],c=a.resultKeyIndex.get(u),f=c.sceneData,d=f.light.light,_=f.light.level,m=c.castShadows,g=f.light.probe,v=g?g.camera:f.camera,y=this.frustumCullingResults[l];if(g)tat(s,v,v.frustum,m,g,y);else if(d)switch(d.type){case 2:tat(s,v,d.frustum,m,null,y);break;case 0:tat(s,v,this.getBuiltinShadowFrustum(t,v,d,_),m,null,y)}else tat(s,v,v.frustum,m,null,y)}},e.executeSphereLightCulling=function(t,e,i){for(var n,r=t.aabb,s=p(e);!(n=s()).done;){var a=n.value,o=a.worldBounds;o&&!Pa.aabbWithAABB(o,r)||i.push(a)}},e.executeSpotLightCulling=function(t,e,i){for(var n,r=t.aabb,s=t.frustum,a=p(e);!(n=a()).done;){var o=n.value,h=o.worldBounds;(!h||Pa.aabbWithAABB(r,h)&&Pa.aabbFrustum(h,s))&&i.push(o)}},e.executePointLightCulling=function(t,e,i){for(var n,r=t.aabb,s=p(e);!(n=s()).done;){var a=n.value,o=a.worldBounds;o&&!Pa.aabbWithAABB(r,o)||i.push(a)}},e.executeRangedDirectionalLightCulling=function(t,e,i){sat.transform(t.node.worldMatrix,null,null,null,aat);for(var n,r=p(e);!(n=r()).done;){var s=n.value,a=s.worldBounds;a&&!Pa.aabbWithAABB(aat,a)||i.push(s)}},e.batchLightBoundsCulling=function(){for(var t,e=p(this.lightBoundsCullings);!(t=e()).done;){var i=t.value;i[0];for(var n,r=i[1],s=p(r.resultIndex);!(n=s()).done;){var a=n.value,o=a[0],h=a[1],u=r.resultKeyIndex.get(o),l=u.sceneData,c=u.frustumCullingID,f=this.frustumCullingResults[c],d=this.lightBoundsCullingResults[h];switch(l.shadingLight.type){case 1:var _=l.shadingLight;this.executeSphereLightCulling(_,f,d.instances);break;case 2:var m=l.shadingLight;this.executeSpotLightCulling(m,f,d.instances);break;case 3:var g=l.shadingLight;this.executePointLightCulling(g,f,d.instances);break;case 4:var v=l.shadingLight;this.executeRangedDirectionalLightCulling(v,f,d.instances)}}}},e._getModelsByCullingResults=function(t,e){return 4294967295!==t?t=n.width},e.createDeviceBuf=function(t){var e,i=rat.deviceBuffers.get(this.name);i&&this.checkBuffer(this.name)||(null!==(e=i)&&void 0!==e&&e.buffer&&i.buffer.destroy(),i=new dat(this.name,t),rat.deviceBuffers.set(this.name,i))},e.managed=function(t){this.createDeviceTex(t)},e.managedBuffer=function(t){this.createDeviceBuf(t)},e.managedTexture=function(){},e.persistentBuffer=function(t){this.createDeviceBuf(t)},e.persistentTexture=function(t){this.createDeviceTex(t)},e.framebuffer=function(t){this.createDeviceTex(t)},e.swapchain=function(t){this.createDeviceTex(t)},e.formatView=function(){},e.subresourceView=function(){},n(t,[{key:"resName",set:function(t){this.name=t}}]),t}(),lat=function(){function t(t){this._name=void 0,this._name=t}return n(t,[{key:"name",get:function(){return this._name}}]),t}(),cat=function(t){function e(e,i){var n;(n=t.call(this,e)||this)._texture=null,n._swapchain=null,n._framebuffer=null,n._desc=null,n._trait=null;var r=rat.resourceGraph,s=r.vertex(e);return n._desc=r.getDesc(s),n._trait=r.getTraits(s),i instanceof up?n._texture=i:i instanceof Y_?n._framebuffer=i:i instanceof Zit?n._swapchain=i.swapchain:n.createTextureFromDesc(n._desc),n}s(e,t);var i=e.prototype;return i.createTextureFromDesc=function(t){var e=1;switch(t.dimension){case 1:e=0;break;case 3:e=2}var i=[[16,16],[32,32],[64,64],[8,4],[4,8],[256,1],[512,2]].reduce((function(e,i){var n=i[0],r=i[1];return t.flags&n?e|r:e}),0);this._texture=rat.device.createTexture(new jd(e,i,t.format,t.width,t.height))},i.release=function(){var t,e;null===(t=this.framebuffer)||void 0===t||t.destroy(),this._framebuffer=null,null===(e=this.texture)||void 0===e||e.destroy(),this._texture=null},n(e,[{key:"texture",get:function(){return this._texture}},{key:"framebuffer",get:function(){return this._framebuffer},set:function(t){this._framebuffer=t}},{key:"description",get:function(){return this._desc}},{key:"trait",get:function(){return this._trait}},{key:"swapchain",get:function(){return this._swapchain}}]),e}(lat);function fat(t){var e=T.director.root.pipeline.pipelineSceneData;return!!(e.shadows.enabled&&e.shadows.type===Qw.ShadowMap&&t&&8&t.flags)}var dat=function(t){function e(e){var i;(i=t.call(this,e)||this)._buffer=null;var n=rat.resourceGraph,r=n.vertex(e),s=n.getDesc(r),a=new zd(i.calculateBufferUsage(s.flags),1,s.width);return i._buffer=rat.device.createBuffer(a),i}s(e,t);var i=e.prototype;return i.calculateBufferUsage=function(t){return[[2,64],[1,16],[4,32],[256,1],[512,2]].reduce((function(e,i){var n=i[0],r=i[1];return t&n?e|r:e}),0)},i.release=function(){var t;null===(t=this._buffer)||void 0===t||t.destroy(),this._buffer=null},n(e,[{key:"buffer",get:function(){return this._buffer}}]),e}(lat),_at=new Float32Array(4),pat=function(){function t(t){this._isUpdate=!1,this._isGatherLight=!1,this._blit=void 0,this._screenQuad=null,this._stageDesc=void 0,this._lightVolumeBuffer=null,this._lightMeterScale=1e4,this._lightBufferData=void 0,this._blit=t}var e=t.prototype;return e._createQuadInputAssembler=function(){return rat.blit.pipelineIAData},e.createScreenQuad=function(){this._screenQuad||(this._screenQuad=this._createQuadInputAssembler())},e._gatherVolumeLights=function(t){var e=this;if(t.scene){for(var i,n=rat.pipeline,r=rat.commandBuffer,s=t.scene.sphereLights,a=t.scene.spotLights,o=t.exposure,h=Yy.LIGHTS_PER_PASS,u=kn.length,l=u*h,c=zs.create(0,0,0,1),f=0,d=function(i,r){if(!(f>=h)&&(zs.set(c,i.position.x,i.position.y,i.position.z,i.range),Pa.sphereFrustum(c,t.frustum))){if(Kn.toArray(_at,i.position),_at[3]=r?1:0,e._lightBufferData.set(_at,f*u+0*l),Kn.toArray(_at,i.color),i.useColorTemperature){var s=i.colorTemperatureRGB;_at[0]*=s.x,_at[1]*=s.y,_at[2]*=s.z}_at[3]=n.pipelineSceneData.isHDR?i.luminance*o*e._lightMeterScale:i.luminance,e._lightBufferData.set(_at,f*u+1*l),_at[0]=i.size,_at[1]=i.range,_at[2]=r?i.spotAngle:0,e._lightBufferData.set(_at,f*u+2*l),r&&(Kn.toArray(_at,i.direction),e._lightBufferData.set(_at,f*u+3*l)),f++}},_=p(s);!(i=_()).done;)d(i.value,!1);for(var m,g=p(a);!(m=g()).done;)d(m.value,!0);var v=3*l+3;this._lightBufferData.set([f],v),r.updateBuffer(this._lightVolumeBuffer,this._lightBufferData)}},e.update=function(){64&this.blit.sceneFlags&&this.blit.camera&&!this._isGatherLight&&(this._gatherVolumeLights(this.blit.camera),this._isGatherLight=!0,this._isUpdate=!1),this._isUpdate||(this._stageDesc.update(),this._isUpdate=!0)},e.reset=function(){this._isUpdate=!1,this._isGatherLight=!1},e.createStageDescriptor=function(){var t=this.blit,e=t.material.passes[t.passID],i=rat.device;if(this._stageDesc=rat.blit.stageDescs.get(e)||i.createDescriptorSet(new v_(e.localSetLayout)),rat.blit.stageDescs.set(e,this._stageDesc),64&this.blit.sceneFlags){this._lightVolumeBuffer=rat.blit.lightVolumeBuffer;var n=rat.blit.deferredLitsBufView;this._lightBufferData=rat.blit.lightBufferData,this._lightBufferData.fill(0),this._stageDesc.bindBuffer(Xy.BINDING,n)}this._stageDesc.bindBuffer(Uy.BINDING,rat.blit.emptyLocalUBO)},n(t,[{key:"screenQuad",get:function(){return this._screenQuad}},{key:"blit",get:function(){return this._blit},set:function(t){this._blit=t}},{key:"stageDesc",get:function(){return this._stageDesc}}]),t}(),mat=function(){function t(){this._devicePass=void 0,this._hint=0,this._phaseID=Aw("default"),this._renderPhase=null,this._descSetData=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._queueId=-1}var e=t.prototype;return e.preRecord=function(){},e.postRecord=function(){},e.init=function(t,e,i){this.reset(),this.queueHint=e.hint,this.queueId=i,this._devicePass=t,this._phaseID=T.rendering.getPhaseID(t.passID,rat.renderGraph.getLayout(i))},e.reset=function(){this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&rat.commandBuffer.bindDescriptorSet(3,this._descSetData.descriptorSet)},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=rat.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(2)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),gat=function(){function t(){this._renderScenes=[],this._devicePass=void 0,this._hint=0,this._graphQueue=void 0,this._phaseID=Aw("default"),this._renderPhase=null,this._descSetData=null,this._viewport=null,this._scissor=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._blitDesc=null,this._queueId=-1}var e=t.prototype;return e.init=function(t,e,i){this.reset(),this._graphQueue=e,this.queueHint=e.hint;var n=this._viewport=e.viewport;n&&(this._scissor=new Dd(n.left,n.top,n.width,n.height)),this.queueId=i,this._devicePass=t,this._phaseID=T.rendering.getPhaseID(t.passID,rat.renderGraph.getLayout(i))},e.createBlitDesc=function(t){this._blitDesc||(this._blitDesc=new pat(t)),this._blitDesc.createScreenQuad(),this._blitDesc.createStageDescriptor()},e.setScene=function(t,e,i){var n=rat.pools.addDeviceScene();return n.init(this,t,e,i),this._renderScenes.push(n),n},e.reset=function(){var t;this._renderScenes.length=0,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,null===(t=this._blitDesc)||void 0===t||t.reset()},e.preRecord=function(){},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&rat.commandBuffer.bindDescriptorSet(3,this._descSetData.descriptorSet),this._renderScenes.forEach((function(t){t.record()}))},e.postRecord=function(){},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=rat.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(2)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"viewport",get:function(){return this._viewport}},{key:"scissor",get:function(){return this._scissor}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"graphQueue",get:function(){return this._graphQueue}},{key:"blitDesc",get:function(){return this._blitDesc}},{key:"renderScenes",get:function(){return this._renderScenes}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),vat=function(){function t(t,e,i){this._layoutID=0,this._vertID=-1,this._resID=-1,this._stage=null,this._layout=void 0,this._inputName=void 0,this._descriptorSet=null,this._inputName=i[0],this._layoutID=t,this._vertID=e;var n=rat.layoutGraph;this._stage=n.j(t),this._layout=n.getLayout(t);var r=this._layout.descriptorSets.get(3);if(r){var s=r.descriptorSet,a=rat.deviceTextures.get(this._inputName),o=null==a?void 0:a.texture,h=rat.deviceBuffers.get(this._inputName),u=null==h?void 0:h.buffer;if(!o&&!u)throw Error("Could not find texture with resource name "+this._inputName);this._resID=rat.resourceGraph.vertex(this._inputName);for(var l,c=rat.resourceGraph.getSampler(this._resID),f=p(i[1]);!(l=f()).done;){var d=l.value.name,_=n.attributeIndex.get(d);void 0!==_&&this.bindDescriptor(s,_,o,u,c,i[1][0].accessType)}}}return t.prototype.bindDescriptor=function(t,e,i,n,r,s){for(var a,o=this._layout.descriptorSets.get(3),h=rat.resourceGraph.getDesc(this._resID),u=p(o.descriptorSetLayoutData.descriptorBlocks);!(a=u()).done;)for(var l=a.value,c=0;c0){var a=[s,r];r=a[0],s=a[1]}var o=new Float32Array(16),h=function(t,e,i,n,r,s,a,h,u,l,c,f,d,_,p,m){o.set([t,e,i,n,r,s,a,h,u,l,c,f,d,_,p,m])};switch(t){case 0:h(-1,-1,i,s,1,-1,n,s,-1,1,i,r,1,1,n,r);break;case 1:h(-1,-1,n,s,1,-1,n,r,-1,1,i,s,1,1,i,r);break;case 2:h(-1,-1,i,r,1,-1,n,r,-1,1,i,s,1,1,n,s);break;case 3:h(-1,-1,i,r,1,-1,i,s,-1,1,n,r,1,1,n,s)}return o},e._createQuadInputAssembler=function(){var t=new AE,e=T.director.root.device,i=e.createBuffer(new zd(10,3,64,16));if(!i)return t;var n=e.createBuffer(new zd(6,1,12,2));if(!n)return t;var r=new Uint16Array(6);r[0]=0,r[1]=1,r[2]=2,r[3]=1,r[4]=3,r[5]=2,n.update(r.buffer);var s=new Array(2);s[0]=new n_("a_position",21),s[1]=new n_("a_texCoord",21);var a=e.createInputAssembler(new s_(s,[i],n));return t.quadIB=n,t.quadVB=i,t.quadIA=a,t},n(t,[{key:"pipelineIAData",get:function(){return this._pipelineIAData}},{key:"deferredLitsBufView",get:function(){return this._deferredLitsBufView}},{key:"lightVolumeBuffer",get:function(){return this._lightVolumeBuffer}},{key:"lightBufferData",get:function(){return this._lightBufferData}},{key:"stageDescs",get:function(){return this._stageDescs}},{key:"emptyLocalUBO",get:function(){return this._localUBO}}]),t}(),Mat=function(){function t(t,e,i,n,r,s,a,o){void 0===o&&(o=null),this.device=void 0,this.pipeline=void 0,this.commandBuffer=void 0,this.pipelineSceneData=void 0,this.resourceGraph=void 0,this.devicePasses=new Map,this.deviceTextures=new Map,this.deviceBuffers=new Map,this.layoutGraph=void 0,this.root=void 0,this.pools=void 0,this.blit=void 0,this.culling=void 0,this.lightResource=new hat,this.renderGraph=void 0,this.width=void 0,this.height=void 0,this.cullCamera=void 0,this.passDescriptorSet=void 0,this.profilerDescriptorSet=void 0,this.pipeline=t,this.device=e,this.commandBuffer=e.commandBuffer,this.pipelineSceneData=t.pipelineSceneData,this.resourceGraph=i,this.renderGraph=n,this.root=C.director.root,this.layoutGraph=r,this.width=s,this.height=a,this.pools=new Dat,this.blit=new Bat(this),this.culling=new oat,this.passDescriptorSet=o,this.profilerDescriptorSet=vrt("default").descriptorSet}var e=t.prototype;return e.reset=function(){this.culling.clear(),this.pools.reset(),this.cullCamera=null,this.lightResource.clear()},e.resize=function(t,e){this.width=t,this.height=e,this.blit.resize(t,e)},t}(),Pat=function(){function t(t,e,i,n,r,s){this._context=void 0,this._visitor=void 0,rat=this._context=new Mat(t,e,i,new Int,n,r,s);var a=T.rendering.programLib;rat.lightResource.init(a,e,16)}var e=t.prototype;return e.resize=function(t,e){rat.resize(t,e)},e._removeDeviceResource=function(){for(var t,e=rat.pipeline.resourceUses,i=[],n=rat.deviceTextures,r=p(n);!(t=r()).done;){var s=t.value,a=s[0];s[1];var o=rat.resourceGraph.vertex(a),h=rat.resourceGraph.getTraits(o);e.includes(a)||0!==h.residency||i.push(a)}for(var u=0,l=i;uthis.passID););s.set(this.passID,e)}else{var f=r.vertex(t);r.getTraits(f).residency;var d=new Hat;i.set(t,d),d.rasters.set(this.passID,e)}},e._fetchValidPass=function(){var t=this.context.renderGraph,e=this.context.resourceContext,i=this.resID,n=this.context.resourceGraph.vertexName(i);Nat.clear();for(var r,s=this._currPass,a=t.getValid(this.passID),o=p(s.rasterViews);!(r=o()).done;){var h=r.value,u=h[0],l=h[1];u!==n||0===l.accessType?2!==l.accessType&&Nat.set(u,l):(this._useResourceInfo(u,l),t.setValid(this.passID,!0),t.setValid(this.queueID,!0),t.setValid(this.sceneID,!0))}if(!a&&t.getValid(this.sceneID)){for(var c,f=p(s.rasterViews);!(c=f()).done;){var d=c.value,_=d[0];d[1],jat.pipeline.resourceUses.push(_)}for(var m,g,v,y=p(Nat);!(v=y()).done;){var b=v.value,S=b[0];b[1],4294967295!==(g=(m=this.context.resourceGraph).find(S))&&(this._resVisitor.resID=g,m.visitVertex(this._resVisitor,g))}for(var x,w=p(s.computeViews);!(x=w()).done;){var T=x.value,C=T[0],A=T[1],D=e.get(C);D||(D=new Hat,e.set(C,D));var I=D.computes,B=I.get(this.passID);B?B.push(A):I.set(this.passID,[A]),4294967295!==(g=(m=this.context.resourceGraph).find(C))&&(this._resVisitor.resID=g,m.visitVertex(this._resVisitor,g))}Frt(s)}},e.applyID=function(t,e){this.resID=e,this._isRasterPass(t)||this._isCopyPass(t)||this._isCompute(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this._isDispatch(t)&&(this.dispatchID=t)},e.rasterPass=function(t){this._currPass=t},e.rasterSubpass=function(){},e.computeSubpass=function(){},e.compute=function(t){this._currPass=t,jat.renderGraph.setValid(this.passID,!0)},e.resolve=function(){},e.copy=function(t){var e=jat.renderGraph;if(!e.getValid(this.passID)){var i=this.context.resourceGraph;this._currPass=t;for(var n,r,s=this.resID,a=i.vertexName(s),o=p(t.copyPairs);!(r=o()).done;){var h=r.value;h.target===a&&(e.setValid(this.passID,!0),4294967295!==(n=i.find(h.source))&&(this._resVisitor.resID=n,i.visitVertex(this._resVisitor,n)))}}},e.move=function(){},e.raytrace=function(){},e.queue=function(){},e.scene=function(){this._fetchValidPass()},e.blit=function(){this._fetchValidPass()},e.dispatch=function(){var t=this.context.renderGraph;t.setValid(this.queueID,!0),t.setValid(this.dispatchID,!0)},e.clear=function(){},e.viewport=function(){},t}(),Gat=function(t){function e(e,i){var n;return(n=t.call(this)||this)._colorMap=void 0,n._graphView=void 0,n._passVisitor=void 0,n._resId=4294967295,n._resId=i,n._passVisitor=new zat(e),n._graphView=new Wit(e.renderGraph),n._colorMap=new srt(e.renderGraph.nv()),n}return s(e,t),e.prototype.discoverVertex=function(t,e){var i=e.g;this._passVisitor.applyID(t,this.resId),i.visitVertex(this._passVisitor,t)},n(e,[{key:"resId",get:function(){return this._resId},set:function(t){this._resId=t,this._colorMap.colors.length=jat.renderGraph.nv()}},{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(Hit),Uat=function(){function t(t){this._context=void 0,this.resID=4294967295,this._passManagerVis=void 0,this._context=t}var e=t.prototype;return e.managedBuffer=function(){},e.managedTexture=function(){},e.managed=function(){this.dependency()},e.persistentBuffer=function(){},e.dependency=function(){this._passManagerVis?this._passManagerVis.resId=this.resID:this._passManagerVis=new Gat(this._context,this.resID),Uit(this._passManagerVis.graphView,this._passManagerVis,this._passManagerVis.colorMap)},e.persistentTexture=function(){this.dependency()},e.framebuffer=function(){this.dependency()},e.swapchain=function(){this.dependency()},e.formatView=function(){},e.subresourceView=function(){},t}(),Hat=function(){this.rasters=new Map,this.computes=new Map},Wat=function(){function t(){this.resourceGraph=void 0,this.pipeline=void 0,this.renderGraph=void 0,this.layoutGraph=void 0,this.resourceContext=void 0}return t.prototype.set=function(t,e,i,n){this.pipeline=t,this.resourceGraph=e,this.renderGraph=i,this.layoutGraph=n,this.resourceContext||(this.resourceContext=new Map),this.resourceContext.clear()},t}(),jat=new Wat;!function(t){function e(e){var i;return(i=t.call(this)||this)._colorMap=void 0,i._resourceGraph=void 0,i._resVisitor=void 0,i._colorMap=new srt(e.resourceGraph.nv()),i._resourceGraph=e.resourceGraph,i._resVisitor=new Uat(e),i}s(e,t),e.prototype.discoverVertex=function(t){var e=this._resourceGraph.getTraits(t);0!==e.residency&&1!==e.residency&&(this._resVisitor.resID=t,this._resourceGraph.visitVertex(this._resVisitor,t))},n(e,[{key:"colorMap",get:function(){return this._colorMap}}])}(Hit);var qat,Xat,Yat=new kn,Qat=new Xd(1,1,0,2,2,2),Kat=function(){function t(){var t=this;this.renderData=new Ant,this.layoutGraph=new jnt,this.rg=new Int,this.vertId=-1,this.sceneData=new wnt,this.resourceGraph=new pnt,this.computePass=new mnt,this.rasterPass=new lnt,this.rasterSubpass=new hnt,this.renderQueue=new xnt,this.sceneBuilder=new Ua((function(){return new $at(t.renderData,t.layoutGraph,t.rg,t.vertId,t.sceneData)}),16),this.renderPassBuilder=new Ua((function(){return new iot(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.rasterPass,t.getPipelineSceneData())}),16),this.computeQueueBuilder=new Ua((function(){return new not(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderQueueBuilder=new Ua((function(){return new tot(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderSubpassBuilder=new Ua((function(){return new eot(t.renderData,t.rg,t.layoutGraph,t.vertId,t.rasterSubpass,t.getPipelineSceneData())}),16),this.computePassBuilder=new Ua((function(){return new rot(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.computePass,t.getPipelineSceneData())}),16),this.samplerInfo=new Ua((function(){return new Xd}),16),this.color=new Ua((function(){return new Rd}),16),this.renderCommonObjectPool=new Iit,this.renderGraphPool=new Mnt(this.renderCommonObjectPool),this.viewport=new Ua((function(){return new Od}),16)}var e=t.prototype;return e.getPipelineSceneData=function(){return C.director.root.pipeline.pipelineSceneData},e.createColor=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.color.add();return r.set(t,e,i,n),r},e.createSamplerInfo=function(t,e,i,n,r,s,a,o){void 0===t&&(t=2),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=7);var h=this.samplerInfo.add();return h.minFilter=t,h.magFilter=e,h.mipFilter=i,h.addressU=n,h.addressV=r,h.addressW=s,h.maxAnisotropy=a,h.cmpFunc=o,h},e.reset=function(){this.sceneBuilder.reset(),this.renderPassBuilder.reset(),this.computePassBuilder.reset(),this.computeQueueBuilder.reset(),this.renderCommonObjectPool.reset(),this.renderGraphPool.reset(),this.viewport.reset(),this.samplerInfo.reset(),this.color.reset(),this.renderQueueBuilder.reset(),this.renderSubpassBuilder.reset()},t}();function Jat(t,e){switch(t){case 1:return e>1?4:0;case 2:return e>1?5:1;case 3:return 2;case 0:return 1}return 1}function Zat(t){switch(t){case 0:case 4:return 1;case 1:case 5:case 3:return 2;case 2:return 3}return 2}var $at=function(t){function e(e,i,n,r,s){var a;return(a=t.call(this,e,i)||this)._renderGraph=void 0,a._scene=void 0,a._renderGraph=n,a._scene=s,a._vertID=r,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r){this._data=t,this._lg=e,this._renderGraph=i,this._scene=r,this._vertID=n},i.useLightFrustum=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=void 0),this._scene.light.light=t,this._scene.light.level=e,this._scene.light.culledByLight=!0,i&&(this._scene.camera=i),!(32768&this._scene.flags)){var n=this._renderGraph.getParent(this._vertID),r=this._renderGraph.getParent(n);this._renderGraph.getLayout(r),Krt(this,this._scene.camera,t,e)}},e}($rt),tot=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,n)||this)._renderGraph=void 0,o._queue=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._queue=s,o._pipeline=a,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addSceneOfCamera=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="Camera");var r=e.light,s=Xat.createSceneData(t.scene,t,i,!r||8&i?1:5,r);this._renderGraph.addVertex(9,s,n,"",Xat.createRenderData(),!0,this._vertID),this.getParentLayout();var a=T.director.getScene();Hrt(this,t,this._pipeline,t.scene||(a?a.renderScene:null)),8&i||r&&0!==r.type?Krt(this,t,r,e.level):Zrt(this,t)},i.addScene=function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=void 0),void 0===n&&(n=void 0);var r=Xat.createSceneData(n||t.scene,t,e,!i||8&e?1:5,i),s=Xat.createRenderData(),a=this._renderGraph.addVertex(9,r,"Scene","",s,!0,this._vertID);32768&e||(this.getParentLayout(),Hrt(this,t,this._pipeline,n||t.scene),i&&0!==i.type?Krt(this,t,i,0):8&e||Zrt(this,t));var o=qat.sceneBuilder.add();return o.update(s,this._lg,this._renderGraph,a,r),o},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="Quad"),this._renderGraph.addVertex(10,Xat.createBlit(t,e,i,null),n,"",Xat.createRenderData(),!0,this._vertID),this.getParentLayout();var r=T.director.getScene();Hrt(this,null,this._pipeline,r?r.renderScene:null),8&i||Zrt(this,null)},i.addCameraQuad=function(t,e,i,n){void 0===n&&(n=0),this._renderGraph.addVertex(10,Xat.createBlit(e,i,n,t),"CameraQuad","",Xat.createRenderData(),!0,this._vertID),this.getParentLayout();var r=T.director.getScene();Hrt(this,t,this._pipeline,t.scene||(r?r.renderScene:null)),8&n||Zrt(this,t)},i.clearRenderTarget=function(t,e){void 0===e&&(e=new Rd);var i=Xat.createClearView(t,1);i.clearColor.copy(e),this._renderGraph.addVertex(12,[i],"ClearRenderTarget","",Xat.createRenderData(),!0,this._vertID)},i.setViewport=function(t){var e=qat.viewport.add();this._queue.viewport=e.copy(t)},i.addCustomCommand=function(){throw new Error("Method not implemented.")},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}($rt),eot=function(t){function e(e,i,n,r,s,a){var o;(o=t.call(this,e,n)||this)._renderGraph=void 0,o._layoutID=void 0,o._subpass=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._subpass=s,o._pipeline=a;var h=o._renderGraph.getLayout(o._vertID);return o._layoutID=n.locateChild(n.N,h),o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._subpass=r,this._pipeline=s;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.addRenderTarget=function(){throw new Error("Method not implemented.")},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDepthStencil=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(){throw new Error("Method not implemented.")},i.addStorageImage=function(){throw new Error("Method not implemented.")},i.setViewport=function(){throw new Error("Method not implemented.")},i.addQueue=function(t,e){void 0===t&&(t=1),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Xat.createRenderQueue(t,i),r=Xat.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!0,this._vertID),a=qat.renderQueueBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._subpass.showStatistics},set:function(t){this._subpass.showStatistics=t}}]),e}($rt),iot=function(t){function e(e,i,n,r,s,a,o){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._resourceGraph=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=a,h._pipeline=o;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,a){this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=a,this._data=t;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.setVersion=function(t,e){this._pass.versionName=t,this._pass.version=e},i.addRenderTarget=function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=new Rd);var r=1;0===e&&(r=0);var s=Xat.createRasterView("",2,0,e,i,r);s.clearColor.copy(n),this._pass.rasterViews.set(t,s)},i.addDepthStencil=function(t,e,i,n,r,s){void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=6);var a=Xat.createRasterView("",2,1,e,i,s);a.clearColor.set(n,r,0,0),this._pass.rasterViews.set(t,a)},i.resolveRenderTarget=function(){},i.resolveDepthStencil=function(){},i._addComputeResource=function(t,e,i){var n,r=Xat.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},i.addTexture=function(t,e,i){if(void 0===i&&(i=null),this._addComputeResource(t,0,e),i){var n=this._lg.attributeIndex.get(e);this._data.samplers.set(n,i)}},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addRenderSubpass=function(t){void 0===t&&(t="");var e="Raster",i=this._pass.subpassGraph.nv();this._pass.subpassGraph.addVertex(e,Xat.createSubpass());var n=Xat.createRasterSubpass(i,1,0),r=Xat.createRenderData(),s=this._renderGraph.addVertex(1,n,e,t,r,!0),a=qat.renderSubpassBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},i.addQueue=function(t,e){void 0===t&&(t=1),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Xat.createRenderQueue(t,i),r=Xat.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!0,this._vertID),a=qat.renderQueueBuilder.add();return a.update(r,this._renderGraph,this._lg,s,n,this._pipeline),a},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n="FullscreenQuad");var r=Xat.createRenderQueue(3),s=this._renderGraph.addVertex(8,r,"Queue","",Xat.createRenderData(),!0,this._vertID);this._renderGraph.addVertex(10,Xat.createBlit(t,e,i,null),n,"",Xat.createRenderData(),!0,s)},i.addCameraQuad=function(t,e,i,n,r){void 0===r&&(r="CameraQuad");var s=Xat.createRenderQueue(3),a=this._renderGraph.addVertex(8,s,"Queue","",Xat.createRenderData(),!0,this._vertID);this._renderGraph.addVertex(10,Xat.createBlit(e,i,n,t),r,"",Xat.createRenderData(),!0,a)},i.setViewport=function(t){this._pass.viewport.copy(t)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._pass.showStatistics},set:function(t){this._pass.showStatistics=t}}]),e}($rt),not=function(t){function e(e,i,n,r,s,a){var o;return(o=t.call(this,e,n)||this)._renderGraph=void 0,o._queue=void 0,o._pipeline=void 0,o._renderGraph=i,o._vertID=r,o._queue=s,o._pipeline=a,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDispatch=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s="Dispatch"),this._renderGraph.addVertex(11,Xat.createDispatch(n,r,t,e,i),s,"",Xat.createRenderData(),!0,this._vertID)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}($rt),rot=function(t){function e(e,i,n,r,s,a,o){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._resourceGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=a,h._pipeline=o;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,a){this._data=t,this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=a;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addMaterialTexture=function(){throw new Error("Method not implemented.")},i.addQueue=function(t){void 0===t&&(t="default");var e=this._lg.locateChild(this._layoutID,t),i=Xat.createRenderQueue(1,e),n=Xat.createRenderData(),r=this._renderGraph.addVertex(8,i,"",t,n,!0,this._vertID),s=qat.computeQueueBuilder.add();return s.update(n,this._renderGraph,this._lg,r,i,this._pipeline),s},i._addComputeResource=function(t,e,i){var n,r=Xat.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}($rt);!function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.setCustomBehavior=function(){throw new Error("Method not implemented.")},e.addPair=function(t){this._pass.movePairs.push(t)},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}(),function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.addPair=function(){throw new Error("Method not implemented.")},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}();var sot=function(){function t(t){this._width=0,this._height=0,this._usesDeferredPipeline=!1,this._copyPassMat=new Xw,this._device=void 0,this._globalDSManager=void 0,this._defaultSampler=void 0,this._globalDescriptorSet=null,this._globalDescriptorSetInfo=null,this._globalDescriptorSetLayout=null,this._profilerDescriptorSet=null,this._macros={},this._pipelineSceneData=new ek,this._constantMacros="",this._lightingMode=1,this._profiler=null,this._cameras=[],this._resourceUses=[],this._layoutGraph=void 0,this._resourceGraph=new pnt,this._renderGraph=null,this._compiler=null,this._executor=null,this._customPipelineName="",this._globalDescSetData=void 0,this._combineSignY=0,this._layoutGraph=t}var e=t.prototype;return e.addCustomBuffer=function(){throw new Error("Method not implemented.")},e.addCustomTexture=function(){throw new Error("Method not implemented.")},e.tryAddRenderWindowDepthStencil=function(t,e,i,n){i&&(n?this.addDepthStencilImpl(i,n.depthStencilTexture.format,t,e,4,n):this.addDepthStencilImpl(i,55,t,e,0))},e.addRenderWindow=function(t,e,i,n,r,s){var a=this._resourceGraph.find(t);if(4294967295!==a)return this.updateRenderWindow(t,r,s),a;this.tryAddRenderWindowDepthStencil(i,n,s,r.swapchain);var o=new Kit;return o.dimension=2,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=r.framebuffer.colorTextures[0].format,o.flags=16,r.swapchain?this._resourceGraph.addVertex(6,new Zit(r.swapchain),t,o,new Jit(4),new $it,new Xd):(o.sampleCount=r.framebuffer.colorTextures[0].info.samples,this._resourceGraph.addVertex(5,r.framebuffer,t,o,new Jit(3),new $it,new Xd))},e.updateRenderWindow=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e.width,r.height=e.height,this.resourceGraph.object(n)!==e.framebuffer&&(this.resourceGraph.x[n].j=e.framebuffer),this.tryAddRenderWindowDepthStencil(e.width,e.height,i,e.swapchain)},e.updateStorageBuffer=function(t,e,i){void 0===i&&(i=0);var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,0!==i&&(r.format=i)},e.updateRenderTarget=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,0!==n&&(s.format=n)},e.updateDepthStencil=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.find(t);4294967295!==r&&this.updateDepthStencilImpl(r,e,i,n)},e.updateStorageTexture=function(t,e,i,n){void 0===n&&(n=0);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,0!==n&&(s.format=n)},e.updateShadingRateTexture=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,r.height=i},e.addBuffer=function(t,e,i,n){var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateBuffer(t,e),r;var s=new Kit;return s.dimension=0,s.width=e,s.flags=i,this._resourceGraph.addVertex(0,new rnt,t,s,new Jit(n),new $it,new Xd(2,2,0,2,2,2))},e.updateBuffer=function(t,e){this.updateResource(t,0,e,0,0,0,0,1)},e.addExternalTexture=function(){throw new Error("Method not implemented.")},e.updateExternalTexture=function(){throw new Error("Method not implemented.")},e.addTexture=function(t,e,i,n,r,s,a,o,h,u,l){var c=this._resourceGraph.find(t);if(4294967295!==c)return this.updateTexture(t,i,n,r,s,a,o,h),c;var f=new Kit;return f.dimension=Zat(e),f.width=n,f.height=r,f.depthOrArraySize=3===f.dimension?s:a,f.mipLevels=o,f.format=i,f.sampleCount=h,f.flags=u,f.viewType=e,this._resourceGraph.addVertex(0,new rnt,t,f,new Jit(l),new $it,new Xd(2,2,0,2,2,2))},e.updateTexture=function(t,e,i,n,r,s,a,o){this.updateResource(t,e,i,n,r,s,a,o)},e.addResource=function(t,e,i,n,r,s,a,o,h,u,l){var c=this._resourceGraph.find(t);return 4294967295!==c?(this.updateResource(t,i,n,r,s,a,o,h),c):0===e?this.addBuffer(t,n,u,l):this.addTexture(t,Jat(e,a),i,n,r,s,a,o,h,u,l)},e.updateResource=function(t,e,i,n,r,s,a,o){var h=this.resourceGraph.vertex(t),u=this.resourceGraph.getDesc(h);u.width=i,u.height=n,u.depthOrArraySize=3===u.dimension?r:s,u.mipLevels=a,0!==e&&(u.format=e),u.sampleCount=o},e.containsResource=function(t){return this._resourceGraph.contains(t)},e.addResolvePass=function(){throw new Error("Method not implemented.")},e.addComputePass=function(t){var e=Xat.createComputePass(),i=Xat.createRenderData(),n=this._renderGraph.addVertex(3,e,"Compute",t,i,!0),r=qat.computePassBuilder.add();return r.update(i,this._renderGraph,this._layoutGraph,this._resourceGraph,n,e,this._pipelineSceneData),T.director.root.pipeline,r},e.addUploadPass=function(t){for(var e,i=Xat.createCopyPass(),n=p(t);!(e=n()).done;){var r=e.value;i.uploadPairs.push(r)}this._renderGraph.addVertex(5,i,"UploadPass","",Xat.createRenderData(),!0)},e.addCopyPass=function(t){for(var e,i=p(t);!(e=i()).done;){var n=e.value,r=n.target,s=this.resourceGraph.find(r),a=this.resourceGraph.getDesc(s),o=this.addRenderPass(a.width,a.height,"copy-pass");o.addRenderTarget(r,1,0,qat.createColor()),o.addTexture(n.source,"outputResultMap"),o.addQueue(0).addFullscreenQuad(this._copyPassMat,0,0)}},e._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(3&this._device.getFormatFeatures(44)?1:0)+"\n",t+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this._device.capabilities.maxVertexUniformVectors+"\n",t+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this._device.capabilities.maxFragmentUniformVectors+"\n",t+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this._device.hasFeature(5)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(xo.os===go.ANDROID&&xo.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ne.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Zy.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t,this._layoutGraph.constantMacros=this._constantMacros},e.setCustomPipelineName=function(t){this._customPipelineName=t,"Deferred"===this._customPipelineName&&(this._usesDeferredPipeline=!0)},e.getGlobalDescriptorSetData=function(){var t=this.layoutGraph.locateChild(this.layoutGraph.N,"default");return this.layoutGraph.getLayout(t).descriptorSets.get(3)},e._initCombineSignY=function(){var t=this._device;this._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},e.getCombineSignY=function(){return this._combineSignY},e._compileMaterial=function(){this._copyPassMat.initialize({effectName:"pipeline/copy-pass"});for(var t=0;t=t.CSM_UNIFORM_VECTORS+t.GLOBAL_UNIFORM_VECTORS,this.setMacroBool("CC_SUPPORT_CASCADED_SHADOW_MAP",this.pipelineSceneData.csmSupported),this.setMacroInt("CC_SHADOW_TYPE",0),this.setMacroInt("CC_DIR_SHADOW_PCF_TYPE",Kw.HARD),this.setMacroInt("CC_DIR_LIGHT_SHADOW_TYPE",0),this.setMacroBool("CC_CASCADED_LAYERS_TRANSITION",!1),this.usesDeferredPipeline&&this.setMacroInt("CC_PIPELINE_TYPE",1),!0},e.destroy=function(){var t,e,i;return null===(t=this._globalDSManager)||void 0===t||t.globalDescriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),!0},e.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},e.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},e.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},e.getSamplerInfo=function(t){if(this.containsResource(t)){var e=this._resourceGraph.vertex(t);return this._resourceGraph.getSampler(e)}return null},e.setMacroString=function(t,e){this._macros[t]=e},e.setMacroInt=function(t,e){this._macros[t]=e},e.setMacroBool=function(t,e){this._macros[t]=e},e.onGlobalPipelineStateChanged=function(){var t=T.rendering.getCustomPipeline(Ne.CUSTOM_PIPELINE_NAME);t&&("function"==typeof t.onGlobalPipelineStateChanged&&t.onGlobalPipelineStateChanged(),T.rendering.forceResizeAllWindows())},e.beginSetup=function(){this._renderGraph||(this._renderGraph=new Int),qat.reset()},e.endSetup=function(){this.compile()},e.addStorageBuffer=function(t,e,i,n){void 0===n&&(n=0);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateStorageBuffer(t,i,e),r;var s=new Kit;return s.dimension=0,s.width=i,s.height=1,s.depthOrArraySize=1,s.mipLevels=1,s.format=e,s.flags=4,2===n?this._resourceGraph.addVertex(3,new ent,t,s,new Jit(2),new $it,new Xd):this._resourceGraph.addVertex(1,new tnt,t,s,new Jit(n),new $it,new Xd)},e.addRenderTarget=function(t,e,i,n,r){void 0===r&&(r=0);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateRenderTarget(t,i,n,e),s;var a=new Kit;return a.dimension=2,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.sampleCount=1,a.flags=24,this._resourceGraph.addVertex(0,new rnt,t,a,new Jit(r),new $it,new Xd(2,2,0,2,2,2))},e.updateDepthStencilImpl=function(t,e,i,n,r){var s=this.resourceGraph.getDesc(t);if(s.width=e,s.height=i,r){var a=this.resourceGraph.j(t);a.swapchain=r,s.format=a.swapchain.depthStencilTexture.format}else 0!==n&&(s.format=n)},e.addDepthStencilImpl=function(t,e,i,n,r,s){var a=this._resourceGraph.find(t);if(4294967295!==a)return this.updateDepthStencilImpl(a,i,n,e,s),a;var o=new Kit;return o.dimension=2,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.sampleCount=1,o.flags=40,s?this._resourceGraph.addVertex(6,new Zit(s,!0),t,o,new Jit(r),new $it,new Xd(1,1,0)):this._resourceGraph.addVertex(0,new rnt,t,o,new Jit(r),new $it,new Xd(1,1,0))},e.addDepthStencil=function(t,e,i,n,r){return void 0===r&&(r=0),this.addDepthStencilImpl(t,e,i,n,r)},e.addStorageTexture=function(t,e,i,n,r){void 0===r&&(r=0);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateStorageTexture(t,i,n,e),s;var a=new Kit;return a.dimension=2,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.flags=12,this._resourceGraph.addVertex(0,new rnt,t,a,new Jit(r),new $it,new Xd(1,1,0))},e.addShadingRateTexture=function(t,e,i,n){void 0===n&&(n=0);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.addShadingRateTexture(t,e,i),r;var s=new Kit;return s.dimension=2,s.width=e,s.height=i,s.depthOrArraySize=1,s.mipLevels=1,s.format=6,s.flags=140,this._resourceGraph.addVertex(0,new rnt,t,s,new Jit(n),new $it,new Xd(2,2,0,2,2,2))},e.beginFrame=function(){},e.update=function(){},e.endFrame=function(){var t;null===(t=this.renderGraph)||void 0===t||t.clear()},e.compile=function(){if(!this._renderGraph)throw new Error("RenderGraph cannot be built without being created");this._renderGraph.x.forEach((function(t){0===t.t&&Frt(t.j)}))},e.execute=function(){if(!this._renderGraph)throw new Error("Cannot run without creating rendergraph");this._executor||(this._executor=new Pat(this,this._device,this._resourceGraph,this.layoutGraph,this.width,this.height)),this._executor.resize(this.width,this.height),this._executor.execute(this._renderGraph)},e._applySize=function(t){var e=this,i=this._width,n=this._height;t.forEach((function(t){var r=t.window;i=Math.max(r.width,i),n=Math.max(r.height,n),e._cameras.includes(t)||e._cameras.push(t)})),i===this._width&&n===this._height||(this._width=i,this._height=n)},e.render=function(t){0!==t.length&&(this._applySize(t),jw(t),this.beginFrame(),this.execute(),this.endFrame())},e.addBuiltinReflectionProbePass=function(t){var e=T.internal.reflectionProbeManager;if(e){var i=e.getProbes();if(0!==i.length)for(var n=0;n>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}h[3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),h[3]+=(o.csmLayerColoration?1:0)*Math.pow(10,7),Yat.set(h[0],h[1],h[2],h[3])}t.setVec4("cc_debug_view_mode",Yat)},n(t,[{key:"type",get:function(){return 0}},{key:"capabilities",get:function(){return new Pnt}},{key:"enableCpuLightCulling",get:function(){return!this._executor||this._executor._context.culling.enableLightCulling},set:function(t){this._executor&&(this._executor._context.culling.enableLightCulling=t)}},{key:"globalDescriptorSetData",get:function(){return this._globalDescSetData}},{key:"defaultSampler",get:function(){return this._defaultSampler}},{key:"defaultShadowTexture",get:function(){return $b(this.device)}},{key:"device",get:function(){return this._device}},{key:"lightingMode",get:function(){return this._lightingMode},set:function(t){this._lightingMode=t}},{key:"usesDeferredPipeline",get:function(){return this._usesDeferredPipeline}},{key:"macros",get:function(){return this._macros}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._globalDSManager.globalDescriptorSet}},{key:"profilerDescriptorSet",get:function(){return this._profilerDescriptorSet}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet}},{key:"globalDescriptorSetInfo",get:function(){return this._globalDescriptorSetInfo}},{key:"commandBuffers",get:function(){return[this._device.commandBuffer]}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){throw new Error("Method not implemented.")}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"renderGraph",get:function(){return this._renderGraph}},{key:"resourceGraph",get:function(){return this._resourceGraph}},{key:"layoutGraph",get:function(){return this._layoutGraph}},{key:"resourceUses",get:function(){return this._resourceUses}}]),t}();sot.MAX_BLOOM_FILTER_PASS_NUM=6,sot.CSM_UNIFORM_VECTORS=61,sot.GLOBAL_UNIFORM_VECTORS=64,function(){function t(){this.capacity=0,this.size=0,this.buffer=void 0,this.dataView=void 0,this.capacity=4096,this.buffer=new Uint8Array(this.capacity),this.dataView=new DataView(this.buffer.buffer)}var e=t.prototype;e.b=function(t){var e=this.size+1;e>this.capacity&&this.reserve(e),this.dataView.setUint8(this.size,t?1:0),this.size=e},e.n=function(t){var e=this.size+8;e>this.capacity&&this.reserve(e),this.dataView.setFloat64(this.size,t,!0),this.size=e},e.s=function(t){this.n(t.length);var e=this.size+t.length;e>this.capacity&&this.reserve(e);for(var i=0;i=8){var i=new Uint8Array(e);if(new DataView(i.buffer,i.byteOffset,8).getUint32(0)===Lot){var n=new Wk.Inflate(new Uint8Array(i.buffer,i.byteOffset+8)).decompress();rrt(new aot(n.buffer,n.byteOffset),Vot)}else rrt(new aot(i.buffer,i.byteOffset),Vot)}Tst(t,Vot)},loadCopyPair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.sourceMostDetailedMip=t.n(),e.sourceFirstSlice=t.n(),e.sourcePlaneSlice=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},loadDescriptor:Mit,loadDescriptorBlock:function(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new pit;Mit(t,s),e.descriptors.set(r,s)}i=t.n();for(var a=0;a!==i;++a){var o=t.s(),h=new Qd;cit(t,h),e.uniformBlocks.set(o,h)}e.capacity=t.n(),e.count=t.n()},loadDescriptorBlockFlattened:function(t,e){var i=0;i=t.n(),e.descriptorNames.length=i;for(var n=0;n!==i;++n)e.descriptorNames[n]=t.s();i=t.n(),e.uniformBlockNames.length=i;for(var r=0;r!==i;++r)e.uniformBlockNames[r]=t.s();i=t.n(),e.descriptors.length=i;for(var s=0;s!==i;++s){var a=new pit;Mit(t,a),e.descriptors[s]=a}i=t.n(),e.uniformBlocks.length=i;for(var o=0;o!==i;++o){var h=new Qd;cit(t,h),e.uniformBlocks[o]=h}e.capacity=t.n(),e.count=t.n()},loadDescriptorBlockIndex:function(t,e){e.updateFrequency=t.n(),e.parameterType=t.n(),e.descriptorType=t.n(),e.visibility=t.n()},loadLightInfo:function(t,e){e.level=t.n(),e.culledByLight=t.b()},loadMovePair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},loadPipelineStatistics:function(t,e){e.numRenderPasses=t.n(),e.numManagedTextures=t.n(),e.totalManagedTextures=t.n(),e.numUploadBuffers=t.n(),e.numUploadBufferViews=t.n(),e.numFreeUploadBuffers=t.n(),e.numFreeUploadBufferViews=t.n(),e.numDescriptorSets=t.n(),e.numFreeDescriptorSets=t.n(),e.numInstancingBuffers=t.n(),e.numInstancingUniformBlocks=t.n()},loadResolvePair:function(t,e){e.source=t.s(),e.target=t.s(),e.resolveFlags=t.n(),e.mode=t.n(),e.mode1=t.n()},packRGBE:function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=Yi((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=sr(t.multiplyScalar(n),new Kn(0,0,0),new Kn(1,1,1));r.multiplyScalar(255);var s,a,o=ar(r).add((s=r.subtract(ar(r)))<(a=new Kn(.5,.5,.5))?a:s);return new kn(o.x/255,o.y/255,o.z/255,i/255)},programLib:Not,saveCopyPair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.sourceMostDetailedMip),t.n(e.sourceFirstSlice),t.n(e.sourcePlaneSlice),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},saveDescriptor:Bit,saveDescriptorBlock:function(t,e){t.n(e.descriptors.size);for(var i,n=p(e.descriptors);!(i=n()).done;){var r=i.value,s=r[0],a=r[1];t.s(s),Bit(t,a)}t.n(e.uniformBlocks.size);for(var o,h=p(e.uniformBlocks);!(o=h()).done;){var u=o.value,l=u[0],c=u[1];t.s(l),lit(t,c)}t.n(e.capacity),t.n(e.count)},saveDescriptorBlockFlattened:function(t,e){t.n(e.descriptorNames.length);for(var i,n=p(e.descriptorNames);!(i=n()).done;){var r=i.value;t.s(r)}t.n(e.uniformBlockNames.length);for(var s,a=p(e.uniformBlockNames);!(s=a()).done;){var o=s.value;t.s(o)}t.n(e.descriptors.length);for(var h,u=p(e.descriptors);!(h=u()).done;)Bit(t,h.value);t.n(e.uniformBlocks.length);for(var l,c=p(e.uniformBlocks);!(l=c()).done;)lit(t,l.value);t.n(e.capacity),t.n(e.count)},saveDescriptorBlockIndex:function(t,e){t.n(e.updateFrequency),t.n(e.parameterType),t.n(e.descriptorType),t.n(e.visibility)},saveLightInfo:function(t,e){t.n(e.level),t.b(e.culledByLight)},saveMovePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},savePipelineStatistics:function(t,e){t.n(e.numRenderPasses),t.n(e.numManagedTextures),t.n(e.totalManagedTextures),t.n(e.numUploadBuffers),t.n(e.numUploadBufferViews),t.n(e.numFreeUploadBuffers),t.n(e.numFreeUploadBufferViews),t.n(e.numDescriptorSets),t.n(e.numFreeDescriptorSets),t.n(e.numInstancingBuffers),t.n(e.numInstancingUniformBlocks)},saveResolvePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.resolveFlags),t.n(e.mode),t.n(e.mode1)},setCustomPipeline:function(t,e){zot.set(t,e),Rot()},setEditorPipelineSettings:function(t){kot=t,Oot=!0}});t("eF",Got),C.rendering=Got;var Uot=Object.setPrototypeOf,Hot={};Hot||(Hot={}),function(t){var e=function(){function e(i){this._clock=new t.WorldClock,this._events=[],this._objects=[],this._eventManager=null,this._eventManager=i,console.info("DragonBones: "+e.VERSION+"\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")}return e.prototype.advanceTime=function(e){if(this._objects.length>0){for(var i=0,n=this._objects;i0){for(var r=0;ri&&(r.length=i),t._maxCountMap[n]=i;else for(var n in t._defaultMaxCount=i,t._poolsMap){var r;(r=t._poolsMap[n]).length>i&&(r.length=i),n in t._maxCountMap&&(t._maxCountMap[n]=i)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var i=String(e);null!==(r=i in t._poolsMap?t._poolsMap[i]:null)&&r.length>0&&(r.length=0)}else for(var n in t._poolsMap){var r;(r=t._poolsMap[n]).length=0}},t.borrowObject=function(e){var i=String(e),n=i in t._poolsMap?t._poolsMap[i]:null;if(null!==n&&n.length>0){var r=n.pop();return r._isInPool=!1,r}var s=new e;return s._onClear(),s},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t}();t.BaseObject=e}(Hot||(Hot={})),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,i=0,n=0,r=this.d*t.d,s=this.tx*t.a+t.tx,a=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,i+=this.b*t.d,n+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(i+=this.a*t.b,n+=this.d*t.c,s+=this.ty*t.c,a+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=a,this},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=this.ty;if(0===e&&0===i)return this.b=this.c=0,0===t||0===n?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,n=this.d=1/n,this.tx=-t*r,this.ty=-n*s),this;var a=t*n-e*i;if(0===a)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;a=1/a;var o=this.a=n*a;return e=this.b=-e*a,i=this.c=-i*a,n=this.d=t*a,this.tx=-(o*r+i*s),this.ty=-(e*r+n*s),this},t.prototype.transformPoint=function(t,e,i,n){void 0===n&&(n=!1),i.x=this.a*t+this.c*e,i.y=this.b*t+this.d*e,n||(i.x+=this.tx,i.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var i=this.a,n=this.b,r=this.c,s=this.d,a=e?0:this.tx,o=e?0:this.ty,h=t.x,u=t.y,l=h+t.width,c=u+t.height,f=i*h+r*u+a,d=n*h+s*u+o,_=i*l+r*u+a,p=n*l+s*u+o,m=i*l+r*c+a,g=n*l+s*c+o,v=i*h+r*c+a,y=n*h+s*c+o,b=0;f>_&&(b=f,f=_,_=b),m>v&&(b=m,m=v,v=b),t.x=Math.floor(fv?_:v)-t.x),d>p&&(b=d,d=p,p=b),g>y&&(b=g,g=y,y=b),t.y=Math.floor(dy?p:y)-t.y)},t}();t.Matrix=e}(Hot||(Hot={})),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=1),this.x=t,this.y=e,this.skew=i,this.rotation=n,this.scaleX=r,this.scaleY=s}return t.normalizeRadian=function(t){return(t=(t+Math.PI)%(2*Math.PI))+(t>0?-Math.PI:Math.PI)},t.prototype.toString=function(){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},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var i=this.scaleX,n=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var s=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation-r&&s=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),n>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s-=Math.PI),this.skew=s-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t}();t.Transform=e}(Hot||(Hot={})),function(t){var e=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=a,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t}();t.ColorTransform=e}(Hot||(Hot={})),function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t}();t.Point=e}(Hot||(Hot={})),function(t){var e=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t}();t.Rectangle=e}(Hot||(Hot={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t=0&&t=0&&t=t&&(i=0),!(this.sortedBones.indexOf(r)>=0)){var s=!1;for(var a in this.constraints){var o=this.constraints[a];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){s=!0;break}}s||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),n++)}}}},i.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},i.prototype.setCacheFrame=function(t,e){var i=this.parent.cachedFrames,n=i.length;return i.length+=10,i[n]=t.a,i[n+1]=t.b,i[n+2]=t.c,i[n+3]=t.d,i[n+4]=t.tx,i[n+5]=t.ty,i[n+6]=e.rotation,i[n+7]=e.skew,i[n+8]=e.scaleX,i[n+9]=e.scaleY,n},i.prototype.getCacheFrame=function(t,e,i){var n=this.parent.cachedFrames;t.a=n[i],t.b=n[i+1],t.c=n[i+2],t.d=n[i+3],t.tx=n[i+4],t.ty=n[i+5],e.rotation=n[i+6],e.skew=n[i+7],e.scaleX=n[i+8],e.scaleY=n[i+9],e.x=t.tx,e.y=t.ty},i.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},i.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},i.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},i.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},i.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},i.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},i.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},i.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},i.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},i.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},i.prototype.getMesh=function(t,e,i){var n=this.getSkin(t);return null===n?null:n.getDisplay(e,i)},i.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},i}(t.BaseObject);t.ArmatureData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i.userData=null,i}return Uot(i,e),i.toString=function(){return"[class dragonBones.BoneData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.name="",this.transform.identity(),this.userData=null,this.parent=null},i}(t.BaseObject);t.BoneData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.SurfaceData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.vertices.length=0},e}(i);t.SurfaceData=n;var r=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return Uot(i,e),i.createColor=function(){return new t.ColorTransform},i.toString=function(){return"[class dragonBones.SlotData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.name="",this.color=null,this.userData=null,this.parent=null},i.DEFAULT_COLOR=new t.ColorTransform,i}(t.BaseObject);t.SlotData=r}(Hot||(Hot={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e}(t.BaseObject);t.ConstraintData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e}(e);t.IKConstraintData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e}(e);t.PathConstraintData=n}(Hot||(Hot={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e}(t.BaseObject);t.CanvasData=e}(Hot||(Hot={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return Uot(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,i=this.displays[t];er&&(a|=2),es&&(a|=8),a},e.rectangleIntersectsSegment=function(t,i,n,r,s,a,o,h,u,l,c){void 0===u&&(u=null),void 0===l&&(l=null),void 0===c&&(c=null);var f=t>s&&ta&&is&&na&&r=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return!0}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null);var h=.5*this.width,u=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-h,-u,h,u,s,a,o)},e}(e);t.RectangleBoundingBoxData=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,a,o,h,u,l){void 0===h&&(h=null),void 0===u&&(u=null),void 0===l&&(l=null);var c=a/o,f=c*c,d=i-t,_=(n*=c)-(e*=c),p=Math.sqrt(d*d+_*_),m=d/p,g=_/p,v=(r-t)*m+(s-e)*g,y=a*a,b=y-(t*t+e*e)+v*v,S=0;if(b>=0){var x=Math.sqrt(b),w=v-x,T=v+x,C=w<0?-1:w<=p?0:1,A=T<0?-1:T<=p?0:1,D=C*A;if(D<0)return-1;0===D&&(-1===C?(S=2,i=t+T*m,n=(e+T*g)/c,null!==h&&(h.x=i,h.y=n),null!==u&&(u.x=i,u.y=n),null!==l&&(l.x=Math.atan2(n/y*f,i/y),l.y=l.x+Math.PI)):1===A?(S=1,t+=w*m,e=(e+w*g)/c,null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=t,u.y=e),null!==l&&(l.x=Math.atan2(e/y*f,t/y),l.y=l.x+Math.PI)):(S=3,null!==h&&(h.x=t+w*m,h.y=(e+w*g)/c,null!==l&&(l.x=Math.atan2(h.y/y*f,h.x/y))),null!==u&&(u.x=t+T*m,u.y=(e+T*g)/c,null!==l&&(l.y=Math.atan2(u.y/y*f,u.x/y)))))}return S},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e}(e);t.EllipseBoundingBoxData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),t===i&&(t=i+1e-6),e===n&&(e=n+1e-6);for(var h=r.length,u=t-i,l=e-n,c=t*n-e*i,f=0,d=r[h-2],_=r[h-1],p=0,m=0,g=0,v=0,y=0,b=0,S=0;S=d&&I<=x||I>=x&&I<=d)&&(0===u||I>=t&&I<=i||I>=i&&I<=t)){var B=(c*C-l*A)/D;if((B>=_&&B<=w||B>=w&&B<=_)&&(0===l||B>=e&&B<=n||B>=n&&B<=e)){if(null===a){g=I,v=B,y=I,b=B,f++,null!==o&&(o.x=Math.atan2(w-_,x-d)-.5*Math.PI,o.y=o.x);break}var M=I-t;M<0&&(M=-M),0===f?(p=M,m=M,g=I,v=B,y=I,b=B,null!==o&&(o.x=Math.atan2(w-_,x-d)-.5*Math.PI,o.y=o.x)):(Mm&&(m=M,y=I,b=B,null!==o&&(o.y=Math.atan2(w-_,x-d)-.5*Math.PI))),f++}}d=x,_=w}return 1===f?(null!==s&&(s.x=g,s.y=v),null!==a&&(a.x=g,a.y=v),null!==o&&(o.y=o.x+Math.PI)):f>1&&(f++,null!==s&&(s.x=g,s.y=v),null!==a&&(a.x=y,a.y=b)),f},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var i=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var n=0,r=this.vertices.length,s=r-2;n=e||a=e){var h=this.vertices[s],u=this.vertices[n];(e-o)*(h-u)/(a-o)+u0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var i=0,n=this.cacheFrames.length;i=0},e.prototype.addBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=t.getBone(e);if(null!==n&&(this.boneMask.indexOf(e)<0&&this.boneMask.push(e),i))for(var r=0,s=t.getBones();r=0&&this.boneMask.splice(n,1),i){var r=t.getBone(e);if(null!==r)if(this.boneMask.length>0)for(var s=0,a=t.getBones();s=0&&r.contains(o)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();ue._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t=s)){var o=i[a],h=this.getSlot(o.name);null!==h&&h._setZorder(r)}}this._slotsDirty=!0,this._zOrderDirty=!n}},i.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},i.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},i.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},i.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},i.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},i.prototype.init=function(e,i,n,r){null===this._armatureData&&(this._armatureData=e,this._animation=t.BaseObject.borrowObject(t.Animation),this._proxy=i,this._display=n,this._dragonBones=r,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},i.prototype.advanceTime=function(t){if(!this._lockUpdate)if(null!==this._armatureData)if(null!==this._armatureData.parent){var e=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty&&(this._slotsDirty=!1,this._slots.sort(i._onSortSlots)),this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var n=0,r=0;for(n=0,r=this._bones.length;n0){this._lockUpdate=!0;for(var s=0,a=this._actions;s0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i0){if(null===r&&null===s){m=b;break}var S;null!==r&&((S=o?r.y-e:r.x-t)<0&&(S=-S),(null===m||Su)&&(u=S,f=s.x,d=s.y,g=b,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==a&&(a.x=_)),null!==g&&null!==s&&(s.x=f,s.y=d,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var i=0,n=this._armature._constraints;i=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},i.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},i.prototype.invalidUpdate=function(){this._transformDirty=!0},i.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(i.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,i=this._armature.getSlots();e=s)return this.globalTransformMatrix;if(_=7*(2*(o*(h+1)+2*o+h+d)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[_]>0)v.copyFromArray(g,_+1);else{var y=d*(u+2),b=this._hullCache[4],S=this._hullCache[5],x=this._hullCache[2]-(h-d)*b,w=this._hullCache[3]-(h-d)*S,T=this._vertices;r?this._getAffineTransform(-s,m+c,800,c,T[y+u+2],T[y+u+3],x+b,w+S,T[y],T[y+1],e._helpTransform,v,!0):this._getAffineTransform(-n,m,800,c,x,w,T[y],T[y+1],x+b,w+S,e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty}}else if(t>=s){if(i<-s||i>=s)return this.globalTransformMatrix;_=7*(2*(o*(h+1)+o+d)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=(d+1)*(u+2)-2,b=this._hullCache[4],S=this._hullCache[5],x=this._hullCache[0]+d*b,w=this._hullCache[1]+d*S,T=this._vertices,r?this._getAffineTransform(n,m+c,800,c,x+b,w+S,T[y+u+2],T[y+u+3],x,w,e._helpTransform,v,!0):this._getAffineTransform(s,m,800,c,T[y],T[y+1],x,w,T[y+u+2],T[y+u+3],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else if(i<-s){if(t<-s||t>=s)return this.globalTransformMatrix;_=7*(o*(h+1)+2*f+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=2*f,b=this._hullCache[10],S=this._hullCache[11],x=this._hullCache[8]+f*b,w=this._hullCache[9]+f*S,T=this._vertices,r?this._getAffineTransform(p+l,-s,l,800,T[y+2],T[y+3],T[y],T[y+1],x+b,w+S,e._helpTransform,v,!0):this._getAffineTransform(p,-n,l,800,x,w,x+b,w+S,T[y],T[y+1],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else if(i>=s){if(t<-s||t>=s)return this.globalTransformMatrix;_=7*(2*(o*(h+1)+o+h+d)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=h*(u+2)+2*f,b=this._hullCache[10],S=this._hullCache[11],x=this._hullCache[6]-(o-f)*b,w=this._hullCache[7]-(o-f)*S,T=this._vertices,r?this._getAffineTransform(p+l,n,l,800,x+b,w+S,x,w,T[y+2],T[y+3],e._helpTransform,v,!0):this._getAffineTransform(p,s,l,800,T[y],T[y+1],T[y+2],T[y+3],x,w,e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty)}else _=7*(2*(o*d+f)+((r=i>this._k*(t-p-l)+m)?1:0)),this._matrixCahce[_]>0?v.copyFromArray(g,_+1):(y=2*f+d*(u+2),T=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,T[y+u+4],T[y+u+5],T[y+u+2],T[y+u+3],T[y+2],T[y+3],e._helpTransform,v,!0):this._getAffineTransform(p,m,l,c,T[y],T[y+1],T[y+2],T[y+3],T[y+u+2],T[y+u+3],e._helpTransform,v,!1),g[_]=1,g[_+1]=v.a,g[_+2]=v.b,g[_+3]=v.c,g[_+4]=v.d,g[_+5]=v.tx,g[_+6]=v.ty);return v},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=14*(n*r+2*n+2*r),this._hullCache.length=10;for(var a=0;a=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];if(i>=0&&this._cachedFrameIndex===i)this._transformDirty=!1;else if(i>=0)this._transformDirty=!0,this._cachedFrameIndex=i;else{if(this._hasConstraint)for(var n=0,r=this._armature._constraints;n=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s=0;this._localDirty&&this._updateGlobalTransformMatrix(l),l&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var c=2*this.global.x,f=2*this.global.y,d=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,d),this._hullCache[0]=d.x,this._hullCache[1]=d.y,this._hullCache[2]=c-d.x,this._hullCache[3]=f-d.y,this.globalTransformMatrix.transformPoint(0,this._dY,d,!0),this._hullCache[4]=d.x,this._hullCache[5]=d.y,this.globalTransformMatrix.transformPoint(200,1e3,d),this._hullCache[6]=d.x,this._hullCache[7]=d.y,this._hullCache[8]=c-d.x,this._hullCache[9]=f-d.y,this.globalTransformMatrix.transformPoint(this._dX,0,d,!0),this._hullCache[10]=d.x,this._hullCache[11]=d.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(Hot||(Hot={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._localMatrix=new t.Matrix,i._colorTransform=new t.ColorTransform,i._displayDatas=[],i._displayList=[],i._deformVertices=null,i._rawDisplay=null,i._meshDisplay=null,i}return Uot(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex=0&&this._displayIndex=0&&null!==this._rawDisplayDatas){var a=this._displayIndex0)for(var o=0,h=s;o0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];e>=0&&this._cachedFrameIndex===e?this._transformDirty=!1:e>=0?(this._transformDirty=!0,this._cachedFrameIndex=e):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(null!==this._display){if(this._visibleDirty&&(this._visibleDirty=!1,this._updateVisible()),this._blendModeDirty&&(this._blendModeDirty=!1,this._updateBlendMode()),this._colorDirty&&(this._colorDirty=!1,this._updateColor()),null!==this._deformVertices&&null!==this._deformVertices.verticesData&&this._display===this._meshDisplay){var i=null!==this._deformVertices.verticesData.weight,n=0!==this._parent._boneData.type;if((this._deformVertices.verticesDirty||i&&this._deformVertices.isBonesUpdate()||n&&this._parent._childrenTransformDirty)&&(this._deformVertices.verticesDirty=!1,this._updateMesh()),i||n)return}if(this._transformDirty){if(this._transformDirty=!1,this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._isFromCache=!0,this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform()}}},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._transformDirty=!1,this._updateGlobalTransformMatrix(!1))},i.prototype.replaceDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0&&(e=this._displayIndex<0?0:this._displayIndex),this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var i=0,n=this._displayDatas.length;i0&&(1===h||2===h?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&(a.x=s.x,a.y=s.y)):null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),h},i.prototype.invalidUpdate=function(){this._displayDirty=!0,this._transformDirty=!0},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){this._setDisplayIndex(t)&&this.update(-1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._slotData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var i=this._displayList.concat(),n=new Array;this._setDisplayList(e)&&this.update(-1);for(var r=0,s=i;r_)continue}for(;;W++){var L=p[W];if(!(F>L)){0===W?F/=L:F=(F-(z=p[W-1]))/(L-z);break}}if(W!==f){f=W;var V=6*W;for(T=u[V],C=u[V+1],A=u[V+2],D=u[V+3],I=u[V+4],B=u[V+5],b=2*(m=.03*(T-2*A+I))+(v=.006*(3*(A-I)-T+(M=u[V+6]))),S=2*(g=.03*(C-2*D+B))+(y=.006*(3*(D-B)-C+(P=u[V+7]))),x=.3*(A-T)+m+.16666667*v,w=.3*(D-C)+g+.16666667*y,O=Math.sqrt(x*x+w*w),k[0]=O,V=1;V<8;V++)x+=b,w+=S,b+=v,S+=y,O+=Math.sqrt(x*x+w*w),k[V]=O;x+=b,w+=S,O+=Math.sqrt(x*x+w*w),k[8]=O,x+=b+v,w+=S+y,O+=Math.sqrt(x*x+w*w),k[9]=O,R=0}for(F*=O;;R++){var N=k[R];if(!(F>N)){var z;0===R?F/=N:F=R+(F-(z=k[R-1]))/(N-z);break}}this.addCurvePosition(.1*F,T,C,A,D,I,B,M,P,a,H,i)}}else{var G=t.curveLengths;if(_=G[c-=h?1:2],n&&(d*=_),r)for(var U=0;U_)continue}for(var j=0;;W++){var q=G[W];if(!(d>q)){if(0===W)j=d/q;else{var X=G[W-1];j=(d-X)/(q-X)}break}}W!==f&&(f=W,h&&W===c?(this._computeVertices(l-4,4,0,u),this._computeVertices(0,4,4,u)):this._computeVertices(6*W+2,8,0,u)),this.addCurvePosition(j,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],a,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,u,l,c){if(0===t)return u[l]=e,u[l+1]=i,void(u[l+2]=0);if(1===t)return u[l]=o,u[l+1]=h,void(u[l+2]=0);var f=1-t,d=f*f,_=t*t,p=d*f,m=d*t*3,g=f*_*3,v=t*_,y=p*e+m*n+g*s+v*o,b=p*i+m*r+g*a+v*h;u[l]=y,u[l+1]=b,u[l+2]=c?Math.atan2(b-(p*i+m*r+g*a),y-(p*e+m*n+g*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var I=this.rotateMix,B=this.translateMix,M=(g=0,3);g0){var L=E.a,V=E.b,N=E.c,z=E.d,G=void 0,U=void 0,H=void 0;if(G=f?T[M-1]:Math.atan2(O,k),G-=Math.atan2(V,L),w){U=Math.cos(G),H=Math.sin(G);var W=P._boneData.length;A+=(W*(U*L-H*V)-k)*I,D+=(W*(H*L+U*V)-O)*I}else G+=C;G>t.Transform.PI?G-=t.Transform.PI_D:G<-t.Transform.PI&&(G+=t.Transform.PI_D),G*=I,U=Math.cos(G),H=Math.sin(G),E.a=U*L-H*V,E.b=H*L+U*V,E.c=U*N-H*z,E.d=H*N+U*z}P.global.fromMatrix(E)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i}(e);t.PathConstraint=n}(Hot||(Hot={})),function(t){var e=function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var i=0,n=0,r=this._animatebles.length;i0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&_._subFadeState>0)this._armature._dragonBones.bufferObject(_),this._animationStates.length=0,this._lastAnimationState=null;else{var i=_._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r0){var c=l[0];if(null!==c&&c.parent===this._armature.armatureData.defaultSkin){u._cachedFrameIndices=i.getSlotCachedFrameIndices(u.name);continue}}u._cachedFrameIndices=null}}_.advanceTime(t,n)}else if(e>1){for(var f=0,d=0;f0&&_._subFadeState>0?(d++,this._armature._dragonBones.bufferObject(_),this._animationDirty=!0,this._lastAnimationState===_&&(this._lastAnimationState=null)):(d>0&&(this._animationStates[f-d]=_),_.advanceTime(t,0)),f===e-1&&d>0&&(this._animationStates.length-=d,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},i.prototype.reset=function(){for(var t=0,e=this._animationStates;t1?(e.position<0?(e.position%=n.duration,e.position=n.duration-e.position):e.position===n.duration?e.position-=1e-6:e.position>n.duration&&(e.position%=n.duration),e.duration>0&&e.position+e.duration>n.duration&&(e.duration=n.duration-e.position),e.playTimes<0&&(e.playTimes=n.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,n,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var h=!1,u=0,l=this._animationStates.length;uthis._animationStates[u].layer){h=!0,this._animationStates.splice(u,0,o);break}if(u!==l-1&&o.layer>this._animationStates[u+1].layer){h=!0,this._animationStates.splice(u+1,0,o);break}}h||this._animationStates.push(o)}else this._animationStates.push(o);for(var c=0,f=this._armature.getSlots();c0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),i.prototype.gotoAndPlay=function(t,e,i,n,r,s,a){void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=-1),void 0===r&&(r=0),void 0===s&&(s=null),void 0===a&&(a=3),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=a,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var o=this._animations[t];return o&&i>0&&(this._animationConfig.timeScale=o.duration/i),this.playConfig(this._animationConfig)},i.prototype.gotoAndStop=function(t,e){return void 0===e&&(e=0),console.warn("Deprecated."),this.gotoAndStopByTime(t,e)},Object.defineProperty(i.prototype,"animationList",{get:function(){return console.warn("Deprecated."),this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");for(var t=[],e=0,i=this._animationNames.length;e0;if(this._subFadeState<0){this._subFadeState=0;var r=n?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i))}(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=n?0:1):this._fadeTime>0?this._fadeProgress=n?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=n?1:0,this._subFadeState>0)&&(n||(this._playheadState|=1,this._fadeState=0),r=n?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE,this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i)))},r.prototype.init=function(e,i,n){if(null===this._armature){if(this._armature=e,this._animationData=i,this.resetToPose=n.resetToPose,this.additiveBlending=n.additiveBlending,this.displayControl=n.displayControl,this.actionEnabled=n.actionEnabled,this.layer=n.layer,this.playTimes=n.playTimes,this.timeScale=n.timeScale,this.fadeTotalTime=n.fadeInTime,this.autoFadeOutTime=n.autoFadeOutTime,this.weight=n.weight,this.name=n.name.length>0?n.name:n.animation,this.group=n.group,n.pauseFadeIn?this._playheadState=2:this._playheadState=3,n.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==n.position?this.timeScale>=0?this._time=n.position:this._time=n.position-this._duration:this._time=0):(this._position=n.position,this._duration=n.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),n.boneMask.length>0){this._boneMask.length=n.boneMask.length;for(var r=0,s=this._boneMask.length;r0,r=!0,s=!0,a=this._time;if(this._weightResult=this.weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult/this._parent._fadeProgress),this._actionTimeline.playState<=0&&this._actionTimeline.update(a),n){var o=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(a),n){var h=Math.floor(this._actionTimeline.currentTime*i);this._armature._cacheFrameIndex===h?(r=!1,s=!1):(this._armature._cacheFrameIndex=h,this._animationData.cachedFrames[h]?s=!1:this._animationData.cachedFrames[h]=!0)}if(r){if(s)for(var u=0,l=this._boneTimelines.length;u0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var d=0,_=this._poseTimelines;d<_.length;d++){var p;(p=_[d])instanceof t.BoneTimelineState?this._boneTimelines.splice(this._boneTimelines.indexOf(p),1):p instanceof t.SurfaceTimelineState?this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p),1):p instanceof t.SlotTimelineState?this._slotTimelines.splice(this._slotTimelines.indexOf(p),1):p instanceof t.ConstraintTimelineState&&this._constraintTimelines.splice(this._constraintTimelines.indexOf(p),1),p.returnToPool()}this._poseTimelines.length=0}this._actionTimeline.playState>0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},r.prototype.play=function(){this._playheadState=3},r.prototype.stop=function(){this._playheadState&=1},r.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var i=0,n=this._boneTimelines;i1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},r.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},r.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._armature.getBone(t);if(null!==i){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var n=0,r=this._armature.getBones();n=0&&this._boneMask.splice(i,1),e){var n=this._armature.getBone(t);if(null!==n){var r=this._armature.getBones();if(this._boneMask.length>0)for(var s=0,a=r;s=0&&n.contains(o)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return!!(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration0&&e===this.playTimes-1&&t===this._duration&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var i=0,n=this._boneTimelines;i0))return 0;if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.leftWeight=0,0;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return t*=this.leftWeight,this.layerWeight+=t,this.blendWeight=t,2}return this.dirty=!0,this.layer=e,this.layerWeight=t,this.leftWeight=1,this.blendWeight=t,1},t.prototype.clear=function(){this.dirty=!1,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},t}();t.BlendState=n}(Hot||(Hot={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.prototype._onClear=function(){this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this._tweenState=0,this._frameRate=0,this._frameValueOffset=0,this._frameCount=0,this._frameOffset=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._dragonBonesData=null,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._frameIntArray=null,this._frameFloatArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,i=this.currentPlayTimes,n=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,s=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=s||t<=-s)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==i||this.currentTime!==n)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,i){this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState._animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._dragonBonesData=this._animationData.parent.parent,null!==this._timelineData&&(this._frameIntArray=this._dragonBonesData.frameIntArray,this._frameFloatArray=this._dragonBonesData.frameFloatArray,this._frameArray=this._dragonBonesData.frameArray,this._timelineArray=this._dragonBonesData.timelineArray,this._frameIndices=this._dragonBonesData.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1])},e.prototype.fadeOut=function(){},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());0!==this._tweenState&&this._onUpdateFrame()}},e}(t.BaseObject);t.TimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e._getEasingValue=function(t,e,i){var n=e;switch(t){case 3:n=Math.pow(e,2);break;case 4:n=1-Math.pow(1-e,2);break;case 5:n=.5*(1-Math.cos(e*Math.PI))}return(n-e)*i+e},e._getEasingCurveValue=function(t,e,i,n){if(t<=0)return 0;if(t>=1)return 1;var r=i+1,s=Math.floor(t*r),a=0===s?0:e[n+s-1];return 1e-4*(a+((s===r-1?1e4:e[n+s])-a)*(t*r-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenProgress=0,this._tweenEasing=0},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes0?1/e:0}else this._tweenState=1},e.prototype._onUpdateFrame=function(){2===this._tweenState?(this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,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))):this._tweenProgress=0},e}(e);t.TweenTimelineState=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.bone=null,this.bonePose=null},e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight,i=this.bone.animationPose,n=this.bonePose.result;2===t?(i.x+=n.x*e,i.y+=n.y*e,i.rotation+=n.rotation*e,i.skew+=n.skew*e,i.scaleX+=(n.scaleX-1)*e,i.scaleY+=(n.scaleY-1)*e):1!==e?(i.x=n.x*e,i.y=n.y*e,i.rotation=n.rotation*e,i.skew=n.skew*e,i.scaleX=(n.scaleX-1)*e+1,i.scaleY=(n.scaleY-1)*e+1):(i.x=n.x,i.y=n.y,i.rotation=n.rotation,i.skew=n.skew,i.scaleX=n.scaleX,i.scaleY=n.scaleY),0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.bone._transformDirty=!0)},e}(i);t.BoneTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.slot=null},e}(i);t.SlotTimelineState=r;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(Hot||(Hot={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Uot(i,e),i.toString=function(){return"[class dragonBones.ActionTimelineState]"},i.prototype._onCrossFrame=function(e){var i=this._armature.eventDispatcher;if(this._animationState.actionEnabled)for(var n=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e],r=this._frameArray[n+1],s=this._animationData.parent.actions,a=0;a0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((u=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,u.armature=this._armature,u.animationState=this._animationState)),this._frameCount>1){var l=this._timelineData,c=Math.floor(this.currentTime*this._frameRate),f=this._frameIndices[l.frameIndicesOffset+c];if(this._frameIndex!==f){var d=this._frameIndex;if(this._frameIndex=f,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],o){if(d<0){var _=Math.floor(r*this._frameRate);d=this._frameIndices[l.frameIndicesOffset+_],this.currentPlayTimes===n&&d===f&&(d=-1)}for(;d>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+d],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(d),null!==h&&0===d&&(this._armature._dragonBones.bufferEvent(h),h=null),d>0?d--:d=this._frameCount-1,d===f)break}}else for(d<0&&(_=Math.floor(r*this._frameRate),d=this._frameIndices[l.frameIndicesOffset+_],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+d],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?d>0?d--:d=this._frameCount-1:d===f&&(d=-1)));d>=0&&(d=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.ZOrderTimelineState=i;var n=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Uot(i,e),i.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var t=this._animationData.frameFloatOffset+this._frameValueOffset+6*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[t++]*i,r.y=n[t++]*i,r.rotation=n[t++],r.skew=n[t++],r.scaleX=n[t++],r.scaleY=n[t++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(t=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[t++]*i-r.x,s.y=n[t++]*i-r.y,s.rotation=n[t++]-r.rotation,s.skew=n[t++]-r.skew,s.scaleX=n[t++]-r.scaleX,s.scaleY=n[t++]-r.scaleY):(s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,r.rotation=0,r.skew=0,r.scaleX=1,r.scaleY=1,s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=t.x+i.x*this._tweenProgress,n.y=t.y+i.y*this._tweenProgress,n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress,n.scaleX=t.scaleX+i.scaleX*this._tweenProgress,n.scaleY=t.scaleY+i.scaleY*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneAllTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[e++]*i,r.y=n[e++]*i,2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[e++]*i-r.x,s.y=n[e++]*i-r.y):(s.x=0,s.y=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,s.x=0,s.y=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=e.x+i.x*this._tweenProgress,n.y=e.y+i.y*this._tweenProgress},e}(t.BoneTimelineState);t.BoneTranslateTimelineState=r;var s=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Uot(i,e),i.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var i=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.rotation=n[i++],r.skew=n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1?(i=this._animationData.frameFloatOffset+this._frameValueOffset,s.rotation=t.Transform.normalizeRadian(n[i++]-r.rotation)):s.rotation=n[i++]-r.rotation,s.skew=n[i++]-r.skew):(s.rotation=0,s.skew=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.rotation=0,r.skew=0,s.rotation=0,s.skew=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneRotateTimelineState=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._frameFloatArray,n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=i[e++],n.scaleY=i[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),r.scaleX=i[e++]-n.scaleX,r.scaleY=i[e++]-n.scaleY):(r.scaleX=0,r.scaleY=0)}else n=this.bonePose.current,r=this.bonePose.delta,n.scaleX=1,n.scaleY=1,r.scaleX=0,r.scaleY=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.scaleX=e.scaleX+i.scaleX*this._tweenProgress,n.scaleY=e.scaleY+i.scaleY*this._tweenProgress},e}(t.BoneTimelineState);t.BoneScaleTimelineState=a;var o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.surface=null,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0){var t=null!==this._timelineData?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;this.slot.displayIndex!==t&&this.slot._setDisplayIndex(t,!0)}},e}(t.SlotTimelineState);t.SlotDislayTimelineState=h;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._delta=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dirty=!1},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._dragonBonesData.intArray,i=this._frameIntArray,n=this._animationData.frameIntOffset+this._frameValueOffset+1*this._frameIndex,r=i[n];r<0&&(r+=65536),this._current[0]=e[r++],this._current[1]=e[r++],this._current[2]=e[r++],this._current[3]=e[r++],this._current[4]=e[r++],this._current[5]=e[r++],this._current[6]=e[r++],this._current[7]=e[r++],2===this._tweenState&&((r=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[n+1])<0&&(r+=65536),this._delta[0]=e[r++]-this._current[0],this._delta[1]=e[r++]-this._current[1],this._delta[2]=e[r++]-this._current[2],this._delta[3]=e[r++]-this._current[3],this._delta[4]=e[r++]-this._current[4],this._delta[5]=e[r++]-this._current[5],this._delta[6]=e[r++]-this._current[6],this._delta[7]=e[r++]-this._current[7])}else{var s=this.slot._slotData.color;this._current[0]=100*s.alphaMultiplier,this._current[1]=100*s.redMultiplier,this._current[2]=100*s.greenMultiplier,this._current[3]=100*s.blueMultiplier,this._current[4]=s.alphaOffset,this._current[5]=s.redOffset,this._current[6]=s.greenOffset,this._current[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0),this._result[0]=.01*(this._current[0]+this._delta[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._delta[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._delta[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._delta[3]*this._tweenProgress),this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress,this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress,this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress,this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty){var i=this.slot._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){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]){var n=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*n,i.redMultiplier+=(this._result[1]-i.redMultiplier)*n,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*n,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*n,i.alphaOffset+=(this._result[4]-i.alphaOffset)*n,i.redOffset+=(this._result[5]-i.redOffset)*n,i.greenOffset+=(this._result[6]-i.greenOffset)*n,i.blueOffset+=(this._result[7]-i.blueOffset)*n,this.slot._colorDirty=!0}}else this._dirty&&(this._dirty=!1,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]||(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],this.slot._colorDirty=!0))}},e}(t.SlotTimelineState);t.SlotColorTimelineState=u;var l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return Uot(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.vertexOffset=0,this._dirty=!1,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0&&(this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress),this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress},e.prototype.blend=function(t){var e=this.animationState,i=e._blendState.blendWeight;2===t?(e.weight+=this._floats[5]*i,e.currentTime+=this._floats[2]*i):(e.weight=this._floats[5]*i,e.currentTime=this._floats[2]*i)},e}(t.TweenTimelineState);t.AnimationTimelineState=f}(Hot||(Hot={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Uot(e,t),e.actionDataToInstance=function(t,i,n){0===t.type?i.type=e.FRAME_EVENT:i.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,i.name=t.name,i.armature=n,i.actionData=t,i.data=t.data,null!==t.bone&&(i.bone=n.getBone(t.bone.name)),null!==t.slot&&(i.slot=n.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e}(t.BaseObject);t.EventObject=e}(Hot||(Hot={})),function(t){var e=function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":default:return 0;case"movieclip":return 1}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":default:return 0;case"surface":return 1}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":default:return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":default:return 0;case"ellipse":return 1;case"polygon":return 2}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":default:return 0;case"frame":return 10;case"sound":return 11}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":default:return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":default:return 1;case"fixed":return 0}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":default:return 0;case"percent":return 2;case"fixed":return 1}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":default:return 0;case"chain":return 1;case"chainscale":return 2}},e.parseDragonBonesData=function(e){return console.warn("Deprecated."),e instanceof ArrayBuffer?t.BinaryDataParser.getInstance().parseDragonBonesData(e):t.ObjectDataParser.getInstance().parseDragonBonesData(e)},e.parseTextureAtlasData=function(i,n){void 0===n&&(n=1),console.warn("已废弃");for(var r={},s=i[e.SUB_TEXTURE],a=0,o=s.length;a255)return encodeURI(r);return r}return String(r)}return n},n.prototype._getCurvePoint=function(t,e,i,n,r,s,a,o,h,u){var l=1-h,c=l*l,f=h*h,d=l*c,_=3*h*c,p=3*l*f,m=h*f;u.x=d*t+_*i+p*r+m*a,u.y=d*e+_*n+p*s+m*o},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r=0&&n+61e-4;){var v=.5*(g+m);this._getCurvePoint(h,u,l,c,f,d,_,p,v,this._helpPoint),a-this._helpPoint.x>0?m=v:g=v}e[r]=this._helpPoint.y}},n.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},n.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,a),u=0,l=null,c=0,f=h;cn)break;u++}null===l&&((l=new i).frameStart=n,this._actionFrames.splice(u+1,0,l));for(var g=0;g0){var d=r.getBone(c);null!==d?f.parent=d:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(f))}if(f.name in this._cacheBones){for(var _=0,p=this._cacheBones[f.name];_0&&null!==i.parent?(s.root=i.parent,s.bone=i):(s.root=i,s.bone=null),s},n.prototype._parsePathConstraint=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.TARGET,""));if(null===i)return null;var r=this._armature.defaultSkin;if(null===r)return null;var s=r.getDisplay(i.name,n._getString(e,t.DataParser.TARGET_DISPLAY,i.name));if(null===s||!(s instanceof t.PathDisplayData))return null;var a=e[t.DataParser.BONES];if(null===a||0===a.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=n._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=i,o.pathDisplayData=s,o.target=i.parent,o.positionMode=t.DataParser._getPositionMode(n._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(n._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(n._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=n._getNumber(e,t.DataParser.POSITION,0),o.spacing=n._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=n._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=n._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=n._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var h=0,u=a;h0?r:i,this._parsePivot(e,o);break;case 1:var h=a=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(h.name=i,h.path=r.length>0?r:i,h.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var u=0,l=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);u0?r:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var g=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);g.name=i,g.path=r.length>0?r:i,g.boundingBox=m}break;case 4:var v=e[t.DataParser.LENGTHS],y=a=t.BaseObject.borrowObject(t.PathDisplayData);y.closed=n._getBoolean(e,t.DataParser.CLOSED,!1),y.constantSpeed=n._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),y.name=i,y.path=r.length>0?r:i,y.vertices.data=this._data,y.curveLengths.length=v.length;for(var b=0,S=v.length;bi.width&&(i.width=h),ui.height&&(i.height=u))}i.width-=i.x,i.height-=i.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return i},n.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);if(i.frameCount=Math.max(n._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=n._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=n._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=n._getNumber(e,t.DataParser.SCALE,1),i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),i.frameIntOffset=this._frameIntArray.length,i.frameFloatOffset=this._frameFloatArray.length,i.frameOffset=this._frameArray.length,this._animation=i,t.DataParser.FRAME in e){var r=e[t.DataParser.FRAME],s=r.length;if(s>0)for(var a=0,o=0;a0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,!1,!1,0,this._parseActionFrame),this._actionFrames.length=0),this._animation=null,i},n.prototype._parseTimeline=function(e,r,s,a,o,h,u,l){if(null!==e&&s.length>0&&s in e&&(r=e[s]),null===r)return null;var c=r.length;if(0===c)return null;var f=this._frameIntArray.length,d=this._frameFloatArray.length,_=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+c,null!==e?(this._timelineArray[p+0]=Math.round(100*n._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*n._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=c,this._timelineArray[p+3]=u,this._timelineArray[p+4]=o?f-this._animation.frameIntOffset:h?d-this._animation.frameFloatOffset:0,this._timeline=_,_.type=a,_.offset=p,1===c)_.frameIndicesOffset=-1,this._timelineArray[p+5+0]=l.call(this,r[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,g=this._data.frameIndices,v=0;t.DragonBones.webAssembly?(v=g.size(),g.resize(v+m,0)):(v=g.length,g.length+=m),_.frameIndicesOffset=v;for(var y=0,b=0,S=0,x=0;y0)if(t.DataParser.CURVE in e){var a=r+1;this._helpArray.length=a,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=a;for(var o=0;o0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),h=new Array(a),u=0;u0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),a},n.prototype._parseBoneTranslateFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,0),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,0),s},n.prototype._parseBoneRotateFrame=function(e,i,r){var s=n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,a},n.prototype._parseBoneScaleFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,1),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,1),s},n.prototype._parseSurfaceFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=e[t.DataParser.VERTICES],h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._surface.vertices.length/2,l=0,c=0;this._frameFloatArray.length+=2*u;for(var f=0;f<2*u;f+=2)l=f=o.length?0:o[f-h],c=f+1=o.length?0:o[f+1-h],this._frameFloatArray[s+f]=l,this._frameFloatArray[s+f+1]=c;if(0===i){var d=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[d+0]=0,this._frameIntArray[d+1]=this._frameFloatArray.length-s,this._frameIntArray[d+2]=this._frameFloatArray.length-s,this._frameIntArray[d+3]=0,this._frameIntArray[d+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=d-this._animation.frameIntOffset}return a},n.prototype._parseSlotDisplayFrame=function(e,i,r){var s=this._parseFrame(e,i,r);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[s+1]=n._getNumber(e,t.DataParser.VALUE,0):this._frameArray[s+1]=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,i,this._slot.parent,this._slot),s},n.prototype._parseSlotColorFrame=function(e,i,n){var r=this._parseTweenFrame(e,i,n),s=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var a=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in a){this._parseColorTransform(a,this._helpColorTransform),s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.redMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._intArray[s++]=Math.round(this._helpColorTransform.alphaOffset),this._intArray[s++]=Math.round(this._helpColorTransform.redOffset),this._intArray[s++]=Math.round(this._helpColorTransform.greenOffset),this._intArray[s++]=Math.round(this._helpColorTransform.blueOffset),s-=8;break}}s<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0),s=this._defaultColorOffset);var h=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[h]=s,r},n.prototype._parseSlotFFDFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._intArray[this._mesh.vertices.offset+0],l=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,c=this._mesh.vertices.weight,f=0,d=0,_=0,p=0;if(null!==c){var m=this._weightSlotPose[l];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*c.count,_=c.offset+2+c.bones.length}else this._frameFloatArray.length+=2*u;for(var g=0;g<2*u;g+=2)if(null===o?(f=0,d=0):(f=g=o.length?0:o[g-h],d=g+1=o.length?0:o[g+1-h]),null!==c){var v=this._weightBonePoses[l],y=this._intArray[_++];this._helpMatrixA.transformPoint(f,d,this._helpPoint,!0),f=this._helpPoint.x,d=this._helpPoint.y;for(var b=0;b=0||t.DataParser.DATA_VERSIONS.indexOf(s)>=0){var a=t.BaseObject.borrowObject(t.DragonBonesData);if(a.version=r,a.name=n._getString(e,t.DataParser.NAME,""),a.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,24),0===a.frameRate&&(a.frameRate=24),t.DataParser.ARMATURE in e){this._data=a,this._parseArray(e);for(var o=0,h=e[t.DataParser.ARMATURE];o0&&(a.stage=a.getArmature(a.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),a}return console.assert(!1,"Nonsupport data version: "+r+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},n.prototype.parseTextureAtlasData=function(e,i,r){if(void 0===r&&(r=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var s=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(s,i,r),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0),i.scale=1===r?1/n._getNumber(e,t.DataParser.SCALE,1):r,i.name=n._getString(e,t.DataParser.NAME,""),i.imagePath=n._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var a=e[t.DataParser.SUB_TEXTURE],o=0,h=a.length;o0&&f>0&&(l.frame=t.TextureData.createRectangle(),l.frame.x=n._getNumber(u,t.DataParser.FRAME_X,0),l.frame.y=n._getNumber(u,t.DataParser.FRAME_Y,0),l.frame.width=c,l.frame.height=f),i.addTexture(l)}return!0},n.getInstance=function(){return null===n._objectDataParserInstance&&(n._objectDataParserInstance=new n),n._objectDataParserInstance},n._objectDataParserInstance=null,n}(t.DataParser);t.ObjectDataParser=e;var i=function(){this.frameStart=0,this.actions=[]};t.ActionFrame=i}(Hot||(Hot={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Uot(i,e),i.prototype._inRange=function(t,e,i){return e<=t&&t<=i},i.prototype._decodeUTF8=function(t){for(var e,i=0,n="",r=0,s=0,a=0,o=0;t.length>i;){var h=t[i++];if(-1===h)e=0!==s?65533:-1;else if(0===s)this._inRange(h,0,127)?e=h:(this._inRange(h,194,223)?(s=1,o=128,r=h-192):this._inRange(h,224,239)?(s=2,o=2048,r=h-224):this._inRange(h,240,244)&&(s=3,o=65536,r=h-240),r*=Math.pow(64,s),e=null);else if(this._inRange(h,128,191))if(a+=1,r+=(h-128)*Math.pow(64,s-a),a!==s)e=null;else{var u=r,l=o;r=0,s=0,a=0,o=0,e=this._inRange(u,l,1114111)&&!this._inRange(u,55296,57343)?u:h}else r=0,s=0,a=0,o=0,i--,e=h;null!==e&&-1!==e&&(e<=65535?e>0&&(n+=String.fromCharCode(e)):(e-=65536,n+=String.fromCharCode(55296+(e>>10&1023)),n+=String.fromCharCode(56320+(1023&e))))}return n},i.prototype._getUTF16Key=function(t){for(var e=0,i=t.length;e255)return encodeURI(t);return t},i.prototype._parseBinaryTimeline=function(e,i,n){void 0===n&&(n=null);var r=null!==n?n:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=i,this._timeline=r;var s=this._timelineArrayBuffer[r.offset+2];if(1===s)r.frameIndicesOffset=-1;else{var a=0,o=this._animation.frameCount+1,h=this._data.frameIndices;t.DragonBones.webAssembly?(a=h.size(),h.resize(a+o,0)):(a=h.length,h.length+=o),r.frameIndicesOffset=a;for(var u=0,l=0,c=0,f=0;u=0){var r=t.BaseObject.borrowObject(t.WeightData),s=this._intArrayBuffer[i.offset+0],a=this._intArrayBuffer[n+0];r.offset=n;for(var o=0;o0&&e in this._dragonBonesDataMap&&(a=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===a&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[o],(0===e.length||s.autoSearch)&&null!==(a=s.getArmature(i))){e=o;break}if(null!==a){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=a,t.skin=null,n.length>0&&(t.skin=a.getSkin(n),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var h=this._dragonBonesDataMap[o].getArmature(n);if(null!==h){t.skin=h.defaultSkin;break}}return null===t.skin&&(t.skin=a.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,i){for(var n=0,r=e.armature.sortedBones;n0&&(o.texture=this._getTextureData(e.textureAtlasName,i.path)),null===o.texture&&(o.texture=this._getTextureData(s,i.path)),a=null!==n&&2===n.type&&this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 2:var h=i;null!==e&&e.textureAtlasName.length>0&&(h.texture=this._getTextureData(e.textureAtlasName,h.path)),null===h.texture&&(h.texture=this._getTextureData(s,h.path)),a=this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 1:var u=i,l=this._buildChildArmature(e,r,i);if(null!==l){if(l.inheritAnimation=u.inheritAnimation,!l.inheritAnimation){var c=u.actions.length>0?u.actions:l.armatureData.defaultActions;if(c.length>0)for(var f=0,d=c;f=0)){var l=i.getDisplays(u.name);if(l||(null!==a&&i!==a&&(l=a.getDisplays(u.name)),l)){var c=t.DragonBones.webAssembly?l.size():l.length,f=u.displayList;f.length=c;for(var d=0,_=c;d<_;++d){var p=t.DragonBones.webAssembly?l.get(d):l[d];f[d]=null!==p?this._getSlotDisplay(null,p,null,u):null}s=!0,u.rawDisplayDatas=l,u.displayList=f}else n&&(u.rawDisplayDatas=null,u.displayList=[])}}return s},e.prototype.replaceAnimation=function(e,i,n){void 0===n&&(n=!0);var r=i.defaultSkin;if(null===r)return!1;if(n)e.animation.animations=i.animations;else{var s=e.animation.animations,a={};for(var o in s)a[o]=s[o];for(var o in i.animations)a[o]=i.animations[o];e.animation.animations=a}for(var h=0,u=e.getSlots();h0&&n.inheritDeform,a=this._localVertices;if(r){var o=n.data,h=o.intArray,u=o.floatArray,l=h[n.offset+xut.MeshVertexCount],c=h[r.offset+xut.WeigthFloatOffset];c<0&&(c+=65536);for(var f=0,d=r.offset+xut.WeigthBoneIndices+i.length,_=c,p=0,m=0;f=0;o--)if(s>=e[o]._zOrder){e.splice(o+1,0,r),a=!0;break}a||e.unshift(r)}this._slots=e},i._buildArmature=function(t){var e=nht.borrowObject(Nht);e._skinData=t.skin,e._animation=nht.borrowObject(Yht),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new Rut;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=nht.borrowObject(Out),r=n;return n.init(e,i,r,r),n},i.getDragonBonesDataByUUID=function(t){for(var e in this._dragonBonesDataMap)if(-1!==e.indexOf(t))return this._dragonBonesDataMap[e];return null},i.removeDragonBonesDataByUUID=function(t,e){for(var i in void 0===e&&(e=!0),this._dragonBonesDataMap)-1!==i.indexOf(t)&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[i]),delete this._dragonBonesDataMap[i])},e}(but),Qot._factory=null,Yot=Qot))||Yot,Lut=1/60,Vut=[],Nut=[],zut=0,Gut=0,Uut=0,Hut=null,Wut=null,jut=0,qut=0,Xut=0,Yut=0,Qut=0,Kut=function(){function t(){this.maxVertexCount=0,this.maxIndexCount=0,this._privateMode=!1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this.frames=[],this.totalTime=0,this.isCompleted=!1,this._frameIdx=-1,this._armatureInfo=null,this._animationName=null,this._tempSegments=null,this._tempColors=null,this._tempBoneInfos=null}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._armatureInfo=t,this._animationName=e},e.clear=function(){this._inited=!1;for(var t=0,e=this.frames.length;t0&&(r[Yut-1].vfOffset=Uut),r.length=Yut,s.length=zut;var a=Xut-1;if(a>=0)if(qut>0){var o=n[a];o.indexCount=qut,o.vfCount=9*jut,o.vertexCount=jut,n.length=Xut}else n.length=Xut-1;if(0!==n.length){var h,u=i.vertices,l=Uut/5,c=9*l;(!u||u.length>8&255)/255,u[f+7]=(h>>16&255)/255,u[f+8]=(h>>24&255)/255,f+=9;var _=i.indices;(!_||_.lengththis.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=_.length>this.maxIndexCount?_.length:this.maxIndexCount}},e._traverseArmature=function(t,e){var i,n,r,s,a,o,h,u,l,c=this._tempColors,f=this._tempSegments,d=this._tempBoneInfos,_=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m=0&&(qut>0?((l=f[u]).indexCount=qut,l.vertexCount=jut,l.vfCount=9*jut):Xut--),f[Xut]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},Xut++,qut=0,jut=0),o=(a.a*e<<24>>>0)+(a.b<<16)+(a.g<<8)+a.r,Qut!==o&&(Qut=o,Yut>0&&(c[Yut-1].vfOffset=Uut),c[Yut++]={r:a.r,g:a.g,b:a.b,a:a.a*e,vfOffset:0}),i=r._localVertices,n=r._indices,s=r._worldMatrix;for(var w=0,T=i.length;w":0},r=i.animations,s=0;for(var a in r)r.hasOwnProperty(a)&&(n[a]=s+1,s++);return Me(n)}return null},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(Jut.sharedCache.resetArmature(this._uuid),this._factory.removeDragonBonesDataByUUID(this._uuid,!0))},n(e,[{key:"dragonBonesJson",get:function(){return this._dragonBonesJson},set:function(t){this._dragonBonesJson=t,this._dragonBonesJsonData=JSON.parse(t),this.reset()}}]),e}(em),eht=yh(tht.prototype,"_dragonBonesJson",[alt],(function(){return""})),$ot=tht))||$ot;T.internal.DragonBonesAsset=olt;var hlt,ult=Uh,llt=fu,clt=(Zut=Bh("dragonBones.DragonBonesAtlasAsset"),$ut=llt(hv),Zut((elt=function(t){function e(){var e;return(e=t.call(this)||this)._atlasJson=ilt&&ilt(),e._texture=nlt&&nlt(),e._atlasJsonData=rlt&&rlt(),e._factory=null,e._textureAtlasData=slt&&slt(),e._clear(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new ry(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAtlasAsset=this,t(null,e)},i.init=function(t){this._factory=t,this._atlasJsonData||(this._atlasJsonData=JSON.parse(this.atlasJson));var e=this._atlasJsonData;this._uuid=this._uuid||e.name,this._textureAtlasData?t.addTextureAtlasData(this._textureAtlasData,this._uuid):this._textureAtlasData=t.parseTextureAtlasData(e,this.texture,this._uuid)},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(Jut.sharedCache.resetArmature(this._uuid),this._factory.removeTextureAtlasData(this._uuid,!0),this._factory.removeDragonBonesDataByUUID(this._uuid,!0)),this._textureAtlasData=null},n(e,[{key:"atlasJson",get:function(){return this._atlasJson},set:function(t){this._atlasJson=t,this._atlasJsonData=JSON.parse(this.atlasJson),this._clear()}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this._clear()}}]),e}(em),ilt=yh(elt.prototype,"_atlasJson",[ult],(function(){return""})),nlt=yh(elt.prototype,"_texture",[ult,$ut],(function(){return null})),rlt=yh(elt.prototype,"_atlasJsonData",[ult],(function(){return{}})),slt=yh(elt.prototype,"_textureAtlasData",[ult],(function(){return null})),tlt=elt))||tlt);T.internal.DragonBonesAtlasAsset=clt;var flt,dlt,_lt,plt,mlt,glt,vlt,ylt,blt,Slt,xlt,wlt,Tlt,Clt,Alt,Dlt,Ilt,Blt,Mlt,Plt,Elt,klt,Olt,Rlt,Flt,Llt,Vlt,Nlt,zlt,Glt,Ult=new zr,Hlt=Bh("dragonBones.AttachUtil")(hlt=function(){function t(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null}var e=t.prototype;return e.init=function(t){this._inited=!0,this._armature=t._armature,this._armatureNode=t.node,this._armatureDisplay=t},e.reset=function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null},e._syncAttachedNode=function(){if(this._inited){this._armatureNode.worldMatrix;var t=null,e=this._armatureDisplay.isAnimationCached();if(!e||!this._armatureDisplay||(t=this._armatureDisplay._curFrame&&this._armatureDisplay._curFrame.boneInfos))for(var i,n,r,s=this._armatureDisplay.sockets,a=this._armatureDisplay.socketNodes,o=this._armature.getBones(),h=s.length-1;h>=0;h--){var u=s[h],l=u.target;if(l)if(l.isValid){var c=e?t[u.boneIndex]:o[u.boneIndex];c&&(i=l,n=c.globalTransformMatrix,r=void 0,(r=Ult).m00=n.a,r.m01=n.b,r.m04=-n.c,r.m05=-n.d,r.m12=n.tx,r.m13=n.ty,i.matrix=Ult)}else a.delete(u.path),s.splice(h,1)}}},t}())||hlt,Wlt=function(t){function e(){var e;return(e=t.call(this)||this)._armatures=new Set,e}s(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,wE.registerSystem(e.ID,e._instance,df.Priority.HIGH)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._armatures.has(t)||this._armatures.add(t))},i.remove=function(t){t&&this._armatures.has(t)&&this._armatures.delete(t)},i.postUpdate=function(t){this._armatures&&this._armatures.forEach((function(e){e.updateAnimation(t),e.syncAttachedNode()}))},i.prepareRenderData=function(){this._armatures&&this._armatures.forEach((function(t){t.markForUpdateRenderData()}))},e}(df);Wlt.ID="ARMATURE",Wlt._instance=void 0,T.internal.ArmatureSystem=Wlt;var jlt={default:-1};ke(jlt);var qlt={"":0};ke(qlt);var Xlt={REALTIME:0};ke(Xlt);var Ylt={REALTIME:0,SHARED_CACHE:1,PRIVATE_CACHE:2};ke(Ylt);var Qlt=Bh,Klt=Uh,Jlt=fu,Zlt=Su,$lt=(flt=Qlt("dragonBones.ArmatureDisplay.DragonBoneSocket"),dlt=Jlt(ry),flt((plt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=mlt&&mlt(),this.target=glt&&glt(),this.boneIndex=null,this.path=t,this.target=e},mlt=yh(plt.prototype,"path",[Klt],(function(){return""})),glt=yh(plt.prototype,"target",[dlt,Klt],(function(){return null})),_lt=plt))||_lt);ue($lt,"dragonBones.ArmatureDisplay.DragonBoneSocket");var tct=(vlt=Qlt("dragonBones.ArmatureDisplay"),ylt=Jlt(olt),blt=Jlt(clt),Slt=Jlt(jlt),xlt=Jlt(qlt),wlt=Jlt([$lt]),Tlt=Jlt(Xw),vlt((Glt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).playTimes=Dlt&&Dlt(),e.premultipliedAlpha=Ilt&&Ilt(),e._armature=null,e.attachUtil=void 0,e._defaultArmatureIndexValue=Blt&&Blt(),e._dragonAsset=Mlt&&Mlt(),e._dragonAtlasAsset=Plt&&Plt(),e._armatureName=Elt&&Elt(),e._animationName=klt&&klt(),e._animationIndexValue=Olt&&Olt(),e._preCacheMode=-1,e._cacheMode=0,e._defaultCacheModeValue=Rlt&&Rlt(),e._timeScale=Flt&&Flt(),e._playTimes=Llt&&Llt(),e._debugBones=Vlt&&Vlt(),e._enableBatch=Nlt&&Nlt(),e._debugDraw=null,e._armatureKey="",e._accTime=0,e._playCount=0,e._frameCache=null,e._curFrame=null,e._playing=!1,e._armatureCache=null,e._eventTarget=void 0,e._factory=null,e._displayProxy=null,e._drawIdx=0,e._drawList=new Ua((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumArmatures=Me({}),e._enumAnimations=Me({}),e._socketNodes=new Map,e._cachedSockets=new Map,e._sockets=zlt&&zlt(),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new fo,e._inited=!1,e.attachUtil=new Hlt,e.initFactory(),xi(f(e),"_animationIndex",e._enumAnimations),xi(f(e),"_defaultArmatureIndex",e._enumArmatures),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new oF),this._drawInfoList[t]},e.initFactory=function(){this._factory=Fut.getInstance()},e.onLoad=function(){t.prototype.onLoad.call(this)},e._requestDrawData=function(t,e,i,n){var r=this._drawList.add();return r.material=t,r.texture=e,r.indexOffset=i,r.indexCount=n,r},e.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},e.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},e.getMaterialForBlend=function(t,e){var i=t+"/"+e,n=this._materialCache[i];if(n)return n;var r=this.getMaterialTemplate();return(n=new iT({parent:r,subModelIdx:0,owner:this})).recompileShaders({TWO_COLORED:!1,USE_LOCAL:!1}),this._materialCache[i]=n,n.overridePipelineStates({blendState:{targets:[{blendSrc:t,blendDst:e}]}}),n},e._updateBuiltinMaterial=function(){return Cw.get("default-spine-material")},e.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setSharedMaterial(t,0),this._cleanMaterialCache()},e._render=function(t){var e=0;if(this.renderData&&this._drawList){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;othis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),e.isCompleted&&r>=i.length){if(this._playCount++,this.playTimes>0&&this._playCount>=this.playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playing=!1,this._playCount=0,this._emitCacheCompleteEvent(),void this.attachUtil._syncAttachedNode();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r],this.attachUtil._syncAttachedNode()}else e.isInvalid()&&(e.updateToFrame(),this._curFrame=i[i.length-1],this.renderData&&(this.renderData.vertexCountthis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount))))}}},e.onDestroy=function(){this._materialInstances=this._materialInstances.filter((function(t){return!!t})),this._inited=!1,2===this._cacheMode?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):1===this._cacheMode?(this._armatureCache=null,this._armature=null):this._armature&&(this._armature.dispose(),this._armature=null),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e._updateDebugDraw=function(){if(this.debugBones){if(!this._debugDraw){var t=new ry("DEBUG_DRAW_NODE");t.hideFlags|=eo.Flags.DontSave|eo.Flags.HideInHierarchy;var e=t.addComponent(tN);e.lineWidth=1,e.strokeColor=new nr(255,0,0,255),this._debugDraw=e}this._debugDraw.node.parent=this.node}else this._debugDraw&&(this._debugDraw.node.parent=null);this.markForUpdateRenderData()},e._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},e._buildArmature=function(){if(this.dragonAsset&&this.dragonAtlasAsset&&this.armatureName){this._armature&&(2===this._preCacheMode?this._armatureCache.dispose():0===this._preCacheMode&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=-1),1===this._cacheMode?this._armatureCache=Jut.sharedCache:2===this._cacheMode&&(this._armatureCache=new Jut,this._armatureCache.enablePrivateMode());var t=this.dragonAtlasAsset._uuid;if(this._armatureKey=this.dragonAsset.init(this._factory,t),this.isAnimationCached()&&(this._armature=this._armatureCache.getArmatureCache(this.armatureName,this._armatureKey,t),this._armature||(this._cacheMode=0)),this._preCacheMode=this._cacheMode,0===this._cacheMode){if(this._displayProxy=this._factory.buildArmatureDisplay(this.armatureName,this._armatureKey,"",t),!this._displayProxy)return;this._displayProxy._ccNode=this.node,this._displayProxy._ccComponent=this,this._displayProxy.setEventTarget(this._eventTarget),this._armature=this._displayProxy._armature,this._armature.animation.timeScale=this.timeScale}if(0!==this._cacheMode&&this.debugBones&&X("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node._uiProps.uiTransformComp.setContentSize(e.width,e.height)}this.attachUtil.init(this),this.animationName&&this.playAnimation(this.animationName,this.playTimes),this._flushAssembler()}},e.querySockets=function(){return this._armature?(0===this._cachedSockets.size&&this._indexBoneSockets(),Array.from(this._cachedSockets.keys()).sort()):[]},e.querySocketPathByName=function(t){for(var e,i=[],n=p(this._cachedSockets.keys());!(e=n()).done;){var r=e.value;r.endsWith(t)&&i.push(r)}return i},e._parseDragonAtlasAsset=function(){this.dragonAtlasAsset&&this.dragonAtlasAsset.init(this._factory)},e._refresh=function(){this._buildArmature(),this._indexBoneSockets(),this.markForUpdateRenderData()},e._updateCacheModeEnum=function(){this._cacheModeEnum=Me({}),this._armature?Object.assign(this._cacheModeEnum,Ylt):Object.assign(this._cacheModeEnum,Xlt),xi(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):qlt,this._enumAnimations=Me({}),Object.assign(this._enumAnimations,t||qlt),Me.update(this._enumAnimations),xi(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():jlt,this._enumArmatures=Me({}),Object.assign(this._enumArmatures,t||jlt),Me.update(this._enumArmatures),xi(this,"_defaultArmatureIndex",this._enumArmatures)},e._indexBoneSockets=function(){if(this._armature){this._cachedSockets.clear();var t=this._cachedSockets,e=function t(e,i,n){if(n.has(e))return n.get(e);var r=i[e];if(!r.parent)return n.set(e,r.name),r.path=r.name,r.name;var s=t(r.parent._boneIndex,i,n)+"/"+r.name;return n.set(e,s),r.path=s,s};!function i(n,r){for(var s=r.getBones(),a=new Map,o=0;o0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._playing=!0,this._curFrame=this._frameCache.frames[0])}else if(this._armature)return this._armature.animation.play(t,this.playTimes);return this.markForUpdateRenderData(),null},e.updateAnimationCache=function(t){this.isAnimationCached()&&this._armatureCache.updateAnimationCache(this._armatureKey,t)},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._armatureCache.invalidAnimationCache(this._armatureKey)},e.getArmatureNames=function(){var t=this._factory.getDragonBonesData(this._armatureKey);return t&&t.armatureNames||[]},e.getAnimationNames=function(t){var e=[],i=this._factory.getDragonBonesData(this._armatureKey);if(i){var n=i.getArmature(t);if(n)for(var r in n.animations)n.animations.hasOwnProperty(r)&&e.push(r)}return e},e.on=function(t,e,i){this.addEventListener(t,e,i)},e.off=function(t,e,i){this.removeEventListener(t,e,i)},e.once=function(t,e,i){this._eventTarget.once(t,e,i)},e.addEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},e.removeEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},e.buildArmature=function(t,e){return this._factory.createArmatureNode(this,t,e)},e.armature=function(){return this._armature},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._armature&&this._assembler&&(this._renderData=this._assembler.createData(this),this._renderData&&(this.maxVertexCount=this._renderData.vertexCount,this.maxIndexCount=this._renderData.indexCount),this.markForUpdateRenderData(),this._updateColor())},e._updateSocketBindings=function(){if(this._armature){this._socketNodes.clear();for(var t=0,e=this._sockets.length;t0&&this._frameCache&&this._frameCache.enableCacheAttachedInfo()}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"drawList",get:function(){return this._drawList}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),i}(VF),Glt.AnimationCacheMode=Ylt,y((Alt=Glt).prototype,"dragonAsset",[ylt],Object.getOwnPropertyDescriptor(Alt.prototype,"dragonAsset"),Alt.prototype),y(Alt.prototype,"dragonAtlasAsset",[blt],Object.getOwnPropertyDescriptor(Alt.prototype,"dragonAtlasAsset"),Alt.prototype),y(Alt.prototype,"_defaultArmatureIndex",[Slt],Object.getOwnPropertyDescriptor(Alt.prototype,"_defaultArmatureIndex"),Alt.prototype),y(Alt.prototype,"_animationIndex",[xlt],Object.getOwnPropertyDescriptor(Alt.prototype,"_animationIndex"),Alt.prototype),y(Alt.prototype,"timeScale",[Klt],Object.getOwnPropertyDescriptor(Alt.prototype,"timeScale"),Alt.prototype),Dlt=yh(Alt.prototype,"playTimes",[Klt],(function(){return-1})),Ilt=yh(Alt.prototype,"premultipliedAlpha",[Klt],(function(){return!1})),y(Alt.prototype,"sockets",[wlt],Object.getOwnPropertyDescriptor(Alt.prototype,"sockets"),Alt.prototype),Blt=yh(Alt.prototype,"_defaultArmatureIndexValue",[Klt],(function(){return-1})),Mlt=yh(Alt.prototype,"_dragonAsset",[Klt],(function(){return null})),Plt=yh(Alt.prototype,"_dragonAtlasAsset",[Klt],(function(){return null})),Elt=yh(Alt.prototype,"_armatureName",[Klt],(function(){return""})),klt=yh(Alt.prototype,"_animationName",[Klt],(function(){return""})),Olt=yh(Alt.prototype,"_animationIndexValue",[Klt],(function(){return 0})),Rlt=yh(Alt.prototype,"_defaultCacheModeValue",[Klt],(function(){return 0})),Flt=yh(Alt.prototype,"_timeScale",[Klt],(function(){return 1})),Llt=yh(Alt.prototype,"_playTimes",[Klt],(function(){return-1})),Vlt=yh(Alt.prototype,"_debugBones",[Klt],(function(){return!1})),Nlt=yh(Alt.prototype,"_enableBatch",[Klt],(function(){return!1})),zlt=yh(Alt.prototype,"_sockets",[Klt],(function(){return[]})),y(Alt.prototype,"customMaterial",[Zlt,Tlt],Object.getOwnPropertyDescriptor(Alt.prototype,"customMaterial"),Alt.prototype),Clt=Alt))||Clt);T.internal.ArmatureDisplay=tct;var ect,ict,nct,rct,sct,act,oct,hct,uct,lct,cct,fct=new nr(255,0,0,255),dct=new nr(0,0,255,255),_ct=new nr(0,255,0,255),pct=0,mct=0,gct=0,vct=0,yct=0,bct=0,Sct=0,xct=0,wct=0,Tct=new Float32Array(4),Cct=new Kn(0,0,0),Act=new zr,Dct=null,Ict=null;function Bct(t,e){if(!t)return null;var i,n;switch(e){case 1:i=sct?1:2,n=1;break;case 10:i=7,n=4;break;case 12:i=1,n=8;break;default:i=sct?1:2,n=4}return lct.getMaterialForBlend(i,n)}function Mct(t,e){var i=t.a*e*rct,n=sct?i/255:1,r=t.r*ect*n/255,s=t.g*ict*n/255,a=t.b*nct*n/255;Tct[0]=r,Tct[1]=s,Tct[2]=a,Tct[3]=sct?1:i/255}var Pct=null,Ect={accessor:Pct,vCount:32767,ensureAccessor:function(){if(!Pct){var t=wE.root.device,e=wE.root.batcher2D,i=NR;this.accessor=Pct=new QR(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),Pct)}return this.accessor},createData:function(t){var e=t.renderData;if(!e){this.ensureAccessor();for(var i=t._armature._slots,n=0,r=0,s=0;s0&&(lct._requestDrawData(Dct,Ict,wct,_),wct=bct),Ict=d,Dct=r}Mct(o,e),Act.set(h._worldMatrix),s=h._localVertices,mct=s.length/4,pct=9*mct,a=h._indices,yct=a.length;var p=!1;if(gct+mct>Sct&&(Sct=gct+mct,p=!0),bct+yct>xct&&(xct=bct+yct,p=!0),p){var m=hct,g=n.chunk.vertexOffset;n.resizeAndCopy(Sct,xct>n.indexCount?xct:n.indexCount),uct=n.chunk.vb,xct>hct.length&&(hct=n.indices=new Uint16Array(xct));for(var v=n.chunk.vertexOffset-g,y=0;y0&&(lct._requestDrawData(Dct,Ict,wct,u),wct=bct),lct.maxIndexCount0&&(lct._requestDrawData(Dct,Ict,wct,b),wct=bct),Dct=n,Ict=y.tex}mct=y.vertexCount,yct=y.indexCount,a=_.chunk.vertexOffset;for(var S=bct,x=bct+yct;S=d&&(Mct(f=c[l++],1),d=f.vfOffset),p.set(Tct,I+5);o+=u,gct+=mct,bct+=yct,mct=0,yct=0}}var M=bct-wct;Ict&&M>0&&lct._requestDrawData(Dct,Ict,wct,M)}}}function Rct(t){var e=t._armature;if(e&&null!==t.renderData){act=!0,sct=t.premultipliedAlpha,t.drawList.reset(),lct=t,t.node,oct=t.renderData,lct=t,cct=0,Dct=null;var i=t.color;ect=i.r/255,ict=i.g/255,nct=i.b/255,rct=t.node._uiProps.opacity,4294967295!==nr.toUint32(i)&&(cct|=1);var n=t.node.getWorldMatrix();if(pct=0,gct=0,vct=0,yct=0,bct=0,wct=0,Sct=lct.maxVertexCount,xct=lct.maxIndexCount,t.isAnimationCached())Oct(t._curFrame,n);else{kct(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=fct,r.fillColor=dct;for(var s=e.getBones(),a=0,o=s.length;a0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),cft.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(34962,e.glBuffer),n.glArrayBuffer=e.glBuffer),i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null))}else if(4&e.usage){e.glTarget=34963;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),cft.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(34963,e.glBuffer),n.glElementArrayBuffer=e.glBuffer),i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null))}else 16&e.usage?(e.glTarget=0,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(64&e.usage||2&e.usage||1&e.usage||ot(16315),e.glTarget=0)}function eft(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case 34962:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),cft.gpuInputAssembler=null,i.bindBuffer(34962,null),n.glArrayBuffer=null;break;case 34963:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),cft.gpuInputAssembler=null,i.bindBuffer(34963,null),n.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function ift(t,e,i,n,r){if(16&e.usage)ArrayBuffer.isView(i)?e.vf32.set(i,n/4):e.vf32.set(new Float32Array(i),n/4);else if(64&e.usage){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;at.capabilities.maxTextureSize&&ot(9100,a,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!M_[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var o=n.glTexUnits[n.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),o.glTexture=e.glTexture),M_[e.format].isCompressed)for(var h=0;h>1),s=zct(1,s>>1)}else for(var c=0;c>1),s=zct(1,s>>1);e.isPowerOf2?(e.glWrapS=10497,e.glWrapT=10497):(e.glWrapS=33071,e.glWrapT=33071),e.glMinFilter=9729,e.glMagFilter=9729,i.texParameteri(e.glTarget,10242,e.glWrapS),i.texParameteri(e.glTarget,10243,e.glWrapT),i.texParameteri(e.glTarget,10241,e.glMinFilter),i.texParameteri(e.glTarget,10240,e.glMagFilter)}}else e.glInternalFmt=Hct(e.format),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(36161,e.glInternalFmt,r,s));break;case 3:e.glTarget=34067;var f=zct(r,s);if(f>t.capabilities.maxCubeMapTextureSize&&ot(9100,f,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var d=n.glTexUnits[n.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),d.glTexture=e.glTexture),M_[e.format].isCompressed)for(var _=0;_<6;++_){r=e.width,s=e.height;for(var p=0;p>1),s=zct(1,s>>1)}}else for(var v=0;v<6;++v){r=e.width,s=e.height;for(var y=0;y>1),s=zct(1,s>>1)}e.isPowerOf2?(e.glWrapS=10497,e.glWrapT=10497):(e.glWrapS=33071,e.glWrapT=33071),e.glMinFilter=9729,e.glMagFilter=9729,i.texParameteri(e.glTarget,10242,e.glWrapS),i.texParameteri(e.glTarget,10243,e.glWrapT),i.texParameteri(e.glTarget,10241,e.glMinFilter),i.texParameteri(e.glTarget,10240,e.glMagFilter)}break;default:ot(16317),e.type=1,e.glTarget=3553}}function rft(t,e){var i=t.gl,n=t.stateCache;if(e.glTexture){var r=n.glTexUnits,s=n.texUnit;i.deleteTexture(e.glTexture);for(var a=0;at.capabilities.maxTextureSize&&ot(9100,a,t.capabilities.maxTextureSize),e.glRenderbuffer)n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(36161,e.glInternalFmt,r,s);else if(e.glTexture){var o=n.glTexUnits[n.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),o.glTexture=e.glTexture),M_[e.format].isCompressed)for(var h=0;h>1),s=zct(1,s>>1)}else for(var c=0;c>1),s=zct(1,s>>1)}break;case 3:e.glTarget=34067;var f=zct(r,s);f>t.capabilities.maxCubeMapTextureSize&&ot(9100,f,t.capabilities.maxTextureSize);var d=n.glTexUnits[n.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),d.glTexture=e.glTexture),M_[e.format].isCompressed)for(var _=0;_<6;++_){r=e.width,s=e.height;for(var p=0;p>1),s=zct(1,s>>1)}}else for(var v=0;v<6;++v){r=e.width,s=e.height;for(var y=0;y>1),s=zct(1,s>>1)}break;default:ot(16317),e.type=1,e.glTarget=3553}}}function aft(t,e){for(var i=0;i0){e.glBlocks=new Array(e.blocks.length);for(var w=0;w0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;O=0&&D.gpuDescriptors[I],M=null,P=0;if(B&&B.gpuBuffer){var E=B.gpuBuffer,k=T[A.set],O=k&&k[A.binding];O>=0&&(P=r[O]),"vf32"in E?M=E.vf32:(P+=E.offset,M=E.gpuBuffer.vf32),P>>=2}if(M)for(var R=A.glActiveUniforms.length,F=0;F=0&&Pt.gpuDescriptors[Et],Ot=Mt.units.length,Rt=0;Rt0){var Lt=kt.gpuTexture,Vt=l.glTexUnits[Ft];Vt.glTexture!==Lt.glTexture&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),Lt.glTexture?u.bindTexture(Lt.glTarget,Lt.glTexture):u.bindTexture(Lt.glTarget,t.nullTex2D.gpuTexture.glTexture),Vt.glTexture=Lt.glTexture);var Nt=kt.gpuSampler;Lt.isPowerOf2?(a=Nt.glWrapS,o=Nt.glWrapT):(a=33071,o=33071),h=Lt.isPowerOf2?Lt.mipLevel<=1&&(9985===Nt.glMinFilter||9987===Nt.glMinFilter)?9729:Nt.glMinFilter:9729===Nt.glMinFilter||9985===Nt.glMinFilter||9987===Nt.glMinFilter?9729:9728,Lt.glWrapS!==a&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10242,a),Lt.glWrapS=a),Lt.glWrapT!==o&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10243,o),Lt.glWrapT=o),Lt.glMinFilter!==h&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10241,h),Lt.glMinFilter=h),Lt.glMagFilter!==Nt.glMagFilter&&(l.texUnit!==Ft&&(u.activeTexture(33984+Ft),l.texUnit=Ft),u.texParameteri(Lt.glTarget,10240,Nt.glMagFilter),Lt.glMagFilter=Nt.glMagFilter)}kt=Pt.gpuDescriptors[++Et]}}}if(i&&d&&(_||cft.gpuInputAssembler!==i)){cft.gpuInputAssembler=i;var zt=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Gt=t.extensions.OES_vertex_array_object,Ut=i.glVAOs.get(d.glProgram);if(!Ut){var Ht;Ut=Gt.createVertexArrayOES(),i.glVAOs.set(d.glProgram,Ut),Gt.bindVertexArrayOES(Ut),u.bindBuffer(34962,null),u.bindBuffer(34963,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Wt=d.glInputs.length,jt=0;jt=0&&(u.enableVertexAttribArray(ue),l.glEnabledAttribLocs[ue]=!0),l.glCurrentAttribLocs[ue]=!0,u.vertexAttribPointer(ue,re.count,re.glType,re.isNormalized,re.stride,le),zt&&zt.vertexAttribDivisorANGLE(ue,re.isInstanced?1:0)}}}var ce=i.gpuIndexBuffer;ce&&l.glElementArrayBuffer!==ce.glBuffer&&(u.bindBuffer(34963,ce.glBuffer),l.glElementArrayBuffer=ce.glBuffer);for(var fe=0;fe0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var _=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}function mft(t,e,i,n){var r=t.gl,s=t.stateCache,a=s.glTexUnits[s.texUnit];a.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),a.glTexture=i.glTexture);var o=0,h=0;switch(i.glTarget){case 3553:for(var u=0;u0?g.buffStride:d.width,p.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var y=g.texExtent.width+_.x===i.width>>v?g.texExtent.width:d.width,b=g.texExtent.height+_.y===i.height>>v?g.texExtent.height:d.height,S=void 0,x=e[o++];if(p.width===d.width&&p.height===d.height){var w=R_(i.format,y,b,1)/l.BYTES_PER_ELEMENT;ut(Number.isInteger(w),9101),S=new l(x.buffer,x.byteOffset+g.buffOffset,w)}else S=vft(x,i.format,g.buffOffset,p,d);c?36196===i.glInternalFmt||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(3553,v,i.glInternalFmt,y,b,0,S):r.compressedTexSubImage2D(3553,v,_.x,_.y,y,b,i.glFormat,S):r.texSubImage2D(3553,v,_.x,_.y,y,b,i.glFormat,i.glType,S)}break;case 34067:for(var T=0;T0?C.buffStride:d.width,p.height=C.buffTexHeight>0?C.buffTexHeight:d.height;var D=C.texExtent.width+_.x===i.width>>A?C.texExtent.width:d.width,I=C.texExtent.height+_.y===i.height>>A?C.texExtent.height:d.height,B=C.texSubres.baseArrayLayer+C.texSubres.layerCount;for(h=C.texSubres.baseArrayLayer;h0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=O(t);var e=wft(this._capacity),i=wft(this._capacity),n=wft(this._capacity);this.byteOffsets=wft(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),Cft=function(){function t(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var t=xft.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new Qd(0,0,"BlitParams",[new Yd("tilingOffsetSrc",16,1),new Yd("tilingOffsetDst",16,1)],1)],samplerTextures:[new Kd(0,t,"textureSrc",28,1)],subpassInputs:[],gpuStages:[{type:1,source:"\nprecision mediump float;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nuniform vec4 tilingOffsetSrc;\nuniform vec4 tilingOffsetDst;\nvarying vec2 v_texCoord;\nvoid main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n}",glShader:null},{type:16,source:"\nprecision mediump float;\nuniform sampler2D textureSrc;\nvarying vec2 v_texCoord;\nvoid main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n}",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},oft(xft.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new m_(0,1,1,1),new m_(t,16,1,16)],dynamicBindings:[],descriptorIndices:[],descriptorCount:t+1};for(var e=0;e0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new Tft,glTarget:0,glBuffer:null},16&this._usage&&(this._gpuBuffer.buffer=this._uniformBuffer),tft(xft.instance,this._gpuBuffer),xft.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(eft(xft.instance,this._gpuBuffer),xft.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)st(16379);else{var e,i,n,r,s,a=this._size;a!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(e=xft.instance,i=this._gpuBuffer,n=e.gl,r=e.stateCache,s=2&i.memUsage?35048:35044,8&i.usage?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),cft.gpuInputAssembler=null,r.glArrayBuffer!==i.glBuffer&&n.bindBuffer(34962,i.glBuffer),i.buffer?n.bufferData(34962,i.buffer,s):n.bufferData(34962,i.size,s),n.bindBuffer(34962,null),r.glArrayBuffer=null):4&i.usage?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),cft.gpuInputAssembler=null,r.glElementArrayBuffer!==i.glBuffer&&n.bindBuffer(34963,i.glBuffer),i.buffer?n.bufferData(34963,i.buffer,s):n.bufferData(34963,i.size,s),n.bindBuffer(34963,null),r.glElementArrayBuffer=null):16&i.usage?i.buffer&&(i.vf32=new Float32Array(i.buffer.buffer)):(64&i.usage||2&i.usage||1&i.usage||ot(16315),i.glTarget=0),xft.instance.memoryStatus.bufferSize-=a,xft.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?st(16380):(i=void 0!==e?e:64&this._usage?0:t.byteLength,ift(xft.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(H_),Dft=function(t){function e(){var e;return(e=t.call(this)||this)._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new D_,e._isStateInvalied=!1,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=xft.instance.bindingMappings.blockOffsets.length,i=0;i0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:u},set width(t){u=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:l},set height(t){l=t},lodLevel:r},aft(xft.instance,this._gpuFramebuffer),this.gpuFramebuffer.gpuColorTextures.forEach((function(t){return i._gpuColorTextures.push(t.glTexture)})),this._gpuDepthStencilTexture=null===(e=this.gpuFramebuffer.gpuDepthStencilTexture)||void 0===e?void 0:e.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e,i,n;this._gpuFramebuffer&&(t=xft.instance,e=this._gpuFramebuffer,i=t.gl,n=t.stateCache,e.glFramebuffer&&(i.deleteFramebuffer(e.glFramebuffer),n.glFramebuffer===e.glFramebuffer&&(i.bindFramebuffer(36160,null),n.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null,this._gpuColorTextures.length=0,this._gpuDepthStencilTexture=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}},{key:"needRebuild",get:function(){if(this.gpuFramebuffer){for(var t,e=0;ei&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=F_(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(sft(xft.instance,this._gpuTexture),xft.instance.memoryStatus.textureSize-=n,xft.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new jd;e.format=t.format,e.usage=M_[t.format].hasDepth?32:16,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(up),Uft="webglcontextlost";function Hft(t){t.activeTexture(33984),t.pixelStorei(3333,1),t.pixelStorei(3317,1),t.pixelStorei(37440,!1),t.bindFramebuffer(36160,null),t.enable(3089),t.enable(2884),t.cullFace(1029),t.frontFace(2305),t.disable(32823),t.polygonOffset(0,0),t.enable(2929),t.depthMask(!0),t.depthFunc(513),t.depthRange(0,1),t.stencilFuncSeparate(1028,519,1,65535),t.stencilOpSeparate(1028,7680,7680,7680),t.stencilMaskSeparate(1028,65535),t.stencilFuncSeparate(1029,519,1,65535),t.stencilOpSeparate(1029,7680,7680,7680),t.stencilMaskSeparate(1029,65535),t.disable(2960),t.disable(32926),t.disable(3042),t.blendEquationSeparate(32774,32774),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}function Wft(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n=0&&o<=1&&h>=0&&h<=1)return!0}return!1}C.WebGLDevice=Yft;var Kft=new ns,Jft=new ns,Zft=new ns,$ft=new ns;function tdt(t,e,i){for(var n=i.length,r=0;rr!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function idt(t,e,i,n){var r,s=i.x-e.x,a=i.y-e.y,o=s*s+a*a,h=((t.x-e.x)*s+(t.y-e.y)*a)/o;return r=n?o?h<0?e:h>1?i:Kft.set(e.x+h*s,e.y+h*a):e:Kft.set(e.x+h*s,e.y+h*a),s=t.x-r.x,a=t.y-r.y,Math.sqrt(s*s+a*a)}var ndt=t("eI",(function(){}));ndt.lineLine=Qft,ndt.lineRect=function(t,e,i){var n=Kft.set(i.x,i.y),r=Jft.set(i.x,i.yMax),s=Zft.set(i.xMax,i.yMax),a=$ft.set(i.xMax,i.y);return!!(Qft(t,e,n,r)||Qft(t,e,r,s)||Qft(t,e,s,a)||Qft(t,e,a,n))},ndt.linePolygon=tdt,ndt.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,a=e.x,o=e.y,h=e.x+e.width,u=e.y+e.height;return i<=h&&r>=a&&n<=u&&s>=o},ndt.rectPolygon=function(t,e){var i=Kft.set(t.x,t.y),n=Jft.set(t.x,t.yMax),r=Zft.set(t.xMax,t.yMax),s=$ft.set(t.xMax,t.y);if(tdt(i,n,e))return!0;if(tdt(n,r,e))return!0;if(tdt(r,s,e))return!0;if(tdt(s,i,e))return!0;for(var a=0,o=e.length;as+o&&(u=s+o),ra+h&&(l=a+h);var c=n-u,f=r-l;return Math.sqrt(c*c+f*f)<=i},ndt.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i=0){var s=t._probes,a=s[this.vertex0].position,o=s[this.vertex1].position,h=s[this.vertex2].position,u=s[this.vertex3].position;this.sphere.init(a,o,h,u)}}var e=t.prototype;return e.isInCircumSphere=function(t){return Kn.squaredDistance(t,this.sphere.center)=0},e.isOuterCell=function(){return this.vertex3<0},t}(),Bdt=yh(Idt.prototype,"invalid",[Gdt],(function(){return!1})),Mdt=yh(Idt.prototype,"vertex0",[Gdt],(function(){return-1})),Pdt=yh(Idt.prototype,"vertex1",[Gdt],(function(){return-1})),Edt=yh(Idt.prototype,"vertex2",[Gdt],(function(){return-1})),kdt=yh(Idt.prototype,"vertex3",[Gdt],(function(){return-1})),Odt=yh(Idt.prototype,"neighbours",[Gdt],(function(){return[-1,-1,-1,-1]})),Rdt=yh(Idt.prototype,"matrix",[Gdt],(function(){return new ur})),Fdt=yh(Idt.prototype,"offset",[Gdt],(function(){return new Kn(0,0,0)})),Ldt=yh(Idt.prototype,"sphere",[Gdt],(function(){return new $dt})),Ddt=Idt))||Ddt),e_t=t("eO",function(){function t(t){this._probes=[],this._tetrahedrons=[],this._triangles=[],this._edges=[],this._probes=t}var e=t.prototype;return e.build=function(){return this.reset(),this.tetrahedralize(),this.computeAdjacency(),this.computeMatrices(),this._tetrahedrons},e.reset=function(){this._tetrahedrons.length=0,this._triangles.length=0,this._edges.length=0},e.tetrahedralize=function(){for(var t=this._probes.length,e=this.initTetrahedron(),i=0;i0&&Kn.negate(t,t),Kn.add(l.normal,l.normal,t),Kn.add(c.normal,c.normal,t),Kn.add(f.normal,f.normal,t);var p=this._triangles[h].vertex0,m=_>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=_>0?this._triangles[h].vertex1:this._triangles[h].vertex2,v=new t_t(this,p,m,g);v.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(v)}}for(var y=0,b=r;b=0?this.computeTetrahedronMatrix(e):this.computeOuterCellMatrix(e)}},e.computeTetrahedronMatrix=function(t){var e=this._probes[t.vertex0].position,i=this._probes[t.vertex1].position,n=this._probes[t.vertex2].position,r=this._probes[t.vertex3].position;t.matrix.set(e.x-r.x,i.x-r.x,n.x-r.x,e.y-r.y,i.y-r.y,n.y-r.y,e.z-r.z,i.z-r.z,n.z-r.z),t.matrix.invert(),t.matrix.transpose()},e.computeOuterCellMatrix=function(t){var e=[],i=[];e[0]=this._probes[t.vertex0].normal,e[1]=this._probes[t.vertex1].normal,e[2]=this._probes[t.vertex2].normal,i[0]=this._probes[t.vertex0].position,i[1]=this._probes[t.vertex1].position,i[2]=this._probes[t.vertex2].position,Kn.subtract(Wdt,i[0],i[2]),Kn.subtract(jdt,e[0],e[2]),Kn.subtract(qdt,i[1],i[2]),Kn.subtract(Xdt,e[1],e[2]),Ydt.set(i[2]),Kn.negate(Qdt,e[2]);var n=[];n[0]=jdt.y*Xdt.z-jdt.z*Xdt.y,n[3]=-jdt.x*Xdt.z+jdt.z*Xdt.x,n[6]=jdt.x*Xdt.y-jdt.y*Xdt.x,n[9]=Wdt.x*Xdt.y*Qdt.z-Wdt.y*Xdt.x*Qdt.z+jdt.x*qdt.y*Qdt.z-jdt.y*qdt.x*Qdt.z+Wdt.z*Xdt.x*Qdt.y-Wdt.z*Xdt.y*Qdt.x+jdt.z*qdt.x*Qdt.y-jdt.z*qdt.y*Qdt.x-Wdt.x*Xdt.z*Qdt.y+Wdt.y*Xdt.z*Qdt.x-jdt.x*qdt.z*Qdt.y+jdt.y*qdt.z*Qdt.x,n[9]-=Ydt.x*n[0]+Ydt.y*n[3]+Ydt.z*n[6],n[1]=jdt.y*qdt.z+Wdt.y*Xdt.z-jdt.z*qdt.y-Wdt.z*Xdt.y,n[4]=-Wdt.x*Xdt.z-jdt.x*qdt.z+Wdt.z*Xdt.x+jdt.z*qdt.x,n[7]=Wdt.x*Xdt.y-Wdt.y*Xdt.x+jdt.x*qdt.y-jdt.y*qdt.x,n[10]=Wdt.x*qdt.y*Qdt.z-Wdt.y*qdt.x*Qdt.z-Wdt.x*qdt.z*Qdt.y+Wdt.y*qdt.z*Qdt.x+Wdt.z*qdt.x*Qdt.y-Wdt.z*qdt.y*Qdt.x,n[10]-=Ydt.x*n[1]+Ydt.y*n[4]+Ydt.z*n[7],n[2]=-Wdt.z*qdt.y+Wdt.y*qdt.z,n[5]=-Wdt.x*qdt.z+Wdt.z*qdt.x,n[8]=Wdt.x*qdt.y-Wdt.y*qdt.x,n[11]=0,n[11]-=Ydt.x*n[2]+Ydt.y*n[5]+Ydt.z*n[8];var r=jdt.x*Xdt.y*Qdt.z-jdt.y*Xdt.x*Qdt.z+jdt.z*Xdt.x*Qdt.y-jdt.z*Xdt.y*Qdt.x+jdt.y*Xdt.z*Qdt.x-jdt.x*Xdt.z*Qdt.y;if(Math.abs(r)>ji)for(var s=0;s<12;s++)n[s]/=r;else t.vertex3=-2;t.matrix.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]),t.offset.set(n[9],n[10],n[11])},t}()),i_t=t("eP",function(){function t(){}return t.uniformSampleSphere=function(t,e){var i=1-2*t,n=Math.sqrt(Math.max(0,1-i*i)),r=2*Math.PI*e,s=n*Math.cos(r),a=n*Math.sin(r);return new Kn(s,a,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,a=0;a0&&(t.length,e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(i_t.uniformSpherePdf()*n),s=[],a=0;a0){var h=Math.sqrt(o);n.push(Math.cbrt(-a+h)+Math.cbrt(-a-h))}else if(o<0){var u=Math.acos(-a*Math.sqrt(-s)/(s*s))/3;n.push(2*Math.sqrt(-s)*Math.cos(u)),n.push(2*Math.sqrt(-s)*Math.cos(u+2*Math.PI/3)),n.push(2*Math.sqrt(-s)*Math.cos(u+4*Math.PI/3))}else if(0===a)n.push(0);else{var l=Math.cbrt(a);n.push(l),n.push(-2*l)}for(var c=0;c=0)return n[c]+r;return 0},t}(),f_t=new Kn(0,0,0),d_t=new Kn(0,0,0),__t=new Kn(0,0,0),p_t=new Kn(0,0,0),m_t=new Kn(0,0,0),g_t=new Kn(0,0,0),v_t=new Kn(0,0,0),y_t=new Kn(0,0,0),b_t=new Kn(0,0,0),S_t=new Kn(0,0,0),x_t=new Kn(0,0,0),w_t=new Kn(0,0,0),T_t=new Kn(0,0,0),C_t=new Kn(0,0,0),A_t=new Kn(0,0,0),D_t=t("eR",(r_t=Bh("cc.LightProbesData"),s_t=fu([Kdt]),a_t=fu([t_t]),r_t((h_t=function(){function t(){this._probes=u_t&&u_t(),this._tetrahedrons=l_t&&l_t()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=t.length;for(var e=this._probes.length,i=0;i=0)for(var h=this._probes[r.vertex3].coefficients,u=0;u=n)&&(e=0);for(var r=-1,s=-1,a=0;a=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x=0?this.getTetrahedronBarycentricCoord(t,e,i):this.getOuterCellBarycentricCoord(t,e,i)},e.getTetrahedronBarycentricCoord=function(t,e,i){var n=new Kn(0,0,0);Kn.subtract(n,t,this._probes[e.vertex3].position),Kn.transformMat3(n,n,e.matrix),i.set(n.x,n.y,n.z,1-n.x-n.y-n.z)},e.getOuterCellBarycentricCoord=function(e,i,n){var r=this._probes[i.vertex0].position,s=this._probes[i.vertex1].position,a=this._probes[i.vertex2].position;Kn.subtract(S_t,s,r),Kn.subtract(x_t,a,r),Kn.cross(b_t,S_t,x_t),Kn.subtract(w_t,e,r);var o=Kn.dot(w_t,b_t);if(o<0)n.set(0,0,0,-1);else{var h=new Kn(0,0,0);Kn.transformMat3(h,e,i.matrix),Kn.add(h,h,i.offset),o=-1===i.vertex3?c_t.getCubicUniqueRoot(h.x,h.y,h.z):c_t.getQuadraticUniqueRoot(h.x,h.y,h.z),Kn.scaleAndAdd(T_t,r,this._probes[i.vertex0].normal,o),Kn.scaleAndAdd(C_t,s,this._probes[i.vertex1].normal,o),Kn.scaleAndAdd(A_t,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(T_t,C_t,A_t,e);n.set(u.x,u.y,u.z,0)}},n(t,[{key:"probes",get:function(){return this._probes}},{key:"tetrahedrons",get:function(){return this._tetrahedrons}}]),t}(),u_t=yh(h_t.prototype,"_probes",[Uh,s_t],(function(){return[]})),l_t=yh(h_t.prototype,"_tetrahedrons",[Uh,a_t],(function(){return[]})),o_t=h_t))||o_t));T.internal.LightProbesData=D_t;var I_t,B_t,M_t,P_t,E_t,k_t,O_t,R_t,F_t,L_t,V_t,N_t,z_t,G_t,U_t,H_t=t("eS",function(){function t(){this._giScale=1,this._giSamples=1024,this._bounces=2,this._reduceRinging=0,this._showProbe=!0,this._showWireframe=!0,this._showConvex=!1,this._data=null,this._lightProbeSphereVolume=1}var e=t.prototype;return e.initialize=function(t){this._giScale=t.giScale,this._giSamples=t.giSamples,this._bounces=t.bounces,this._reduceRinging=t.reduceRinging,this._showProbe=t.showProbe,this._showWireframe=t.showWireframe,this._showConvex=t.showConvex,this._data=t.data,this._lightProbeSphereVolume=t.lightProbeSphereVolume},e.empty=function(){return!this._data||this._data.empty()},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale=t}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples=t}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces=t}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging=t}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe=t}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe=t}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex=t}},{key:"data",get:function(){return this._data},set:function(t){this._data=t}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume=t}}]),t}());T.internal.LightProbes=H_t,t("eT",(I_t=Bh("cc.LightProbeGroup"),B_t=fu([Kn]),M_t=fu(Vdt),P_t=fu(hi),E_t=fu(hi),k_t=fu(hi),I_t(O_t=Eh((R_t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(Ym),Q_t=yh(Y_t.prototype,"_texture",[j_t],(function(){return null})),y(Y_t.prototype,"texture",[q_t],Object.getOwnPropertyDescriptor(Y_t.prototype,"texture"),Y_t.prototype),K_t=yh(Y_t.prototype,"_height",[Uh],(function(){return 0})),J_t=yh(Y_t.prototype,"_width",[Uh],(function(){return 0})),Z_t=yh(Y_t.prototype,"_rotation",[Uh],(function(){return 0})),$_t=yh(Y_t.prototype,"_techIndex",[Uh],(function(){return 0})),X_t=Y_t))||X_t)),ypt=[new n_("a_position",32),new n_("a_texCoord",44),new n_("a_texCoord1",32),new n_("a_color",35,!0)],bpt=new Kn,Spt=new Kn,xpt=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._vertSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._subMeshData=null,e._vertCount=0,e._indexCount=0,e._material=null,e._iaVertCount=0,e._iaIndexCount=0,e.type=5,e._capacity=100,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){this._capacity=t,this.createBuffer()},i.createBuffer=function(){this._vertSize=0;for(var t=0,e=ypt;t1){var n=0;Kn.subtract(bpt,t[1],t[0]),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=0,this._vdataF32[n++]=bpt.x,this._vdataF32[n++]=bpt.y,this._vdataF32[n++]=bpt.z,this._vdataUint32[n++]=nr.toUint32(i.evaluate(0,1)),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=1,this._vdataF32[n++]=bpt.x,this._vdataF32[n++]=bpt.y,this._vdataF32[n++]=bpt.z,this._vdataUint32[n++]=nr.toUint32(i.evaluate(0,1));for(var r=1;r0&&this._models[0]&&this._detachFromScene()},i._attachToScene=function(){if(t.prototype._attachToScene.call(this),this._models.length>0&&this._models[0]&&this.node&&this.node.scene){var e=this._models[0];e.scene&&this._detachFromScene(),this._getRenderScene().addModel(e)}},i._detachFromScene=function(){if(t.prototype._detachFromScene.call(this),this._models.length>0&&this._models[0]){var e=this._models[0];e.scene&&e.scene.removeModel(e)}},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i);var n=this.getMaterialInstance(0);n&&(lmt[umt]=this.worldSpace,n.recompileShaders(lmt),this._models[0]&&this._models[0].updateMaterial(n))},n(e,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.material&&this.material.setProperty("mainTexture",t)}},{key:"lineMaterial",get:function(){return this.getSharedMaterial(0)},set:function(t){this.setSharedMaterial(t,0)}},{key:"sharedMaterials",get:function(){return t.prototype.sharedMaterials},set:function(t){this.sharedMaterials=t}},{key:"worldSpace",get:function(){return this._worldSpace},set:function(t){this._worldSpace=t;var e=this.getMaterialInstance(0);e&&(lmt[umt]=this.worldSpace,e.recompileShaders(lmt),this._models[0]&&this._models[0].setSubModelMaterial(0,e))}},{key:"positions",get:function(){return this._positions},set:function(t){this._positions=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this.width,this.color)}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"tile",get:function(){return this._tile},set:function(t){this._tile.set(t),this.material&&(this._tile_offset.x=this._tile.x,this._tile_offset.y=this._tile.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this.material&&(this._tile_offset.z=this._offset.x,this._tile_offset.w=this._offset.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}}]),e}(aG),Ypt=yh(Xpt.prototype,"_texture",[Lpt],(function(){return null})),y(Xpt.prototype,"texture",[Vpt],Object.getOwnPropertyDescriptor(Xpt.prototype,"texture"),Xpt.prototype),Qpt=yh(Xpt.prototype,"_material",[Uh],(function(){return null})),y(Xpt.prototype,"lineMaterial",[Npt],Object.getOwnPropertyDescriptor(Xpt.prototype,"lineMaterial"),Xpt.prototype),y(Xpt.prototype,"sharedMaterials",[Su,Uh],Object.getOwnPropertyDescriptor(Xpt.prototype,"sharedMaterials"),Xpt.prototype),Kpt=yh(Xpt.prototype,"_worldSpace",[Uh],(function(){return!1})),Jpt=yh(Xpt.prototype,"_positions",[zpt],(function(){return[]})),y(Xpt.prototype,"positions",[Gpt],Object.getOwnPropertyDescriptor(Xpt.prototype,"positions"),Xpt.prototype),y(Xpt.prototype,"width",[Upt],Object.getOwnPropertyDescriptor(Xpt.prototype,"width"),Xpt.prototype),Zpt=yh(Xpt.prototype,"_width",[Uh],(function(){return new Apt})),y(Xpt.prototype,"color",[Hpt],Object.getOwnPropertyDescriptor(Xpt.prototype,"color"),Xpt.prototype),$pt=yh(Xpt.prototype,"_color",[Uh],(function(){return new smt})),tmt=yh(Xpt.prototype,"_tile",[Uh],(function(){return new ns(1,1)})),y(Xpt.prototype,"tile",[Wpt],Object.getOwnPropertyDescriptor(Xpt.prototype,"tile"),Xpt.prototype),emt=yh(Xpt.prototype,"_offset",[Uh],(function(){return new ns(0,0)})),y(Xpt.prototype,"offset",[jpt],Object.getOwnPropertyDescriptor(Xpt.prototype,"offset"),Xpt.prototype),qpt=Xpt))||qpt)),fmt=function(){function t(t){this.particleSystem=void 0,this.position=void 0,this.velocity=void 0,this.animatedVelocity=void 0,this.ultimateVelocity=void 0,this.angularVelocity=void 0,this.axisOfRotation=void 0,this.rotation=void 0,this.startEuler=void 0,this.startRotation=void 0,this.startRotated=void 0,this.deltaQuat=void 0,this.deltaMat=void 0,this.localMat=void 0,this.startSize=void 0,this.size=void 0,this.startColor=void 0,this.color=void 0,this.randomSeed=void 0,this.remainingLifetime=void 0,this.loopCount=void 0,this.lastLoop=void 0,this.trailDelay=void 0,this.startLifetime=void 0,this.emitAccumulator0=void 0,this.emitAccumulator1=void 0,this.frameIndex=void 0,this.startRow=void 0,this.particleSystem=t,this.position=new Kn(0,0,0),this.velocity=new Kn(0,0,0),this.animatedVelocity=new Kn(0,0,0),this.ultimateVelocity=new Kn(0,0,0),this.angularVelocity=new Kn(0,0,0),this.axisOfRotation=new Kn(0,0,0),this.rotation=new Kn(0,0,0),this.startEuler=new Kn(0,0,0),this.startRotation=new Cr,this.startRotated=!1,this.deltaQuat=new Cr,this.deltaMat=new zr,this.localMat=new zr,this.startSize=new Kn(0,0,0),this.size=new Kn(0,0,0),this.startColor=nr.WHITE.clone(),this.color=nr.WHITE.clone(),this.randomSeed=0,this.remainingLifetime=0,this.loopCount=0,this.lastLoop=0,this.trailDelay=0,this.startLifetime=0,this.emitAccumulator0=0,this.emitAccumulator1=0,this.frameIndex=0,this.startRow=0}return t.prototype.reset=function(){this.rotation.set(0,0,0),this.startEuler.set(0,0,0),this.startRotation.set(0,0,0,1),this.startRotated=!1,this.deltaQuat.set(0,0,0,1),this.deltaMat.identity(),this.localMat.identity()},t}();fmt.INDENTIFY_NEG_QUAT=10,fmt.R2D=180/Math.PI;var dmt,_mt,pmt,mmt,gmt,vmt,ymt="noiseModule",bmt=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],Smt=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],xmt=function(){function t(){this.target=null,this.needUpdate=!1,this.needAnimate=!0,this.name=void 0}var e=t.prototype;return e.bindTarget=function(t){this.target=t},e.update=function(){},t}(),wmt=Me({World:0,Local:1,Custom:2}),Tmt=Me({Pause:0,PauseAndCatchup:1,AlwaysSimulate:2}),Cmt=Me({World:0,Local:1,View:2}),Amt=Me({Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4}),Dmt=Me({Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4}),Imt=Me({Base:0,Edge:1,Shell:2,Volume:3}),Bmt=Me({Random:0,Loop:1,PingPong:2}),Mmt=Me({Particles:0}),Pmt=Me({Stretch:0}),Emt=new Kn(0,0,-1);function kmt(t,e,i,n){return e!==t?(t===wmt.World||zr.invert(i,i),zr.getRotation(n,i),!0):(Cr.set(n,0,0,0,1),!1)}function Omt(t,e){ns.set(t,Math.cos(e),Math.sin(e))}function Rmt(t){var e=en(-1,1),i=en(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);Kn.set(t,r,s,e)}function Fmt(t,e,i){Rmt(t),Kn.multiplyScalar(t,t,e+(i-e)*$i())}function Lmt(t,e,i,n){Omt(t,n),t.z=0,Kn.multiplyScalar(t,t,e+(i-e)*$i())}function Vmt(t){for(var e=0;ee){var s=r-r*i;r=s>e?s:e}return r*n}var Fgt,Lgt,Vgt,Ngt,zgt,Ggt,Ugt,Hgt,Wgt,jgt,qgt,Xgt,Ygt,Qgt,Kgt,Jgt,Zgt,$gt,tvt,evt,ivt,nvt,rvt,svt,avt,ovt,hvt,uvt,lvt,cvt,fvt,dvt,_vt,pvt,mvt,gvt,vvt,yvt,bvt,Svt,xvt,wvt,Tvt,Cvt,Avt,Dvt,Ivt,Bvt,Mvt,Pvt,Evt,kvt,Ovt,Rvt,Fvt,Lvt,Vvt,Nvt,zvt,Gvt,Uvt,Hvt,Wvt,jvt,qvt,Xvt,Yvt,Qvt,Kvt,Jvt,Zvt,$vt,tyt,eyt,iyt,nyt,ryt,syt,ayt,oyt,hyt,uyt,lyt,cyt,fyt,dyt,_yt=125292,pyt=(mgt=Bh("cc.RotationOvertimeModule"),ggt=fu(Apt),vgt=fu(Apt),ygt=fu(Apt),mgt((Sgt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=xgt&&xgt(),e._separateAxes=wgt&&wgt(),e.x=Tgt&&Tgt(),e.y=Cgt&&Cgt(),e.z=Agt&&Agt(),e.name="rotationModule",e._startMat=new zr,e._matRot=new zr,e._quatRot=new Cr,e._otherEuler=new Kn,e}s(e,t);var i=e.prototype;return i._processRotation=function(t){var e=t.particleSystem.processor.getInfo().renderMode;e!==Amt.Mesh&&e===Amt.StrecthedBillboard&&this._quatRot.set(0,0,0,1),Cr.normalize(this._quatRot,this._quatRot),this._quatRot.w<0&&(this._quatRot.x+=fmt.INDENTIFY_NEG_QUAT)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=zmt(this.z)?rn(t.randomSeed+_yt):0,r=t.particleSystem.processor.getInfo().renderMode;if(this._separateAxes&&r!==Amt.VerticalBillboard&&r!==Amt.HorizontalBillboard){var s=zmt(this.x)?rn(t.randomSeed+_yt):0,a=zmt(this.y)?rn(t.randomSeed+_yt):0;Cr.fromEuler(t.deltaQuat,this.x.evaluate(i,s)*e*fmt.R2D,this.y.evaluate(i,a)*e*fmt.R2D,this.z.evaluate(i,n)*e*fmt.R2D)}else Cr.fromEuler(t.deltaQuat,0,0,this.z.evaluate(i,n)*e*fmt.R2D);t.deltaMat=zr.fromQuat(t.deltaMat,t.deltaQuat),t.localMat=t.localMat.multiply(t.deltaMat),t.startRotated||(r!==Amt.Mesh&&(r===Amt.StrecthedBillboard?t.startEuler.set(0,0,0):r!==Amt.Billboard&&t.startEuler.set(0,0,t.startEuler.z)),Cr.fromEuler(t.startRotation,t.startEuler.x*fmt.R2D,t.startEuler.y*fmt.R2D,t.startEuler.z*fmt.R2D),t.startRotated=!0),this._startMat=zr.fromQuat(this._startMat,t.startRotation),this._matRot=this._startMat.multiply(t.localMat),zr.getRotation(this._quatRot,this._matRot),this._processRotation(t,fmt.R2D),t.rotation.set(this._quatRot.x,this._quatRot.y,this._quatRot.z)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}},{key:"separateAxes",get:function(){return this._separateAxes},set:function(t){this._separateAxes=t}}]),e}(xmt),xgt=yh(Sgt.prototype,"_enable",[Uh],(function(){return!1})),wgt=yh(Sgt.prototype,"_separateAxes",[Uh],(function(){return!1})),Tgt=yh(Sgt.prototype,"x",[ggt,Uh],(function(){return new Apt})),Cgt=yh(Sgt.prototype,"y",[vgt,Uh],(function(){return new Apt})),Agt=yh(Sgt.prototype,"z",[ygt,Uh],(function(){return new Apt})),bgt=Sgt))||bgt),myt=39825,gyt=(Fgt=Bh("cc.SizeOvertimeModule"),Lgt=fu(Apt),Vgt=fu(Apt),Ngt=fu(Apt),zgt=fu(Apt),Fgt((Ugt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Hgt&&Hgt(),e.separateAxes=Wgt&&Wgt(),e.size=jgt&&jgt(),e.x=qgt&&qgt(),e.y=Xgt&&Xgt(),e.z=Ygt&&Ygt(),e.name="sizeModule",e}return s(e,t),e.prototype.animate=function(t){if(this.separateAxes){var e=1-t.remainingLifetime/t.startLifetime,i=zmt(this.x)?rn(t.randomSeed+myt):0,n=zmt(this.y)?rn(t.randomSeed+myt):0,r=zmt(this.z)?rn(t.randomSeed+myt):0;t.size.x=t.startSize.x*this.x.evaluate(e,i),t.size.y=t.startSize.y*this.y.evaluate(e,n),t.size.z=t.startSize.z*this.z.evaluate(e,r)}else{var s=zmt(this.size)?rn(t.randomSeed+myt):0;Kn.multiplyScalar(t.size,t.startSize,this.size.evaluate(1-t.remainingLifetime/t.startLifetime,s))}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(xmt),Hgt=yh(Ugt.prototype,"_enable",[Uh],(function(){return!1})),Wgt=yh(Ugt.prototype,"separateAxes",[Uh],(function(){return!1})),jgt=yh(Ugt.prototype,"size",[Lgt,Uh],(function(){return new Apt})),qgt=yh(Ugt.prototype,"x",[Vgt,Uh],(function(){return new Apt})),Xgt=yh(Ugt.prototype,"y",[Ngt,Uh],(function(){return new Apt})),Ygt=yh(Ugt.prototype,"z",[zgt,Uh],(function(){return new Apt})),Ggt=Ugt))||Ggt),vyt=Me({Grid:0}),yyt=Me({WholeSheet:0,SingleRow:1}),byt=(Qgt=Bh("cc.TextureAnimationModule"),Kgt=Hh("numTilesX"),Jgt=Hh("numTilesY"),Zgt=fu(vyt),$gt=fu(vyt),tvt=fu(yyt),evt=fu(Apt),ivt=fu(Apt),Qgt((rvt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=svt&&svt(),e._numTilesX=avt&&avt(),e._numTilesY=ovt&&ovt(),e._mode=hvt&&hvt(),e.animation=uvt&&uvt(),e.frameOverTime=lvt&&lvt(),e.startFrame=cvt&&cvt(),e.cycleCount=fvt&&fvt(),e._flipU=dvt&&dvt(),e._flipV=_vt&&_vt(),e._uvChannelMask=pvt&&pvt(),e.randomRow=mvt&&mvt(),e.rowIndex=gvt&&gvt(),e.name="textureModule",e}s(e,t);var i=e.prototype;return i.init=function(t){t.startRow=Math.floor($i()*this.numTilesY)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=zmt(this.startFrame)?rn(t.randomSeed+90794):0,n=zmt(this.frameOverTime)?rn(t.randomSeed+90794):0,r=this.startFrame.evaluate(e,i)/(this.numTilesX*this.numTilesY);if(this.animation===yyt.WholeSheet)t.frameIndex=hn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1);else if(this.animation===yyt.SingleRow){var s=1/this.numTilesY;if(this.randomRow){var a=hn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1),o=t.startRow*s,h=o+s;t.frameIndex=Ki(o,h,a)}else{var u=this.rowIndex*s,l=u+s;t.frameIndex=Ki(u,l,hn(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1))}}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&(this.target.updateMaterialParams(),this.target.enableModule(this.name,t,this)))}},{key:"mode",get:function(){return this._mode},set:function(t){t!==vyt.Grid&&Y("particle texture animation's sprites is not supported!")}},{key:"numTilesX",get:function(){return this._numTilesX},set:function(t){this._numTilesX!==t&&(this._numTilesX=t,this.target.updateMaterialParams())}},{key:"numTilesY",get:function(){return this._numTilesY},set:function(t){this._numTilesY!==t&&(this._numTilesY=t,this.target.updateMaterialParams())}},{key:"flipU",get:function(){return this._flipU},set:function(){Y("particle texture animation's flipU is not supported!")}},{key:"flipV",get:function(){return this._flipV},set:function(){Y("particle texture animation's flipV is not supported!")}},{key:"uvChannelMask",get:function(){return this._uvChannelMask},set:function(){Y("particle texture animation's uvChannelMask is not supported!")}}]),e}(xmt),svt=yh(rvt.prototype,"_enable",[Uh],(function(){return!1})),avt=yh(rvt.prototype,"_numTilesX",[Kgt],(function(){return 0})),ovt=yh(rvt.prototype,"_numTilesY",[Jgt],(function(){return 0})),hvt=yh(rvt.prototype,"_mode",[Zgt],(function(){return vyt.Grid})),y(rvt.prototype,"mode",[$gt],Object.getOwnPropertyDescriptor(rvt.prototype,"mode"),rvt.prototype),uvt=yh(rvt.prototype,"animation",[tvt,Uh],(function(){return yyt.WholeSheet})),lvt=yh(rvt.prototype,"frameOverTime",[evt,Uh],(function(){return new Apt})),cvt=yh(rvt.prototype,"startFrame",[ivt,Uh],(function(){return new Apt})),fvt=yh(rvt.prototype,"cycleCount",[Uh],(function(){return 0})),dvt=yh(rvt.prototype,"_flipU",[Uh],(function(){return 0})),_vt=yh(rvt.prototype,"_flipV",[Uh],(function(){return 0})),pvt=yh(rvt.prototype,"_uvChannelMask",[Uh],(function(){return-1})),mvt=yh(rvt.prototype,"randomRow",[Uh],(function(){return!1})),gvt=yh(rvt.prototype,"rowIndex",[Uh],(function(){return 0})),nvt=rvt))||nvt),Syt=197866,xyt=new Kn,wyt=(vvt=Bh("cc.VelocityOvertimeModule"),yvt=fu(Apt),bvt=fu(Apt),Svt=fu(Apt),xvt=fu(Apt),wvt=fu(wmt),vvt((Cvt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Avt&&Avt(),e.x=Dvt&&Dvt(),e.y=Ivt&&Ivt(),e.z=Bvt&&Bvt(),e.speedModifier=Mvt&&Mvt(),e.space=Pvt&&Pvt(),e.rotation=void 0,e.needTransform=void 0,e.name="velocityModule",e.rotation=new Cr,e.speedModifier.constant=1,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=kmt(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=zmt(this.x)?rn(t.randomSeed^Syt):0,n=zmt(this.y)?rn(156497^t.randomSeed):0,r=zmt(this.z)?rn(984136^t.randomSeed):0,s=zmt(this.speedModifier)?rn(t.randomSeed+Syt):0,a=Kn.set(xyt,this.x.evaluate(e,i),this.y.evaluate(e,n),this.z.evaluate(e,r));this.needTransform&&Kn.transformQuat(a,a,this.rotation),Kn.add(t.animatedVelocity,t.animatedVelocity,a),Kn.add(t.ultimateVelocity,t.velocity,t.animatedVelocity),Kn.multiplyScalar(t.ultimateVelocity,t.ultimateVelocity,this.speedModifier.evaluate(1-t.remainingLifetime/t.startLifetime,s))},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(xmt),Avt=yh(Cvt.prototype,"_enable",[Uh],(function(){return!1})),Dvt=yh(Cvt.prototype,"x",[yvt,Uh],(function(){return new Apt})),Ivt=yh(Cvt.prototype,"y",[bvt,Uh],(function(){return new Apt})),Bvt=yh(Cvt.prototype,"z",[Svt,Uh],(function(){return new Apt})),Mvt=yh(Cvt.prototype,"speedModifier",[xvt,Uh],(function(){return new Apt})),Pvt=yh(Cvt.prototype,"space",[wvt,Uh],(function(){return wmt.Local})),Tvt=Cvt))||Tvt),Tyt=t("e_",(Evt=Bh("cc.Burst"),kvt=fu(Apt),Evt((Rvt=function(){function t(){this._time=Fvt&&Fvt(),this._repeatCount=Lvt&&Lvt(),this.repeatInterval=Vvt&&Vvt(),this.count=Nvt&&Nvt(),this._remainingCount=void 0,this._curTime=void 0,this._remainingCount=0,this._curTime=0}var e=t.prototype;return e.update=function(t,e){if(0===this._remainingCount&&(this._remainingCount=this._repeatCount,this._curTime=this._time),this._remainingCount>0){var i=hn(t.time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=hn(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime0&&(t.position.x+=en(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=en(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=en(-this.randomPositionAmount,this.randomPositionAmount)),Kn.transformQuat(t.velocity,t.velocity,this.quat),Kn.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var e=Kn.normalize(Cyt,t.position);Kn.lerp(t.velocity,t.velocity,e,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem.time},e.constructMat=function(){Cr.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),zr.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(this.arcMode===Bmt.Random)return en(0,this._arc);var t=this.totalAngle+2*Math.PI*this.arcSpeed.evaluate(this.particleSystem.time,1)*(this.particleSystem.time-this.lastTime);switch(this.totalAngle=t,0!==this.arcSpread&&(t=Math.floor(t/(this._arc*this.arcSpread))*this._arc*this.arcSpread),this.arcMode){case Bmt.Loop:return hn(t,this._arc);case Bmt.PingPong:return un(t,this._arc);default:return hn(t,this._arc)}},n(t,[{key:"position",get:function(){return this._position},set:function(t){this._position=t,this.constructMat()}},{key:"rotation",get:function(){return this._rotation},set:function(t){this._rotation=t,this.constructMat()}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.constructMat()}},{key:"arc",get:function(){return Zi(this._arc)},set:function(t){this._arc=Ji(t)}},{key:"angle",get:function(){return Math.round(100*Zi(this._angle))/100},set:function(t){this._angle=Ji(t)}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"shapeType",get:function(){return this._shapeType},set:function(t){switch(this._shapeType=t,this._shapeType){case Dmt.Box:this.emitFrom===Imt.Base&&(this.emitFrom=Imt.Volume);break;case Dmt.Cone:this.emitFrom===Imt.Edge&&(this.emitFrom=Imt.Base);break;case Dmt.Sphere:case Dmt.Hemisphere:this.emitFrom!==Imt.Base&&this.emitFrom!==Imt.Edge||(this.emitFrom=Imt.Volume)}}}]),t}(),Qvt=yh(Yvt.prototype,"_enable",[Uh],(function(){return!1})),Kvt=yh(Yvt.prototype,"_shapeType",[Gvt,Uvt],(function(){return Dmt.Cone})),y(Yvt.prototype,"shapeType",[Hvt],Object.getOwnPropertyDescriptor(Yvt.prototype,"shapeType"),Yvt.prototype),Jvt=yh(Yvt.prototype,"emitFrom",[Wvt,Uh],(function(){return Imt.Volume})),Zvt=yh(Yvt.prototype,"alignToDirection",[Uh],(function(){return!1})),$vt=yh(Yvt.prototype,"randomDirectionAmount",[Uh],(function(){return 0})),tyt=yh(Yvt.prototype,"sphericalDirectionAmount",[Uh],(function(){return 0})),eyt=yh(Yvt.prototype,"randomPositionAmount",[Uh],(function(){return 0})),iyt=yh(Yvt.prototype,"radius",[Uh],(function(){return 1})),nyt=yh(Yvt.prototype,"radiusThickness",[Uh],(function(){return 1})),ryt=yh(Yvt.prototype,"arcMode",[jvt,Uh],(function(){return Bmt.Random})),syt=yh(Yvt.prototype,"arcSpread",[Uh],(function(){return 0})),ayt=yh(Yvt.prototype,"arcSpeed",[qvt,Uh],(function(){return new Apt})),oyt=yh(Yvt.prototype,"length",[Uh],(function(){return 5})),hyt=yh(Yvt.prototype,"boxThickness",[Uh],(function(){return new Kn(0,0,0)})),uyt=yh(Yvt.prototype,"_position",[Uh],(function(){return new Kn(0,0,0)})),lyt=yh(Yvt.prototype,"_rotation",[Uh],(function(){return new Kn(0,0,0)})),cyt=yh(Yvt.prototype,"_scale",[Uh],(function(){return new Kn(1,1,1)})),fyt=yh(Yvt.prototype,"_arc",[Uh],(function(){return Ji(360)})),dyt=yh(Yvt.prototype,"_angle",[Uh],(function(){return Ji(25)})),Xvt=Yvt))||Xvt);function Byt(t,e,i,n,r){switch(t){case Imt.Volume:Fmt(n,e*(1-i),e),Kn.normalize(r,n);break;case Imt.Shell:Rmt(n),Kn.multiplyScalar(n,n,e),Kn.normalize(r,n);break;default:X(t+" is not supported for sphere emitter.")}}function Myt(t,e,i,n,r){switch(t){case Imt.Volume:Fmt(n,e*(1-i),e),n.z>0&&(n.z*=-1),Kn.normalize(r,n);break;case Imt.Shell:Rmt(n),Kn.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),Kn.normalize(r,n);break;default:X(t+" is not supported for hemisphere emitter.")}}function Pyt(t,e,i,n,r,s,a,o){switch(t){case Imt.Base:Lmt(a,e*(1-i),e,n),ns.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,Kn.normalize(o,o),a.z=0;break;case Imt.Shell:Omt(a,n),ns.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r),Kn.normalize(o,o),ns.multiplyScalar(a,a,e),a.z=0;break;case Imt.Volume:Lmt(a,e*(1-i),e,n),ns.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,Kn.normalize(o,o),a.z=0,Kn.add(a,a,Kn.multiplyScalar(Cyt,o,s*$i()/-o.z));break;default:X(t+" is not supported for cone emitter.")}}function Eyt(t,e,i,n){switch(t){case Imt.Volume:r=i,s=Dyt,Kn.set(r,en(-s.x,s.x),en(-s.y,s.y),en(-s.z,s.z));break;case Imt.Shell:Ayt[0]=en(-.5,.5),Ayt[1]=en(-.5,.5),Ayt[2]=.5*Nmt(),Vmt(Ayt),Oyt(Ayt,e),Kn.set(i,Ayt[0],Ayt[1],Ayt[2]);break;case Imt.Edge:Ayt[0]=en(-.5,.5),Ayt[1]=.5*Nmt(),Ayt[2]=.5*Nmt(),Vmt(Ayt),Oyt(Ayt,e),Kn.set(i,Ayt[0],Ayt[1],Ayt[2]);break;default:X(t+" is not supported for box emitter.")}var r,s;Kn.copy(n,Emt)}function kyt(t,e,i,n,r){Lmt(n,t*(1-e),t,i),Kn.normalize(r,n)}function Oyt(t,e){e.x>0&&(t[0]+=.5*en(-e.x,e.x),t[0]=Yi(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*en(-e.y,e.y),t[1]=Yi(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*en(-e.z,e.z),t[2]=Yi(t[2],-.5,.5))}var Ryt=[0,0,1,0,0,1,1,1],Fyt=[0,0,0,1,0,0,0,1,0,1,1,0],Lyt=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._bufferSize=void 0,e._vertAttrs=void 0,e._vertAttribSize=void 0,e._vBuffer=void 0,e._vertAttrsFloatCount=void 0,e._vdataF32=void 0,e._vdataUint32=void 0,e._subMeshData=void 0,e._mesh=void 0,e._vertCount=0,e._indexCount=0,e._startTimeOffset=0,e._lifeTimeOffset=0,e._material=null,e._vertAttribSizeStatic=void 0,e._vertStaticAttrsFloatCount=void 0,e._insBuffers=void 0,e._insIndices=void 0,e._useInstance=void 0,e._iaVertCount=0,e._iaIndexCount=0,e.type=4,e._capacity=0,e._bufferSize=16,e._vertAttrs=null,e._vertAttribSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._vertAttribSizeStatic=0,e._vertStaticAttrsFloatCount=0,e._insBuffers=[],e._insIndices=null,vp.gfxDevice.hasFeature(1)?e._useInstance=!0:e._useInstance=!1,e._subMeshData=null,e._mesh=null,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){var e=this._capacity!==t;this._capacity=t,this._bufferSize=Math.max(this._capacity,16),this._subMeshData&&e&&this.rebuild()},i.setVertexAttributes=function(t,e){if(this._useInstance)this.setVertexAttributesIns(t,e);else{if(this._mesh===t&&this._vertAttrs===e)return;this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0;for(var i,n=p(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=M_[r.format].size}this._vertAttrsFloatCount=this._vertAttribSize/4,this.rebuild()}},i.setVertexAttributesIns=function(t,e){if(this._mesh!==t||this._vertAttrs!==e){this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0,this._vertAttribSizeStatic=0;for(var i,n=p(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=M_[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=M_[r.format].size)}this._vertAttrsFloatCount=this._vertAttribSize/4,this._vertStaticAttrsFloatCount=this._vertAttribSizeStatic/4,this.rebuild()}},i.createSubMeshData=function(){this.destroySubMeshData(),this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new zd(10,3,this._vertAttribSize*this._bufferSize*this._vertCount,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize*this._vertCount);if(this._mesh&&this._capacity>0){var i=this._vertAttrs[this._vertAttrs.findIndex((function(t){return"a_texCoord"===t.name}))].offset;this._mesh.copyAttribute(0,"a_texCoord",e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return"a_texCoord3"===t.name}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,"a_position",e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,"a_normal",e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,"a_color",e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s0){this._mesh.copyIndices(0,h);for(var u=1;u=this._particleSystem.capacity?null:this._particles.add()},i.getDefaultTrailMaterial=function(){return this._defaultTrailMat},i.setNewParticle=function(){},i._initModuleList=function(){var t=this;jyt.forEach((function(e){if(t._particleSystem){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&t._updateList.set(i.name,i),i.needAnimate&&t._animateList.set(i.name,i))}})),this._runAnimateList.length=0;for(var e=0,i=bmt.length;e0,this._particles.length},i.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===ymt&&r.getNoisePreview(t,n._particleSystem,e,i)}))},i.updateRenderData=function(){for(var t=0,e=0;e=(null===(t=this._particleSystem)||void 0===t?void 0:t.capacity)?null:this._tempParticle},i.setNewParticle=function(t){this._particleSystem&&(this._model.addGPUParticleVertexData(t,this._particleNum,this._particleSystem.time),this._particleNum++)},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(this._renderInfo.renderMode===Amt.Mesh||this._alignSpace!==Cmt.View){var e;if(this._alignSpace===Cmt.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(hbt);else if(this._alignSpace===Cmt.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(hbt)}else if(this._alignSpace===Cmt.View){var n,r;hbt.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s&&this._particleSystem)for(var a=0;a<(null==s?void 0:s.length);++a){var o=s[a];if((o.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){Cr.fromViewUp(hbt,o.forward);break}}}else hbt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,hbt)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i=this._node_scale;switch(null===(e=this._particleSystem)||void 0===e?void 0:e.scaleSpace){case wmt.Local:this._particleSystem.node.getScale(i);break;case wmt.World:this._particleSystem.node.getWorldScale(i)}t.setUniform(t.getHandle("scale"),rbt.set(i.x,i.y,i.z))},i.updateParticles=function(t){return this._particleSystem?(this._particleNum=this._model.updateGPUParticles(this._particleNum,this._particleSystem.time,t),this.updateShaderUniform(t),this._model.enabled=this._particleNum>0,this._particleNum):this._particleNum},i.updateRenderData=function(){},i.beforeRender=function(){this._model.updateIA(this._particleNum)},i.updateAlignSpace=function(t){this._alignSpace=t},i.updateShaderUniform=function(t){if(this._particleSystem){var e=this._particleSystem.getMaterialInstance(0)||this._defaultMat;if(e){var i=e.passes[0];abt.x=this._particleSystem.time,abt.y=t,i.setUniform(this._uTimeHandle,abt),this._particleSystem.node.getWorldRotation(obt),i.setUniform(this._uRotHandle,obt),this.doUpdateRotation(i)}}},i.initShaderUniform=function(t){var e,i,n,r,s,a,o=t.passes[0];this._uTimeHandle=o.getHandle("u_timeDelta"),this._uRotHandle=o.getHandle("u_worldRot"),this._uNodeRotHandle=o.getHandle("nodeRotation"),this.doUpdateScale(o),o.setUniform(o.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),abt.x=Mbt,abt.y=.03125,o.setUniform(o.getHandle("u_sampleInfo"),abt);var h=!1,u=null===(e=this._particleSystem)||void 0===e?void 0:e._forceOvertimeModule;if(h=!!u&&u.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=h,h){var l=Opt(this._forceTexture,this._forceData,Mbt,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=o.getHandle("force_over_time_tex0"),f=Pw.getBindingFromHandle(c);o.bindSampler(f,this._forceTexture.getGFXSampler()),o.bindTexture(f,this._forceTexture.getGFXTexture());var d=o.getHandle("u_force_space");o.setUniform(d,u.space);var _=o.getHandle("u_force_mode");o.setUniform(_,this._forceTexture.height)}var p=null===(i=this._particleSystem)||void 0===i?void 0:i._velocityOvertimeModule;if(h=!!p&&p.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=h,h){var m=Rpt(this._velocityTexture,this._velocityData,Mbt,p.x,p.y,p.z,p.speedModifier);this._velocityTexture=m.texture,this._velocityData=m.texdata;var g=o.getHandle("velocity_over_time_tex0"),v=Pw.getBindingFromHandle(g);o.bindSampler(v,this._velocityTexture.getGFXSampler()),o.bindTexture(v,this._velocityTexture.getGFXTexture());var y=o.getHandle("u_velocity_space");o.setUniform(y,p.space);var b=o.getHandle("u_velocity_mode");o.setUniform(b,this._velocityTexture.height)}var S=null===(n=this._particleSystem)||void 0===n?void 0:n._colorOverLifetimeModule;if(h=!!S&&S.enable,this._defines.COLOR_OVER_TIME_MODULE_ENABLE=h,h){var x=hmt(this._colorTexture,this._colorData,Mbt,S.color);this._colorTexture=x.texture,this._colorData=x.texdata;var w=o.getHandle("color_over_time_tex0"),T=Pw.getBindingFromHandle(w);o.bindSampler(T,this._colorTexture.getGFXSampler()),o.bindTexture(T,this._colorTexture.getGFXTexture());var C=o.getHandle("u_color_mode");o.setUniform(C,this._colorTexture.height)}var A,D=null===(r=this._particleSystem)||void 0===r?void 0:r._rotationOvertimeModule;if(h=!!D&&D.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=h,h&&(A=D.separateAxes?Opt(this._rotationTexture,this._rotationData,Mbt,D.x,D.y,D.z):Ppt(this._rotationTexture,this._rotationData,Mbt,D.z),this._rotationTexture=A.texture,this._rotationData=A.texdata,this._rotationTexture)){var I=o.getHandle("rotation_over_time_tex0"),B=Pw.getBindingFromHandle(I);o.bindSampler(B,this._rotationTexture.getGFXSampler()),o.bindTexture(B,this._rotationTexture.getGFXTexture());var M=o.getHandle("u_rotation_mode");o.setUniform(M,this._rotationTexture.height)}var P,E=null===(s=this._particleSystem)||void 0===s?void 0:s._sizeOvertimeModule;if(h=!!E&&E.enable,this._defines.SIZE_OVER_TIME_MODULE_ENABLE=h,h&&(P=E.separateAxes?Opt(this._sizeTexture,this._sizeData,Mbt,E.x,E.y,E.z,!0):Ept(this._sizeTexture,this._sizeData,Mbt,E.size),this._sizeTexture=P.texture,this._sizeData=P.texdata,this._sizeTexture)){var k=o.getHandle("size_over_time_tex0"),O=Pw.getBindingFromHandle(k);o.bindSampler(O,this._sizeTexture.getGFXSampler()),o.bindTexture(O,this._sizeTexture.getGFXTexture());var R=o.getHandle("u_size_mode");o.setUniform(R,this._sizeTexture.height)}var F=null===(a=this._particleSystem)||void 0===a?void 0:a._textureAnimationModule;if(h=!!F&&F.enable,this._defines.TEXTURE_ANIMATION_MODULE_ENABLE=h,h){var L=kpt(this._animTexture,this._animData,Mbt,F.startFrame,F.frameOverTime);this._animTexture=L.texture,this._animData=L.texdata;var V=o.getHandle("texture_animation_tex0"),N=Pw.getBindingFromHandle(V);o.bindSampler(N,this._animTexture.getGFXSampler()),o.bindTexture(N,this._animTexture.getGFXTexture());var z=o.getHandle("u_anim_info");abt.x=this._animTexture.height,abt.y=F.numTilesX*F.numTilesY,abt.z=F.cycleCount,o.setUniform(z,abt)}this._defines.USE_VK_SHADER=4===vp.gfxDevice.gfxAPI,this._defines.CC_INSTANCE_PARTICLE=this._useInstance},i.getParticleCount=function(){return this._particleNum},i.onMaterialModified=function(){this._inited&&this.updateMaterialParams()},i.onRebuildPSO=function(t,e){this._model&&0===t&&this._model.setSubModelMaterial(0,e)},i.updateVertexAttrib=function(){if(this._renderInfo.renderMode===Amt.Mesh&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,"a_color");if(t){for(var e=35,i=0;i=8&&3&t.getFormatFeatures(44))||(T.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var Ybt,Qbt,Kbt,Jbt,Zbt,$bt,tSt,eSt,iSt,nSt,rSt,sSt,aSt,oSt,hSt,uSt,lSt,cSt,fSt,dSt,_St,pSt,mSt,gSt,vSt,ySt,bSt,SSt,xSt,wSt,TSt,CSt,ASt,DSt,ISt,BSt,MSt,PSt,ESt,kSt,OSt,RSt,FSt,LSt,VSt,NSt,zSt,GSt,USt,HSt,WSt,jSt,qSt,XSt,YSt,QSt,KSt,JSt,ZSt,$St,txt,ext,ixt,nxt,rxt,sxt,axt,oxt,hxt,uxt,lxt,cxt,fxt,dxt,_xt,pxt,mxt,gxt,vxt,yxt,bxt,Sxt,xxt,wxt,Txt,Cxt,Axt,Dxt,Ixt,Bxt,Mxt,Pxt,Ext,kxt,Oxt,Rxt,Fxt,Lxt,Vxt,Nxt,zxt,Gxt,Uxt,Hxt,Wxt,jxt,qxt,Xxt,Yxt,Qxt,Kxt,Jxt,Zxt,$xt,twt,ewt,iwt,nwt,rwt,swt,awt,owt,hwt,uwt,lwt,cwt,fwt,dwt,_wt,pwt,mwt,gwt,vwt,ywt,bwt,Swt,xwt,wwt,Twt,Cwt,Awt,Dwt,Iwt,Bwt,Mwt,Pwt=(ubt=Bh("cc.ParticleSystemRenderer"),lbt=fu(Amt),cbt=fu(Amt),fbt=fu(Qk),dbt=fu(Xw),_bt=fu(Xw),pbt=fu(Xw),mbt=fu(Xw),gbt=fu(Cmt),ubt((Bbt=function(){function t(){this._renderMode=bbt&&bbt(),this._velocityScale=Sbt&&Sbt(),this._lengthScale=xbt&&xbt(),this._mesh=wbt&&wbt(),this._cpuMaterial=Tbt&&Tbt(),this._gpuMaterial=Cbt&&Cbt(),this._mainTexture=Abt&&Abt(),this._useGPU=Dbt&&Dbt(),this._alignSpace=Ibt&&Ibt(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&ot(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&Xbt();this._particleSystem.processor?ot(6034):(this._particleSystem.processor=e?new qbt(this):new nbt(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(t)),e?this.gpuMaterial=this.particleMaterial:(this.particleMaterial&&-1!==this.particleMaterial.effectName.indexOf("particle-gpu")&&(this.particleMaterial=null,st(6035)),this.cpuMaterial=this.particleMaterial)},e._switchProcessor=function(){if(this._particleSystem){this._particleSystem.processor&&(this._particleSystem.processor.detachFromScene(),this._particleSystem.processor.clear(),this._particleSystem.processor=null);var t=this._useGPU&&Xbt();this.particleMaterial=t?this.gpuMaterial:this.cpuMaterial,this._particleSystem.processor=t?new qbt(this):new nbt(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(this._particleSystem),this._particleSystem.processor.onEnable(),this._particleSystem.bindModule()}},n(t,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode!==t&&(this._renderMode=t,this._particleSystem&&this._particleSystem.processor.updateRenderMode())}},{key:"velocityScale",get:function(){return this._velocityScale},set:function(t){this._velocityScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"lengthScale",get:function(){return this._lengthScale},set:function(t){this._lengthScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh=t,this._particleSystem&&this._particleSystem.processor.setVertexAttributes()}},{key:"particleMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(0):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,0)}},{key:"cpuMaterial",get:function(){return this._cpuMaterial},set:function(t){if(t){var e=t.effectName;if(-1===e.indexOf("particle")||-1!==e.indexOf("particle-gpu"))return void st(6035)}this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){t&&-1===t.effectName.indexOf("particle-gpu")?st(6035):(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial)}},{key:"trailMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(1):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,1)}},{key:"mainTexture",get:function(){return this._mainTexture},set:function(t){this._mainTexture=t}},{key:"useGPU",get:function(){return this._useGPU},set:function(t){this._useGPU!==t&&(Xbt()?this._useGPU=t:this._useGPU=!1,this._switchProcessor())}},{key:"alignSpace",get:function(){return this._alignSpace},set:function(t){this._alignSpace=t,this._particleSystem.processor.updateAlignSpace(this._alignSpace)}}]),t}(),Bbt.AlignmentSpace=Cmt,y((ybt=Bbt).prototype,"renderMode",[lbt],Object.getOwnPropertyDescriptor(ybt.prototype,"renderMode"),ybt.prototype),bbt=yh(ybt.prototype,"_renderMode",[cbt,Uh],(function(){return Amt.Billboard})),Sbt=yh(ybt.prototype,"_velocityScale",[Uh],(function(){return 1})),xbt=yh(ybt.prototype,"_lengthScale",[Uh],(function(){return 1})),wbt=yh(ybt.prototype,"_mesh",[Uh],(function(){return null})),y(ybt.prototype,"mesh",[fbt],Object.getOwnPropertyDescriptor(ybt.prototype,"mesh"),ybt.prototype),y(ybt.prototype,"particleMaterial",[dbt],Object.getOwnPropertyDescriptor(ybt.prototype,"particleMaterial"),ybt.prototype),y(ybt.prototype,"cpuMaterial",[_bt],Object.getOwnPropertyDescriptor(ybt.prototype,"cpuMaterial"),ybt.prototype),Tbt=yh(ybt.prototype,"_cpuMaterial",[Uh],(function(){return null})),y(ybt.prototype,"gpuMaterial",[pbt],Object.getOwnPropertyDescriptor(ybt.prototype,"gpuMaterial"),ybt.prototype),Cbt=yh(ybt.prototype,"_gpuMaterial",[Uh],(function(){return null})),y(ybt.prototype,"trailMaterial",[mbt],Object.getOwnPropertyDescriptor(ybt.prototype,"trailMaterial"),ybt.prototype),Abt=yh(ybt.prototype,"_mainTexture",[Uh],(function(){return null})),Dbt=yh(ybt.prototype,"_useGPU",[Uh],(function(){return!1})),y(ybt.prototype,"alignSpace",[gbt],Object.getOwnPropertyDescriptor(ybt.prototype,"alignSpace"),ybt.prototype),Ibt=yh(ybt.prototype,"_alignSpace",[Uh],(function(){return Cmt.View})),vbt=ybt))||vbt),Ewt=Math.cos(Ji(100)),kwt={position:new Kn,velocity:new Kn},Owt=new Cr,Rwt=new Kn,Fwt=new Kn,Lwt=new nr,Vwt=function(){function t(t){for(this.start=void 0,this.end=void 0,this.trailElements=void 0,this.start=-1,this.end=-1,this.trailElements=[];t--;)this.trailElements.push({position:new Kn,lifetime:0,width:0,velocity:new Kn,direction:0,color:new nr})}var e=t.prototype;return e.getElement=function(t){return-1===this.start?null:(t<0&&(t=(t+this.trailElements.length)%this.trailElements.length),t>=this.trailElements.length&&(t%=this.trailElements.length),this.trailElements[t])},e.addElement=function(){if(0===this.trailElements.length)return null;if(-1===this.start)return this.start=0,this.end=1,this.trailElements[0];this.start===this.end&&(this.trailElements.splice(this.end,0,{position:new Kn,lifetime:0,width:0,velocity:new Kn,direction:0,color:new nr}),this.start++,this.start%=this.trailElements.length);var t=this.end++;return this.end%=this.trailElements.length,this.trailElements[t]},e.iterateElement=function(t,e,i,n){for(var r=this.start>=this.end?this.end+this.trailElements.length:this.end,s=this.start;st.lastLoop)t.trailDelay>1?(t.lastLoop=t.loopCount,t.trailDelay=0):t.trailDelay++;else{var i=this._particleTrail.get(t);if(!i)return i=this._trailSegments.alloc(),void this._particleTrail.set(t,i);var n=i.getElement(i.end-1);if(this._needTransform?Kn.transformMat4(Rwt,t.position,this._psTransform):Kn.copy(Rwt,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),Kn.squaredDistance(n.position,Rwt)2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);Kn.subtract(Rwt,o.position,a.position),Kn.subtract(Fwt,n.position,a.position),Kn.subtract(a.velocity,Fwt,Rwt),Kn.equals(Kn.ZERO,a.velocity)&&Kn.copy(a.velocity,Rwt),Kn.normalize(a.velocity,a.velocity),this._checkDirectionReverse(a,o)}this.colorFromParticle?n.color.set(t.color):n.color.set(this.colorOvertime.evaluate(0,1))}}},t.removeParticle=function(t){var e=this._particleTrail.get(t);e&&this._trailSegments&&(e.clear(),this._trailSegments.free(e),this._particleTrail.delete(t))},t.updateRenderData=function(){this.vbOffset=0,this.ibOffset=0;for(var t,e=p(this._particleTrail.keys());!(t=e()).done;){var i=t.value,n=this._particleTrail.get(i);if(-1!==n.start){var r=4*this.vbOffset/this._vertSize,s=n.start>=n.end?n.end+n.trailElements.length:n.end,a=s-n.start,o=1/a,h=n.trailElements[n.start];this._fillVertexBuffer(h,this.colorOverTrail.evaluate(1,1),r,1,0,4);for(var u=n.start+1;u2){var _=n.getElement(n.end-1),m=n.getElement(n.end-2);Kn.subtract(Rwt,m.position,_.position),Kn.subtract(Fwt,kwt.position,_.position),Kn.normalize(Rwt,Rwt),Kn.normalize(Fwt,Fwt),Kn.subtract(_.velocity,Fwt,Rwt),Kn.normalize(_.velocity,_.velocity),this._checkDirectionReverse(_,m),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(_,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),Kn.subtract(kwt.velocity,kwt.position,_.position),Kn.normalize(kwt.velocity,kwt.velocity),this._checkDirectionReverse(kwt,_)}this.widthFromParticle?kwt.width=i.size.x*this.widthRatio.evaluate(0,1):kwt.width=this.widthRatio.evaluate(0,1),kwt.color=i.color,Kn.equals(kwt.velocity,Kn.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(kwt,this.colorOverTrail.evaluate(0,1),r,0,a,1)}}this._trailModel&&(this._trailModel.enabled=this.ibOffset>0)},t.updateIA=function(t){var e=this._trailModel&&this._trailModel.subModels;if(e&&e.length>0){var i=e[0];i.inputAssembler.vertexBuffers[0].update(this._vbF32),i.inputAssembler.indexBuffer.update(this._iBuffer),i.inputAssembler.firstIndex=0,i.inputAssembler.indexCount=t,i.inputAssembler.vertexCount=this._iaVertCount}},t.beforeRender=function(){this.updateIA(this.ibOffset)},t._createModel=function(){this._trailModel||(this._trailModel=T.director.root.createModel(_M))},t.rebuild=function(){var t=wE.root.device,e=t.createBuffer(new zd(10,3,this._vertSize*(this._trailNum+1)*2,this._vertSize)),i=new ArrayBuffer(this._vertSize*(this._trailNum+1)*2);this._vbF32=new Float32Array(i),this._vbUint32=new Uint32Array(i),e.update(i);var n=t.createBuffer(new zd(6,3,12*Math.max(1,this._trailNum),2));this._iBuffer=new Uint16Array(6*Math.max(1,this._trailNum)),n.update(this._iBuffer),this._iaVertCount=2*(this._trailNum+1),this._iaIndexCount=6*this._trailNum,this._subMeshData=new OE([e],this._vertAttrs,7,n);var r=this._trailModel;r&&this._material&&(r.node=r.transform=this._particleSystem.node,r.visFlags=this._particleSystem.visibility,r.initSubModel(0,this._subMeshData,this._material),r.enabled=!0)},t._updateTrailElement=function(t,e,i,n){return e.lifetime+=n,t.colorFromParticle?(e.color.set(i.color),e.color.multiply(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1))):e.color.set(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1)),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),e.lifetime>t._trailLifetime},t._fillVertexBuffer=function(t,e,i,n,r,s){this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=0,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,Lwt.set(t.color),Lwt.multiply(e),this._vbUint32[this.vbOffset++]=nr.toUint32(Lwt),this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=1-t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=1,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,this._vbUint32[this.vbOffset++]=nr.toUint32(Lwt),1&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r-1,this._iBuffer[this.ibOffset++]=i+2*r+1),4&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r+1,this._iBuffer[this.ibOffset++]=i+2*r+2)},t._checkDirectionReverse=function(t,e){Kn.dot(t.velocity,e.velocity)0&&!this._isCulled&&(null!==(e=this.processor.getModel())&&void 0!==e&&e.scene||this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&(null!==(i=this._trailModule.getModel())&&void 0!==i&&i.scene||this._trailModule._attachToScene()),this._needAttach=!1);!this.renderer.useGPU&&this._trailModule&&this._trailModule.enable&&(this._trailModule.inited||(this._trailModule.clear(),this._trailModule.destroy(),this._trailModule.onInit(this),this._trailModule.enable=!1,this._trailModule.enable=!0))},i.beforeRender=function(){var t,e;this.getParticleCount()<=0?null!==(e=this.processor.getModel())&&void 0!==e&&e.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._needAttach=!1):null!==(t=this.processor.getModel())&&void 0!==t&&t.scene||(this._needAttach=!0),this._isPlaying&&(this.processor.updateRenderData(),this.processor.beforeRender(),this._trailModule&&this._trailModule.enable&&(this._trailModule.updateRenderData(),this._trailModule.beforeRender()))},i._onVisibilityChange=function(t){this.processor.model&&(this.processor.model.visFlags=t)},i.emit=function(t,e){var i=this._time%this.duration/this.duration;this._needRefresh&&(this.node.invalidateChildren(1),this._needRefresh=!1),this._simulationSpace===wmt.World&&(this.node.getWorldMatrix(Qwt),this.node.getWorldRotation(Kwt));for(var n=0;ne){if(this._time>this.duration+e&&(this.loop||(this._isEmitting=!1)),!this._isEmitting)return;if(this._emitRateTimeCounter+=this.rateOverTime.evaluate(this._time/this.duration,1)*t,this._emitRateTimeCounter>1){var i=Math.floor(this._emitRateTimeCounter);this._emitRateTimeCounter-=i,this.emit(i,t)}var n=this.rateOverDistance.evaluate(this._time/this.duration,1);if(n>0){Kn.copy(this._oldWPos,this._curWPos),this.node.getWorldPosition(this._curWPos);var r=Kn.distance(this._curWPos,this._oldWPos);this._emitRateDistanceCounter+=r*n}if(this._emitRateDistanceCounter>1){var s=Math.floor(this._emitRateDistanceCounter);this._emitRateDistanceCounter-=s,this.emit(s,t)}for(var a,o=p(this.bursts);!(a=o()).done;)a.value.update(this,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),Kn.copy(this._curWPos,this._oldWPos)},i.addSubEmitter=function(t){this._subEmitters.push(t)},i.removeSubEmitter=function(t){this._subEmitters.splice(this._subEmitters.indexOf(t),1)},i.addBurst=function(t){this.bursts.push(t)},i.removeBurst=function(t){var e=this.bursts.indexOf(t);e>-1&&this.bursts.splice(e,1)},i.getBoundingX=function(){return this._aabbHalfX},i.getBoundingY=function(){return this._aabbHalfY},i.getBoundingZ=function(){return this._aabbHalfZ},i.setBoundingX=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.x=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfX=t)},i.setBoundingY=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.y=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfY=t)},i.setBoundingZ=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.z=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfZ=t)},i._onBeforeSerialize=function(t){var e=this;return this.dataCulling?t.filter((function(t){return!Smt.includes(t)||e[t]&&e[t].enable})):t},i.getNoisePreview=function(t,e){var i=[];return this.processor&&this.processor.getNoisePreview(i,t,e),i},n(e,[{key:"capacity",get:function(){return this._capacity},set:function(t){this._capacity=Math.floor(t>0?t:0),this.processor&&this.processor.model&&this.processor.model.setCapacity(this._capacity)}},{key:"prewarm",get:function(){return this._prewarm},set:function(t){!0===t&&this.loop,this._prewarm=t}},{key:"simulationSpace",get:function(){return this._simulationSpace},set:function(t){t!==this._simulationSpace&&(this._simulationSpace=t,this.processor&&(this.processor.updateMaterialParams(),this.processor.updateTrailMaterial()))}},{key:"renderCulling",get:function(){return this._renderCulling},set:function(t){this._renderCulling=t,t&&(this._boundingBox||(this._boundingBox=new th,this._calculateBounding(!1)))}},{key:"cullingMode",get:function(){return this._cullingMode},set:function(t){this._cullingMode=t}},{key:"aabbHalfX",get:function(){return this.getBoundingX()||0},set:function(t){this.setBoundingX(t)}},{key:"aabbHalfY",get:function(){return this.getBoundingY()||0},set:function(t){this.setBoundingY(t)}},{key:"aabbHalfZ",get:function(){return this.getBoundingZ()||0},set:function(t){this.setBoundingZ(t)}},{key:"dataCulling",get:function(){return this._dataCulling},set:function(t){this._dataCulling=t}},{key:"sharedMaterials",get:function(){return Jwt.get.call(this)},set:function(t){Jwt.set.call(this,t)}},{key:"colorOverLifetimeModule",get:function(){return this._colorOverLifetimeModule},set:function(t){t&&(this._colorOverLifetimeModule=t)}},{key:"shapeModule",get:function(){return this._shapeModule},set:function(t){t&&(this._shapeModule=t)}},{key:"sizeOvertimeModule",get:function(){return this._sizeOvertimeModule},set:function(t){t&&(this._sizeOvertimeModule=t)}},{key:"velocityOvertimeModule",get:function(){return this._velocityOvertimeModule},set:function(t){t&&(this._velocityOvertimeModule=t)}},{key:"forceOvertimeModule",get:function(){return this._forceOvertimeModule},set:function(t){t&&(this._forceOvertimeModule=t)}},{key:"limitVelocityOvertimeModule",get:function(){return this._limitVelocityOvertimeModule},set:function(t){t&&(this._limitVelocityOvertimeModule=t)}},{key:"rotationOvertimeModule",get:function(){return this._rotationOvertimeModule},set:function(t){t&&(this._rotationOvertimeModule=t)}},{key:"textureAnimationModule",get:function(){return this._textureAnimationModule},set:function(t){t&&(this._textureAnimationModule=t)}},{key:"noiseModule",get:function(){return this._noiseModule},set:function(t){t&&(this._noiseModule=t)}},{key:"trailModule",get:function(){return this._trailModule},set:function(t){t&&(this._trailModule=t)}},{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isStopped",get:function(){return this._isStopped}},{key:"isEmitting",get:function(){return this._isEmitting}},{key:"time",get:function(){return this._time}}]),e}(aG),Mwt.CullingMode=Tmt,Hxt=yh((Uxt=Mwt).prototype,"startColor",[KSt,Uh],(function(){return new smt})),Wxt=yh(Uxt.prototype,"scaleSpace",[JSt,Uh],(function(){return wmt.Local})),jxt=yh(Uxt.prototype,"startSize3D",[Uh],(function(){return!1})),qxt=yh(Uxt.prototype,"startSizeX",[ZSt,$St],(function(){return new Apt})),Xxt=yh(Uxt.prototype,"startSizeY",[txt,Uh],(function(){return new Apt})),Yxt=yh(Uxt.prototype,"startSizeZ",[ext,Uh],(function(){return new Apt})),Qxt=yh(Uxt.prototype,"startSpeed",[ixt,Uh],(function(){return new Apt})),Kxt=yh(Uxt.prototype,"startRotation3D",[Uh],(function(){return!1})),Jxt=yh(Uxt.prototype,"startRotationX",[nxt,Uh],(function(){return new Apt})),Zxt=yh(Uxt.prototype,"startRotationY",[rxt,Uh],(function(){return new Apt})),$xt=yh(Uxt.prototype,"startRotationZ",[sxt,axt],(function(){return new Apt})),twt=yh(Uxt.prototype,"startDelay",[oxt,Uh],(function(){return new Apt})),ewt=yh(Uxt.prototype,"startLifetime",[hxt,Uh],(function(){return new Apt})),iwt=yh(Uxt.prototype,"duration",[Uh],(function(){return 5})),nwt=yh(Uxt.prototype,"loop",[Uh],(function(){return!0})),y(Uxt.prototype,"simulationSpace",[uxt,Uh],Object.getOwnPropertyDescriptor(Uxt.prototype,"simulationSpace"),Uxt.prototype),rwt=yh(Uxt.prototype,"simulationSpeed",[Uh],(function(){return 1})),swt=yh(Uxt.prototype,"playOnAwake",[Uh],(function(){return!0})),awt=yh(Uxt.prototype,"gravityModifier",[lxt,Uh],(function(){return new Apt})),owt=yh(Uxt.prototype,"rateOverTime",[cxt,Uh],(function(){return new Apt})),hwt=yh(Uxt.prototype,"rateOverDistance",[fxt,Uh],(function(){return new Apt})),uwt=yh(Uxt.prototype,"bursts",[dxt,Uh],(function(){return[]})),y(Uxt.prototype,"renderCulling",[_xt],Object.getOwnPropertyDescriptor(Uxt.prototype,"renderCulling"),Uxt.prototype),lwt=yh(Uxt.prototype,"_renderCulling",[Uh],(function(){return!1})),y(Uxt.prototype,"cullingMode",[pxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"cullingMode"),Uxt.prototype),cwt=yh(Uxt.prototype,"_cullingMode",[Uh],(function(){return Tmt.Pause})),y(Uxt.prototype,"aabbHalfX",[mxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"aabbHalfX"),Uxt.prototype),fwt=yh(Uxt.prototype,"_aabbHalfX",[Uh],(function(){return 0})),y(Uxt.prototype,"aabbHalfY",[gxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"aabbHalfY"),Uxt.prototype),dwt=yh(Uxt.prototype,"_aabbHalfY",[Uh],(function(){return 0})),y(Uxt.prototype,"aabbHalfZ",[vxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"aabbHalfZ"),Uxt.prototype),_wt=yh(Uxt.prototype,"_aabbHalfZ",[Uh],(function(){return 0})),pwt=yh(Uxt.prototype,"_dataCulling",[Uh,yxt],(function(){return!1})),y(Uxt.prototype,"sharedMaterials",[Su,Uh],Object.getOwnPropertyDescriptor(Uxt.prototype,"sharedMaterials"),Uxt.prototype),mwt=yh(Uxt.prototype,"_colorOverLifetimeModule",[bxt],(function(){return null})),y(Uxt.prototype,"colorOverLifetimeModule",[Sxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"colorOverLifetimeModule"),Uxt.prototype),gwt=yh(Uxt.prototype,"_shapeModule",[xxt],(function(){return null})),y(Uxt.prototype,"shapeModule",[wxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"shapeModule"),Uxt.prototype),vwt=yh(Uxt.prototype,"_sizeOvertimeModule",[Txt],(function(){return null})),y(Uxt.prototype,"sizeOvertimeModule",[Cxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"sizeOvertimeModule"),Uxt.prototype),ywt=yh(Uxt.prototype,"_velocityOvertimeModule",[Axt],(function(){return null})),y(Uxt.prototype,"velocityOvertimeModule",[Dxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"velocityOvertimeModule"),Uxt.prototype),bwt=yh(Uxt.prototype,"_forceOvertimeModule",[Ixt],(function(){return null})),y(Uxt.prototype,"forceOvertimeModule",[Bxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"forceOvertimeModule"),Uxt.prototype),Swt=yh(Uxt.prototype,"_limitVelocityOvertimeModule",[Mxt],(function(){return null})),y(Uxt.prototype,"limitVelocityOvertimeModule",[Pxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"limitVelocityOvertimeModule"),Uxt.prototype),xwt=yh(Uxt.prototype,"_rotationOvertimeModule",[Ext],(function(){return null})),y(Uxt.prototype,"rotationOvertimeModule",[kxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"rotationOvertimeModule"),Uxt.prototype),wwt=yh(Uxt.prototype,"_textureAnimationModule",[Oxt],(function(){return null})),y(Uxt.prototype,"textureAnimationModule",[Rxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"textureAnimationModule"),Uxt.prototype),Twt=yh(Uxt.prototype,"_noiseModule",[Fxt],(function(){return null})),y(Uxt.prototype,"noiseModule",[Lxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"noiseModule"),Uxt.prototype),Cwt=yh(Uxt.prototype,"_trailModule",[Vxt],(function(){return null})),y(Uxt.prototype,"trailModule",[Nxt],Object.getOwnPropertyDescriptor(Uxt.prototype,"trailModule"),Uxt.prototype),Awt=yh(Uxt.prototype,"renderer",[zxt,Uh],(function(){return new Pwt})),Dwt=yh(Uxt.prototype,"_prewarm",[Uh],(function(){return!1})),Iwt=yh(Uxt.prototype,"_capacity",[Uh],(function(){return 100})),Bwt=yh(Uxt.prototype,"_simulationSpace",[Uh],(function(){return wmt.Local})),Gxt=Uxt))||Gxt)||Gxt)),$wt=t("eX",function(){function t(){}return t.instantiate=function(t){this.registeredSceneEvent||(wE.on("director_before_scene_launch",this.onSceneUnload,this),this.registeredSceneEvent=!0);var e=t._uuid;if(!this.particleSystemPool.has(e)){var i=new Ga((function(){return r0(t)||new ry}),1,(function(t){return t.destroy()}));this.particleSystemPool.set(e,i)}return this.particleSystemPool.get(e).alloc()},t.destroy=function(t){var e,i,n=null===(e=t.prefab)||void 0===e||null===(i=e.asset)||void 0===i?void 0:i.uuid;n&&this.particleSystemPool.has(n)&&(this.stop(t),this.particleSystemPool.get(n).free(t))},t.play=function(t){for(var e,i=p(t.getComponentsInChildren(Zwt));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=p(t.getComponentsInChildren(Zwt));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());$wt.particleSystemPool=new Map,$wt.registeredSceneEvent=!1,pt(Tyt.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),_t(Zwt.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),T.ParticleSystemComponent=Zwt,ue(Zwt,"cc.ParticleSystemComponent"),T.BillboardComponent=vpt,ue(vpt,"cc.BillboardComponent"),T.LineComponent=cmt,ue(cmt,"cc.LineComponent"),T.ParticleUtils=$wt;var tTt=Me({GRAVITY:0,RADIUS:1}),eTt=Me({FREE:0,RELATIVE:1,GROUPED:2}),iTt=new ns,nTt=new ns,rTt=new ns,sTt=new ns,aTt=new kn,oTt=HR(NR);function hTt(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}var uTt,lTt,cTt,fTt=function(){this.pos=new ns(0,0),this.startPos=new ns(0,0),this.color=new nr(0,0,0,255),this.deltaColor={r:0,g:0,b:0,a:255},this.size=0,this.deltaSize=0,this.rotation=0,this.deltaRotation=0,this.timeToLive=0,this.drawPos=new ns(0,0),this.aspectRatio=1,this.dir=new ns(0,0),this.radialAccel=0,this.tangentialAccel=0,this.angle=0,this.degreesPerSecond=0,this.radius=0,this.deltaRadius=0},dTt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(){return this._get()||new fTt},e}(me),_Tt=new dTt((function(t){t.pos.set(ns.ZERO),t.startPos.set(ns.ZERO),t.color.set(0,0,0,255),t.deltaColor.r=t.deltaColor.g=t.deltaColor.b=0,t.deltaColor.a=255,t.size=0,t.deltaSize=0,t.rotation=0,t.deltaRotation=0,t.timeToLive=0,t.drawPos.set(ns.ZERO),t.aspectRatio=1,t.dir.set(ns.ZERO),t.radialAccel=0,t.tangentialAccel=0,t.angle=0,t.degreesPerSecond=0,t.radius=0,t.deltaRadius=0}),1024),pTt=function(){function t(t){this.particles=[],this.active=!1,this.uvFilled=0,this.finished=!1,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this._worldRotation=0,this.sys=t,this.particles=[],this.active=!1,this.readyToPlay=!0,this.finished=!1,this.elapsed=0,this.emitCounter=0,this.uvFilled=0,this._worldRotation=0}var e=t.prototype;return e.stop=function(){this.active=!1,this.readyToPlay=!1,this.elapsed=this.sys.duration,this.emitCounter=0},e.reset=function(){this.active=!0,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this.finished=!1;for(var t=this.particles,e=0;e1?h=o/u:o=h*u;var l=o/2,c=h/2;if(t.rotation){var f=-l,d=-c,_=l,p=c,m=-Ji(t.rotation),g=Math.cos(m),v=Math.sin(m);r[n]=f*g-d*v+s,r[n+1]=f*v+d*g+a,r[n+2]=0,r[n+9]=_*g-d*v+s,r[n+10]=_*v+d*g+a,r[n+11]=0,r[n+18]=f*g-p*v+s,r[n+19]=f*v+p*g+a,r[n+20]=0,r[n+27]=_*g-p*v+s,r[n+28]=_*v+p*g+a,r[n+29]=0}else r[n]=s-l,r[n+1]=a-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=a-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=a+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=a+c,r[n+29]=0;var y=t.color;aTt.x=y.r/255,aTt.y=y.g/255,aTt.z=y.b/255,aTt.w=y.a/255,kn.toArray(r,aTt,n+5),kn.toArray(r,aTt,n+14),kn.toArray(r,aTt,n+23),kn.toArray(r,aTt,n+32)},e.step=function(t){var e=this.sys.assembler,i=this.sys,n=i.node,r=this.particles;if(t=t>e.maxParticleDeltaTime?e.maxParticleDeltaTime:t,n.updateWorldTransform(),i.positionType===eTt.FREE){this._worldRotation=hTt(n);var s=n.worldMatrix;iTt.x=s.m12,iTt.y=s.m13}else i.positionType===eTt.RELATIVE?(this._worldRotation=n.eulerAngles.z,iTt.x=n.position.x,iTt.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var a=1/i.emissionRate;for(r.lengtha;)this.emitParticle(iTt),this.emitCounter-=a;this.elapsed+=t,-1!==i.duration&&i.durationthis.uvFilled&&this.updateUVs();for(var u=0;u0){if(i.emitterMode===tTt.GRAVITY){var c=sTt,f=nTt,d=rTt;(l.pos.x||l.pos.y)&&(f.set(l.pos),f.normalize()),d.set(f),f.multiplyScalar(l.radialAccel);var _=d.x;d.x=-d.y,d.y=_,d.multiplyScalar(l.tangentialAccel),c.set(f),c.add(d),c.add(i.gravity),c.multiplyScalar(t),l.dir.add(c),c.set(l.dir),c.multiplyScalar(t),l.pos.add(c)}else l.angle+=l.degreesPerSecond*t,l.radius+=l.deltaRadius*t,l.pos.x=-Math.cos(l.angle)*l.radius,l.pos.y=-Math.sin(l.angle)*l.radius;l.color.r+=l.deltaColor.r*t,l.color.g+=l.deltaColor.g*t,l.color.b+=l.deltaColor.b*t,l.color.a+=l.deltaColor.a*t,l.size+=l.deltaSize*t,l.size<0&&(l.size=0),l.rotation+=l.deltaRotation*t;var p=nTt;p.set(l.pos),i.positionType!==eTt.GROUPED&&p.add(l.startPos);var m=oTt*u*4;this.updateParticleBuffer(l,p,o,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),_Tt.put(g),r.length--,o.resize(o.vertexCount-4,o.indexCount-6)}}this.renderData.material=this.sys.getRenderMaterial(0),this.renderData.frame=this.sys._renderSpriteFrame,o.setRenderDrawInfoAttributes(),0!==r.length||this.active||this.readyToPlay||(this.finished=!0,i._finishedSimulation())},e.requestData=function(t,e){var i=this.renderData.indexCount;this.renderData.request(t,e);for(var n=this.renderData.indexCount/6,r=this.renderData.iData,s=i;s=0?ns;s>=0?++n:--n)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(s);var u=255-this.transparency.indexed.length;if(u>0)for(r=0;u>=0?ru;u>=0?++r:--r)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(s)[0];break;case 2:this.transparency.rgb=this.read(s)}break;case"tEXt":var l=this.read(s),c=l.indexOf(0),f=String.fromCharCode.apply(String,l.slice(0,c));this.text[f]=String.fromCharCode.apply(String,l.slice(c+1));break;case"IEND":e&&this.animation.frames.push(e),this.colors=function(){switch(i.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this);var d=this.colorType;this.hasAlphaChannel=4===d||6===d;var _=this.colors+(this.hasAlphaChannel?1:0);return this.pixelBitlength=this.bits*_,this.colorSpace=function(){switch(i.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData instanceof Uint8Array||(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=s}if(this.pos+=4,this.pos>this.data.length)throw new Error(ct(6017))}}var e=t.prototype;return e.read=function(t){var e=0,i=[];for(e=0;t>=0?et;t>=0?++e:--e)i.push(this.data[this.pos++]);return i},e.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},e.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},e.decodePixels=function(t){if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);t=new Wk.Inflate(t,{index:0,verify:!1}).decompress();for(var e=this.pixelBitlength/8,i=e*this.width,n=new Uint8Array(i*this.height),r=t.length,s=0,a=0,o=0,h=0,u=0,l=0,c=0,f=0,d=0,_=0,p=0,m=0,g=0,v=0,y=0,b=0,S=0,x=0,w=0;a>>8*(4-s)):r.push(n);else for(var a=0;a=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+o)),r.push(this.getUint32(n+o+4))):et(8e3):r.push(this.getBytes(s,n+o))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},e.getBytes=function(t,e){if(t<=0)et(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);et(8002)}return 0},e.getBits=function(t,e,i){i=i||0;var n=e+Math.floor(i/8),r=i+t,s=32-t,a=0,o=0;return r<=0?et(6023):r<=8?(a=24+i,o=this.getUint8(n)):r<=16?(a=16+i,o=this.getUint16(n)):r<=32?(a=i,o=this.getUint32(n)):et(6022),{bits:o<>>s,byteOffset:n+Math.floor(r/8),bitOffset:r%8}},e.parseFileDirectory=function(t){var e=this.getUint16(t),i=[],n=0,r=0;for(n=t+2,r=0;r=0&&R<=127?g=R+1:R>=-127&&R<=-1?v=1-R:C=!0}else{for(var F=this.getUint8(b+x),L=0;L0)for(var a=0;a>4,i=(15&r)<<4|(s=xTt[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(a=xTt[t.charCodeAt(h++)]),o.push(String.fromCharCode(e)),64!==s&&o.push(String.fromCharCode(i)),64!==a&&o.push(String.fromCharCode(n));return o.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}},ATt=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(ATt.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};ATt.gunzip=function(t){return t.constructor===Array||t.constructor,new ATt(t).gunzip()[0][0]},ATt.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},ATt.LITERALS=288,ATt.NAMEMAX=256,ATt.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],ATt.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],ATt.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],ATt.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],ATt.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],ATt.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ATt.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},ATt.prototype.readByte=function(){return this.bits+=8,this.bytepos>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},ATt.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=ATt.bitReverse[e]>>8-t),e},ATt.prototype.flushBuffer=function(){this.bIdx=0},ATt.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},ATt.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},ATt.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},ATt.prototype.CreateTree=function(t,e,i){var n;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,n=0;n<17;n++)this.fpos[n]=0;return this.len=0,this.Rec()?-1:0},ATt.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,_=this.readBits(ATt.cplext[a])+ATt.cplens[a],a=ATt.bitReverse[this.readBits(5)]>>3,ATt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(ATt.cpdext[a]-8)<<8):p=this.readBits(ATt.cpdext[a]),p+=ATt.cpdist[a],a=0;a<_;a++){var s=this.buf32k[this.bIdx-p&32767];this.addBuffer(s)}}else if(2===e){var a,o,h,u,l,c=new Array(320);for(h=257+this.readBits(5),u=1+this.readBits(5),l=4+this.readBits(4),a=0;a<19;a++)c[a]=0;for(a=0;ao)return this.flushBuffer(),1;for(f=i?c[i-1]:0;a--;)c[i++]=f}else{if(i+(a=17===a?3+this.readBits(3):11+this.readBits(7))>o)return this.flushBuffer(),1;for(;a--;)c[i++]=0}for(_=this.literalTree.length,i=0;i<_;i++)this.literalTree[i]=new ATt.HufNode;if(this.CreateTree(this.literalTree,h,c,0))return this.flushBuffer(),1;for(_=this.literalTree.length,i=0;i<_;i++)this.distanceTree[i]=new ATt.HufNode;var d=new Array;for(i=h;i=256){var _,p;if(0==(a-=256))break;for(a--,_=this.readBits(ATt.cplext[a])+ATt.cplens[a],a=this.DecodeValue(this.distanceTree),ATt.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(ATt.cpdext[a]-8)<<8):p=this.readBits(ATt.cpdext[a]),p+=ATt.cpdist[a];_--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},ATt.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},CCt.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a};var DCt,ICt,BCt,MCt,PCt,ECt,kCt,OCt,RCt,FCt,LCt,VCt=t("e$",(DTt=Bh("cc.ParticleSystem2D"),ITt=fu(gTt),BTt=fu(yO),MTt=fu(eTt),PTt=fu(tTt),ETt=Hh("preview"),DTt((TCt=function(t){function e(){var e;return(e=t.call(this)||this).duration=RTt&&RTt(),e.emissionRate=FTt&&FTt(),e.life=LTt&<t(),e.lifeVar=VTt&&VTt(),e.angle=NTt&&NTt(),e.angleVar=zTt&&zTt(),e.startSize=GTt&>t(),e.startSizeVar=UTt&&UTt(),e.endSize=HTt&&HTt(),e.endSizeVar=WTt&&WTt(),e.startSpin=jTt&&jTt(),e.startSpinVar=qTt&&qTt(),e.endSpin=XTt&&XTt(),e.endSpinVar=YTt&&YTt(),e.sourcePos=QTt&&QTt(),e.posVar=KTt&&KTt(),e.emitterMode=JTt&&JTt(),e.gravity=ZTt&&ZTt(),e.speed=$Tt&&$Tt(),e.speedVar=tCt&&tCt(),e.tangentialAccel=eCt&&eCt(),e.tangentialAccelVar=iCt&&iCt(),e.radialAccel=nCt&&nCt(),e.radialAccelVar=rCt&&rCt(),e.rotationIsDir=sCt&&sCt(),e.startRadius=aCt&&aCt(),e.startRadiusVar=oCt&&oCt(),e.endRadius=hCt&&hCt(),e.endRadiusVar=uCt&&uCt(),e.rotatePerS=lCt&&lCt(),e.rotatePerSVar=cCt&&cCt(),e.aspectRatio=1,e.playOnLoad=fCt&&fCt(),e.autoRemoveOnFinish=dCt&&dCt(),e._preview=_Ct&&_Ct(),e._custom=pCt&&pCt(),e._file=mCt&&mCt(),e._spriteFrame=gCt&&gCt(),e._totalParticles=vCt&&vCt(),e._startColor=yCt&&yCt(),e._startColorVar=bCt&&bCt(),e._endColor=SCt&&SCt(),e._endColorVar=xCt&&xCt(),e._positionType=wCt&&wCt(),e._stopped=!0,e._useFile=void 0,e.initProperties(),e._useFile=!1,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMaterial(),this._updatePositionType()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._simulator.uvFilled=0,this._simulator.renderData&&this._assembler&&this._assembler.removeData(this._simulator.renderData)},i.initProperties=function(){this._previewTimer=null,this._focused=!1,this.aspectRatio=1,this._simulator=new pTt(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=ACt(this.node),e=0;e=this.totalParticles},i._applyFile=function(){var t=this._file;if(t){if(!t)return void ot(6029);if(!this.isValid)return;this._plistFile=t.nativeUrl,this._custom||(this._spriteFrame!==t.spriteFrame&&(this.spriteFrame=t.spriteFrame),this._initWithDictionary(t._nativeAsset)),this._spriteFrame?!this._renderSpriteFrame&&this._spriteFrame&&this._applySpriteFrame():t.spriteFrame?this.spriteFrame=t.spriteFrame:this._custom&&this._initTextureWithDictionary(t._nativeAsset)}},i._initTextureWithDictionary=function(t){var e,i=this;if(t.spriteFrameUuid){var n=t.spriteFrameUuid;Sw.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),Y(e)):i.spriteFrame=n}))}else{var r=Eo(this._plistFile,t.textureFileName||"");if(t.textureFileName)Sw.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),Y(e)):i.spriteFrame=n?yO.createWithImage(n):yO.createWithImage(Cw.get("white-texture"))}));else if(t.textureImageData){var s=t.textureImageData;if(!(s&&s.length>0))return!1;var a=r;this.file&&(a+="-"+this.file.uuid);var o=Sw.assets.get(a);if(!o){var h=CCt.unzipBase64AsArray(s,1);if(!h)return st(6030,this._file.name),!1;var u=(e=h).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]?1:e.length>2&&(73===e[0]&&73===e[1]||77===e[0]&&77===e[1]||255===e[0]&&216===e[1])?2:10;if(2!==u&&1!==u)return st(6031,this._file.name),!1;var l=D.document.createElement("canvas");1===u?new vTt(h).render(l):(this._tiffReader||(this._tiffReader=new yTt),this._tiffReader.parseTIFF(h,l)),o=new vm(l),Sw.assets.add(a,o)}o||st(6032,this._file.name),this.spriteFrame=o?yO.createWithImage(o):yO.createWithImage(Cw.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this._useFile=!0,this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this._srcBlendFactor=parseInt(t.blendFuncSource||2),this._dstBlendFactor=parseInt(t.blendFuncDestination||4);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*parseFloat(t.startColorVarianceRed||0),n.g=255*parseFloat(t.startColorVarianceGreen||0),n.b=255*parseFloat(t.startColorVarianceBlue||0),n.a=255*parseFloat(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*parseFloat(t.finishColorRed||0),r.g=255*parseFloat(t.finishColorGreen||0),r.b=255*parseFloat(t.finishColorBlue||0),r.a=255*parseFloat(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*parseFloat(t.finishColorVarianceRed||0),s.g=255*parseFloat(t.finishColorVarianceGreen||0),s.b=255*parseFloat(t.finishColorVarianceBlue||0),s.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(void 0!==t.positionType?t.positionType:eTt.FREE),this.sourcePos.set(0,0),this.posVar.set(parseFloat(t.sourcePositionVariancex||0),parseFloat(t.sourcePositionVariancey||0)),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||tTt.GRAVITY),this.emitterMode===tTt.GRAVITY){this.gravity.set(parseFloat(t.gravityx||0),parseFloat(t.gravityy||0)),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var a=t.rotationIsDir||"";null!==a?(a=a.toString().toLowerCase(),this.rotationIsDir="true"===a||"1"===a):this.rotationIsDir=!1}else{if(this.emitterMode!==tTt.RADIUS)return st(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},i._syncAspect=function(){if(this._renderSpriteFrame){var t=this._renderSpriteFrame.rect;this.aspectRatio=t.width/t.height}},i._applySpriteFrame=function(){this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame,this._renderSpriteFrame?this._renderSpriteFrame.texture&&(this._simulator&&this._simulator.updateUVs(!0),this._syncAspect(),this._updateMaterial(),this._stopped=!1,this.markForUpdateRenderData()):this.resetSystem()},i._getTexture=function(){return this._renderSpriteFrame&&this._renderSpriteFrame.texture},i._updateMaterial=function(){if(this._customMaterial){this.setSharedMaterial(this._customMaterial,0);var t=this.getRenderMaterial(0).passes[0].blendState.targets[0];this._dstBlendFactor=t.blendDst,this._srcBlendFactor=t.blendSrc}var e=this.getMaterialInstance(0);e&&e.recompileShaders({USE_LOCAL:this._positionType!==eTt.FREE}),e&&e.passes.length>0&&this._updateBlendFunc()},i._finishedSimulation=function(){this.resetSystem(),this.stopSystem(),this.markForUpdateRenderData(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()},i._canRender=function(){return t.prototype._canRender.call(this)&&!this._stopped&&null!==this._renderSpriteFrame&&void 0!==this._renderSpriteFrame},i._render=function(t){this._positionType===eTt.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===eTt.GROUPED?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node):t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,null)},i._updatePositionType=function(){this._positionType===eTt.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===eTt.GROUPED?(this._renderEntity.setRenderTransform(this.node),this._renderEntity.setUseLocal(!0)):(this._renderEntity.setRenderTransform(null),this._renderEntity.setUseLocal(!1))},n(e,[{key:"custom",get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile(),this._updateMaterial())}},{key:"file",get:function(){return this._file},set:function(t){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._renderSpriteFrame!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),this._applySpriteFrame())}},{key:"particleCount",get:function(){return this._simulator.particles.length}},{key:"totalParticles",get:function(){return this._totalParticles},set:function(t){this._totalParticles!==t&&(this._totalParticles=t)}},{key:"startColor",get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},{key:"startColorVar",get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},{key:"color",get:function(){return this._color},set:function(){}},{key:"endColor",get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},{key:"endColorVar",get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},{key:"positionType",get:function(){return this._positionType},set:function(t){this._positionType=t,this._updateMaterial(),this._updatePositionType()}},{key:"preview",get:function(){return this._preview},set:function(t){t?this._startPreview():this._stopPreview(),this._preview=t}},{key:"stopped",get:function(){return this._stopped}},{key:"active",get:function(){return this._simulator.active}},{key:"assembler",get:function(){return this._assembler}}]),e}(VF),TCt.EmitterMode=tTt,TCt.PositionType=eTt,TCt.DURATION_INFINITY=-1,TCt.START_SIZE_EQUAL_TO_END_SIZE=-1,TCt.START_RADIUS_EQUAL_TO_END_RADIUS=-1,y((OTt=TCt).prototype,"file",[ITt],Object.getOwnPropertyDescriptor(OTt.prototype,"file"),OTt.prototype),y(OTt.prototype,"spriteFrame",[BTt],Object.getOwnPropertyDescriptor(OTt.prototype,"spriteFrame"),OTt.prototype),RTt=yh(OTt.prototype,"duration",[Uh],(function(){return-1})),FTt=yh(OTt.prototype,"emissionRate",[Uh],(function(){return 10})),LTt=yh(OTt.prototype,"life",[Uh],(function(){return 1})),VTt=yh(OTt.prototype,"lifeVar",[Uh],(function(){return 0})),y(OTt.prototype,"color",[Su],Object.getOwnPropertyDescriptor(OTt.prototype,"color"),OTt.prototype),NTt=yh(OTt.prototype,"angle",[Uh],(function(){return 90})),zTt=yh(OTt.prototype,"angleVar",[Uh],(function(){return 20})),GTt=yh(OTt.prototype,"startSize",[Uh],(function(){return 50})),UTt=yh(OTt.prototype,"startSizeVar",[Uh],(function(){return 0})),HTt=yh(OTt.prototype,"endSize",[Uh],(function(){return 0})),WTt=yh(OTt.prototype,"endSizeVar",[Uh],(function(){return 0})),jTt=yh(OTt.prototype,"startSpin",[Uh],(function(){return 0})),qTt=yh(OTt.prototype,"startSpinVar",[Uh],(function(){return 0})),XTt=yh(OTt.prototype,"endSpin",[Uh],(function(){return 0})),YTt=yh(OTt.prototype,"endSpinVar",[Uh],(function(){return 0})),QTt=yh(OTt.prototype,"sourcePos",[Uh],(function(){return ns.ZERO.clone()})),KTt=yh(OTt.prototype,"posVar",[Uh],(function(){return ns.ZERO.clone()})),y(OTt.prototype,"positionType",[MTt],Object.getOwnPropertyDescriptor(OTt.prototype,"positionType"),OTt.prototype),JTt=yh(OTt.prototype,"emitterMode",[Uh,PTt],(function(){return tTt.GRAVITY})),ZTt=yh(OTt.prototype,"gravity",[Uh],(function(){return ns.ZERO.clone()})),$Tt=yh(OTt.prototype,"speed",[Uh],(function(){return 180})),tCt=yh(OTt.prototype,"speedVar",[Uh],(function(){return 50})),eCt=yh(OTt.prototype,"tangentialAccel",[Uh],(function(){return 80})),iCt=yh(OTt.prototype,"tangentialAccelVar",[Uh],(function(){return 0})),nCt=yh(OTt.prototype,"radialAccel",[Uh],(function(){return 0})),rCt=yh(OTt.prototype,"radialAccelVar",[Uh],(function(){return 0})),sCt=yh(OTt.prototype,"rotationIsDir",[Uh],(function(){return!1})),aCt=yh(OTt.prototype,"startRadius",[Uh],(function(){return 0})),oCt=yh(OTt.prototype,"startRadiusVar",[Uh],(function(){return 0})),hCt=yh(OTt.prototype,"endRadius",[Uh],(function(){return 0})),uCt=yh(OTt.prototype,"endRadiusVar",[Uh],(function(){return 0})),lCt=yh(OTt.prototype,"rotatePerS",[Uh],(function(){return 0})),cCt=yh(OTt.prototype,"rotatePerSVar",[Uh],(function(){return 0})),fCt=yh(OTt.prototype,"playOnLoad",[Uh],(function(){return!0})),dCt=yh(OTt.prototype,"autoRemoveOnFinish",[Uh],(function(){return!1})),_Ct=yh(OTt.prototype,"_preview",[ETt],(function(){return!0})),pCt=yh(OTt.prototype,"_custom",[Uh],(function(){return!1})),mCt=yh(OTt.prototype,"_file",[Uh],(function(){return null})),gCt=yh(OTt.prototype,"_spriteFrame",[Uh],(function(){return null})),vCt=yh(OTt.prototype,"_totalParticles",[Uh],(function(){return 150})),yCt=yh(OTt.prototype,"_startColor",[Uh],(function(){return new nr(255,255,255,255)})),bCt=yh(OTt.prototype,"_startColorVar",[Uh],(function(){return new nr(0,0,0,0)})),SCt=yh(OTt.prototype,"_endColor",[Uh],(function(){return new nr(255,255,255,0)})),xCt=yh(OTt.prototype,"_endColorVar",[Uh],(function(){return new nr(0,0,0,0)})),wCt=yh(OTt.prototype,"_positionType",[Uh],(function(){return eTt.FREE})),kTt=OTt))||kTt)),NCt=function(){function t(t,e){this.point=new ns,this.dir=new ns,this.distance=0,this.time=0,t&&this.point.set(t),e&&this.dir.set(e)}var e=t.prototype;return e.setPoint=function(t,e){this.point.x=t,this.point.y=e},e.setDir=function(t,e){this.dir.x=t,this.dir.y=e},t}(),zCt=t("f0",(DCt=Bh("cc.MotionStreak"),ICt=fu(hv),DCt((LCt=function(t){function e(){var e;return(e=t.call(this)||this)._preview=PCt&&PCt(),e._fadeTime=ECt&&ECt(),e._minSeg=kCt&&kCt(),e._stroke=OCt&&OCt(),e._texture=RCt&&RCt(),e._fastMode=FCt&&FCt(),e._points=[],e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.reset()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._renderData.material=this.material,this._updateColor())},i.onFocusInEditor=function(){this._preview&&this.reset()},i.onLostFocusInEditor=function(){this._preview&&this.reset()},i.reset=function(){this._points.length=0,this._renderData&&this._renderData.clear()},i.lateUpdate=function(t){this._assembler&&this._assembler.update(this,t)},i._render=function(t){t.commitComp(this,this._renderData,this._texture,this._assembler,null)},n(e,[{key:"preview",get:function(){return this._preview},set:function(t){this._preview=t,this.reset()}},{key:"fadeTime",get:function(){return this._fadeTime},set:function(t){this._fadeTime=t,this.reset()}},{key:"minSeg",get:function(){return this._minSeg},set:function(t){this._minSeg=t}},{key:"stroke",get:function(){return this._stroke},set:function(t){this._stroke=t}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t)}},{key:"fastMode",get:function(){return this._fastMode},set:function(t){this._fastMode=t}},{key:"points",get:function(){return this._points}}]),e}(VF),LCt.Point=NCt,y((MCt=LCt).prototype,"texture",[ICt],Object.getOwnPropertyDescriptor(MCt.prototype,"texture"),MCt.prototype),PCt=yh(MCt.prototype,"_preview",[Uh],(function(){return!1})),ECt=yh(MCt.prototype,"_fadeTime",[Uh],(function(){return 1})),kCt=yh(MCt.prototype,"_minSeg",[Uh],(function(){return 1})),OCt=yh(MCt.prototype,"_stroke",[Uh],(function(){return 64})),RCt=yh(MCt.prototype,"_texture",[Uh],(function(){return null})),FCt=yh(MCt.prototype,"_fastMode",[Uh],(function(){return!1})),BCt=MCt))||BCt));new ns;var GCt,UCt=new ns,HCt=new ns;function WCt(t,e){return t.x=-e.y,t.y=e.x,t}var jCt={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(16,42),e},update:function(t,e){var i,n=t.stroke/2,r=t.node.worldMatrix,s=r.m12,a=r.m13,o=t.points;if(o.length>1){var h=o[0],u=h.point.x-s,l=h.point.y-a;u*u+l*l=0;w--){var T=o[w],C=T.point,A=T.dir;if(T.time-=e,T.time<0)o.splice(w,1);else{var D=T.time/S,I=o[w-1];if(!x){if(!I){o.splice(w,1);continue}C.x=I.point.x-A.x*D,C.y=I.point.y-A.y*D}x=!0,WCt(UCt,A);var B=D*v,M=f;b[M].x=C.x+UCt.x*n,b[M].y=C.y+UCt.y*n,b[M].u=1,b[M].v=D,b[M].color.set(p,m,g,B),b[M+=1].x=C.x-UCt.x*n,b[M].y=C.y-UCt.y*n,b[M].u=0,b[M].v=D,b[M].color.set(p,m,g,B),f+=2}}c=f<=2?0:3*(f-2),d.resize(f,c)}},updateWorldVertexAllData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;se?t:e}function O(t,e,i){return ti?i:t}var R=isFinite;function F(t){return t*t}function L(t){return 1/Math.sqrt(t)}var V=Math.sqrt,N=Math.pow;var z=Math.cos,G=Math.sin,U=Math.acos,H=Math.asin,W=Math.atan2;var j=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i=r){var e=1/t;this.x*=e,this.y*=e}return t},e.SelfNormalize=function(){var t=this.Length();if(t>=r){var e=1/t;this.x*=e,this.y*=e}return this},e.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},e.SelfRotateCosSin=function(t,e){var i=this.x;return this.x=t*i-e*this.y,this.y=e*i+t*this.y,this},e.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},e.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},e.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},e.SelfMinV=function(t){return this.x=E(this.x,t.x),this.y=E(this.y,t.y),this},e.SelfMaxV=function(t){return this.x=k(this.x,t.x),this.y=k(this.y,t.y),this},e.SelfAbs=function(){return this.x=P(this.x),this.y=P(this.y),this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},e.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return A(e,(function(){return new t}))},t.AbsV=function(t,e){return e.x=P(t.x),e.y=P(t.y),e},t.MinV=function(t,e,i){return i.x=E(t.x,e.x),i.y=E(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=k(t.x,e.x),i.y=k(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=O(t.x,e.x,i.x),n.y=O(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),a=Math.sin(e);return i.x=s*n-a*r,i.y=a*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},n(t,[{key:"x",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"y",get:function(){return this.data[1]},set:function(t){this.data[1]=t}}]),t}();j.ZERO=new j(0,0),j.UNITX=new j(1,0),j.UNITY=new j(0,1),j.s_t0=new j,j.s_t1=new j,j.s_t2=new j,j.s_t3=new j;var q=new j(0,0),X=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;ithis.m_count&&(this.m_min_count=this.m_count)},t}(),rt=function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=A(t,(function(){return null})),this.m_count=0}var e=t.prototype;return e.Reset=function(){return this.m_count=0,this},e.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},e.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},e.GetCount=function(){return this.m_count},t}(),st=function(){function t(){this.m_buffer=j.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}var e=t.prototype;return e.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},e.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},e.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},e.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},e.GetSupport=function(t){for(var e=0,i=j.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return e},e.GetSupportVertex=function(t){for(var e=0,i=j.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return this.m_vertices[e]},e.GetVertexCount=function(){return this.m_count},e.GetVertex=function(t){return this.m_vertices[t]},t}(),at=function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t}(),ot=function(){function t(){this.proxyA=new st,this.proxyB=new st,this.transformA=new J,this.transformB=new J,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t}(),ht=function(){function t(){this.pointA=new j,this.pointB=new j,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t}();t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var ut=function(){function t(){this.wA=new j,this.wB=new j,this.w=new j,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t}(),lt=function(){function t(){this.m_v1=new ut,this.m_v2=new ut,this.m_v3=new ut,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}var e=t.prototype;return e.ReadCache=function(t,e,i,n,s){this.m_count=t.count;for(var a=this.m_vertices,o=0;o1){var c=t.metric,f=this.GetMetric();(f<.5*c||2*c0?j.CrossOneV(e,t):j.CrossVOne(e,t);default:return t.SetZero()}},e.GetClosestPoint=function(t){switch(this.m_count){case 0:case 3:default:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2: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)}},e.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3: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,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}},e.GetMetric=function(){switch(this.m_count){case 0:case 1:default:return 0;case 2:return j.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return j.CrossVV(j.SubVV(this.m_v2.w,this.m_v1.w,j.s_t0),j.SubVV(this.m_v3.w,this.m_v1.w,j.s_t1))}},e.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=j.SubVV(i,e,t.s_e12),r=-j.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=j.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var a=1/(s+r);this.m_v1.a=s*a,this.m_v2.a=r*a,this.m_count=2},e.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=j.SubVV(i,e,t.s_e12),s=j.DotVV(e,r),a=j.DotVV(i,r),o=-s,h=j.SubVV(n,e,t.s_e13),u=j.DotVV(e,h),l=j.DotVV(n,h),c=-u,f=j.SubVV(n,i,t.s_e23),d=j.DotVV(i,f),_=j.DotVV(n,f),p=-d,m=j.CrossVV(r,h),g=m*j.CrossVV(i,n),v=m*j.CrossVV(n,e),y=m*j.CrossVV(e,i);if(o<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(a>0&&o>0&&y<=0){var b=1/(a+o);return this.m_v1.a=a*b,this.m_v2.a=o*b,void(this.m_count=2)}if(l>0&&c>0&&v<=0){var S=1/(l+c);return this.m_v1.a=l*S,this.m_v3.a=c*S,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(l<=0&&_<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(_>0&&p>0&&g<=0){var x=1/(_+p);return this.m_v2.a=_*x,this.m_v3.a=p*x,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var w=1/(g+v+y);this.m_v1.a=g*w,this.m_v2.a=v*w,this.m_v3.a=y*w,this.m_count=3},t}();lt.s_e12=new j,lt.s_e13=new j,lt.s_e23=new j;var ct=new lt,ft=[0,0,0],dt=[0,0,0],_t=new j,pt=new j,mt=new j,gt=new j,vt=new j;function yt(e,i,n){++t.b2_gjkCalls;var s=n.proxyA,o=n.proxyB,h=n.transformA,u=n.transformB,l=ct;l.ReadCache(i,s,h,o,u);for(var c=l.m_vertices,f=ft,d=dt,_=0,p=0;p<20;){_=l.m_count;for(var m=0;m<_;++m)f[m]=c[m].indexA,d[m]=c[m].indexB;switch(l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)break;var g=l.GetSearchDirection(pt);if(g.LengthSquared()S+x&&e.distance>r){e.distance-=S+x;var w=j.SubVV(e.pointB,e.pointA,mt);w.Normalize(),e.pointA.SelfMulAdd(S,w),e.pointB.SelfMulSub(x,w)}else{var T=j.MidVV(e.pointA,e.pointB,_t);e.pointA.Copy(T),e.pointB.Copy(T),e.distance=0}}}var bt,St=new j,xt=new lt,wt=new j,Tt=new j,Ct=new j,At=new j,Dt=new j,It=new j;(bt=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[bt.e_vertex=0]="e_vertex",bt[bt.e_face=1]="e_face";var Bt,Mt=function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return n(t,[{key:"key",get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255}},{key:"indexA",get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0}},{key:"indexB",get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0}},{key:"typeA",get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0}},{key:"typeB",get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0}}]),t}(),Pt=function(){function t(){this.cf=new Mt}var e=t.prototype;return e.Copy=function(t){return this.key=t.key,this},e.Clone=function(){return(new t).Copy(this)},n(t,[{key:"key",get:function(){return this.cf.key},set:function(t){this.cf.key=t}}]),t}(),Et=function(){function t(){this.localPoint=new j,this.normalImpulse=0,this.tangentImpulse=0,this.id=new Pt}t.MakeArray=function(e){return A(e,(function(){return new t}))};var e=t.prototype;return e.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},e.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t}();(Bt=t.b2ManifoldType||(t.b2ManifoldType={}))[Bt.e_unknown=-1]="e_unknown",Bt[Bt.e_circles=0]="e_circles",Bt[Bt.e_faceA=1]="e_faceA",Bt[Bt.e_faceB=2]="e_faceB";var kt,Ot=function(){function e(){this.points=Et.MakeArray(2),this.localNormal=new j,this.localPoint=new j,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}var i=e.prototype;return i.Reset=function(){for(var e=0;e<2;++e)this.points[e].Reset();this.localNormal.SetZero(),this.localPoint.SetZero(),this.type=t.b2ManifoldType.e_unknown,this.pointCount=0},i.Copy=function(t){this.pointCount=t.pointCount;for(var e=0;e<2;++e)this.points[e].Copy(t.points[e]);return this.localNormal.Copy(t.localNormal),this.localPoint.Copy(t.localPoint),this.type=t.type,this},i.Clone=function(){return(new e).Copy(this)},e}(),Rt=function(){function e(){this.normal=new j,this.points=j.MakeArray(2),this.separations=D(2)}return e.prototype.Initialize=function(i,n,r,s,o){if(0!==i.pointCount)switch(i.type){case t.b2ManifoldType.e_circles:this.normal.Set(1,0);var h=J.MulXV(n,i.localPoint,e.Initialize_s_pointA),u=J.MulXV(s,i.points[0].localPoint,e.Initialize_s_pointB);j.DistanceSquaredVV(h,u)>a&&j.SubVV(u,h,this.normal).SelfNormalize();var l=j.AddVMulSV(h,r,this.normal,e.Initialize_s_cA),c=j.SubVMulSV(u,o,this.normal,e.Initialize_s_cB);j.MidVV(l,c,this.points[0]),this.separations[0]=j.DotVV(j.SubVV(c,l,j.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:K.MulRV(n.q,i.localNormal,this.normal);for(var f=J.MulXV(n,i.localPoint,e.Initialize_s_planePoint),d=0;dp){var g=_;_=p,p=g,m=1}if(_>n&&(f.x=m,f.y=0,n=_),n>(s=E(s,p)))return!1}if(cb){var x=y;y=b,b=x,S=1}if(y>n&&(f.x=0,f.y=S,n=y),n>(s=E(s,b)))return!1}return!(n<0||e.maxFraction0;){var n=i.Pop();if(null!==n&&n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.QueryPoint=function(t,e){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(null!==n&&n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.RayCast=function(e,i){var n=e.p1,r=e.p2,s=j.SubVV(r,n,t.s_r);s.Normalize();var a=j.CrossOneV(s,t.s_v),o=j.AbsV(a,t.s_abs_v),h=e.maxFraction,u=t.s_segmentAABB,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y);u.lowerBound.x=E(n.x,l),u.lowerBound.y=E(n.y,c),u.upperBound.x=k(n.x,l),u.upperBound.y=k(n.y,c);var f=this.m_stack.Reset();for(f.Push(this.m_root);f.GetCount()>0;){var d=f.Pop();if(null!==d&&zt(d.aabb,u)){var _=d.aabb.GetCenter(),p=d.aabb.GetExtents();if(!(P(j.DotVV(a,j.SubVV(n,_,j.s_t0)))-j.DotVV(o,p)>0))if(d.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,d);if(0===g)return;g>0&&(h=g,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y),u.lowerBound.x=E(n.x,l),u.lowerBound.y=E(n.y,c),u.upperBound.x=k(n.x,l),u.upperBound.y=k(n.y,c))}else f.Push(d.child1),f.Push(d.child2)}}},e.AllocateNode=function(){if(null!==this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,e}return new Xt(t.s_node_id++)},e.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,t.Reset(),this.m_freeList=t},e.CreateProxy=function(t,e){var i=this.AllocateNode();return i.aabb.lowerBound.x=t.lowerBound.x-.1,i.aabb.lowerBound.y=t.lowerBound.y-.1,i.aabb.upperBound.x=t.upperBound.x+.1,i.aabb.upperBound.y=t.upperBound.y+.1,i.userData=e,i.height=0,this.InsertLeaf(i),i},e.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},e.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);t.aabb.lowerBound.x=e.lowerBound.x-.1,t.aabb.lowerBound.y=e.lowerBound.y-.1,t.aabb.upperBound.x=e.upperBound.x+.1,t.aabb.upperBound.y=e.upperBound.y+.1;var n=2*i.x,r=2*i.y;return n<0?t.aabb.lowerBound.x+=n:t.aabb.upperBound.x+=n,r<0?t.aabb.lowerBound.y+=r:t.aabb.upperBound.y+=r,this.InsertLeaf(t),!0},e.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=qt(n.child1),s=qt(n.child2),a=n.aabb.GetPerimeter(),o=t.s_combinedAABB;o.Combine2(n.aabb,i);var h=o.GetPerimeter(),u=2*h,l=2*(h-a),c=void 0,f=t.s_aabb,d=void 0;r.IsLeaf()?(f.Combine2(i,r.aabb),c=f.GetPerimeter()+l):(f.Combine2(i,r.aabb),d=r.aabb.GetPerimeter(),c=f.GetPerimeter()-d+l);var _=void 0;if(s.IsLeaf()?(f.Combine2(i,s.aabb),_=f.GetPerimeter()+l):(f.Combine2(i,s.aabb),d=s.aabb.GetPerimeter(),_=f.GetPerimeter()-d+l),u1){var r=qt(i.child1),s=qt(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+k(e.height,s.height),i.height=1+k(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+k(e.height,r.height),i.height=1+k(t.height,s.height)),i}if(n<-1){var a=qt(e.child1),o=qt(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,a.height>o.height?(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+k(i.height,o.height),e.height=1+k(t.height,a.height)):(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+k(i.height,a.height),e.height=1+k(t.height,o.height)),e}return t},e.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return(i+=t.GetAreaNode(e.child1))+t.GetAreaNode(e.child2)},e.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.ComputeHeightNode=function(e){return null===e||e.IsLeaf()?0:1+k(t.ComputeHeightNode(e.child1),t.ComputeHeightNode(e.child2))},e.ComputeHeight=function(){return t.ComputeHeightNode(this.m_root)},e.ValidateStructure=function(t){if(null!==t&&(this.m_root,!t.IsLeaf())){var e=qt(t.child1),i=qt(t.child2);this.ValidateStructure(e),this.ValidateStructure(i)}},e.ValidateMetrics=function(e){if(null!==e&&!e.IsLeaf()){var i=qt(e.child1),n=qt(e.child2);t.s_aabb.Combine2(i.aabb,n.aabb),this.ValidateMetrics(i),this.ValidateMetrics(n)}},e.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=qt(t.child1),n=qt(t.child2);return k(e,P(n.height-i.height))},e.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},e.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},e.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t}();function Qt(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Kt(t,e){return t=i)break;Qt(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}Yt.s_r=new j,Yt.s_v=new j,Yt.s_abs_v=new j,Yt.s_segmentAABB=new Nt,Yt.s_subInput=new Lt,Yt.s_combinedAABB=new Nt,Yt.s_aabb=new Nt,Yt.s_node_id=0;var Zt=function(t,e){this.proxyA=t,this.proxyB=e},$t=function(){function t(){this.m_tree=new Yt,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}var e=t.prototype;return e.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},e.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},e.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},e.TouchProxy=function(t){this.BufferMove(t)},e.GetProxyCount=function(){return this.m_proxyCount},e.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(){var t=e.m_moveBuffer[n];if(null===t)return 1;var i=t.aabb;e.m_tree.Query(i,(function(i){if(i.m_id===t.m_id)return!0;var n,r;if(i.m_idf+d){e.state=t.b2TOIOutputState.e_separated,e.t=u,x=!0;break}if(D>f-d){_=w;break}var I=S.Evaluate(C[0],A[0],_);if(If?(M=O,I=R):(E=O,D=R),50===B)break}if(t.b2_toiMaxRootIters=k(t.b2_toiMaxRootIters,B),++T===a)break}if(++p,++t.b2_toiIters,x)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=_;break}}t.b2_toiMaxIters=k(t.b2_toiMaxIters,p);var F=n.GetMilliseconds();t.b2_toiMaxTime=k(t.b2_toiMaxTime,F),t.b2_toiTime+=F}var we=new j,Te=new j;function Ce(e,i,n,r,s){e.pointCount=0;var a=J.MulXV(n,i.m_p,we),o=J.MulXV(s,r.m_p,Te),h=j.DistanceSquaredVV(a,o),u=i.m_radius+r.m_radius;h>u*u||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var Ae=new j,De=new j,Ie=new j;function Be(e,n,s,a,o){e.pointCount=0;for(var h=J.MulXV(o,a.m_p,Ae),u=J.MulTXV(s,h,De),l=0,c=-i,f=n.m_radius+a.m_radius,d=n.m_count,_=n.m_vertices,p=n.m_normals,m=0;mf)return;g>c&&(c=g,l=m)}var v=l,y=(v+1)%d,b=_[v],S=_[y];if(cf*f)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(u,b,e.localNormal).SelfNormalize(),e.localPoint.Copy(b),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else if(w<=0){if(j.DistanceSquaredVV(u,S)>f*f)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(u,S,e.localNormal).SelfNormalize(),e.localPoint.Copy(S),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else{var T=j.MidVV(b,S,Ie);if(j.DotVV(j.SubVV(u,T,j.s_t1),p[v])>f)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[v]).SelfNormalize(),e.localPoint.Copy(T),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}}var Me=new j,Pe=new j,Ee=new j,ke=new j;function Oe(t,e,n,r,s){for(var a=t.m_vertices,o=t.m_normals,h=r.m_count,u=r.m_vertices,l=K.MulRV(e.q,o[n],Me),c=K.MulTRV(s.q,l,Pe),f=0,d=i,_=0;_c&&(c=d,l=f)}var _=Oe(e,n,l,r,s),p=(l+a-1)%a,m=Oe(e,n,p,r,s),g=(l+1)%a,v=Oe(e,n,g,r,s),y=0,b=0,S=0;if(m>_&&m>v)S=-1,y=p,b=m;else{if(!(v>_))return t[0]=l,_;S=1,y=g,b=v}for(;(_=Oe(e,n,l=-1===S?(y+a-1)%a:(y+1)%a,r,s))>b;)y=l,b=_;return t[0]=y,b}var Ve=new j;function Ne(e,n,r,s,a,o){for(var h=n.m_normals,u=a.m_count,l=a.m_vertices,c=a.m_normals,f=K.MulTRV(o.q,K.MulRV(r.q,h[s],j.s_t0),Ve),d=0,_=i,p=0;pa)){var u=We;u[0]=0;var l=Le(u,r,s,i,n);if(!(l>a)){var c,f,d,_,p=0,m=0;l>.98*h+.001?(c=r,f=i,d=s,_=n,p=u[0],e.type=t.b2ManifoldType.e_faceB,m=1):(c=i,f=r,d=n,_=s,p=o[0],e.type=t.b2ManifoldType.e_faceA,m=0);var g=ze;Ne(g,c,d,p,f,_);var v=c.m_count,y=c.m_vertices,b=p,S=(p+1)%v,x=y[b],w=y[S],T=j.SubVV(w,x,je);T.Normalize();var C=j.CrossVOne(T,qe),A=j.MidVV(x,w,Xe),D=K.MulRV(d.q,T,Qe),I=j.CrossVOne(D,Ye),B=J.MulXV(d,x,Je),M=J.MulXV(d,w,Ze),P=j.DotVV(I,B),E=-j.DotVV(D,B)+a,k=j.DotVV(D,M)+a,O=Ge,R=Ue;if(!(Gt(O,g,j.NegV(D,Ke),E,b)<2||Gt(R,O,D,k,S)<2)){e.localNormal.Copy(C),e.localPoint.Copy(A);for(var F=0,L=0;L<2;++L){var V=R[L];if(j.DotVV(I,V.v)-P<=a){var N=e.points[F];if(J.MulTXV(_,V.v,N.localPoint),N.id.Copy(V.id),m){var z=N.id.cf;N.id.cf.indexA=z.indexB,N.id.cf.indexB=z.indexA,N.id.cf.typeA=z.typeB,N.id.cf.typeB=z.typeA}++F}}e.pointCount=F}}}}var ti,ei=new j,ii=new j,ni=new j,ri=new j,si=new j,ai=new j,oi=new j,hi=new Pt;function ui(e,i,n,r,s){e.pointCount=0;var a=J.MulTXV(n,J.MulXV(s,r.m_p,j.s_t0),ei),o=i.m_vertex1,h=i.m_vertex2,u=j.SubVV(h,o,ii),l=j.DotVV(u,j.SubVV(h,a,j.s_t0)),c=j.DotVV(u,j.SubVV(a,o,j.s_t0)),f=i.m_radius+r.m_radius,d=hi;if(d.cf.indexB=0,d.cf.typeB=t.b2ContactFeatureType.e_vertex,c<=0){var _=o,p=j.SubVV(a,_,ni);if(j.DotVV(p,p)>f*f)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=o,v=j.SubVV(g,m,ri);if(j.DotVV(v,j.SubVV(g,a,j.s_t0))>0)return}return d.cf.indexA=0,d.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(_),e.points[0].id.Copy(d),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var y=h,b=j.SubVV(a,y,ni);if(j.DotVV(b,b)>f*f)return;if(i.m_hasVertex3){var S=i.m_vertex3,x=h,w=j.SubVV(S,x,si);if(j.DotVV(w,j.SubVV(a,x,j.s_t0))>0)return}return d.cf.indexA=1,d.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(y),e.points[0].id.Copy(d),void e.points[0].localPoint.Copy(r.m_p)}var T=j.DotVV(u,u),C=ai;C.x=1/T*(l*o.x+c*h.x),C.y=1/T*(l*o.y+c*h.y);var A=j.SubVV(a,C,ni);if(!(j.DotVV(A,A)>f*f)){var D=oi.Set(-u.y,u.x);j.DotVV(D,j.SubVV(a,o,j.s_t0))<0&&D.Set(-D.x,-D.y),D.Normalize(),d.cf.indexA=0,d.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(D),e.localPoint.Copy(o),e.points[0].id.Copy(d),e.points[0].localPoint.Copy(r.m_p)}}!function(t){t[t.e_unknown=0]="e_unknown",t[t.e_edgeA=1]="e_edgeA",t[t.e_edgeB=2]="e_edgeB"}(ti||(ti={}));var li,ci=function(){this.type=ti.e_unknown,this.index=0,this.separation=0},fi=function(){this.vertices=[],this.normals=[],this.count=0};!function(t){t[t.e_isolated=0]="e_isolated",t[t.e_concave=1]="e_concave",t[t.e_convex=2]="e_convex"}(li||(li={}));var di=function(){function e(){this.m_polygonB=new fi,this.m_xf=new J,this.m_centroidB=new j,this.m_v0=new j,this.m_v1=new j,this.m_v2=new j,this.m_v3=new j,this.m_normal0=new j,this.m_normal1=new j,this.m_normal2=new j,this.m_normal=new j,this.m_type1=li.e_isolated,this.m_type2=li.e_isolated,this.m_lowerLimit=new j,this.m_upperLimit=new j,this.m_radius=0,this.m_front=!1}var n=e.prototype;return n.Collide=function(i,n,r,s,a){J.MulTXX(r,a,this.m_xf),J.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var o=n.m_hasVertex0,h=n.m_hasVertex3,u=j.SubVV(this.m_v2,this.m_v1,e.s_edge1);u.Normalize(),this.m_normal1.Set(u.y,-u.x);var l=j.DotVV(this.m_normal1,j.SubVV(this.m_centroidB,this.m_v1,j.s_t0)),c=0,f=0,d=!1,_=!1;if(o){var p=j.SubVV(this.m_v1,this.m_v0,e.s_edge0);p.Normalize(),this.m_normal0.Set(p.y,-p.x),d=j.CrossVV(p,u)>=0,c=j.DotVV(this.m_normal0,j.SubVV(this.m_centroidB,this.m_v0,j.s_t0))}if(h){var m=j.SubVV(this.m_v3,this.m_v2,e.s_edge2);m.Normalize(),this.m_normal2.Set(m.y,-m.x),_=j.CrossVV(u,m)>0,f=j.DotVV(this.m_normal2,j.SubVV(this.m_centroidB,this.m_v2,j.s_t0))}o&&h?d&&_?(this.m_front=c>=0||l>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=c>=0||l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):_?(this.m_front=f>=0||c>=0&&l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=c>=0&&l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):o?d?(this.m_front=c>=0||l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=c>=0&&l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):h?_?(this.m_front=l>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=l>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=l>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var g=0;gthis.m_radius)){var y=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(y.type!==ti.e_unknown&&y.separation>this.m_radius)){var b;b=y.type===ti.e_unknown?v:y.separation>.98*v.separation+.001?y:v;var S=e.s_ie,x=e.s_rf;if(b.type===ti.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var w=0,T=j.DotVV(this.m_normal,this.m_polygonB.normals[0]),C=1;Cthis.m_radius)return n.type=ti.e_edgeB,n.index=s,n.separation=o,n;if(j.DotVV(a,r)>=0){if(j.DotVV(j.SubVV(a,this.m_upperLimit,j.s_t0),this.m_normal)<-c)continue}else if(j.DotVV(j.SubVV(a,this.m_lowerLimit,j.s_t0),this.m_normal)<-c)continue;o>n.separation&&(n.type=ti.e_edgeB,n.index=s,n.separation=o)}return n},e}();di.s_edge1=new j,di.s_edge0=new j,di.s_edge2=new j,di.s_ie=Ft.MakeArray(2),di.s_rf=new function(){this.i1=0,this.i2=0,this.v1=new j,this.v2=new j,this.normal=new j,this.sideNormal1=new j,this.sideOffset1=0,this.sideNormal2=new j,this.sideOffset2=0},di.s_clipPoints1=Ft.MakeArray(2),di.s_clipPoints2=Ft.MakeArray(2),di.s_edgeAxis=new ci,di.s_polygonAxis=new ci,di.s_n=new j,di.s_perp=new j;var _i=new di;function pi(t,e,i,n,r){_i.Collide(t,e,i,n,r)}var mi,gi=function(){this.mass=0,this.center=new j(0,0),this.I=0};(mi=t.b2ShapeType||(t.b2ShapeType={}))[mi.e_unknown=-1]="e_unknown",mi[mi.e_circleShape=0]="e_circleShape",mi[mi.e_edgeShape=1]="e_edgeShape",mi[mi.e_polygonShape=2]="e_polygonShape",mi[mi.e_chainShape=3]="e_chainShape",mi[mi.e_shapeTypeCount=4]="e_shapeTypeCount";var vi=function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}var i=e.prototype;return i.Copy=function(t){return this.m_radius=t.m_radius,this},i.GetType=function(){return this.m_type},e}(),yi=function(e){function i(i){var n;return void 0===i&&(i=0),(n=e.call(this,t.b2ShapeType.e_circleShape,i)||this).m_p=new j,n}s(i,e);var n=i.prototype;return n.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){var n=J.MulXV(t,this.m_p,i.TestPoint_s_center),r=j.SubVV(e,n,i.TestPoint_s_d);return j.DotVV(r,r)<=F(this.m_radius)},n.ComputeDistance=function(t,e,n){var r=J.MulXV(t,this.m_p,i.ComputeDistance_s_center);return j.SubVV(e,r,n),n.Normalize()-this.m_radius},n.RayCast=function(t,e,n){var s=J.MulXV(n,this.m_p,i.RayCast_s_position),a=j.SubVV(e.p1,s,i.RayCast_s_s),o=j.DotVV(a,a)-F(this.m_radius),h=j.SubVV(e.p2,e.p1,i.RayCast_s_r),u=j.DotVV(a,h),l=j.DotVV(h,h),c=u*u-l*o;if(c<0||lthis.m_radius)return n.Copy(s),o*this.m_radius*this.m_radius;var h=this.m_radius*this.m_radius,u=a*a,l=h*(H(a/this.m_radius)+o/2)+a*V(h-u),c=-2/3*N(h-u,1.5)/l;return n.x=s.x+t.x*c,n.y=s.y+t.y*c,l},n.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i}(vi);yi.TestPoint_s_center=new j,yi.TestPoint_s_d=new j,yi.ComputeDistance_s_center=new j,yi.RayCast_s_position=new j,yi.RayCast_s_s=new j,yi.RayCast_s_r=new j,yi.ComputeAABB_s_p=new j;var bi=function(e){function n(){var i;return(i=e.call(this,t.b2ShapeType.e_polygonShape,f)||this).m_centroid=new j(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}s(n,e);var r=n.prototype;return r.Clone=function(){return(new n).Copy(this)},r.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count);for(var i=0;il||f===l&&r[c].yv.LengthSquared()&&(m=g)}else m=g;if(++_,p=m,m===u)break}this.m_count=_,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count);for(var S=0;S<_;++S)this.m_vertices[S].Copy(r[d[S]]);for(var x=0;x<_;++x){var w=this.m_vertices[x],T=this.m_vertices[(x+1)%_],C=j.SubVV(T,w,j.s_t0);j.CrossVOne(C,this.m_normals[x]).SelfNormalize()}return n.ComputeCentroid(this.m_vertices,_,this.m_centroid),this},r.SetAsBox=function(t,e,i,n){if(void 0===n&&(n=0),this.m_count=4,this.m_vertices=j.MakeArray(this.m_count),this.m_normals=j.MakeArray(this.m_count),this.m_vertices[0].Set(-t,-e),this.m_vertices[1].Set(t,-e),this.m_vertices[2].Set(t,e),this.m_vertices[3].Set(-t,e),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid.SetZero(),i){this.m_centroid.Copy(i);var r=new J;r.SetPosition(i),r.SetRotationAngle(n);for(var s=0;s0)return!1;return!0},r.ComputeDistance=function(t,e,r){for(var s=J.MulTXV(t,e,n.ComputeDistance_s_pLocal),a=-i,o=n.ComputeDistance_s_normalForMaxDistance.Copy(s),h=0;ha&&(a=u,o.Copy(this.m_normals[h]))}if(a>0){for(var l=n.ComputeDistance_s_minDistance.Copy(o),c=a*a,f=0;f_&&(l.Copy(d),c=_)}return K.MulRV(t.q,l,r),r.Normalize(),Math.sqrt(c)}return K.MulRV(t.q,o,r),a},r.RayCast=function(t,e,i){for(var r=J.MulTXV(i,e.p1,n.RayCast_s_p1),s=J.MulTXV(i,e.p2,n.RayCast_s_p2),a=j.SubVV(s,r,n.RayCast_s_d),o=0,h=e.maxFraction,u=-1,l=0;l0&&c=0&&(t.fraction=o,K.MulRV(i.q,this.m_normals[u],t.normal),!0)},r.ComputeAABB=function(t,e){for(var i=J.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(i),s=0;s0&&(d?c||(u=f-1,h++):c&&(l=f-1,h++)),c=d}switch(h){case 0:if(c){var _=n.ComputeSubmergedArea_s_md;return this.ComputeMass(_,1),J.MulXV(i,_.center,r),_.mass}return 0;case 1:-1===u?u=this.m_count-1:l=this.m_count-1}for(var p,m=(u+1)%this.m_count,g=(l+1)%this.m_count,v=(0-o[u])/(o[m]-o[u]),y=(0-o[l])/(o[g]-o[l]),b=n.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[u].x*(1-v)+this.m_vertices[m].x*v,this.m_vertices[u].y*(1-v)+this.m_vertices[m].y*v),S=n.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[l].x*(1-y)+this.m_vertices[g].x*y,this.m_vertices[l].y*(1-y)+this.m_vertices[g].y*y),x=0,w=n.ComputeSubmergedArea_s_center.SetZero(),T=this.m_vertices[m],C=m;C!==g;){p=(C=(C+1)%this.m_count)===g?S:this.m_vertices[C];var A=.5*((T.x-b.x)*(p.y-b.y)-(T.y-b.y)*(p.x-b.x));x+=A,w.x+=A*(b.x+T.x+p.x)/3,w.y+=A*(b.y+T.y+p.y)/3,T=p}return w.SelfMul(1/x),J.MulXV(i,w,r),x},r.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e0){var u=j.DotVV(o,o);h>u?j.SubVV(e,s,a):a.SelfMulSub(h/u,o)}return n.Copy(a),n.Normalize()},n.RayCast=function(t,e,n){var r=J.MulTXV(n,e.p1,i.RayCast_s_p1),s=J.MulTXV(n,e.p2,i.RayCast_s_p2),a=j.SubVV(s,r,i.RayCast_s_d),o=this.m_vertex1,h=this.m_vertex2,u=j.SubVV(h,o,i.RayCast_s_e),l=t.normal.Set(u.y,-u.x).SelfNormalize(),c=j.DotVV(l,j.SubVV(o,r,j.s_t0)),f=j.DotVV(l,a);if(0===f)return!1;var d=c/f;if(d<0||e.maxFraction0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=J.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=J.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);j.MinV(n,r,t.lowerBound),j.MaxV(n,r,t.upperBound);var s=this.m_radius;t.lowerBound.SelfSubXY(s,s),t.upperBound.SelfAddXY(s,s)},n.ComputeMass=function(t){t.mass=0,j.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},n.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i}(vi);Si.ComputeDistance_s_v1=new j,Si.ComputeDistance_s_v2=new j,Si.ComputeDistance_s_d=new j,Si.ComputeDistance_s_s=new j,Si.RayCast_s_p1=new j,Si.RayCast_s_p2=new j,Si.RayCast_s_d=new j,Si.RayCast_s_e=new j,Si.RayCast_s_q=new j,Si.RayCast_s_r=new j,Si.ComputeAABB_s_v1=new j,Si.ComputeAABB_s_v2=new j;var xi=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_chainShape,f)||this).m_vertices=[],i.m_count=0,i.m_prevVertex=new j,i.m_nextVertex=new j,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}s(i,e);var n=i.prototype;return n.CreateLoop=function(){for(var t=arguments.length,e=new Array(t),i=0;i0?(t.m_vertex0.Copy(this.m_vertices[e-1]),t.m_hasVertex0=!0):(t.m_vertex0.Copy(this.m_prevVertex),t.m_hasVertex0=this.m_hasPrevVertex),e0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},n.CreateFixtureShapeDensity=function(t,e){void 0===e&&(e=0);var n=i.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=e,this.CreateFixtureDef(n)},n.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),a=r.GetFixtureB();t!==s&&t!==a||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Reset(),--this.m_fixtureCount,this.ResetMassData()},n.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},n.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),J.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(this.m_xf,this.m_xf,j.ZERO);this.m_world.m_contactManager.FindNewContacts()},n.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},n.GetTransform=function(){return this.m_xf},n.GetPosition=function(){return this.m_xf.p},n.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},n.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},n.GetAngle=function(){return this.m_sweep.a},n.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},n.GetWorldCenter=function(){return this.m_sweep.c},n.GetLocalCenter=function(){return this.m_sweep.localCenter},n.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(j.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},n.GetLinearVelocity=function(){return this.m_linearVelocity},n.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},n.GetAngularVelocity=function(){return this.m_angularVelocity},n.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},n.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},n.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},n.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},n.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},n.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},n.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},n.GetMass=function(){return this.m_mass},n.GetInertia=function(){return this.m_I+this.m_mass*j.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},n.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*j.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},n.SetMassData=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=e.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,e.I>0&&!this.m_fixedRotationFlag&&(this.m_I=e.I-this.m_mass*j.DotVV(e.center,e.center),this.m_invI=1/this.m_I);var n=i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e.center),J.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(this.m_sweep.c,n,j.s_t0),this.m_linearVelocity)}},n.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var e=i.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(i.ResetMassData_s_massData);this.m_mass+=r.mass,e.x+=r.center.x*r.mass,e.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,e.x*=this.m_invMass,e.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*j.DotVV(e,e),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e),J.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(this.m_sweep.c,s,j.s_t0),this.m_linearVelocity)},n.GetWorldPoint=function(t,e){return J.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return K.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return J.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return K.MulTRV(this.m_xf.q,t,e)},n.GetLinearVelocityFromWorldPoint=function(t,e){return j.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,j.SubVV(t,this.m_sweep.c,j.s_t0),e)},n.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},n.GetLinearDamping=function(){return this.m_linearDamping},n.SetLinearDamping=function(t){this.m_linearDamping=t},n.GetAngularDamping=function(){return this.m_angularDamping},n.SetAngularDamping=function(t){this.m_angularDamping=t},n.GetGravityScale=function(){return this.m_gravityScale},n.SetGravityScale=function(t){this.m_gravityScale=t},n.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},n.GetType=function(){return this.m_type},n.SetBullet=function(t){this.m_bulletFlag=t},n.IsBullet=function(){return this.m_bulletFlag},n.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},n.IsSleepingAllowed=function(){return this.m_autoSleepFlag},n.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},n.IsAwake=function(){return this.m_awakeFlag},n.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies();else{for(var i=this.m_fixtureList;i;i=i.m_next)i.DestroyProxies();for(var n=this.m_contactList;n;){var r=n;n=n.next,this.m_world.m_contactManager.Destroy(r.contact)}this.m_contactList=null}},n.IsActive=function(){return this.m_activeFlag},n.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},n.IsFixedRotation=function(){return this.m_fixedRotationFlag},n.GetFixtureList=function(){return this.m_fixtureList},n.GetJointList=function(){return this.m_jointList},n.GetContactList=function(){return this.m_contactList},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.GetWorld=function(){return this.m_world},n.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},n.SynchronizeFixtures=function(){var t=i.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),K.MulRV(t.q,this.m_sweep.localCenter,t.p),j.SubVV(this.m_sweep.c0,t.p,t.p);for(var e=j.SubVV(this.m_sweep.c,this.m_sweep.c0,i.SynchronizeFixtures_s_displacement),n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(t,this.m_xf,e)},n.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),K.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),j.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},n.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},n.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),K.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),j.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.GetControllerList=function(){return this.m_controllerList},n.GetControllerCount=function(){return this.m_controllerCount},i}();Mi.CreateFixtureShapeDensity_s_def=new Ti,Mi.SetMassData_s_oldCenter=new j,Mi.ResetMassData_s_localCenter=new j,Mi.ResetMassData_s_oldCenter=new j,Mi.ResetMassData_s_massData=new gi,Mi.SynchronizeFixtures_s_xf1=new J,Mi.SynchronizeFixtures_s_displacement=new j,(Bi=t.b2JointType||(t.b2JointType={}))[Bi.e_unknownJoint=0]="e_unknownJoint",Bi[Bi.e_revoluteJoint=1]="e_revoluteJoint",Bi[Bi.e_prismaticJoint=2]="e_prismaticJoint",Bi[Bi.e_distanceJoint=3]="e_distanceJoint",Bi[Bi.e_pulleyJoint=4]="e_pulleyJoint",Bi[Bi.e_mouseJoint=5]="e_mouseJoint",Bi[Bi.e_gearJoint=6]="e_gearJoint",Bi[Bi.e_wheelJoint=7]="e_wheelJoint",Bi[Bi.e_weldJoint=8]="e_weldJoint",Bi[Bi.e_frictionJoint=9]="e_frictionJoint",Bi[Bi.e_ropeJoint=10]="e_ropeJoint",Bi[Bi.e_motorJoint=11]="e_motorJoint",Bi[Bi.e_areaJoint=12]="e_areaJoint",(Ii=t.b2LimitState||(t.b2LimitState={}))[Ii.e_inactiveLimit=0]="e_inactiveLimit",Ii[Ii.e_atLowerLimit=1]="e_atLowerLimit",Ii[Ii.e_atUpperLimit=2]="e_atUpperLimit",Ii[Ii.e_equalLimits=3]="e_equalLimits";var Pi=function(){function t(){this.linear=new j,this.angularA=0,this.angularB=0}var e=t.prototype;return e.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},e.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t}(),Ei=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.joint=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),ki=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},Oi=function(){function i(i){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_edgeA=new Ei(this),this.m_edgeB=new Ei(this),this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=i.type,this.m_edgeA.other=i.bodyB,this.m_edgeB.other=i.bodyA,this.m_bodyA=i.bodyA,this.m_bodyB=i.bodyB,this.m_collideConnected=e(i.collideConnected,!1),this.m_userData=e(i.userData,null)}var n=i.prototype;return n.GetType=function(){return this.m_type},n.GetBodyA=function(){return this.m_bodyA},n.GetBodyB=function(){return this.m_bodyB},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},n.GetCollideConnected=function(){return this.m_collideConnected},n.Dump=function(t){t("// Dump is not supported for this joint type.\n")},n.ShiftOrigin=function(){},i}(),Ri=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_distanceJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=j.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i}(ki),Fi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new j,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new K,n.m_qB=new K,n.m_lalcA=new j,n.m_lalcB=new j,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_length=i.length,n}s(i,t);var n=i.prototype;return n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},n.GetReactionTorque=function(){return 0},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetLength=function(t){this.m_length=t},n.Length=function(){return this.m_length},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,h=t.positions[this.m_indexB].a,u=t.velocities[this.m_indexB].v,c=t.velocities[this.m_indexB].w,f=this.m_qA.SetAngle(n),d=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(d,this.m_lalcB,this.m_rB),this.m_u.x=a.x+this.m_rB.x-e.x-this.m_rA.x,this.m_u.y=a.y+this.m_rB.y-e.y-this.m_rA.y;var _=this.m_u.Length();_>l?this.m_u.SelfMul(1/_):this.m_u.SetZero();var p=j.CrossVV(this.m_rA,this.m_u),m=j.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,this.m_frequencyHz>0){var v=_-this.m_length,y=2*o*this.m_frequencyHz,b=2*this.m_mass*this.m_dampingRatio*y,S=this.m_mass*y*y,x=t.step.dt;this.m_gamma=x*(b+x*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*x*S*this.m_gamma,g+=this.m_gamma,this.m_mass=0!==g?1/g:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var w=j.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,w),s-=this.m_invIA*j.CrossVV(this.m_rA,w),u.SelfMulAdd(this.m_invMassB,w),c+=this.m_invIB*j.CrossVV(this.m_rB,w)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=c},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=j.DotVV(this.m_u,j.SubVV(o,a,j.s_t0)),u=-this.m_mass*(h+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=u;var l=j.MulSV(u,this.m_u,i.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,l),n-=this.m_invIA*j.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,l),s+=this.m_invIB*j.CrossVV(this.m_rB,l),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=K.MulRV(a,this.m_lalcA,this.m_rA),u=K.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_u;c.x=r.x+u.x-e.x-h.x,c.y=r.y+u.y-e.y-h.y;var f=this.m_u.Normalize()-this.m_length;f=O(f,-.2,d);var _=-this.m_mass*f,p=j.MulSV(_,c,i.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,p),n-=this.m_invIA*j.CrossVV(h,p),r.SelfMulAdd(this.m_invMassB,p),s+=this.m_invIB*j.CrossVV(u,p),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,P(f)F(d)&&y.SelfMul(d/V(b)),b>F(l)&&(_=!1),g.x+=y.x,g.y+=y.y}return _},i}(Oi),Ni=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_frictionJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.maxForce=0,i.maxTorque=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i}(ki),zi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_linearImpulse=new j,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Y,n.m_angularMass=0,n.m_qA=new K,n.m_qB=new K,n.m_lalcA=new j,n.m_lalcB=new j,n.m_K=new Y,n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_linearMass.SetZero(),n}s(i,t);var n=i.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,a=t.velocities[this.m_indexB].w,o=this.m_qA.SetAngle(e),h=this.m_qB.SetAngle(r);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var u=K.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=K.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,f=this.m_invMassB,d=this.m_invIA,_=this.m_invIB,p=this.m_K;if(p.ex.x=c+f+d*u.y*u.y+_*l.y*l.y,p.ex.y=-d*u.x*u.y-_*l.x*l.y,p.ey.x=p.ex.y,p.ey.y=c+f+d*u.x*u.x+_*l.x*l.x,p.GetInverse(this.m_linearMass),this.m_angularMass=d+_,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(c,m),n-=d*(j.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(f,m),a+=_*(j.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=a},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=s-n,f=-this.m_angularMass*c,d=this.m_angularImpulse,_=l*this.m_maxTorque;this.m_angularImpulse=O(this.m_angularImpulse+f,-_,_),n-=h*(f=this.m_angularImpulse-d),s+=u*f;var p=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot_v2),m=Y.MulMV(this.m_linearMass,p,i.SolveVelocityConstraints_s_impulseV).SelfNeg(),g=i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);var v=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>v*v&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(v)),j.SubVV(this.m_linearImpulse,g,m),e.SelfMulSub(a,m),n-=h*j.CrossVV(this.m_rA,m),r.SelfMulAdd(o,m),s+=u*j.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Oi);zi.SolveVelocityConstraints_s_Cdot_v2=new j,zi.SolveVelocityConstraints_s_impulseV=new j,zi.SolveVelocityConstraints_s_oldImpulseV=new j;var Gi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_gearJoint)||this).ratio=1,i}return s(i,e),i}(ki),Ui=function(i){function n(n){var r,s,a;(r=i.call(this,n)||this).m_typeA=t.b2JointType.e_unknownJoint,r.m_typeB=t.b2JointType.e_unknownJoint,r.m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_localAnchorC=new j,r.m_localAnchorD=new j,r.m_localAxisC=new j,r.m_localAxisD=new j,r.m_referenceAngleA=0,r.m_referenceAngleB=0,r.m_constant=0,r.m_ratio=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_indexC=0,r.m_indexD=0,r.m_lcA=new j,r.m_lcB=new j,r.m_lcC=new j,r.m_lcD=new j,r.m_mA=0,r.m_mB=0,r.m_mC=0,r.m_mD=0,r.m_iA=0,r.m_iB=0,r.m_iC=0,r.m_iD=0,r.m_JvAC=new j,r.m_JvBD=new j,r.m_JwA=0,r.m_JwB=0,r.m_JwC=0,r.m_JwD=0,r.m_mass=0,r.m_qA=new K,r.m_qB=new K,r.m_qC=new K,r.m_qD=new K,r.m_lalcA=new j,r.m_lalcB=new j,r.m_lalcC=new j,r.m_lalcD=new j,r.m_joint1=n.joint1,r.m_joint2=n.joint2,r.m_typeA=r.m_joint1.GetType(),r.m_typeB=r.m_joint2.GetType(),r.m_bodyC=r.m_joint1.GetBodyA(),r.m_bodyA=r.m_joint1.GetBodyB();var o=r.m_bodyA.m_xf,h=r.m_bodyA.m_sweep.a,u=r.m_bodyC.m_xf,l=r.m_bodyC.m_sweep.a;if(r.m_typeA===t.b2JointType.e_revoluteJoint){var c=n.joint1;r.m_localAnchorC.Copy(c.m_localAnchorA),r.m_localAnchorA.Copy(c.m_localAnchorB),r.m_referenceAngleA=c.m_referenceAngle,r.m_localAxisC.SetZero(),s=h-l-r.m_referenceAngleA}else{var f=n.joint1;r.m_localAnchorC.Copy(f.m_localAnchorA),r.m_localAnchorA.Copy(f.m_localAnchorB),r.m_referenceAngleA=f.m_referenceAngle,r.m_localAxisC.Copy(f.m_localXAxisA);var d=r.m_localAnchorC,_=K.MulTRV(u.q,j.AddVV(K.MulRV(o.q,r.m_localAnchorA,j.s_t0),j.SubVV(o.p,u.p,j.s_t1),j.s_t0),j.s_t0);s=j.DotVV(j.SubVV(_,d,j.s_t0),r.m_localAxisC)}r.m_bodyD=r.m_joint2.GetBodyA(),r.m_bodyB=r.m_joint2.GetBodyB();var p=r.m_bodyB.m_xf,m=r.m_bodyB.m_sweep.a,g=r.m_bodyD.m_xf,v=r.m_bodyD.m_sweep.a;if(r.m_typeB===t.b2JointType.e_revoluteJoint){var y=n.joint2;r.m_localAnchorD.Copy(y.m_localAnchorA),r.m_localAnchorB.Copy(y.m_localAnchorB),r.m_referenceAngleB=y.m_referenceAngle,r.m_localAxisD.SetZero(),a=m-v-r.m_referenceAngleB}else{var b=n.joint2;r.m_localAnchorD.Copy(b.m_localAnchorA),r.m_localAnchorB.Copy(b.m_localAnchorB),r.m_referenceAngleB=b.m_referenceAngle,r.m_localAxisD.Copy(b.m_localXAxisA);var S=r.m_localAnchorD,x=K.MulTRV(g.q,j.AddVV(K.MulRV(p.q,r.m_localAnchorB,j.s_t0),j.SubVV(p.p,g.p,j.s_t1),j.s_t0),j.s_t0);a=j.DotVV(j.SubVV(x,S,j.s_t0),r.m_localAxisD)}return r.m_ratio=e(n.ratio,1),r.m_constant=s+r.m_ratio*a,r.m_impulse=0,r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=e.positions[this.m_indexC].a,l=e.velocities[this.m_indexC].v,c=e.velocities[this.m_indexC].w,f=e.positions[this.m_indexD].a,d=e.velocities[this.m_indexD].v,_=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),g=this.m_qC.SetAngle(u),v=this.m_qD.SetAngle(f);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var y=K.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var b=K.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);j.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var S=K.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(y),this.m_JwC=j.CrossVV(b,y),this.m_JwA=j.CrossVV(S,y),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}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{var x=K.MulRV(v,this.m_localAxisD,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var w=K.MulRV(v,this.m_lalcD,n.InitVelocityConstraints_s_rD);j.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var T=K.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);j.MulSV(this.m_ratio,x,this.m_JvBD),this.m_JwD=this.m_ratio*j.CrossVV(w,x),this.m_JwB=this.m_ratio*j.CrossVV(T,x),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}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,o.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),h+=this.m_iB*this.m_impulse*this.m_JwB,l.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),c-=this.m_iC*this.m_impulse*this.m_JwC,d.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),_-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h,e.velocities[this.m_indexC].w=c,e.velocities[this.m_indexD].w=_},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,h=t.velocities[this.m_indexD].w,u=j.DotVV(this.m_JvAC,j.SubVV(e,s,j.s_t0))+j.DotVV(this.m_JvBD,j.SubVV(n,o,j.s_t0));u+=this.m_JwA*i-this.m_JwC*a+(this.m_JwB*r-this.m_JwD*h);var l=-this.m_mass*u;this.m_impulse+=l,e.SelfMulAdd(this.m_mA*l,this.m_JvAC),i+=this.m_iA*l*this.m_JwA,n.SelfMulAdd(this.m_mB*l,this.m_JvBD),r+=this.m_iB*l*this.m_JwB,s.SelfMulSub(this.m_mC*l,this.m_JvAC),a-=this.m_iC*l*this.m_JwC,o.SelfMulSub(this.m_mD*l,this.m_JvBD),h-=this.m_iD*l*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=a,t.velocities[this.m_indexD].w=h},r.SolvePositionConstraints=function(e){var i,r,s,a,o,h,u=e.positions[this.m_indexA].c,l=e.positions[this.m_indexA].a,c=e.positions[this.m_indexB].c,f=e.positions[this.m_indexB].a,d=e.positions[this.m_indexC].c,_=e.positions[this.m_indexC].a,p=e.positions[this.m_indexD].c,m=e.positions[this.m_indexD].a,g=this.m_qA.SetAngle(l),v=this.m_qB.SetAngle(f),y=this.m_qC.SetAngle(_),b=this.m_qD.SetAngle(m),S=this.m_JvAC,x=this.m_JvBD,w=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)S.SetZero(),s=1,o=1,w+=this.m_iA+this.m_iC,i=l-_-this.m_referenceAngleA;else{var T=K.MulRV(y,this.m_localAxisC,n.SolvePositionConstraints_s_u),C=K.MulRV(y,this.m_lalcC,n.SolvePositionConstraints_s_rC),A=K.MulRV(g,this.m_lalcA,n.SolvePositionConstraints_s_rA);S.Copy(T),o=j.CrossVV(C,T),s=j.CrossVV(A,T),w+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var D=this.m_lalcC,I=K.MulTRV(y,j.AddVV(A,j.SubVV(u,d,j.s_t0),j.s_t0),j.s_t0);i=j.DotVV(j.SubVV(I,D,j.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)x.SetZero(),a=this.m_ratio,h=this.m_ratio,w+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=f-m-this.m_referenceAngleB;else{var B=K.MulRV(b,this.m_localAxisD,n.SolvePositionConstraints_s_u),M=K.MulRV(b,this.m_lalcD,n.SolvePositionConstraints_s_rD),P=K.MulRV(v,this.m_lalcB,n.SolvePositionConstraints_s_rB);j.MulSV(this.m_ratio,B,x),h=this.m_ratio*j.CrossVV(M,B),a=this.m_ratio*j.CrossVV(P,B),w+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*a*a;var E=this.m_lalcD,k=K.MulTRV(b,j.AddVV(P,j.SubVV(c,p,j.s_t0),j.s_t0),j.s_t0);r=j.DotVV(j.SubVV(k,E,j.s_t0),this.m_localAxisD)}var O=i+this.m_ratio*r-this.m_constant,R=0;return w>0&&(R=-O/w),u.SelfMulAdd(this.m_mA*R,S),l+=this.m_iA*R*s,c.SelfMulAdd(this.m_mB*R,x),f+=this.m_iB*R*a,d.SelfMulSub(this.m_mC*R,S),_-=this.m_iC*R*o,p.SelfMulSub(this.m_mD*R,x),m-=this.m_iD*R*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=f,e.positions[this.m_indexC].a=_,e.positions[this.m_indexD].a=m,!0},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return j.MulSV(t*this.m_impulse,this.m_JvAC,e)},r.GetReactionTorque=function(t){return t*this.m_impulse*this.m_JwA},r.GetJoint1=function(){return this.m_joint1},r.GetJoint2=function(){return this.m_joint2},r.GetRatio=function(){return this.m_ratio},r.SetRatio=function(t){this.m_ratio=t},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex,n=this.m_joint1.m_index,r=this.m_joint2.m_index;t(" const jd: b2GearJointDef = new b2GearJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.joint1 = joints[%d];\n",n),t(" jd.joint2 = joints[%d];\n",r),t(" jd.ratio = %.15f;\n",this.m_ratio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Oi);Ui.InitVelocityConstraints_s_u=new j,Ui.InitVelocityConstraints_s_rA=new j,Ui.InitVelocityConstraints_s_rB=new j,Ui.InitVelocityConstraints_s_rC=new j,Ui.InitVelocityConstraints_s_rD=new j,Ui.SolvePositionConstraints_s_u=new j,Ui.SolvePositionConstraints_s_rA=new j,Ui.SolvePositionConstraints_s_rB=new j,Ui.SolvePositionConstraints_s_rC=new j,Ui.SolvePositionConstraints_s_rD=new j;var Hi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_motorJoint)||this).linearOffset=new j(0,0),i.angularOffset=0,i.maxForce=1,i.maxTorque=1,i.correctionFactor=.3,i}return s(i,e),i.prototype.Initialize=function(t,e){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(this.bodyB.GetPosition(),this.linearOffset);var i=this.bodyA.GetAngle(),n=this.bodyB.GetAngle();this.angularOffset=n-i},i}(ki),Wi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_linearOffset=new j,n.m_angularOffset=0,n.m_linearImpulse=new j,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_correctionFactor=.3,n.m_indexA=0,n.m_indexB=0,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_linearError=new j,n.m_angularError=0,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Y,n.m_angularMass=0,n.m_qA=new K,n.m_qB=new K,n.m_K=new Y,n.m_linearOffset.Copy(e(i.linearOffset,j.ZERO)),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_correctionFactor=e(i.correctionFactor,.3),n}s(i,t);var n=i.prototype;return n.GetAnchorA=function(t){var e=this.m_bodyA.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetAnchorB=function(t){var e=this.m_bodyB.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetReactionForce=function(t,e){return j.MulSV(t,this.m_linearImpulse,e)},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.SetLinearOffset=function(t){j.IsEqualToV(t,this.m_linearOffset)||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_linearOffset.Copy(t))},n.GetLinearOffset=function(){return this.m_linearOffset},n.SetAngularOffset=function(t){t!==this.m_angularOffset&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_angularOffset=t)},n.GetAngularOffset=function(){return this.m_angularOffset},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,n=t.velocities[this.m_indexA].v,r=t.velocities[this.m_indexA].w,s=t.positions[this.m_indexB].c,a=t.positions[this.m_indexB].a,o=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(a),c=K.MulRV(u,j.SubVV(this.m_linearOffset,this.m_localCenterA,j.s_t0),this.m_rA),f=K.MulRV(l,j.NegV(this.m_localCenterB,j.s_t0),this.m_rB),d=this.m_invMassA,_=this.m_invMassB,p=this.m_invIA,m=this.m_invIB,g=this.m_K;if(g.ex.x=d+_+p*c.y*c.y+m*f.y*f.y,g.ex.y=-p*c.x*c.y-m*f.x*f.y,g.ey.x=g.ex.y,g.ey.y=d+_+p*c.x*c.x+m*f.x*f.x,g.GetInverse(this.m_linearMass),this.m_angularMass=p+m,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),j.SubVV(j.AddVV(s,f,j.s_t0),j.AddVV(e,c,j.s_t1),this.m_linearError),this.m_angularError=a-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var v=this.m_linearImpulse;n.SelfMulSub(d,v),r-=p*(j.CrossVV(c,v)+this.m_angularImpulse),o.SelfMulAdd(_,v),h+=m*(j.CrossVV(f,v)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=t.step.inv_dt,f=s-n+c*this.m_correctionFactor*this.m_angularError,d=-this.m_angularMass*f,_=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=O(this.m_angularImpulse+d,-p,p),n-=h*(d=this.m_angularImpulse-_),s+=u*d;var m=this.m_rA,g=this.m_rB,v=j.AddVV(j.SubVV(j.AddVV(r,j.CrossSV(s,g,j.s_t0),j.s_t0),j.AddVV(e,j.CrossSV(n,m,j.s_t1),j.s_t1),j.s_t2),j.MulSV(c*this.m_correctionFactor,this.m_linearError,j.s_t3),i.SolveVelocityConstraints_s_Cdot_v2),y=Y.MulMV(this.m_linearMass,v,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),b=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(y);var S=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>S*S&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(S)),j.SubVV(this.m_linearImpulse,b,y),e.SelfMulSub(a,y),n-=h*j.CrossVV(m,y),r.SelfMulAdd(o,y),s+=u*j.CrossVV(g,y),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Oi);Wi.SolveVelocityConstraints_s_Cdot_v2=new j,Wi.SolveVelocityConstraints_s_impulse_v2=new j,Wi.SolveVelocityConstraints_s_oldImpulse_v2=new j;var ji=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_mouseJoint)||this).target=new j,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return s(i,e),i}(ki),qi=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_localAnchorB=new j,n.m_targetA=new j,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new j,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new j,n.m_localCenterB=new j,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new Y,n.m_C=new j,n.m_qB=new K,n.m_lalcB=new j,n.m_K=new Y,n.m_targetA.Copy(e(i.target,j.ZERO)),J.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=e(i.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}s(i,t);var n=i.prototype;return n.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},n.GetTarget=function(){return this.m_targetA},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=this.m_qB.SetAngle(i),a=this.m_bodyB.GetMass(),h=2*o*this.m_frequencyHz,u=2*a*this.m_dampingRatio*h,l=a*h*h,c=t.step.dt;this.m_gamma=c*(u+c*l),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=c*l*this.m_gamma,j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(s,this.m_lalcB,this.m_rB);var f=this.m_K;f.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,f.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,f.ey.x=f.ex.y,f.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,f.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*j.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=j.AddVCrossSV(e,n,this.m_rB,i.SolveVelocityConstraints_s_Cdot),s=Y.MulMV(this.m_mass,j.AddVV(r,j.AddVV(this.m_C,j.MulSV(this.m_gamma,this.m_impulse,j.s_t0),j.s_t0),j.s_t0).SelfNeg(),i.SolveVelocityConstraints_s_impulse),a=i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var o=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>o*o&&this.m_impulse.SelfMul(o/this.m_impulse.Length()),j.SubVV(this.m_impulse,a,s),e.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*j.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return j.MulSV(t,this.m_impulse,e)},n.GetReactionTorque=function(){return 0},n.Dump=function(t){t("Mouse joint dumping is not supported.\n")},n.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},i}(Oi);qi.SolveVelocityConstraints_s_Cdot=new j,qi.SolveVelocityConstraints_s_impulse=new j,qi.SolveVelocityConstraints_s_oldImpulse=new j;var Xi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_prismaticJoint)||this).localAnchorA=new j,i.localAnchorB=new j,i.localAxisA=new j(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(ki),Yi=function(i){function n(n){var r;return(r=i.call(this,n)||this).m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_localXAxisA=new j,r.m_localYAxisA=new j,r.m_referenceAngle=0,r.m_impulse=new X(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new j,r.m_localCenterB=new j,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new j(0,0),r.m_perp=new j(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new Q,r.m_K3=new Q,r.m_K2=new Y,r.m_motorMass=0,r.m_qA=new K,r.m_qB=new K,r.m_lalcA=new j,r.m_lalcB=new j,r.m_rA=new j,r.m_rB=new j,r.m_localAnchorA.Copy(e(n.localAnchorA,j.ZERO)),r.m_localAnchorB.Copy(e(n.localAnchorB,j.ZERO)),r.m_localXAxisA.Copy(e(n.localAxisA,new j(1,0))).SelfNormalize(),j.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=e(n.referenceAngle,0),r.m_lowerTranslation=e(n.lowerTranslation,0),r.m_upperTranslation=e(n.upperTranslation,0),r.m_maxMotorForce=e(n.maxMotorForce,0),r.m_motorSpeed=e(n.motorSpeed,0),r.m_enableLimit=e(n.enableLimit,!1),r.m_enableMotor=e(n.enableMotor,!1),r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=K.MulRV(c,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var _=K.MulRV(f,this.m_lalcB,this.m_rB),p=j.AddVV(j.SubVV(o,i,j.s_t0),j.SubVV(_,d,j.s_t1),n.InitVelocityConstraints_s_d),m=this.m_invMassA,g=this.m_invMassB,v=this.m_invIA,y=this.m_invIB;if(K.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=j.CrossVV(j.AddVV(p,d,j.s_t0),this.m_axis),this.m_a2=j.CrossVV(_,this.m_axis),this.m_motorMass=m+g+v*this.m_a1*this.m_a1+y*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),K.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=j.CrossVV(j.AddVV(p,d,j.s_t0),this.m_perp),this.m_s2=j.CrossVV(_,this.m_perp),this.m_K.ex.x=m+g+v*this.m_s1*this.m_s1+y*this.m_s2*this.m_s2,this.m_K.ex.y=v*this.m_s1+y*this.m_s2,this.m_K.ex.z=v*this.m_s1*this.m_a1+y*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=v+y,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=v*this.m_a1+y*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=m+g+v*this.m_a1*this.m_a1+y*this.m_a2*this.m_a2,this.m_enableLimit){var b=j.DotVV(this.m_axis,p);P(this.m_upperTranslation-this.m_lowerTranslation)<.016?this.m_limitState=t.b2LimitState.e_equalLimits:b<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):b>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var S=j.AddVV(j.MulSV(this.m_impulse.x,this.m_perp,j.s_t0),j.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,j.s_t1),n.InitVelocityConstraints_s_P),x=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,w=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(m,S),a-=v*x,u.SelfMulAdd(g,S),l+=y*w}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var c=j.DotVV(this.m_axis,j.SubVV(s,i,j.s_t0))+this.m_a2*a-this.m_a1*r,f=this.m_motorMass*(this.m_motorSpeed-c),d=this.m_motorImpulse,_=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=O(this.m_motorImpulse+f,-_,_),f=this.m_motorImpulse-d;var p=j.MulSV(f,this.m_axis,n.SolveVelocityConstraints_s_P),m=f*this.m_a1,g=f*this.m_a2;i.SelfMulSub(o,p),r-=u*m,s.SelfMulAdd(h,p),a+=l*g}var v=j.DotVV(this.m_perp,j.SubVV(s,i,j.s_t0))+this.m_s2*a-this.m_s1*r,y=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var b=j.DotVV(this.m_axis,j.SubVV(s,i,j.s_t0))+this.m_a2*a-this.m_a1*r,S=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),x=this.m_K.Solve33(-v,-y,-b,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(x),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=k(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=E(this.m_impulse.z,0));var w=-v-(this.m_impulse.z-S.z)*this.m_K.ez.x,T=-y-(this.m_impulse.z-S.z)*this.m_K.ez.y,C=this.m_K.Solve22(w,T,n.SolveVelocityConstraints_s_f2r);C.x+=S.x,C.y+=S.y,this.m_impulse.x=C.x,this.m_impulse.y=C.y,x.x=this.m_impulse.x-S.x,x.y=this.m_impulse.y-S.y,x.z=this.m_impulse.z-S.z;var A=j.AddVV(j.MulSV(x.x,this.m_perp,j.s_t0),j.MulSV(x.z,this.m_axis,j.s_t1),n.SolveVelocityConstraints_s_P),D=x.x*this.m_s1+x.y+x.z*this.m_a1,I=x.x*this.m_s2+x.y+x.z*this.m_a2;i.SelfMulSub(o,A),r-=u*D,s.SelfMulAdd(h,A),a+=l*I}else{var B=this.m_K.Solve22(-v,-y,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=B.x,this.m_impulse.y+=B.y;var M=j.MulSV(B.x,this.m_perp,n.SolveVelocityConstraints_s_P),P=B.x*this.m_s1+B.y,R=B.x*this.m_s2+B.y;i.SelfMulSub(o,M),r-=u*P,s.SelfMulAdd(h,M),a+=l*R}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,f=this.m_invIA,_=this.m_invIB,p=K.MulRV(a,this.m_lalcA,this.m_rA),m=K.MulRV(o,this.m_lalcB,this.m_rB),g=j.SubVV(j.AddVV(r,m,j.s_t0),j.AddVV(e,p,j.s_t1),n.SolvePositionConstraints_s_d),v=K.MulRV(a,this.m_localXAxisA,this.m_axis),y=j.CrossVV(j.AddVV(g,p,j.s_t0),v),b=j.CrossVV(m,v),S=K.MulRV(a,this.m_localYAxisA,this.m_perp),x=j.CrossVV(j.AddVV(g,p,j.s_t0),S),w=j.CrossVV(m,S),T=n.SolvePositionConstraints_s_impulse,C=j.DotVV(S,g),A=s-i-this.m_referenceAngle,D=P(C),I=P(A),B=!1,M=0;if(this.m_enableLimit){var E=j.DotVV(v,g);P(this.m_upperTranslation-this.m_lowerTranslation)<.016?(M=O(E,-.2,d),D=k(D,P(E)),B=!0):E<=this.m_lowerTranslation?(M=O(E-this.m_lowerTranslation+l,-.2,0),D=k(D,this.m_lowerTranslation-E),B=!0):E>=this.m_upperTranslation&&(M=O(E-this.m_upperTranslation-l,0,d),D=k(D,E-this.m_upperTranslation),B=!0)}if(B){var R=h+u+f*x*x+_*w*w,F=f*x+_*w,L=f*x*y+_*w*b,V=f+_;0===V&&(V=1);var N=f*y+_*b,z=h+u+f*y*y+_*b*b,G=this.m_K3;G.ex.SetXYZ(R,F,L),G.ey.SetXYZ(F,V,N),G.ez.SetXYZ(L,N,z),T=G.Solve33(-C,-A,-M,T)}else{var U=h+u+f*x*x+_*w*w,H=f*x+_*w,W=f+_;0===W&&(W=1);var q=this.m_K2;q.ex.Set(U,H),q.ey.Set(H,W);var X=q.Solve(-C,-A,n.SolvePositionConstraints_s_impulse1);T.x=X.x,T.y=X.y,T.z=0}var Y=j.AddVV(j.MulSV(T.x,S,j.s_t0),j.MulSV(T.z,v,j.s_t1),n.SolvePositionConstraints_s_P),Q=T.x*x+T.y+T.z*y,J=T.x*w+T.y+T.z*b;return e.SelfMulSub(h,Y),i-=f*Q,r.SelfMulAdd(u,Y),s+=_*J,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,D<=l&&I<=c},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},r.GetReactionTorque=function(t){return t*this.m_impulse.y},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetLocalAxisA=function(){return this.m_localXAxisA},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=j.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return j.DotVV(i,r)},r.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;j.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=K.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=K.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=j.AddVV(t.m_sweep.c,i,j.s_t0),s=j.AddVV(e.m_sweep.c,n,j.s_t1),a=j.SubVV(s,r,j.s_t2),o=t.GetWorldVector(this.m_localXAxisA,this.m_axis),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return j.DotVV(a,j.CrossSV(l,o,j.s_t0))+j.DotVV(o,j.SubVV(j.AddVCrossSV(u,c,n,j.s_t0),j.AddVCrossSV(h,l,i,j.s_t1),j.s_t0))},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerTranslation},r.GetUpperLimit=function(){return this.m_upperTranslation},r.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},r.GetMaxMotorForce=function(){return this.m_maxMotorForce},r.GetMotorForce=function(t){return t*this.m_motorImpulse},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Oi);Yi.InitVelocityConstraints_s_d=new j,Yi.InitVelocityConstraints_s_P=new j,Yi.SolveVelocityConstraints_s_P=new j,Yi.SolveVelocityConstraints_s_f2r=new j,Yi.SolveVelocityConstraints_s_f1=new X,Yi.SolveVelocityConstraints_s_df3=new X,Yi.SolveVelocityConstraints_s_df2=new j,Yi.SolvePositionConstraints_s_d=new j,Yi.SolvePositionConstraints_s_impulse=new X,Yi.SolvePositionConstraints_s_impulse1=new j,Yi.SolvePositionConstraints_s_P=new j,Yi.GetJointTranslation_s_pA=new j,Yi.GetJointTranslation_s_pB=new j,Yi.GetJointTranslation_s_d=new j,Yi.GetJointTranslation_s_axis=new j;var Qi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_pulleyJoint)||this).groundAnchorA=new j(-1,1),i.groundAnchorB=new j(1,1),i.localAnchorA=new j(-1,0),i.localAnchorB=new j(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,a){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=j.DistanceVV(r,i),this.lengthB=j.DistanceVV(s,n),this.ratio=a},i}(ki),Ki=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_groundAnchorA=new j,n.m_groundAnchorB=new j,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new j,n.m_uB=new j,n.m_rA=new j,n.m_rB=new j,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new K,n.m_qB=new K,n.m_lalcA=new j,n.m_lalcB=new j,n.m_groundAnchorA.Copy(e(i.groundAnchorA,new j(-1,1))),n.m_groundAnchorB.Copy(e(i.groundAnchorB,new j(1,0))),n.m_localAnchorA.Copy(e(i.localAnchorA,new j(-1,0))),n.m_localAnchorB.Copy(e(i.localAnchorB,new j(1,0))),n.m_lengthA=e(i.lengthA,0),n.m_lengthB=e(i.lengthB,0),n.m_ratio=e(i.ratio,1),n.m_constant=e(i.lengthA,0)+n.m_ratio*e(i.lengthB,0),n.m_impulse=0,n}s(i,t);var n=i.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=this.m_qA.SetAngle(n),c=this.m_qB.SetAngle(o);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(l,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(c,this.m_lalcB,this.m_rB),this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var f=this.m_uA.Length(),d=this.m_uB.Length();f>.08?this.m_uA.SelfMul(1/f):this.m_uA.SetZero(),d>.08?this.m_uB.SelfMul(1/d):this.m_uB.SetZero();var _=j.CrossVV(this.m_rA,this.m_uA),p=j.CrossVV(this.m_rB,this.m_uB),m=this.m_invMassA+this.m_invIA*_*_,g=this.m_invMassB+this.m_invIB*p*p;if(this.m_mass=m+this.m_ratio*this.m_ratio*g,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var v=j.MulSV(-this.m_impulse,this.m_uA,i.InitVelocityConstraints_s_PA),y=j.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,i.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,v),s+=this.m_invIA*j.CrossVV(this.m_rA,v),h.SelfMulAdd(this.m_invMassB,y),u+=this.m_invIB*j.CrossVV(this.m_rB,y)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=u},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=-j.DotVV(this.m_uA,a)-this.m_ratio*j.DotVV(this.m_uB,o),u=-this.m_mass*h;this.m_impulse+=u;var l=j.MulSV(-u,this.m_uA,i.SolveVelocityConstraints_s_PA),c=j.MulSV(-this.m_ratio*u,this.m_uB,i.SolveVelocityConstraints_s_PB);e.SelfMulAdd(this.m_invMassA,l),n+=this.m_invIA*j.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,c),s+=this.m_invIB*j.CrossVV(this.m_rB,c),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=K.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),f=this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB),d=c.Length(),_=f.Length();d>.08?c.SelfMul(1/d):c.SetZero(),_>.08?f.SelfMul(1/_):f.SetZero();var p=j.CrossVV(h,c),m=j.CrossVV(u,f),g=this.m_invMassA+this.m_invIA*p*p,v=this.m_invMassB+this.m_invIB*m*m,y=g+this.m_ratio*this.m_ratio*v;y>0&&(y=1/y);var b=this.m_constant-d-this.m_ratio*_,S=P(b),x=-y*b,w=j.MulSV(-x,c,i.SolvePositionConstraints_s_PA),T=j.MulSV(-this.m_ratio*x,f,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,w),n+=this.m_invIA*j.CrossVV(h,w),r.SelfMulAdd(this.m_invMassB,T),s+=this.m_invIB*j.CrossVV(u,T),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,S0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!m||(this.m_motorImpulse=0),this.m_enableLimit&&!m){var g=a-i-this.m_referenceAngle;P(this.m_upperAngle-this.m_lowerAngle)<2*c?this.m_limitState=t.b2LimitState.e_equalLimits:g<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):g>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var v=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(f,v),s-=_*(j.CrossVV(this.m_rA,v)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(d,v),h+=p*(j.CrossVV(this.m_rB,v)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB,c=u+l===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!c){var f=a-r-this.m_motorSpeed,d=-this.m_motorMass*f,_=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=O(this.m_motorImpulse+d,-p,p),r-=u*(d=this.m_motorImpulse-_),a+=l*d}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var m=j.SubVV(j.AddVCrossSV(s,a,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot1),g=a-r,v=this.m_mass.Solve33(m.x,m.y,g,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit)if(this.m_impulse.z+v.z<0){var y=-m.x+this.m_impulse.z*this.m_mass.ez.x,b=-m.y+this.m_impulse.z*this.m_mass.ez.y,S=this.m_mass.Solve22(y,b,n.SolveVelocityConstraints_s_reduced_v2);v.x=S.x,v.y=S.y,v.z=-this.m_impulse.z,this.m_impulse.x+=S.x,this.m_impulse.y+=S.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atUpperLimit)if(this.m_impulse.z+v.z>0){var x=-m.x+this.m_impulse.z*this.m_mass.ez.x,w=-m.y+this.m_impulse.z*this.m_mass.ez.y,T=this.m_mass.Solve22(x,w,n.SolveVelocityConstraints_s_reduced_v2);v.x=T.x,v.y=T.y,v.z=-this.m_impulse.z,this.m_impulse.x+=T.x,this.m_impulse.y+=T.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v);var C=n.SolveVelocityConstraints_s_P.Set(v.x,v.y);i.SelfMulSub(o,C),r-=u*(j.CrossVV(this.m_rA,C)+v.z),s.SelfMulAdd(h,C),a+=l*(j.CrossVV(this.m_rB,C)+v.z)}else{var A=j.SubVV(j.AddVCrossSV(s,a,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),D=this.m_mass.Solve22(-A.x,-A.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=D.x,this.m_impulse.y+=D.y,i.SelfMulSub(o,D),r-=u*j.CrossVV(this.m_rA,D),s.SelfMulAdd(h,D),a+=l*j.CrossVV(this.m_rB,D)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(e){var i,r=e.positions[this.m_indexA].c,s=e.positions[this.m_indexA].a,a=e.positions[this.m_indexB].c,o=e.positions[this.m_indexB].a,h=this.m_qA.SetAngle(s),u=this.m_qB.SetAngle(o),f=0,d=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!d){var p=o-s-this.m_referenceAngle,m=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var g=O(p-this.m_lowerAngle,-.13962634015955555,_);m=-this.m_motorMass*g,f=P(g)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var v=p-this.m_lowerAngle;f=-v,v=O(v+c,-.13962634015955555,0),m=-this.m_motorMass*v}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var y=p-this.m_upperAngle;f=y,y=O(y-c,0,_),m=-this.m_motorMass*y}s-=this.m_invIA*m,o+=this.m_invIB*m}h.SetAngle(s),u.SetAngle(o),j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var b=K.MulRV(h,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var S=K.MulRV(u,this.m_lalcB,this.m_rB),x=j.SubVV(j.AddVV(a,S,j.s_t0),j.AddVV(r,b,j.s_t1),n.SolvePositionConstraints_s_C_v2);i=x.Length();var w=this.m_invMassA,T=this.m_invMassB,C=this.m_invIA,A=this.m_invIB,D=this.m_K;D.ex.x=w+T+C*b.y*b.y+A*S.y*S.y,D.ex.y=-C*b.x*b.y-A*S.x*S.y,D.ey.x=D.ex.y,D.ey.y=w+T+C*b.x*b.x+A*S.x*S.x;var I=D.Solve(x.x,x.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(w,I),s-=C*j.CrossVV(b,I),a.SelfMulAdd(T,I),o+=A*j.CrossVV(S,I),e.positions[this.m_indexA].a=s,e.positions[this.m_indexB].a=o,i<=l&&f<=c},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},r.GetReactionTorque=function(t){return t*this.m_impulse.z},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},r.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.GetMotorTorque=function(t){return t*this.m_motorImpulse},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},r.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerAngle},r.GetUpperLimit=function(){return this.m_upperAngle},r.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(Oi);Zi.InitVelocityConstraints_s_P=new j,Zi.SolveVelocityConstraints_s_P=new j,Zi.SolveVelocityConstraints_s_Cdot_v2=new j,Zi.SolveVelocityConstraints_s_Cdot1=new j,Zi.SolveVelocityConstraints_s_impulse_v3=new X,Zi.SolveVelocityConstraints_s_reduced_v2=new j,Zi.SolveVelocityConstraints_s_impulse_v2=new j,Zi.SolvePositionConstraints_s_C_v2=new j,Zi.SolvePositionConstraints_s_impulse=new j;var $i=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_ropeJoint)||this).localAnchorA=new j(-1,0),i.localAnchorB=new j(1,0),i.maxLength=0,i}return s(i,e),i}(ki),tn=function(i){function n(n){var r;return(r=i.call(this,n)||this).m_localAnchorA=new j,r.m_localAnchorB=new j,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new j,r.m_rA=new j,r.m_rB=new j,r.m_localCenterA=new j,r.m_localCenterB=new j,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new K,r.m_qB=new K,r.m_lalcA=new j,r.m_lalcB=new j,r.m_localAnchorA.Copy(e(n.localAnchorA,new j(-1,0))),r.m_localAnchorB.Copy(e(n.localAnchorB,new j(1,0))),r.m_maxLength=e(n.maxLength,0),r}s(n,i);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,c=e.velocities[this.m_indexB].w,f=this.m_qA.SetAngle(r),d=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),K.MulRV(f,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),K.MulRV(d,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var _=this.m_length-this.m_maxLength;if(this.m_state=_>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>l))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var p=j.CrossVV(this.m_rA,this.m_u),m=j.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var v=j.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,v),a-=this.m_invIA*j.CrossVV(this.m_rA,v),u.SelfMulAdd(this.m_invMassB,v),c+=this.m_invIB*j.CrossVV(this.m_rB,v)}else this.m_impulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=c},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=j.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),o=j.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),h=this.m_length-this.m_maxLength,u=j.DotVV(this.m_u,j.SubVV(o,a,j.s_t0));h<0&&(u+=t.step.inv_dt*h);var l=-this.m_mass*u,c=this.m_impulse;this.m_impulse=E(0,this.m_impulse+l),l=this.m_impulse-c;var f=j.MulSV(l,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,f),i-=this.m_invIA*j.CrossVV(this.m_rA,f),r.SelfMulAdd(this.m_invMassB,f),s+=this.m_invIB*j.CrossVV(this.m_rB,f),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=K.MulRV(o,this.m_lalcB,this.m_rB),c=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),f=c.Normalize(),_=f-this.m_maxLength;_=O(_,0,d);var p=-this.m_mass*_,m=j.MulSV(p,c,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,m),i-=this.m_invIA*j.CrossVV(h,m),r.SelfMulAdd(this.m_invMassB,m),s+=this.m_invIB*j.CrossVV(u,m),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,f-this.m_maxLength0){p.GetInverse22(this.m_mass);var m=d+_,g=m>0?1/m:0,v=s-e-this.m_referenceAngle,y=2*o*this.m_frequencyHz,b=2*g*this.m_dampingRatio*y,S=g*y*y,x=t.step.dt;this.m_gamma=x*(b+x*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*x*S*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var w=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,w),r-=d*(j.CrossVV(this.m_rA,w)+this.m_impulse.z),a.SelfMulAdd(f,w),h+=_*(j.CrossVV(this.m_rB,w)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB;if(this.m_frequencyHz>0){var l=s-n,c=-this.m_mass.ez.z*(l+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=c,n-=h*c,s+=u*c;var f=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot1),d=Q.MulM33XY(this.m_mass,f.x,f.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=d.x,this.m_impulse.y+=d.y;var _=d;e.SelfMulSub(a,_),n-=h*j.CrossVV(this.m_rA,_),r.SelfMulAdd(o,_),s+=u*j.CrossVV(this.m_rB,_)}else{var p=j.SubVV(j.AddVCrossSV(r,s,this.m_rB,j.s_t0),j.AddVCrossSV(e,n,this.m_rA,j.s_t1),i.SolveVelocityConstraints_s_Cdot1),m=s-n,g=Q.MulM33XYZ(this.m_mass,p.x,p.y,m,i.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(g);var v=i.SolveVelocityConstraints_s_P.Set(g.x,g.y);e.SelfMulSub(a,v),n-=h*(j.CrossVV(this.m_rA,v)+g.z),r.SelfMulAdd(o,v),s+=u*(j.CrossVV(this.m_rB,v)+g.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,f=this.m_invIA,d=this.m_invIB;j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var _=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,g=K.MulRV(o,this.m_lalcB,this.m_rB),v=this.m_K;if(v.ex.x=h+u+_.y*_.y*f+g.y*g.y*d,v.ey.x=-_.y*_.x*f-g.y*g.x*d,v.ez.x=-_.y*f-g.y*d,v.ex.y=v.ey.x,v.ey.y=h+u+_.x*_.x*f+g.x*g.x*d,v.ez.y=_.x*f+g.x*d,v.ex.z=v.ez.x,v.ey.z=v.ez.y,v.ez.z=f+d,this.m_frequencyHz>0){var y=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,_,j.s_t1),i.SolvePositionConstraints_s_C1);p=y.Length(),m=0;var b=v.Solve22(y.x,y.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(h,b),n-=f*j.CrossVV(_,b),r.SelfMulAdd(u,b),s+=d*j.CrossVV(g,b)}else{var S=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,_,j.s_t1),i.SolvePositionConstraints_s_C1),x=s-n-this.m_referenceAngle;p=S.Length(),m=P(x);var w=v.Solve33(S.x,S.y,x,i.SolvePositionConstraints_s_impulse).SelfNeg(),T=i.SolvePositionConstraints_s_P.Set(w.x,w.y);e.SelfMulSub(h,T),n-=f*(j.CrossVV(this.m_rA,T)+w.z),r.SelfMulAdd(u,T),s+=d*(j.CrossVV(this.m_rB,T)+w.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,p<=l&&m<=c},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.GetReactionTorque=function(t){return t*this.m_impulse.z},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetReferenceAngle=function(){return this.m_referenceAngle},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Oi);nn.InitVelocityConstraints_s_P=new j,nn.SolveVelocityConstraints_s_Cdot1=new j,nn.SolveVelocityConstraints_s_impulse1=new j,nn.SolveVelocityConstraints_s_impulse=new X,nn.SolveVelocityConstraints_s_P=new j,nn.SolvePositionConstraints_s_C1=new j,nn.SolvePositionConstraints_s_P=new j,nn.SolvePositionConstraints_s_impulse=new X;var rn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_wheelJoint)||this).localAnchorA=new j(0,0),i.localAnchorB=new j(0,0),i.localAxisA=new j(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i}(ki),sn=function(t){function i(i){var n;return(n=t.call(this,i)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new j,n.m_localAnchorB=new j,n.m_localXAxisA=new j,n.m_localYAxisA=new j,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new j,n.m_localCenterB=new j,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new j,n.m_ay=new j,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new K,n.m_qB=new K,n.m_lalcA=new j,n.m_lalcB=new j,n.m_rA=new j,n.m_rB=new j,n.m_frequencyHz=e(i.frequencyHz,2),n.m_dampingRatio=e(i.dampingRatio,.7),n.m_localAnchorA.Copy(e(i.localAnchorA,j.ZERO)),n.m_localAnchorB.Copy(e(i.localAnchorB,j.ZERO)),n.m_localXAxisA.Copy(e(i.localAxisA,j.UNITX)),j.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=e(i.maxMotorTorque,0),n.m_motorSpeed=e(i.motorSpeed,0),n.m_enableMotor=e(i.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}s(i,t);var n=i.prototype;return n.GetMotorSpeed=function(){return this.m_motorSpeed},n.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},n.GetSpringFrequencyHz=function(){return this.m_frequencyHz},n.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},n.GetSpringDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.positions[this.m_indexA].c,h=t.positions[this.m_indexA].a,u=t.velocities[this.m_indexA].v,l=t.velocities[this.m_indexA].w,c=t.positions[this.m_indexB].c,f=t.positions[this.m_indexB].a,d=t.velocities[this.m_indexB].v,_=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(h),m=this.m_qB.SetAngle(f);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var g=K.MulRV(p,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var v=K.MulRV(m,this.m_lalcB,this.m_rB),y=j.SubVV(j.AddVV(c,v,j.s_t0),j.AddVV(a,g,j.s_t1),i.InitVelocityConstraints_s_d);if(K.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=j.CrossVV(j.AddVV(y,g,j.s_t0),this.m_ay),this.m_sBy=j.CrossVV(v,this.m_ay),this.m_mass=e+n+r*this.m_sAy*this.m_sAy+s*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){K.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=j.CrossVV(j.AddVV(y,g,j.s_t0),this.m_ax),this.m_sBx=j.CrossVV(v,this.m_ax);var b=e+n+r*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(b>0){this.m_springMass=1/b;var S=j.DotVV(y,this.m_ax),x=2*o*this.m_frequencyHz,w=2*this.m_springMass*this.m_dampingRatio*x,T=this.m_springMass*x*x,C=t.step.dt;this.m_gamma=C*(w+C*T),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=S*C*T*this.m_gamma,this.m_springMass=b+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+s,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var A=j.AddVV(j.MulSV(this.m_impulse,this.m_ay,j.s_t0),j.MulSV(this.m_springImpulse,this.m_ax,j.s_t1),i.InitVelocityConstraints_s_P),D=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,I=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,A),l-=this.m_invIA*D,d.SelfMulAdd(this.m_invMassB,A),_+=this.m_invIB*I}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=l,t.velocities[this.m_indexB].w=_},n.SolveVelocityConstraints=function(t){var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=j.DotVV(this.m_ax,j.SubVV(h,a,j.s_t0))+this.m_sBx*u-this.m_sAx*o,c=-this.m_springMass*(l+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=c;var f=j.MulSV(c,this.m_ax,i.SolveVelocityConstraints_s_P),d=c*this.m_sAx,_=c*this.m_sBx;a.SelfMulSub(e,f),o-=r*d,h.SelfMulAdd(n,f);var p=(u+=s*_)-o-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,v=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=O(this.m_motorImpulse+m,-v,v),o-=r*(m=this.m_motorImpulse-g),u+=s*m;var y=j.DotVV(this.m_ay,j.SubVV(h,a,j.s_t0))+this.m_sBy*u-this.m_sAy*o,b=-this.m_mass*y;this.m_impulse+=b;var S=j.MulSV(b,this.m_ay,i.SolveVelocityConstraints_s_P),x=b*this.m_sAy,w=b*this.m_sBy;a.SelfMulSub(e,S),o-=r*x,h.SelfMulAdd(n,S),u+=s*w,t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=u},n.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=K.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,c=K.MulRV(o,this.m_lalcB,this.m_rB),f=j.AddVV(j.SubVV(r,e,j.s_t0),j.SubVV(c,h,j.s_t1),i.SolvePositionConstraints_s_d),d=K.MulRV(a,this.m_localYAxisA,this.m_ay),_=j.CrossVV(j.AddVV(f,h,j.s_t0),d),p=j.CrossVV(c,d),m=j.DotVV(f,this.m_ay),g=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;u=0!==g?-m/g:0;var v=j.MulSV(u,d,i.SolvePositionConstraints_s_P),y=u*_,b=u*p;return e.SelfMulSub(this.m_invMassA,v),n-=this.m_invIA*y,r.SelfMulAdd(this.m_invMassB,v),s+=this.m_invIB*b,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,P(m)<=l},n.GetDefinition=function(t){return t},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},n.GetReactionTorque=function(t){return t*this.m_motorImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetLocalAxisA=function(){return this.m_localXAxisA},n.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},n.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},n.GetJointAngle=function(){return this.GetRevoluteJointAngle()},n.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},n.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new j),n=e.GetWorldPoint(this.m_localAnchorB,new j),r=j.SubVV(n,i,new j),s=t.GetWorldVector(this.m_localXAxisA,new j);return j.DotVV(r,s)},n.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;j.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=K.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=K.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=j.AddVV(t.m_sweep.c,i,j.s_t0),s=j.AddVV(e.m_sweep.c,n,j.s_t1),a=j.SubVV(s,r,j.s_t2),o=t.GetWorldVector(this.m_localXAxisA,new j),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return j.DotVV(a,j.CrossSV(l,o,j.s_t0))+j.DotVV(o,j.SubVV(j.AddVCrossSV(u,c,n,j.s_t0),j.AddVCrossSV(h,l,i,j.s_t1),j.s_t0))},n.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},n.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},n.IsMotorEnabled=function(){return this.m_enableMotor},n.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i}(Oi);function an(t,e){return V(t*e)}function on(t,e){return t>e?t:e}sn.InitVelocityConstraints_s_d=new j,sn.InitVelocityConstraints_s_P=new j,sn.SolveVelocityConstraints_s_P=new j,sn.SolvePositionConstraints_s_d=new j,sn.SolvePositionConstraints_s_P=new j;var hn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.contact=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),un=function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_nodeA=new hn(this),this.m_nodeB=new hn(this),this.m_indexA=0,this.m_indexB=0,this.m_manifold=new Ot,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new Ot}var e=t.prototype;return e.GetManifold=function(){return this.m_manifold},e.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.GetShapeA(),r=this.GetShapeB();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},e.IsTouching=function(){return this.m_touchingFlag},e.SetEnabled=function(t){this.m_enabledFlag=t},e.IsEnabled=function(){return this.m_enabledFlag},e.GetNext=function(){return this.m_next},e.GetFixtureA=function(){return this.m_fixtureA},e.GetChildIndexA=function(){return this.m_indexA},e.GetShapeA=function(){return this.m_fixtureA.GetShape()},e.GetFixtureB=function(){return this.m_fixtureB},e.GetChildIndexB=function(){return this.m_indexB},e.GetShapeB=function(){return this.m_fixtureB.GetShape()},e.FlagForFiltering=function(){this.m_filterFlag=!0},e.SetFriction=function(t){this.m_friction=t},e.GetFriction=function(){return this.m_friction},e.ResetFriction=function(){this.m_friction=an(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},e.SetRestitution=function(t){this.m_restitution=t},e.GetRestitution=function(){return this.m_restitution},e.ResetRestitution=function(){this.m_restitution=on(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.SetTangentSpeed=function(t){this.m_tangentSpeed=t},e.GetTangentSpeed=function(){return this.m_tangentSpeed},e.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,this.m_nodeA.Reset(),this.m_nodeB.Reset(),this.m_toiCount=0,this.m_friction=an(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=on(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),a=r||s,o=this.m_fixtureA.GetBody(),h=this.m_fixtureB.GetBody(),u=o.GetTransform(),l=h.GetTransform();if(a){var c=this.GetShapeA(),f=this.GetShapeB();i=jt(c,this.m_indexA,f,this.m_indexB,u,l),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,u,l),i=this.m_manifold.pointCount>0;for(var d=0;d0:!!(s.maskBits&a.categoryBits)&&!!(s.categoryBits&a.maskBits)},i.ShouldCollideFixtureParticle=function(){return!0},i.ShouldCollideParticleParticle=function(){return!0},e}();bn.b2_defaultFilter=new bn;var Sn=function(){this.normalImpulses=D(2),this.tangentImpulses=D(2),this.count=0},xn=function(){function t(){}var e=t.prototype;return e.BeginContact=function(){},e.EndContact=function(){},e.BeginContactFixtureParticle=function(){},e.EndContactFixtureParticle=function(){},e.BeginContactParticleParticle=function(){},e.EndContactParticleParticle=function(){},e.PreSolve=function(){},e.PostSolve=function(){},t}();xn.b2_defaultListener=new xn;var wn=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(){return!0},e.ReportParticle=function(){return!1},e.ShouldQueryParticleSystem=function(){return!0},t}(),Tn=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(t,e,i,n){return n},e.ReportParticle=function(){return 0},e.ShouldQueryParticleSystem=function(){return!0},t}(),Cn=function(){function e(){this.m_broadPhase=new $t,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=bn.b2_defaultFilter,this.m_contactListener=xn.b2_defaultListener,this.m_contactFactory=new vn}var i=e.prototype;return i.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,a=i.GetBody(),o=n.GetBody();if(a!==o){for(var h=o.GetContactList();h;){if(h.other===a){var u=h.contact.GetFixtureA(),l=h.contact.GetFixtureB(),c=h.contact.GetChildIndexA(),f=h.contact.GetChildIndexB();if(u===i&&l===n&&c===r&&f===s)return;if(u===n&&l===i&&c===s&&f===r)return}h=h.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var d=this.m_contactFactory.Create(i,r,n,s);null!==d&&(i=d.GetFixtureA(),n=d.GetFixtureB(),r=d.GetChildIndexA(),s=d.GetChildIndexB(),a=i.m_body,o=n.m_body,d.m_prev=null,d.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=d),this.m_contactList=d,d.m_nodeA.other=o,d.m_nodeA.prev=null,d.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=d.m_nodeA),a.m_contactList=d.m_nodeA,d.m_nodeB.other=a,d.m_nodeB.prev=null,d.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=d.m_nodeB),o.m_contactList=d.m_nodeB,i.IsSensor()||n.IsSensor()||(a.SetAwake(!0),o.SetAwake(!0)),++this.m_contactCount)}}},i.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},i.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),t.m_manifold.pointCount>0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0)),this.m_contactFactory.Destroy(t),--this.m_contactCount},i.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),a=i.GetBody(),o=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){var h=e;e=h.m_next,this.Destroy(h);continue}e.m_filterFlag=!1}var u=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody,l=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody;if(u||l){var c=i.m_proxies[r].treeNode,f=n.m_proxies[s].treeNode;if(zt(c.aabb,f.aabb))e.Update(this.m_contactListener),e=e.m_next;else{var d=e;e=d.m_next,this.Destroy(d)}}else e=e.m_next}},e}(),An=function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t}(),Dn=function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t}(),In=function(){function t(){this.c=new j,this.a=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),Bn=function(){function t(){this.v=new j,this.w=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),Mn=function(){this.step=new Dn},Pn=!1,En=function(){function t(){this.rA=new j,this.rB=new j,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),kn=function(){function t(){this.points=En.MakeArray(2),this.normal=new j,this.tangent=new j,this.normalMass=new Y,this.K=new Y,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return A(e,(function(){return new t}))},t}(),On=function(){function e(){this.localPoints=j.MakeArray(2),this.localNormal=new j,this.localPoint=new j,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new j,this.localCenterB=new j,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return A(t,(function(){return new e}))},e}(),Rn=function(){this.step=new Dn,this.count=0},Fn=function(){function e(){this.normal=new j,this.point=new j,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var a=e.Initialize_s_pointA,o=e.Initialize_s_pointB,h=e.Initialize_s_planePoint,u=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:J.MulXV(n,i.localPoint,a),J.MulXV(r,i.localPoints[0],o),j.SubVV(o,a,this.normal).SelfNormalize(),j.MidVV(a,o,this.point),this.separation=j.DotVV(j.SubVV(o,a,j.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:K.MulRV(n.q,i.localNormal,this.normal),J.MulXV(n,i.localPoint,h),J.MulXV(r,i.localPoints[s],u),this.separation=j.DotVV(j.SubVV(u,h,j.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u);break;case t.b2ManifoldType.e_faceB:K.MulRV(r.q,i.localNormal,this.normal),J.MulXV(r,i.localPoint,h),J.MulXV(n,i.localPoints[s],u),this.separation=j.DotVV(j.SubVV(u,h,j.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u),this.normal.SelfNeg()}},e}();Fn.Initialize_s_pointA=new j,Fn.Initialize_s_pointB=new j,Fn.Initialize_s_planePoint=new j,Fn.Initialize_s_clipPoint=new j;var Ln=function(){function t(){this.m_step=new Dn,this.m_positionConstraints=On.MakeArray(1024),this.m_velocityConstraints=kn.MakeArray(1024),this.m_count=0}var e=t.prototype;return e.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_count=t.count,this.m_positionConstraints.length0?1/P:0;var E=s.tangent,k=j.CrossVV(I.rA,E),O=j.CrossVV(I.rB,E),R=f+d+_*k*k+p*O*O;I.tangentMass=R>0?1/R:0,I.velocityBias=0;var F=j.DotVV(s.normal,j.SubVV(j.AddVCrossSV(T,C,I.rB,j.s_t0),j.AddVCrossSV(b,S,I.rA,j.s_t1),j.s_t0));F<-1&&(I.velocityBias+=-s.restitution*F)}s.pointCount}},e.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i0?-I/P:0;j.MulSV(k,C,a),b.SelfMulSub(_,a),S-=p*j.CrossVV(r,a),x.SelfMulAdd(g,a),w+=v*j.CrossVV(s,a)}this.m_positions[c].a=S,this.m_positions[f].a=w}return o>-.024},e.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,a=t.SolveTOIPositionConstraints_s_rA,o=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,u=0,c=0;c0?-M/R:0;j.MulSV(F,D,h),x.SelfMulSub(v,h),w-=y*j.CrossVV(a,h),T.SelfMulAdd(b,h),C+=S*j.CrossVV(o,h)}this.m_positions[d].a=w,this.m_positions[_].a=C}return u>=-.012},t}();Ln.InitializeVelocityConstraints_s_xfA=new J,Ln.InitializeVelocityConstraints_s_xfB=new J,Ln.InitializeVelocityConstraints_s_worldManifold=new Rt,Ln.WarmStart_s_P=new j,Ln.SolveVelocityConstraints_s_dv=new j,Ln.SolveVelocityConstraints_s_dv1=new j,Ln.SolveVelocityConstraints_s_dv2=new j,Ln.SolveVelocityConstraints_s_P=new j,Ln.SolveVelocityConstraints_s_a=new j,Ln.SolveVelocityConstraints_s_b=new j,Ln.SolveVelocityConstraints_s_x=new j,Ln.SolveVelocityConstraints_s_d=new j,Ln.SolveVelocityConstraints_s_P1=new j,Ln.SolveVelocityConstraints_s_P2=new j,Ln.SolveVelocityConstraints_s_P1P2=new j,Ln.SolvePositionConstraints_s_xfA=new J,Ln.SolvePositionConstraints_s_xfB=new J,Ln.SolvePositionConstraints_s_psm=new Fn,Ln.SolvePositionConstraints_s_rA=new j,Ln.SolvePositionConstraints_s_rB=new j,Ln.SolvePositionConstraints_s_P=new j,Ln.SolveTOIPositionConstraints_s_xfA=new J,Ln.SolveTOIPositionConstraints_s_xfB=new J,Ln.SolveTOIPositionConstraints_s_psm=new Fn,Ln.SolveTOIPositionConstraints_s_rA=new j,Ln.SolveTOIPositionConstraints_s_rB=new j,Ln.SolveTOIPositionConstraints_s_P=new j;var Vn,Nn=function(){function e(){this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=In.MakeArray(1024),this.m_velocities=Bn.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}var n=e.prototype;return n.Initialize=function(t,e,i,n){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_listener=n,this.m_positions.length4){var I=2/D.Length();C.SelfMul(I)}var B=h*A;B*B>g&&(A*=m/P(B)),w.x+=h*C.x,w.y+=h*C.y,T+=h*A,this.m_positions[x].a=T,this.m_velocities[x].w=A}o.Reset();for(var M=!1,k=0;k.0012184696791469947||j.DotVV(U.m_linearVelocity,U.m_linearVelocity)>1e-4?(U.m_sleepTime=0,z=0):(U.m_sleepTime+=h,z=E(z,U.m_sleepTime)))}if(z>=.5&&M)for(var H=0;H4){var y=2/v.Length();_.SelfMul(y)}var b=l*p;b*b>g&&(p*=m/P(b)),f.SelfMulAdd(l,_),d+=l*p,this.m_positions[c].a=d,this.m_velocities[c].w=p;var S=this.m_bodies[c];S.m_sweep.c.Copy(f),S.m_sweep.a=d,S.m_linearVelocity.Copy(_),S.m_angularVelocity=p,S.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},n.Report=function(t){if(null!==this.m_listener)for(var i=0;i0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(var s=this.m_firstIndex;s0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e}();jn.GetLinearVelocityFromWorldPoint_s_t0=new j;var qn=function(){function t(t){this.m_buffer=[],this.m_front=0,this.m_back=0,this.m_buffer.fill(null,0,t)}var e=t.prototype;return e.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e=0&&d>=0&&f0&&u.Push(new Qn(p-1,m,g-1,v)),m>0&&u.Push(new Qn(p,m-1,g-this.m_countX,v)),pV*V+N*N&&(this.m_diagram[E]=R,M>0&&u.Push(new Qn(M-1,P,E-1,R)),P>0&&u.Push(new Qn(M,P-1,E-this.m_countX,R)),M=i)break;Kn(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}function $n(t,e,i,n){return void 0===i&&(i=t.length-e),void 0===n&&(n=Jn),Zn(t,e,i,n)}function tr(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r0;){var a=Math.floor(s/2),o=e+a;r(t[o],n)?(e=++o,s-=a+1):s=a}return e}function ir(t,e,i,n,r){for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(n,t[o])?s=a:(e=++o,s-=a+1)}return e}function nr(t,e,i,n){for(var r=i;e!==r;)Kn(t,e++,r++),r===n?r=i:e===i&&(i=r)}function rr(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Kn(t,++r,e);return++r}var sr=function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}var e=t.prototype;return e.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},e.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e=0;)this.ReportFixtureAndParticle(t,i,s);return!0},i.ReportParticle=function(){return!1},i.ReportFixtureAndParticle=function(){},e}(wn),or=function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new j,this.flags=0}var e=t.prototype;return e.SetIndices=function(t,e){this.indexA=t,this.indexB=e},e.SetWeight=function(t){this.weight=t},e.SetNormal=function(t){this.normal.Copy(t)},e.SetFlags=function(t){this.flags=t},e.GetIndexA=function(){return this.indexA},e.GetIndexB=function(){return this.indexB},e.GetWeight=function(){return this.weight},e.GetNormal=function(){return this.normal},e.GetFlags=function(){return this.flags},e.IsEqual=function(t){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},e.IsNotEqual=function(t){return!this.IsEqual(t)},e.ApproximatelyEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&P(this.weight-t.weight)<.01&&j.DistanceSquaredVV(this.normal,t.normal)<1e-4},t}(),hr=function(){this.index=0,this.weight=0,this.normal=new j,this.mass=0},ur=function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0},lr=function(){this.indexA=0,this.indexB=0,this.indexC=0,this.flags=0,this.strength=0,this.pa=new j(0,0),this.pb=new j(0,0),this.pc=new j(0,0),this.ka=0,this.kb=0,this.kc=0,this.s=0},cr=function(){function t(){this.strictContactCheck=!1,this.density=1,this.gravityScale=1,this.radius=1,this.maxCount=0,this.pressureStrength=.005,this.dampingStrength=1,this.elasticStrength=.25,this.springStrength=.25,this.viscousStrength=.25,this.surfaceTensionPressureStrength=.2,this.surfaceTensionNormalStrength=.2,this.repulsiveStrength=1,this.powderStrength=.5,this.ejectionStrength=.5,this.staticPressureStrength=.2,this.staticPressureRelaxation=.2,this.staticPressureIterations=8,this.colorMixingStrength=.5,this.destroyByAge=!0,this.lifetimeGranularity=1/60}var e=t.prototype;return e.Copy=function(t){return this.strictContactCheck=t.strictContactCheck,this.density=t.density,this.gravityScale=t.gravityScale,this.radius=t.radius,this.maxCount=t.maxCount,this.pressureStrength=t.pressureStrength,this.dampingStrength=t.dampingStrength,this.elasticStrength=t.elasticStrength,this.springStrength=t.springStrength,this.viscousStrength=t.viscousStrength,this.surfaceTensionPressureStrength=t.surfaceTensionPressureStrength,this.surfaceTensionNormalStrength=t.surfaceTensionNormalStrength,this.repulsiveStrength=t.repulsiveStrength,this.powderStrength=t.powderStrength,this.ejectionStrength=t.ejectionStrength,this.staticPressureStrength=t.staticPressureStrength,this.staticPressureRelaxation=t.staticPressureRelaxation,this.staticPressureIterations=t.staticPressureIterations,this.colorMixingStrength=t.colorMixingStrength,this.destroyByAge=t.destroyByAge,this.lifetimeGranularity=t.lifetimeGranularity,this},e.Clone=function(){return(new t).Copy(this)},t}(),fr=function(){function n(t,e){this.m_paused=!1,this.m_timestamp=0,this.m_allParticleFlags=0,this.m_needsUpdateAllParticleFlags=!1,this.m_allGroupFlags=0,this.m_needsUpdateAllGroupFlags=!1,this.m_hasForce=!1,this.m_iterationIndex=0,this.m_inverseDensity=0,this.m_particleDiameter=0,this.m_inverseDiameter=0,this.m_squaredDiameter=0,this.m_count=0,this.m_internalAllocatedCapacity=0,this.m_handleIndexBuffer=new dr,this.m_flagsBuffer=new dr,this.m_positionBuffer=new dr,this.m_velocityBuffer=new dr,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new dr,this.m_groupBuffer=[],this.m_userDataBuffer=new dr,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new dr,this.m_bodyContactCountBuffer=new dr,this.m_consecutiveContactStepsBuffer=new dr,this.m_stuckParticleBuffer=new sr((function(){return 0})),this.m_proxyBuffer=new sr((function(){return new _r})),this.m_contactBuffer=new sr((function(){return new or})),this.m_bodyContactBuffer=new sr((function(){return new hr})),this.m_pairBuffer=new sr((function(){return new ur})),this.m_triadBuffer=new sr((function(){return new lr})),this.m_expirationTimeBuffer=new dr,this.m_indexByExpirationTimeBuffer=new dr,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new cr,this.m_prev=null,this.m_next=null,this.UpdateBodyContacts_callback=null,this.SolveCollision_callback=null,this.SetStrictContactCheck(t.strictContactCheck),this.SetDensity(t.density),this.SetGravityScale(t.gravityScale),this.SetRadius(t.radius),this.SetMaxParticleCount(t.maxCount),this.m_def=t.Clone(),this.m_world=e,this.SetDestructionByAge(this.m_def.destroyByAge)}n.computeTag=function(t,e){return(e+n.yOffset>>>0<>>0)>>>0},n.computeRelativeTag=function(t,e,i){return t+(i<>>0};var r=n.prototype;return r.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},r.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var i=this.m_count?2*this.m_count:S;this.ReallocateInternalAllocatedBuffers(i)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return v;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new j).Copy(e(t.position,j.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new j).Copy(e(t.velocity,j.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new j).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new tt).Copy(e(t.color,tt.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new tt).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],a=e(t.lifetime,0),o=a>0;(this.m_expirationTimeBuffer.data||o)&&(this.SetParticleLifetime(n,o?a:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),this.m_indexByExpirationTimeBuffer.data[n]=n),s.index=n;var h=e(t.group,null);return this.m_groupBuffer[n]=h,h&&(h.m_firstIndex0?n:r,e)},r.DestroyParticlesInShape=function(t,e,i){void 0===i&&(i=!1);var r=n.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new Sr(this,t,e,i),a=r;return t.ComputeAABB(a,e,0),this.m_world.QueryAABB(s,a),s.Destroyed()},r.CreateParticleGroup=function(t){var i=n.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=i;r.SetPositionAngle(e(t.position,j.ZERO),e(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,e(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var a=e(t.particleCount,t.positionData.length),o=0;o0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},r.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},r.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},r.ComputeCollisionEnergy=function(){for(var t=n.ComputeCollisionEnergy_s_v,e=this.m_velocityBuffer.data,i=0,r=0;r0?this.GetQuantizedTimeElapsed()+s:s;a!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=a,this.m_expirationTimeBufferRequiresSorting=!0)},r.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},r.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},r.GetDestructionByAge=function(){return this.m_def.destroyByAge},r.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},r.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},r.GetIndexByExpirationTimeBuffer=function(){return this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data},r.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},r.ApplyLinearImpulse=function(t,e,i){for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new j).Copy(i).SelfMul(1/r),a=t;a=0;){var m=j.SubVV(e,u[c],s),g=j.DotVV(m,d),v=g*g-_*(j.DotVV(m,m)-this.m_squaredDiameter);if(v>=0){var y=V(v),b=(-g-y)/_;if(b>f)continue;if(b<0&&((b=(-g+y)/_)<0||b>f))continue;var S=j.AddVMulSV(m,b,d,o);if(S.Normalize(),(f=E(f,t.ReportParticle(this,c,j.AddVMulSV(e,b,d,h),S,b)))<=0)break}}}},r.ComputeAABB=function(t){var e=this.GetParticleCount();t.lowerBound.x=+i,t.lowerBound.y=+i,t.upperBound.x=-i,t.upperBound.y=-i;for(var n=this.m_positionBuffer.data,r=0;re?e:t}if(t=e(t,this.m_def.maxCount),t=e(t,this.m_flagsBuffer.userSuppliedCapacity),t=e(t,this.m_positionBuffer.userSuppliedCapacity),t=e(t,this.m_velocityBuffer.userSuppliedCapacity),t=e(t,this.m_colorBuffer.userSuppliedCapacity),t=e(t,this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},r.CreateParticleForGroup=function(t,i,n){var r=new zn;r.flags=e(t.flags,0),J.MulXV(i,n,r.position),j.AddVV(e(t.linearVelocity,j.ZERO),j.CrossSV(e(t.angularVelocity,0),j.SubVV(r.position,e(t.position,j.ZERO),j.s_t0),j.s_t0),r.velocity),r.color.Copy(e(t.color,tt.ZERO)),r.lifetime=e(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},r.CreateParticlesStrokeShapeForGroup=function(i,r,s){var a=n.CreateParticlesStrokeShapeForGroup_s_edge,o=n.CreateParticlesStrokeShapeForGroup_s_d,h=n.CreateParticlesStrokeShapeForGroup_s_p,u=e(r.stride,0);0===u&&(u=this.GetParticleStride());for(var l=0,c=i.GetChildCount(),f=0;f=e&&d=e&&_v||j.DotVV(m,m)>v||j.DotVV(g,g)>v)return;var y=C.m_groupBuffer[t],b=C.m_groupBuffer[e],S=C.m_groupBuffer[i],x=C.m_triadBuffer.data[C.m_triadBuffer.Append()];x.indexA=t,x.indexB=e,x.indexC=i,x.flags=u|l|c,x.strength=E(E(y?y.m_strength:1,b?b.m_strength:1),S?S.m_strength:1);var w=(f.x+d.x+_.x)/3,T=(f.y+d.y+_.y)/3;x.pa.x=f.x-w,x.pa.y=f.y-T,x.pb.x=d.x-w,x.pb.y=d.y-T,x.pc.x=_.x-w,x.pc.y=_.y-T,x.ka=-j.DotVV(g,p),x.kb=-j.DotVV(p,m),x.kc=-j.DotVV(m,g),x.s=j.CrossVV(f,d)+j.CrossVV(d,_)+j.CrossVV(_,f)}})),$n(this.m_triadBuffer.data,0,this.m_triadBuffer.count,n.CompareTriadIndices),this.m_triadBuffer.Unique(n.MatchTriadIndices)}},r.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new Tr(this.m_flagsBuffer);this.UpdatePairsAndTriads(0,this.m_count,e);for(var i=0;ik&&(this.m_depthBuffer[I]=k,C=!0),E>O&&(this.m_depthBuffer[B]=O,C=!0)}if(!C)break}for(var R=0;R0)for(var i=this.GetParticleCount(),r=0;rthis.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0);this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s),null===this.UpdateBodyContacts_callback&&(this.UpdateBodyContacts_callback=new Cr(this));var a=this.UpdateBodyContacts_callback;a.m_contactFilter=this.GetFixtureContactFilter(),this.m_world.QueryAABB(a,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(e)},r.Solve=function(e){var i=n.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(e),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndexi&&r.SelfMul(V(i/s))}},r.SolveGravity=function(t){for(var e=n.SolveGravity_s_gravity,i=this.m_velocityBuffer.data,r=j.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),e),s=0;s=0;){var R=p[O],F=this.m_groupBuffer[O];if(D!==F&&I!==F){var L=this.GetLinearVelocity(F,O,R,h),N=j.SubVV(R,T,u),z=j.SubVV(L,B,l),G=j.CrossVV(E,z),U=j.CrossVV(P,z)-j.CrossVV(N,E),H=j.CrossVV(P,N),W=void 0,q=void 0,X=c,Y=f;if(0===G){if(0===U)continue;if(!((q=-H/U)>=0&&q=0&&W<=1))continue}else{var Q=U*U-4*H*G;if(Q<0)continue;var K=V(Q),J=(-U-K)/(2*G),Z=(-U+K)/(2*G);if(J>Z){var $=J;J=Z,Z=$}if(q=J,j.AddVMulSV(P,q,E,X),j.AddVMulSV(N,q,z,Y),W=j.DotVV(X,Y)/j.DotVV(X,X),!(q>=0&&q=0&&W<=1)){if(!((q=Z)>=0&&q=0&&W<=1))continue}}var tt=d;tt.x=B.x+W*E.x-L.x,tt.y=B.y+W*E.y-L.y;var et=j.MulSV(y,tt,_);if(F&&this.IsRigidGroup(F)){var it=F.GetMass(),nt=F.GetInertia();it>0&&F.m_linearVelocity.SelfMulAdd(1/it,et),nt>0&&(F.m_angularVelocity+=j.CrossVV(j.SubVV(R,F.GetCenter(),j.s_t0),et)/nt)}else m[O].SelfAdd(tt);this.ParticleApplyForce(O,et.SelfMul(-e.inv_dt))}}}}},r.SolveStaticPressure=function(e){this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=b*i,s=this.m_def.staticPressureRelaxation,a=0;ao){var d=l.body,_=l.mass,p=r[c],m=l.normal,g=j.MulSV(a*_*(f-o),m,i);s[c].SelfMulSub(h,g),d.ApplyLinearImpulse(g,p,!0)}}}for(var v=0;vo){var S=y.indexA,x=y.indexB,w=y.normal,T=j.MulSV(a*(b-o),w,i);s[S].SelfSub(T),s[x].SelfAdd(T)}}}},r.SolveSolid=function(t){var e=n.SolveSolid_s_f,i=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s=0?(A=E(A,M),D=k(D,M+1)):I=!0}Ar:s})),this.m_expirationTimeBufferRequiresSorting=!1);for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(ee.weight:t.index3)return!0;var o=t.Copy(n.normal);o.SelfMul(r.m_particleDiameter*(1-n.weight));var h=j.AddVV(r.m_positionBuffer.data[n.index],o,e);if(!n.fixture.TestPoint(h)){for(var u=n.fixture.GetShape().GetChildCount(),c=0;cthis.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp)},r.ValidateParticleIndex=function(t){return t>=0&&t0?1/n:0,e[0]=r>0?1/r:0,i[0]=j.CrossVV(j.SubVV(a,s,j.s_t0),o)},r.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,a,o,h){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),o,h);else{var u=this.m_flagsBuffer.data[a];this.InitDampingParameter(e,i,n,u&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,o,o,h)}},r.ComputeDampingImpulse=function(t,e,i,n,r,s,a){var o=t+e*i*i+n+r*s*s;return o>0?a/o:0},r.ApplyDamping=function(t,e,i,n,r,s,a,o){r&&n?(r.m_linearVelocity.SelfMulAdd(a*t,o),r.m_angularVelocity+=a*i*e):this.m_velocityBuffer.data[s].SelfMulAdd(a*t,o)},n}();fr.xTruncBits=12,fr.yTruncBits=12,fr.tagBits=32,fr.yOffset=1<>>0,this.m_xUpper=(i&fr.xMask)>>>0,this.m_yLower=(e&fr.yMask)>>>0,this.m_yUpper=(i&fr.yMask)>>>0,this.m_first=n,this.m_last=r}return t.prototype.GetNext=function(){for(;this.m_first>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return v},t}(),mr=function(){this.next=null,this.count=0,this.index=0},gr=function(){function t(){}var e=t.prototype;return e.Allocate=function(t,e){return e},e.Clear=function(){},e.GetCount=function(){return 0},e.Invalidate=function(){},e.GetValidBuffer=function(){return[]},e.GetBuffer=function(){return[]},e.SetCount=function(){},t}(),vr=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return v},e}(gr),yr=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return v},e}(gr),br=function(){function t(){}var e=t.prototype;return e.IsNecessary=function(){return!0},e.ShouldCreatePair=function(){return!0},e.ShouldCreateTriad=function(){return!0},t}(),Sr=function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this).m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}s(e,t);var i=e.prototype;return i.ReportFixture=function(){return!1},i.ReportParticle=function(t,e){return t===this.m_system&&(this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0)},i.Destroyed=function(){return this.m_destroyed},e}(wn),xr=function(t){function e(e){var i;return(i=t.call(this)||this).m_threshold=0,i.m_threshold=e,i}s(e,t);var i=e.prototype;return i.ShouldCreatePair=function(t,e){return t0?1/f:0,p=d>0?1/d:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=j.SubVV(o,c,a),v=j.CrossVV(g,h),y=m+_+p*v*v,b=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];b.index=r,b.body=l,b.fixture=e,b.weight=1-u*this.m_system.m_inverseDiameter,b.normal.Copy(h.SelfNeg()),b.mass=y>0?1/y:0,this.m_system.DetectStuckParticle(r)}},i}(ar);Cr.ReportFixtureAndParticle_s_n=new j,Cr.ReportFixtureAndParticle_s_rp=new j;var Ar=function(e){function i(t,i){var n;return(n=e.call(this,t)||this).m_step=i,n}s(i,e);var n=i.prototype;return n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_p1,a=i.ReportFixtureAndParticle_s_output,o=i.ReportFixtureAndParticle_s_input,h=i.ReportFixtureAndParticle_s_p,u=i.ReportFixtureAndParticle_s_v,c=i.ReportFixtureAndParticle_s_f,f=e.GetBody(),d=this.m_system.m_positionBuffer.data[r],_=this.m_system.m_velocityBuffer.data[r],p=a,m=o;if(0===this.m_system.m_iterationIndex){var g=J.MulTXV(f.m_xf0,d,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(f.GetLocalCenter()),K.MulRV(f.m_xf0.q,g,g),K.MulTRV(f.m_xf.q,g,g),g.SelfAdd(f.GetLocalCenter())),J.MulXV(f.m_xf,g,m.p1)}else m.p1.Copy(d);if(j.AddVMulSV(d,this.m_step.dt,_,m.p2),m.maxFraction=1,e.RayCast(p,m,n)){var v=p.normal,y=h;y.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+l*v.x,y.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+l*v.y;var b=u;b.x=this.m_step.inv_dt*(y.x-d.x),b.y=this.m_step.inv_dt*(y.y-d.y),this.m_system.m_velocityBuffer.data[r].Copy(b);var S=c;S.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(_.x-b.x),S.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(_.y-b.y),this.m_system.ParticleApplyForce(r,S)}},n.ReportParticle=function(){return!1},i}(ar);Ar.ReportFixtureAndParticle_s_p1=new j,Ar.ReportFixtureAndParticle_s_output=new Vt,Ar.ReportFixtureAndParticle_s_input=new Lt,Ar.ReportFixtureAndParticle_s_p=new j,Ar.ReportFixtureAndParticle_s_v=new j,Ar.ReportFixtureAndParticle_s_f=new j;var Dr=function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new Cn,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new j,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new An,this.m_island=new Nn,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}var n=e.prototype;return n.SetDestructionListener=function(t){this.m_destructionListener=t},n.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},n.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},n.SetDebugDraw=function(t){this.m_debugDraw=t},n.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new Mi(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},n.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var a=s;s=s.next,this.m_contactManager.Destroy(a.contact)}t.m_contactList=null;for(var o=t.m_fixtureList;o;){var h=o;o=o.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(h),h.DestroyProxies(),h.Reset(),t.m_fixtureList=o,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e){switch(e.type){case t.b2JointType.e_distanceJoint:return new Fi(e);case t.b2JointType.e_mouseJoint:return new qi(e);case t.b2JointType.e_prismaticJoint:return new Yi(e);case t.b2JointType.e_revoluteJoint:return new Zi(e);case t.b2JointType.e_pulleyJoint:return new Ki(e);case t.b2JointType.e_gearJoint:return new Ui(e);case t.b2JointType.e_wheelJoint:return new sn(e);case t.b2JointType.e_weldJoint:return new nn(e);case t.b2JointType.e_frictionJoint:return new zi(e);case t.b2JointType.e_ropeJoint:return new tn(e);case t.b2JointType.e_motorJoint:return new Wi(e);case t.b2JointType.e_areaJoint:return new Vi(e)}throw new Error},e._Joint_Destroy=function(){},n.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=i.m_bodyA,r=i.m_bodyB;if(!i.m_collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},n.DestroyJoint=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_bodyA,n=t.m_bodyB,r=t.m_collideConnected;if(i.SetAwake(!0),n.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===i.m_jointList&&(i.m_jointList=t.m_edgeA.next),t.m_edgeA.Reset(),t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===n.m_jointList&&(n.m_jointList=t.m_edgeB.next),t.m_edgeB.Reset(),e._Joint_Destroy(t),--this.m_jointCount,!r)for(var s=n.GetContactList();s;)s.other===i&&s.contact.FlagForFiltering(),s=s.next},n.CreateParticleSystem=function(t){if(this.IsLocked())throw new Error;var e=new fr(t,this);return e.m_prev=null,e.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=e),this.m_particleSystemList=e,e},n.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},n.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;return Gn(this.m_gravity.Length(),function(t){for(var e=i,n=t.GetParticleSystemList();null!==n;n=n.m_next)e=E(e,n.GetRadius());return e}(this),t)},n.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var a=e.Step_s_step;a.dt=t,a.velocityIterations=i,a.positionIterations=n,a.particleIterations=r,a.inv_dt=t>0?1/t:0,a.dtRatio=this.m_inv_dt0*t,a.warmStarting=this.m_warmStarting;var o=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=o.GetMilliseconds(),this.m_stepComplete&&a.dt>0){for(var h=e.Step_s_timer.Reset(),u=this.m_particleSystemList;u;u=u.m_next)u.Solve(a);this.Solve(a),this.m_profile.solve=h.GetMilliseconds()}if(this.m_continuousPhysics&&a.dt>0){var l=e.Step_s_timer.Reset();this.SolveTOI(a),this.m_profile.solveTOI=l.GetMilliseconds()}a.dt>0&&(this.m_inv_dt0=a.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},n.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},n.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},n.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var a=r.GetFixtureList();a;a=a.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(a,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(a,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(a,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(a,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(a,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var o=this.m_particleSystemList;o;o=o.m_next)this.DrawParticleSystem(o);if(i&t.b2DrawFlags.e_jointBit)for(var h=this.m_jointList;h;h=h.m_next)this.DrawJoint(h);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);for(var u=e.DrawDebugData_s_vs,l=this.m_bodyList;l;l=l.m_next)if(l.IsActive())for(var c=l.GetFixtureList();c;c=c.m_next)for(var f=0;f0;){var c=h[--l];if(!c)throw new Error;if(r.AddBody(c),c.m_awakeFlag=!0,c.GetType()!==t.b2BodyType.b2_staticBody){for(var f=c.m_contactList;f;f=f.next){var d=f.contact;if(!d.m_islandFlag&&d.IsEnabled()&&d.IsTouching()){var _=d.m_fixtureA.m_isSensor,p=d.m_fixtureB.m_isSensor;if(!_&&!p){r.AddContact(d),d.m_islandFlag=!0;var m=f.other;m.m_islandFlag||(h[l++]=m,m.m_islandFlag=!0)}}}for(var g=c.m_jointList;g;g=g.next)if(!g.joint.m_islandFlag){var v=g.other;v.IsActive()&&(r.AddJoint(g.joint),g.joint.m_islandFlag=!0,v.m_islandFlag||(h[l++]=v,v.m_islandFlag=!0))}}}var y=new An;r.Solve(y,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=y.solveInit,this.m_profile.solveVelocity+=y.solveVelocity,this.m_profile.solvePosition+=y.solvePosition;for(var b=0;b8)){var u=1;if(h.m_toiFlag)u=h.m_toi;else{var l=h.GetFixtureA(),c=h.GetFixtureB();if(l.IsSensor()||c.IsSensor())continue;var f=l.GetBody(),d=c.GetBody(),_=f.m_type,p=d.m_type,m=f.IsAwake()&&_!==t.b2BodyType.b2_staticBody,g=d.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!g)continue;var v=f.IsBullet()||_!==t.b2BodyType.b2_dynamicBody,y=d.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!v&&!y)continue;var b=f.m_sweep.alpha0;f.m_sweep.alpha0this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var n=this.m_bodyList;n;n=n.nextBody){var s=n.body;if(s.IsAwake()){var a=s.GetWorldVector(Y.MulMV(this.T,s.GetLocalVector(s.GetLinearVelocity(),j.s_t0),j.s_t1),e.Step_s_damping);s.SetLinearVelocity(j.AddVV(s.GetLinearVelocity(),j.MulSV(i,a,j.s_t0),j.s_t1))}}}},i.Draw=function(){},i.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/k(t,e):0},e}(Br);Or.Step_s_damping=new j;var Rr=function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new j,this.m_damping=0,this.m_k2=1,this.m_k3=.1}var e=t.prototype;return e.GetVertexCount=function(){return this.m_count},e.GetVertices=function(){return this.m_ps},e.Initialize=function(t){this.m_count=t.count,this.m_ps=j.MakeArray(this.m_count),this.m_p0s=j.MakeArray(this.m_count),this.m_vs=j.MakeArray(this.m_count),this.m_ims=D(this.m_count);for(var e=0;e0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=D(n),this.m_as=D(r);for(var s=0;s0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(var r=0;ro;)w=(m-=2*o)-this.m_as[i];for(;w<-o;)w=(m+=2*o)-this.m_as[i];var T=-this.m_k3*x*w;n.SelfMulAdd(a*T,y),r.SelfMulAdd(h*T,b),s.SelfMulAdd(u*T,S)}}}},e.Draw=function(t){for(var e=new tt(.4,.5,.7),i=0;i1?e-1:0),n=1;n0&&!(t&t-1)},t.b2IsValid=R,t.b2Island=Nn,t.b2Jacobian=Pi,t.b2Joint=Oi,t.b2JointDef=ki,t.b2JointEdge=Ei,t.b2Log=function(){},t.b2MakeArray=A,t.b2MakeNullArray=function(t){for(var e=new Array(t),i=0;i>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,1+((t|=t>>8&16777215)|t>>16&65535)},t.b2Pair=Zt,t.b2PairLessThan=te,t.b2ParseInt=function(t){return parseInt(t,10)},t.b2ParseUInt=function(t){return Math.abs(parseInt(t,10))},t.b2ParticleBodyContact=hr,t.b2ParticleContact=or,t.b2ParticleDef=zn,t.b2ParticleGroup=jn,t.b2ParticleGroupDef=Wn,t.b2ParticleHandle=Hn,t.b2ParticlePair=ur,t.b2ParticlePairSet=yr,t.b2ParticleSystem=fr,t.b2ParticleSystemDef=cr,t.b2ParticleSystem_CompositeShape=wr,t.b2ParticleSystem_ConnectionFilter=br,t.b2ParticleSystem_DestroyParticlesInShapeCallback=Sr,t.b2ParticleSystem_FixedSetAllocator=gr,t.b2ParticleSystem_FixtureParticle=function(t,e){this.second=v,this.first=t,this.second=e},t.b2ParticleSystem_FixtureParticleSet=vr,t.b2ParticleSystem_InsideBoundsEnumerator=pr,t.b2ParticleSystem_JoinParticleGroupsFilter=xr,t.b2ParticleSystem_ParticleListNode=mr,t.b2ParticleSystem_ParticlePair=function(t,e){this.first=v,this.second=v,this.first=t,this.second=e},t.b2ParticleSystem_Proxy=_r,t.b2ParticleSystem_ReactiveFilter=Tr,t.b2ParticleSystem_SolveCollisionCallback=Ar,t.b2ParticleSystem_UpdateBodyContactsCallback=Cr,t.b2ParticleSystem_UserOverridableBuffer=dr,t.b2ParticleTriad=lr,t.b2PolygonAndCircleContact=fn,t.b2PolygonContact=cn,t.b2PolygonShape=bi,t.b2Position=In,t.b2PositionSolverManifold=Fn,t.b2Pow=N,t.b2PrismaticJoint=Yi,t.b2PrismaticJointDef=Xi,t.b2Profile=An,t.b2PulleyJoint=Ki,t.b2PulleyJointDef=Qi,t.b2QueryCallback=wn,t.b2RadToDeg=function(t){return t*B},t.b2Random=function(){return 2*Math.random()-1},t.b2RandomRange=function(t,e){return(e-t)*Math.random()+t},t.b2RayCastCallback=Tn,t.b2RayCastInput=Lt,t.b2RayCastOutput=Vt,t.b2RevoluteJoint=Zi,t.b2RevoluteJointDef=Ji,t.b2Rope=Rr,t.b2RopeDef=function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new j(0,0),this.damping=.1,this.k2=.9,this.k3=.1},t.b2RopeJoint=tn,t.b2RopeJointDef=$i,t.b2Rot=K,t.b2SeparationFunction=fe,t.b2Shape=vi,t.b2ShapeCast=function(t,e){t.iterations=0,t.lambda=1,t.normal.SetZero(),t.point.SetZero();var i=e.proxyA,n=e.proxyB,r=k(i.m_radius,f)+k(n.m_radius,f),s=e.transformA,a=e.transformB,o=e.translationB,h=St.Set(0,0),u=0,l=xt;l.m_count=0;for(var c=l.m_vertices,d=i.GetSupport(K.MulTRV(s.q,j.NegV(o,j.s_t1),j.s_t0)),_=J.MulXV(s,i.GetVertex(d),wt),p=n.GetSupport(K.MulTRV(a.q,o,j.s_t0)),m=J.MulXV(a,n.GetVertex(p),Tt),g=j.SubVV(_,m,Ct),v=k(f,r-f),y=0;y<20&&P(g.Length()-v)>.004;){t.iterations+=1,d=i.GetSupport(K.MulTRV(s.q,j.NegV(g,j.s_t1),j.s_t0)),_=J.MulXV(s,i.GetVertex(d),wt),p=n.GetSupport(K.MulTRV(a.q,g,j.s_t0)),m=J.MulXV(a,n.GetVertex(p),Tt);var b=j.SubVV(_,m,At);g.Normalize();var S=j.DotVV(g,b),x=j.DotVV(g,o);if(S-v>u*x){if(x<=0)return!1;if((u=(S-v)/x)>1)return!1;h.Copy(g).SelfNeg(),l.m_count=0}var w=c[l.m_count];switch(w.indexA=p,w.wA.Copy(m).SelfMulAdd(u,o),w.indexB=d,w.wB.Copy(_),w.w.Copy(w.wB).SelfSub(w.wA),w.a=1,l.m_count+=1,l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)return!1;l.GetClosestPoint(g),++y}var T=Dt,C=It;return l.GetWitnessPoints(T,C),g.LengthSquared()>0&&(h.Copy(g).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=y,!0},t.b2ShapeCastInput=function(){this.proxyA=new st,this.proxyB=new st,this.transformA=new J,this.transformB=new J,this.translationB=new j},t.b2ShapeCastOutput=function(){this.point=new j,this.normal=new j,this.lambda=0,this.iterations=0},t.b2Simplex=lt,t.b2SimplexCache=at,t.b2SimplexVertex=ut,t.b2Sin=G,t.b2SolverData=Mn,t.b2Sq=F,t.b2Sqrt=V,t.b2StackAllocator=function(){},t.b2Swap=function(t,e){var i=t[0];t[0]=e[0],e[0]=i},t.b2Sweep=$,t.b2TOIInput=ue,t.b2TOIOutput=ce,t.b2TensorDampingController=Or,t.b2TestOverlapAABB=zt,t.b2TestOverlapShape=jt,t.b2TimeOfImpact=xe,t.b2TimeStep=Dn,t.b2Timer=it,t.b2Transform=J,t.b2TreeNode=Xt,t.b2Vec2=j,t.b2Vec2_zero=q,t.b2Vec3=X,t.b2Velocity=Bn,t.b2VelocityConstraintPoint=En,t.b2Version=T,t.b2WeldJoint=nn,t.b2WeldJointDef=en,t.b2WheelJoint=sn,t.b2WheelJointDef=rn,t.b2World=Dr,t.b2WorldManifold=Rt,t.b2_180_over_pi=B,t.b2_aabbExtension=h,t.b2_aabbMultiplier=2,t.b2_angularSleepTolerance=w,t.b2_angularSlop=c,t.b2_barrierCollisionTime=2.5,t.b2_baumgarte=.2,t.b2_branch="master",t.b2_commit="fbf51801d80fc389d43dc46524520e89043b6faf",t.b2_epsilon=r,t.b2_epsilon_sq=a,t.b2_gjk_reset=function(){t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0},t.b2_invalidParticleIndex=v,t.b2_linearSleepTolerance=x,t.b2_linearSlop=l,t.b2_maxAngularCorrection=_,t.b2_maxFloat=i,t.b2_maxLinearCorrection=d,t.b2_maxManifoldPoints=2,t.b2_maxParticleForce=.5,t.b2_maxParticleIndex=2147483647,t.b2_maxParticlePressure=b,t.b2_maxPolygonVertices=8,t.b2_maxRotation=m,t.b2_maxRotationSquared=g,t.b2_maxSubSteps=8,t.b2_maxTOIContacts=32,t.b2_maxTranslation=2,t.b2_maxTranslationSquared=4,t.b2_maxTriadDistance=2,t.b2_maxTriadDistanceSquared=4,t.b2_minParticleSystemBufferCapacity=S,t.b2_minParticleWeight=1,t.b2_minPulleyLength=2,t.b2_particleStride=y,t.b2_pi=o,t.b2_pi_over_180=I,t.b2_polygonRadius=f,t.b2_timeToSleep=.5,t.b2_toiBaumgarte=.75,t.b2_toi_reset=function(){t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0},t.b2_two_pi=M,t.b2_velocityThreshold=1,t.b2_version=C,t.g_blockSolve=Pn,Object.defineProperty(t,"__esModule",{value:!0})}(aAt);var oAt=aAt;sAt(oAt);var hAt=oAt,uAt={};for(var lAt in hAt)-1===lAt.indexOf("b2_")&&(uAt[lAt.replace("b2","")]=hAt[lAt]);var cAt=sAt(uAt),fAt=t("f6",{Static:0,Kinematic:1,Dynamic:2,Animated:3});Me(fAt),Me(t("f7",{None:0,BOX:1,CIRCLE:2,POLYGON:3})),Me(t("f8",{None:0,DISTANCE:1,SPRING:2,WHEEL:3,MOUSE:4,FIXED:5,SLIDER:6,RELATIVE:7,HINGE:8}));var dAt=t("f9",{DEFAULT:1});Me(dAt),t("fa",dAt),t("fb",{Closest:0,Any:1,AllClosest:2,All:3});var _At=t("fc",{None:"none-contact",BEGIN_CONTACT:"begin-contact",END_CONTACT:"end-contact",PRE_SOLVE:"pre-solve",POST_SOLVE:"post-solve"}),pAt=(t("fd",{None:0,Shape:1,Joint:2,Aabb:4,Pair:8,CenterOfMass:16,Particle:32,Controller:64,All:63}),t("fe",32)),mAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=3?1:n):-1},i.getFixtures=function(){return this._fixtures},i.getPoints=function(){return this._points},i.getNormals=function(){return this._normals},i.getFractions=function(){return this._fractions},e}(cAt.RayCastCallback);function yAt(t,e){var i=e.length;return e[t<0?i- -t%i:t%i]}function bAt(t,e,i){for(var n=[];e0}function CAt(t,e,i){return kAt(t,e,i)>=0}function AAt(t,e,i){return kAt(t,e,i)<=0}function DAt(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function IAt(t){BAt(t)||t.reverse()}function BAt(t){return t.length<3||MAt(t)>0}function MAt(t){var e,i=0;for(e=0;e0&&d<1&&_>0&&_<1&&(r.x=s+d*(o-s),r.y=a+d*(h-a),!0))}function kAt(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var OAt=Object.freeze({__proto__:null,ConvexPartition:function t(e){IAt(e);for(var i,n,r,s,a,o,h=[],u=new ns,l=new ns,c=0,f=0,d=0;dm&&(g=v,m=y)}a=bAt(d,g,e),o=bAt(g,d,e)}return(h=h.concat(t(a))).concat(t(o))}h.push(e);for(var b=h.length-1;b>=0;b--)0==h[b].length&&h.splice(b,0);return h},ForceCounterClockWise:IAt,IsCounterClockWise:BAt});function RAt(t){GAt(t);for(var e=!0,i=0,n=t.length;i0||LAt(c,l,a[(o+2)%h])>0)){for(var m=[],g=(o+1)%h;g!==o;g=(g+1)%h)m.push(a[g]);m.push(u,c),a=m,h=m.length,o=-1,s.splice(f,1)}}r.push(a)}return r}var FAt=function(){this.isActive=!1,this.isConvex=!1,this.isEar=!1,this.point=null,this.angleCos=0,this.shouldUpdate=!1,this.index=0,this.prev=null,this.next=null};function LAt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function VAt(t,e,i){return LAt(t,e,i)<0}function NAt(t,e){return t.x===e.x&&t.y===e.y}function zAt(t){for(var e=0,i=0,n=t.length;i0}function GAt(t){zAt(t)&&t.reverse()}function UAt(t,e){if(t.shouldUpdate){t.shouldUpdate=!1;var i=t.prev.point,n=t.point,r=t.next.point;t.isConvex=VAt(i,n,r);var s=i.x-n.x,a=i.y-n.y,o=Math.sqrt(s*s+a*a);s/=o,a/=o;var h=r.x-n.x,u=r.y-n.y,l=Math.sqrt(h*h+u*u);if(h/=l,u/=l,t.angleCos=s*h+a*u,t.isConvex){t.isEar=!0;for(var c=0,f=e.length;c0&&m>0&&g>0){t.isEar=!1;break}if(0===p&&m>=0&&g>=0&&(LAt(i,d.prev.point,n)>0||LAt(i,d.next.point,n)>0)){t.isEar=!1;break}if(0===m&&p>=0&&g>=0&&(LAt(n,d.prev.point,r)>0||LAt(n,d.next.point,r)>0)){t.isEar=!1;break}if(0===g&&p>=0&&m>=0&&(LAt(r,d.prev.point,i)>0||LAt(r,d.next.point,i)>0)){t.isEar=!1;break}}}}}else t.isEar=!1}}function HAt(t){for(var e=t,i=t;;)if(NAt(e.point,e.next.point)||0===LAt(e.prev.point,e.point,e.next.point)){if(e.prev.next=e.next,e.next.prev=e.prev,e.prev.shouldUpdate=!0,e.next.shouldUpdate=!0,e===e.next)break;i=e.prev,e=e.next}else if((e=e.next)===i)break}function WAt(t){if(GAt(t),t.length<4)return[t];for(var e=t.length,i=[],n=[],r=0;ru.angleCos&&(u=c):u=c)}if(!u){for(var f=0;f1e-5)return console.log("Failed to find ear. There might be self-intersection in the polygon."),null}}break}if(n.push([u.prev.point,u.point,u.next.point]),u.isActive=!1,u.prev.next=u.next,u.next.prev=u.prev,u.prev.shouldUpdate=!0,u.next.shouldUpdate=!0,HAt(u.next),h===e-4)break;for(var g=0;g1e-5&&n.push([b,S,x])}}return n}var jAt=Object.freeze({__proto__:null,ConvexPartition:RAt}),qAt=function(t){if(1===t){for(var e=this,i=function(t){var i="_"+(1<e;)this.physicsWorld.step(e,i,n),this._accumulator-=e;for(var s=this._delayEvents,a=0,o=s.length;a0){for(var a=r.getPoints(),o=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;lMath.PI&&(r-=Wi);var s=(this._animatedAngle-r)*n;this._animatedAngle<-Hi&&r>Hi&&(s=(this._animatedAngle+Wi-r)*n),this._animatedAngle>Hi&&r<-Hi&&(s=(this._animatedAngle-Wi-r)*n),e.SetAngularVelocity(s)}},e.syncSceneToPhysics=function(){var t=this._rigidBody.node.hasChangedFlags;t&&this.nodeTransformChanged(t)},e.syncPositionToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i,n=this._rigidBody.node.worldPosition,r=this._rigidBody.type;(i=3===r?e.GetLinearVelocity():e.GetPosition()).x=n.x/pAt,i.y=n.y/pAt,3===r&&t?this._animatedPos.set(i.x,i.y):e.SetTransformVec(i,e.GetAngle())}},e.syncRotationToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i=this._rigidBody.node.worldRotation,n=VMt;Cr.toEulerInYXZOrder(n,i);var r=Ji(n.z);3===this._rigidBody.type&&t?this._animatedAngle=r:e.SetTransformVec(e.GetPosition(),r)}},e.resetVelocity=function(){var t=this._body;if(t){var e=t.m_linearVelocity;e.Set(0,0),t.SetLinearVelocity(e),t.SetAngularVelocity(0)}},e.setType=function(t){YAt.instance.physicsWorld._updateBodyType(this),this._body.SetType(t)},e.setLinearDamping=function(t){this._body.SetLinearDamping(t)},e.setAngularDamping=function(t){this._body.SetAngularDamping(t)},e.setGravityScale=function(t){this._body.SetGravityScale(t)},e.setFixedRotation=function(t){this._body.SetFixedRotation(t)},e.setAllowSleep=function(t){this._body.SetSleepingAllowed(t)},e.isActive=function(){return this._body.IsActive()},e.setActive=function(t){this._body.m_world.IsLocked()||this._body.SetActive(t)},e.wakeUp=function(){this._body.SetAwake(!0)},e.sleep=function(){this._body.SetAwake(!1)},e.getMass=function(){return this._body.GetMass()},e.setLinearVelocity=function(t){this._body.SetLinearVelocity(t)},e.getLinearVelocity=function(t){var e=this._body.GetLinearVelocity();return t.x=e.x,t.y=e.y,t},e.getLinearVelocityFromWorldPoint=function(t,e){return NMt.Set(t.x/pAt,t.y/pAt),this._body.GetLinearVelocityFromWorldPoint(NMt,e),e.x*=pAt,e.y*=pAt,e},e.setAngularVelocity=function(t){this._body.SetAngularVelocity(t)},e.getAngularVelocity=function(){return this._body.GetAngularVelocity()},e.getLocalVector=function(t,e){return e=e||new ns,NMt.Set(t.x/pAt,t.y/pAt),this._body.GetLocalVector(NMt,e),e.x*=pAt,e.y*=pAt,e},e.getWorldVector=function(t,e){return NMt.Set(t.x/pAt,t.y/pAt),this._body.GetWorldVector(NMt,e),e.x*=pAt,e.y*=pAt,e},e.getLocalPoint=function(t,e){return e=e||new ns,NMt.Set(t.x/pAt,t.y/pAt),this._body.GetLocalPoint(NMt,e),e.x*=pAt,e.y*=pAt,e},e.getWorldPoint=function(t,e){return e=e||new ns,NMt.Set(t.x/pAt,t.y/pAt),this._body.GetWorldPoint(NMt,e),e.x*=pAt,e.y*=pAt,e},e.getLocalCenter=function(t){t=t||new ns;var e=this._body.GetLocalCenter();return t.x=e.x*pAt,t.y=e.y*pAt,t},e.getWorldCenter=function(t){t=t||new ns;var e=this._body.GetWorldCenter();return t.x=e.x*pAt,t.y=e.y*pAt,t},e.getInertia=function(){return this._body.GetInertia()},e.applyForce=function(t,e,i){this._body&&(NMt.Set(e.x/pAt,e.y/pAt),this._body.ApplyForce(t,NMt,i))},e.applyForceToCenter=function(t,e){this._body&&this._body.ApplyForceToCenter(t,e)},e.applyTorque=function(t,e){this._body&&this._body.ApplyTorque(t,e)},e.applyLinearImpulse=function(t,e,i){this._body&&(NMt.Set(e.x/pAt,e.y/pAt),this._body.ApplyLinearImpulse(t,NMt,i))},e.applyLinearImpulseToCenter=function(t,e){this._body&&this._body.ApplyLinearImpulse(t,this._body.GetPosition(),e)},e.applyAngularImpulse=function(t,e){this._body&&this._body.ApplyAngularImpulse(t,e)},n(t,[{key:"impl",get:function(){return this._body}},{key:"_imp",set:function(t){this._body=t}},{key:"rigidBody",get:function(){return this._rigidBody}},{key:"isAwake",get:function(){return this._body.IsAwake()}},{key:"isSleeping",get:function(){return!this._body.IsAwake()}}]),t}(),GMt=new cAt.Filter,UMt=new cAt.Vec2,HMt=new cAt.Vec2;function WMt(t){var e=t.collider;return e.body?GMt.categoryBits=1===e.group?e.body.group:e.group:GMt.categoryBits=e.group,GMt.maskBits=YAt.instance.collisionMatrix[GMt.categoryBits],GMt}var jMt,qMt=function(){function t(){this._shapes=[],this._fixtures=[],this._collider=null,this._body=null,this._inited=!1,this._rect=new cs}var e=t.prototype;return e.initialize=function(t){this._collider=t},e.onLoad=function(){},e.onEnable=function(){YAt.instance._callAfterStep(this,this._init)},e.onDisable=function(){YAt.instance._callAfterStep(this,this._destroy)},e.start=function(){},e.onGroupChanged=function(){var t=WMt(this);this._fixtures.forEach((function(e){e.SetFilterData(t)}))},e.apply=function(){this._destroy(),this.collider.enabledInHierarchy&&this._init()},e.getFixtureIndex=function(t){return this._fixtures.indexOf(t)},e._createShapes=function(){return[]},e._init=function(){if(!this._inited){var t=this.collider,e=t.node.worldScale,i=Kn.ZERO,n=t.getComponent(uMt);n&&n.impl&&n.impl.impl?this._body=n.impl.impl:(this._body=YAt.instance.physicsWorld.groundBodyImpl,i=t.node.worldPosition);for(var r=0===e.x&&0===e.y?[]:this._createShapes(e.x,e.y,i.x,i.y),s=WMt(this),a=0;a=0;i--){var n=t[i];n.m_userData=null,YAt.instance.physicsWorld.unregisterContactFixture(n),e&&e.DestroyFixture(n)}this._body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},n(t,[{key:"impl",get:function(){return this._shapes}},{key:"collider",get:function(){return this._collider}},{key:"worldAABB",get:function(){for(var t=1e7,e=t,i=t,n=-t,r=-t,s=this._fixtures,a=0;an&&(n=HMt.x),HMt.y>r&&(r=HMt.y)}e*=pAt,i*=pAt,n*=pAt,r*=pAt;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),XMt=new cs,YMt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&a[0].equals(a[a.length-1])&&(a.length-=1);var o=RAt(a);if(!o)return console.log("[Physics2D] b2PolygonShape failed to decompose polygon into convex polygons, node name: ",s.node.name),r;for(var h=s.offset,u=0;u=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},n(e,[{key:"friction",get:function(){return this._friction},set:function(t){qi(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){qi(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){qi(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){qi(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(em),YPt.allMaterials=[],YPt.EVENT_UPDATE="event_update",YPt._idCounter=0,y((HPt=YPt).prototype,"friction",[VPt],Object.getOwnPropertyDescriptor(HPt.prototype,"friction"),HPt.prototype),y(HPt.prototype,"rollingFriction",[NPt],Object.getOwnPropertyDescriptor(HPt.prototype,"rollingFriction"),HPt.prototype),y(HPt.prototype,"spinningFriction",[zPt],Object.getOwnPropertyDescriptor(HPt.prototype,"spinningFriction"),HPt.prototype),y(HPt.prototype,"restitution",[GPt],Object.getOwnPropertyDescriptor(HPt.prototype,"restitution"),HPt.prototype),WPt=yh(HPt.prototype,"_friction",[Uh],(function(){return.6})),jPt=yh(HPt.prototype,"_rollingFriction",[Uh],(function(){return 0})),qPt=yh(HPt.prototype,"_spinningFriction",[Uh],(function(){return 0})),XPt=yh(HPt.prototype,"_restitution",[Uh],(function(){return 0})),UPt=HPt))||UPt)),nEt=t("fC",function(){function t(){this._hitPoint=new Kn,this._hitNormal=new Kn,this._distance=0,this._collider=null,this._closestHitFraction=0}var e=t.prototype;return e._assign=function(t,e,i,n,r){Kn.copy(this._hitPoint,t),Kn.copy(this._hitNormal,n),this._distance=e,this._collider=i,r&&(this._closestHitFraction=r)},e.clone=function(){var e=new t;return Kn.copy(e._hitPoint,this._hitPoint),Kn.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e._closestHitFraction=this._closestHitFraction,e},n(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}},{key:"closestHitFraction",get:function(){return this._closestHitFraction}}]),t}()),rEt=t("fD",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}wE.emit("director_after_physics")}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:Ve.querySettings("physics","allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:Ve.querySettings("physics","fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:Ve.querySettings("physics","maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:Ve.querySettings("physics","sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:Ve.querySettings("physics","autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:Ve.querySettings("physics","gravity");a&&Kn.copy(this._gravity,a);var o=t?t.collisionMatrix:Ve.querySettings("physics","collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new Bs,a=1;ai);++a){var o=t[a-1],h=t[a],u=new Kn;Kn.subtract(u,h,o);var l=Kn.len(u);if(r+=l,Kn.multiplyScalar(u,u,1/l),s.d=u,s.o=o,this.raycast(s,e,l,n))for(var c=0;c0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new Bs,a=!1,o=1;oi);++o){var h=t[o-1],u=t[o],l=new Kn;Kn.subtract(l,u,h);var c=Kn.len(l);if(r+=c,Kn.multiplyScalar(l,l,1/c),s.d=l,s.o=h,a=this.raycastClosest(s,e,c,n)){var f=this.raycastClosestResult,d=new rEt;d._assign(f.hitPoint,f.distance,f.collider,f.hitNormal,o-1),this.lineStripCastClosestResult=d;break}}return a},e.sweepBox=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBox(t,e,i,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepBoxClosest=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBoxClosest(t,e,i,this.raycastOptions,this.sweepCastClosestResult))},e.sweepSphere=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphere(t,e,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepSphereClosest=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphereClosest(t,e,this.raycastOptions,this.sweepCastClosestResult))},e.sweepCapsule=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){if(!i._instance){var t=this.doConstructAndRegister();t&&bk.onPostProjectInitDelegate.add(t.initDefaultMaterial.bind(t))}},i.constructAndRegisterManually=function(){return Promise.resolve()},i.doConstructAndRegister=function(){var t;if(null!==(t=Ve.querySettings("physics","enabled"))&&void 0!==t&&!t)return null;if(!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),uPt(e),wE.registerSystem(i.ID,e,e.priority)}return i._instance},n(i,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return hPt.physicsWorld}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"debugDrawConstraintSize",get:function(){return this.physicsWorld.debugDrawConstraintSize},set:function(t){this.physicsWorld.debugDrawConstraintSize=t}}],[{key:"PHYSICS_NONE",get:function(){return!hPt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===hPt.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===hPt.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===hPt.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===hPt.id}},{key:"PhysicsGroup",get:function(){return rDt}},{key:"instance",get:function(){return i._instance}}]),i}(df));SEt.ID="PHYSICS",SEt._instance=null,wE.once("director_init",(function(){SEt.constructAndRegister()}));var xEt,wEt,TEt,CEt,AEt,DEt,IEt,BEt,MEt,PEt,EEt,kEt=t("fy",(sEt=Bh("cc.RigidBody"),aEt=Ph(-1),oEt=fu(SEt.PhysicsGroup),hEt=fu(QAt),sEt(uEt=Eh(uEt=aEt((bEt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r2||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(NEt),y(qEt.prototype,"direction",[WEt],Object.getOwnPropertyDescriptor(qEt.prototype,"direction"),qEt.prototype),XEt=yh(qEt.prototype,"_radius",[Uh],(function(){return.5})),YEt=yh(qEt.prototype,"_cylinderHeight",[Uh],(function(){return 1})),QEt=yh(qEt.prototype,"_direction",[Uh],(function(){return 1})),jEt=qEt))||jEt)),eOt=t("fJ",(KEt=Bh("cc.CylinderCollider"),JEt=fu(KAt),KEt(($Et=function(t){function e(){var e;return(e=t.call(this,3)||this)._radius=tkt&&tkt(),e._height=ekt&&ekt(),e._direction=ikt&&ikt(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<0||t>2||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(NEt),y($Et.prototype,"direction",[JEt],Object.getOwnPropertyDescriptor($Et.prototype,"direction"),$Et.prototype),tkt=yh($Et.prototype,"_radius",[Uh],(function(){return.5})),ekt=yh($Et.prototype,"_height",[Uh],(function(){return 2})),ikt=yh($Et.prototype,"_direction",[Uh],(function(){return 1})),ZEt=$Et))||ZEt)),iOt=t("fK",(nkt=Bh("cc.ConeCollider"),rkt=fu(KAt),nkt((akt=function(t){function e(){var e;return(e=t.call(this,4)||this)._radius=okt&&okt(),e._height=hkt&&hkt(),e._direction=ukt&&ukt(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<0||t>2||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(NEt),y(akt.prototype,"direction",[rkt],Object.getOwnPropertyDescriptor(akt.prototype,"direction"),akt.prototype),okt=yh(akt.prototype,"_radius",[Uh],(function(){return.5})),hkt=yh(akt.prototype,"_height",[Uh],(function(){return 1})),ukt=yh(akt.prototype,"_direction",[Uh],(function(){return 1})),skt=akt))||skt)),nOt=t("fI",(lkt=Bh("cc.MeshCollider"),ckt=fu(Qk),lkt((dkt=function(t){function e(){var e;return(e=t.call(this,5)||this)._mesh=_kt&&_kt(),e._convex=pkt&&pkt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(kEt);e&&e.isValid&&1===e.type&&!this.convex&&st(9630,this.node.name)}},n(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(NEt),y(dkt.prototype,"mesh",[ckt],Object.getOwnPropertyDescriptor(dkt.prototype,"mesh"),dkt.prototype),_kt=yh(dkt.prototype,"_mesh",[Uh],(function(){return null})),pkt=yh(dkt.prototype,"_convex",[Uh],(function(){return!1})),fkt=dkt))||fkt)),rOt=t("fA",Bh("cc.ConstantForce")(mkt=Mh(kEt)(mkt=Eh((gkt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rt)){for(var e=this.buffer.byteLength;e=SOt?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n=bOt){var o=e.readInt();this.normals=new Float32Array(o);for(var h=0;h=mOt){var c=e.readInt();this.layerBuffer=new Array(c);for(var f=0;f=gOt){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var _=0;_=SOt?this._layerBinaryInfos[_].tileSize=e.readDouble():this._layerBinaryInfos[_].tileSize=e.readFloat(),this._layerBinaryInfos[_].detailMapId=e.readString(),this._version>=vOt&&(this._layerBinaryInfos[_].normalMapId=e.readString(),this._version>=SOt?(this._layerBinaryInfos[_].roughness=e.readDouble(),this._layerBinaryInfos[_].metallic=e.readDouble()):(this._layerBinaryInfos[_].roughness=e.readFloat(),this._layerBinaryInfos[_].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new TOt;t.writeInt32(xOt),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e=0&&(ye(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):CPt.CollisionObject_setCollisionShape(this.body,CPt.EmptyShape_static()),CPt.CollisionObject_activate(this.body,!0),this.dirty|=1,ye(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&ye(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&ye(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&1&this.dirty&&this.updateBodyByReAdd(),this.ghostIndex>=0&&2&this.dirty&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=MPt.instance.BT_QUAT_0,e=CPt.CollisionObject_getWorldTransform(this.body);if(ZPt(t,this.node.worldRotation),KPt(CPt.Transform_getOrigin(e),this.node.worldPosition),CPt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncBodyScale(),CPt.CollisionObject_isKinematicObject(this.body)){var i=CPt.RigidBody_getMotionState(this.body);i&&CPt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&CPt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){CPt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=MPt.instance.BT_QUAT_0,e=MPt.instance.BT_TRANSFORM_0;CPt.RigidBody_getWorldTransform(this.body,e);var i=CPt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=$Pt(ZVt,t),this.node.worldPosition=JPt(JVt,i),this._ghostStruct){var n=CPt.CollisionObject_getWorldTransform(this.ghost);KPt(CPt.Transform_getOrigin(n),this.node.worldPosition),ZPt(t,this.node.worldRotation),CPt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=MPt.instance.BT_QUAT_0,e=CPt.CollisionObject_getWorldTransform(this.ghost);KPt(CPt.Transform_getOrigin(e),this.node.worldPosition),ZPt(t,this.node.worldRotation),CPt.Transform_setRotation(e,t),4&this.node.hasChangedFlags&&this.syncGhostScale(),CPt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=MPt.instance.BT_QUAT_0,e=CPt.CollisionObject_getWorldTransform(this.body);KPt(CPt.Transform_getOrigin(e),this.node.worldPosition),ZPt(t,this.node.worldRotation),CPt.Transform_setRotation(e,t),this.syncBodyScale(),CPt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=MPt.instance.BT_QUAT_0,e=CPt.CollisionObject_getWorldTransform(this.ghost);KPt(CPt.Transform_getOrigin(e),this.node.worldPosition),ZPt(t,this.node.worldRotation),CPt.Transform_setRotation(e,t),this.syncGhostScale(),CPt.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;MPt.delWrapper(this.id,APt.BODY_CACHE_NAME),CPt._safe_delete(e.motionState,3),CPt._safe_delete(e.compound,5),CPt._safe_delete(e.body,4),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;CPt._safe_delete(i.compound,5),CPt._safe_delete(i.ghost,4),this._ghostStruct=null}},e.isBodySleeping=function(){return CPt.CollisionObject_isSleeping(this.body)},n(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=1,this.dirty|=2)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=1,this.dirty|=2)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(CPt.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();tNt.idCounter=0,tNt.sharedBodesMap=new Map;var eNt=PPt,iNt={},nNt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=CPt.Quat_new(0,0,0,1),this.transform=CPt.Transform_new(),this._collider=void 0,this._sharedBody=void 0}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?SEt.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){iNt[e._uuid]||(iNt[e._uuid]=CPt.ccMaterial_new());var i=iNt[e._uuid];CPt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),CPt.CollisionShape_setMaterial(this._impl,i)}else CPt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){Kn.copy(eNt,t),eNt.multiply(this._collider.node.worldScale),KPt(CPt.Transform_getOrigin(this.transform),eNt),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=MPt.instance.BT_TRANSFORM_0;CPt.Transform_setIdentity(e),CPt.Transform_setRotation(e,ZPt(MPt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=MPt.instance.BT_V3_0,n=MPt.instance.BT_V3_1;CPt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(CPt.Vec3_x(n)-CPt.Vec3_x(i))/2,t.halfExtents.y=(CPt.Vec3_y(n)-CPt.Vec3_y(i))/2,t.halfExtents.z=(CPt.Vec3_z(n)-CPt.Vec3_z(i))/2,Kn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=CPt.CollisionShape_getLocalBoundingSphere(this._impl),Kn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=SEt.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){MPt.isNotEmptyShape(this._impl)&&(CPt.CollisionShape_setUserPointer(this._impl,this._impl),MPt.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,CPt._safe_delete(this.quat,1),CPt._safe_delete(this.transform,2),this._compound&&CPt._safe_delete(this._compound,5),MPt.isNotEmptyShape(this._impl)&&(CPt._safe_delete(this._impl,5),MPt.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&CPt.CompoundShape_removeChildShape(this._compound,this._impl),t&&CPt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?CPt.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=1)},e.needCompound=function(){return 8===this._collider.type||!this._collider.center.equals(Kn.ZERO)},n(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();nNt.TYPE="shape",nNt.idCounter=0;var rNt=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),sNt=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),aNt=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&JPt(t,CPt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&JPt(t,CPt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&JPt(t,CPt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&JPt(t,CPt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=MPt.instance.BT_QUAT_0,i=CPt.PersistentManifold_getBody0(this.event.impl),n=CPt.CollisionObject_getWorldTransform(i);CPt.Transform_getRotation(n,e);var r=OPt;$Pt(r,e),Cr.conjugate(r,r),JPt(t,CPt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||Kn.negate(t,t),Kn.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=MPt.instance.BT_QUAT_0,i=CPt.PersistentManifold_getBody1(this.event.impl),n=CPt.CollisionObject_getWorldTransform(i);CPt.Transform_getRotation(n,e);var r=OPt;$Pt(r,e),Cr.conjugate(r,r),JPt(t,CPt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),Kn.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(JPt(t,CPt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||Kn.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&JPt(t,CPt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===CPt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),oNt=[],hNt=PPt,uNt=EPt,lNt=kPt,cNt=QPt,fNt=new jVt,dNt=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._debugDraw=void 0,this._debugLineCount=0,this._MAX_DEBUG_LINE_COUNT=16384,this._debugDrawFlags=0,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new rNt,this.characterControllerArrayMat=new rNt,this.collisionArrayMat=new rNt,this.contactsDic=new sNt,this.oldContactsDic=new sNt,this.cctShapeEventDic=new sNt,this.cctContactsDic=new sNt,this.cctOldContactsDic=new sNt,APt.CACHE.world=this,this._broadphase=CPt.DbvtBroadphase_new(),this._dispatcher=CPt.CollisionDispatcher_new(),this._solver=CPt.SequentialImpulseConstraintSolver_new(),this._world=CPt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=CPt.DebugDraw.implement(KVt);this._debugDraw=t.$$.ptr,CPt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),CPt.DebugDraw_setDebugMode(this._debugDraw,0),CPt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),CPt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),CPt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),CPt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),CPt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),CPt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),CPt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){CPt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){CPt.DynamicsWorld_setGravity(this._world,KPt(MPt.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}for(var r=this.ccts,s=r.length-1;s>=0;s--){var a=r[s];a.updateDirty(),a.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(hNt,e.maxDistance);var r=KPt(MPt.instance.BT_V3_0,hNt),s=KPt(MPt.instance.BT_V3_1,t.o),a=CPt.ccAllRayCallback_static();if(CPt.ccAllRayCallback_reset(a,s,r,e.mask>>>0,e.queryTrigger),CPt.ccAllRayCallback_setFlags(a,4),CPt.CollisionWorld_rayTest(this._world,s,r,a),CPt.RayCallback_hasHit(a)){for(var o=CPt.ccAllRayCallback_getHitPointWorld(a),h=CPt.ccAllRayCallback_getHitNormalWorld(a),u=CPt.ccAllRayCallback_getCollisionShapePtrs(a),l=CPt.ccAllRayCallback_getClosestHitFraction(a),c=0,f=CPt.int_array_size(u);c>>0,e.queryTrigger),CPt.ccClosestRayCallback_setFlags(s,4),CPt.CollisionWorld_rayTest(this._world,r,n,s),CPt.RayCallback_hasHit(s)){JPt(hNt,CPt.ccClosestRayCallback_getHitPointWorld(s)),JPt(uNt,CPt.ccClosestRayCallback_getHitNormalWorld(s));var a=MPt.getWrapper(CPt.ccClosestRayCallback_getCollisionShapePtr(s),nNt.TYPE),o=CPt.ccClosestConvexCallback_getClosestHitFraction(s);return i._assign(hNt,Kn.distance(t.o,hNt),a.collider,uNt,o),!0}return!1},t.sweepBox=function(t,i,n,r,s,a){var o=MPt.instance.BT_V3_0;return KPt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=CPt.BoxShape_new(o)),CPt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweep(t,e._sweepBoxGeometry,n,r,s,a)},t.sweepBoxClosest=function(t,i,n,r,s){var a=MPt.instance.BT_V3_0;return KPt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=CPt.BoxShape_new(a)),CPt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=CPt.SphereShape_new(i)),CPt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,Cr.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=CPt.SphereShape_new(i)),CPt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,Cr.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,a,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=CPt.CapsuleShape_new(i,n)),CPt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,a,o)},t.sweepCapsuleClosest=function(t,i,n,r,s,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=CPt.CapsuleShape_new(i,n)),CPt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,a)},t.sweep=function(t,e,i,n,r,s){var a=MPt.instance.BT_TRANSFORM_0,o=MPt.instance.BT_TRANSFORM_1,h=MPt.instance.BT_QUAT_0;KPt(CPt.Transform_getOrigin(a),t.o),ZPt(h,i),CPt.Transform_setRotation(a,h),t.computeHit(hNt,n.maxDistance),KPt(CPt.Transform_getOrigin(o),hNt),ZPt(h,i),CPt.Transform_setRotation(o,h);var u=CPt.ccAllConvexCallback_static();if(CPt.ccAllConvexCallback_reset(u,a,o,n.mask>>>0,n.queryTrigger),CPt.CollisionWorld_convexSweepTest(this._world,e,a,o,u,0),CPt.ConvexCallback_hasHit(u)){for(var l=CPt.ccAllConvexCallback_getHitPointWorld(u),c=CPt.ccAllConvexCallback_getHitNormalWorld(u),f=CPt.ccAllConvexCallback_getCollisionShapePtrs(u),d=CPt.ccAllConvexCallback_getClosestHitFraction(u),_=0,p=CPt.int_array_size(f);_>>0,n.queryTrigger),CPt.CollisionWorld_convexSweepTest(this._world,e,s,a,h,0),CPt.ConvexCallback_hasHit(h)){JPt(hNt,CPt.ccClosestConvexCallback_getHitPointWorld(h)),JPt(uNt,CPt.ccClosestConvexCallback_getHitNormalWorld(h));var u=MPt.getWrapper(CPt.ccClosestConvexCallback_getCollisionShapePtr(h),nNt.TYPE),l=CPt.ccClosestConvexCallback_getClosestHitFraction(h);return r._assign(hNt,Kn.distance(t.o,hNt),u.collider,uNt,l),!0}return!1},t.getSharedBody=function(t,e){return tNt.getSharedBody(t,this,e)},t.addSharedBody=function(t){if(this.bodies.indexOf(t)<0){this.bodies.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;CPt.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(ye(this.bodies,e),CPt.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){if(this.ghosts.indexOf(t)<0){this.ghosts.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;CPt.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(ye(this.ghosts,e),CPt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=CPt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();CPt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),CPt.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){ye(this.ccts,e);var i=CPt.CharacterController_getGhostObject(t.impl);CPt.CollisionWorld_removeCollisionObject(this._world,i),CPt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),CPt.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),CPt.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){this._needSyncAfterEvents=!1,this._needEmitEvents&&(this.gatherConatactData(),this.emitCollisionAndTriggerEvent(),this.emitCCTTriggerEvent()),this._needEmitCCTEvents&&this.emitCCTCollisionEvent()},t.emitCollisionAndTriggerEvent=function(){for(var t=this.contactsDic.getLength();t--;){oNt.push.apply(oNt,IPt.contacts),IPt.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.collider;if(s&&a){if(s.isTrigger||a.isTrigger)this.triggerArrayMat.get(n.id,r.id)?DPt.type="onTriggerStay":(DPt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),DPt.impl=i.impl,DPt.selfCollider=s,DPt.otherCollider=a,s.emit(DPt.type,DPt),DPt.selfCollider=a,DPt.otherCollider=s,a.emit(DPt.type,DPt),this._needSyncAfterEvents=!0;else{var o=s.attachedRigidBody,h=a.attachedRigidBody;if(o&&h){if(o.isSleeping&&h.isSleeping)continue}else if(!o&&h){if(h.isSleeping)continue}else if(!h&&o&&o.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?IPt.type="onCollisionStay":(IPt.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u0){var c=oNt.pop();c.impl=l,IPt.contacts.push(c)}else{var f=new aNt(IPt);f.impl=l,IPt.contacts.push(f)}}IPt.impl=i.impl,IPt.selfCollider=s,IPt.otherCollider=a,s.emit(IPt.type,IPt),IPt.selfCollider=a,IPt.otherCollider=s,a.emit(IPt.type,IPt),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var d=this.oldContactsDic.getLength();d--;){var _=this.oldContactsDic.getKeyByIndex(d),p=this.oldContactsDic.getDataByKey(_),m=p.shape0,g=p.shape1,v=m.collider,y=g.collider;if(v&&y){var b=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(_)&&(b?this.triggerArrayMat.get(m.id,g.id)&&(DPt.type="onTriggerExit",DPt.selfCollider=v,DPt.otherCollider=y,v.emit(DPt.type,DPt),DPt.selfCollider=y,DPt.otherCollider=v,y.emit(DPt.type,DPt),this.triggerArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(m.id,g.id)&&(oNt.push.apply(oNt,IPt.contacts),IPt.contacts.length=0,IPt.type="onCollisionExit",IPt.selfCollider=v,IPt.otherCollider=y,v.emit(IPt.type,IPt),IPt.selfCollider=y,IPt.otherCollider=v,y.emit(IPt.type,IPt),this.collisionArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()},t.emitCCTTriggerEvent=function(){for(var t=this.cctContactsDic.getLength();t--;){var e=this.cctContactsDic.getKeyByIndex(t),i=this.cctContactsDic.getDataByKey(e),n=i.shape,r=i.cct;this.cctOldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.characterController;s&&a&&(s.isTrigger&&(this.characterControllerArrayMat.get(n.id,r.id)?BPt.type="onControllerTriggerStay":(BPt.type="onControllerTriggerEnter",this.characterControllerArrayMat.set(n.id,r.id,!0)),BPt.impl=i.impl,BPt.collider=s,BPt.characterController=a,s.emit(BPt.type,BPt),BPt.collider=s,BPt.characterController=a,a.emit(BPt.type,BPt),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var o=this.cctOldContactsDic.getLength();o--;){var h=this.cctOldContactsDic.getKeyByIndex(o),u=this.cctOldContactsDic.getDataByKey(h),l=u.shape,c=u.cct,f=l.collider,d=c.characterController;if(f&&d){var _=f.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&_&&this.characterControllerArrayMat.get(l.id,c.id)&&(BPt.type="onControllerTriggerExit",BPt.collider=f,BPt.characterController=d,f.emit(BPt.type,BPt),BPt.collider=f,BPt.characterController=d,d.emit(BPt.type,BPt),this.characterControllerArrayMat.set(l.id,c.id,!1),this.cctOldContactsDic.set(l.id,c.id,null),this._needSyncAfterEvents=!0)}}this.cctContactsDic.reset()},t.emitCCTCollisionEvent=function(){for(var t=this.cctShapeEventDic.getLength();t--;){var e,i=this.cctShapeEventDic.getKeyByIndex(t),n=this.cctShapeEventDic.getDataByKey(i),r=n.BulletCharacterController,s=n.BulletShape,a=n.worldPos,o=n.worldNormal,h=n.motionDir,u=n.motionLength;fNt.controller=r.characterController,fNt.collider=s.collider,fNt.worldPosition.set(a.x,a.y,a.z),fNt.worldNormal.set(o.x,o.y,o.z),fNt.motionDirection.set(h.x,h.y,h.z),fNt.motionLength=u,null===(e=fNt.controller)||void 0===e||e.emit("onControllerColliderHit",fNt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=CPt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=CPt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=gNt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=CPt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=MPt.instance.BT_V3_0;KPt(n,this._collider.node.worldScale),CPt.CollisionShape_setLocalScaling(this._impl,n),CPt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=CPt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&CPt._safe_delete(this.refBtTriangleMesh,8):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=MPt.instance.BT_V3_0;KPt(e,this._collider.node.worldScale),CPt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=CPt.TriangleMesh_new(),tEt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(nNt),yNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=MPt.instance.BT_V3_0;CPt.Vec3_set(t,.5,1,.5),this._impl=CPt.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(fn(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(fn(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(fn(a.x,a.y))),CPt.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(nNt),bNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=CPt.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(fn(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(fn(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(fn(a.x,a.y))),CPt.ConeShape_setRadius(this._impl,r),CPt.ConeShape_setHeight(this._impl,s),CPt.ConeShape_setConeUpIndex(this._impl,o);var h=MPt.instance.BT_V3_0;CPt.Vec3_set(h,1,1,1),CPt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(nNt),SNt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru&&(s=u),u>a&&(a=u),r+=4}a+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(a+s)/2,(n-1)/2*this._tileSize),this._impl=CPt.TerrainShape_new(i,n,this._bufPtr,1,s,a);var l=MPt.instance.BT_V3_0;CPt.Vec3_set(l,this._tileSize,1,this._tileSize),CPt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=CPt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&CPt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){Kn.copy(PPt,t),PPt.add(this._localOffset),KPt(CPt.Transform_getOrigin(this.transform),PPt),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(nNt),xNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=CPt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=MPt.instance.BT_V3_0,n=0;n=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._connectedBody=t.connectedBody,this._collided=t.enableCollision,this.onComponentSet(),this.setEnableCollision(this._collided)},e.updateDebugDrawSize=function(){if(this.impl){var t=SEt.instance.physicsWorld.debugDrawConstraintSize;CPt.TypedConstraint_setDbgDrawSize(this.impl,t)}},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){CPt._safe_delete(this._impl,13),this._com=null,this._rigidBody=null,this._connectedBody=null},n(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),CNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=MPt.instance.BT_V3_0;Kn.multiply(PPt,t.node.worldScale,t.pivotA),KPt(e,PPt),CPt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=MPt.instance.BT_V3_0,n=t.connectedBody;n?(Kn.multiply(PPt,n.node.worldScale,t.pivotB),KPt(i,PPt)):(Kn.multiply(PPt,e.worldScale,t.pivotA),Kn.transformQuat(PPt,PPt,e.worldRotation),Kn.add(PPt,PPt,e.worldPosition),KPt(i,PPt)),CPt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:CPt.TypedConstraint_getFixedBody(),n=MPt.instance.BT_V3_0,r=MPt.instance.BT_V3_1;this._impl=CPt.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB),this.updateDebugDrawSize()},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(TNt),ANt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){CPt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:CPt.TypedConstraint_getFixedBody(),n=MPt.instance.BT_TRANSFORM_0,r=MPt.instance.BT_TRANSFORM_1;this._impl=CPt.FixedConstraint_new(e,i,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=PPt,n=OPt,r=MPt.instance.BT_TRANSFORM_0,s=MPt.instance.BT_TRANSFORM_1,a=MPt.instance.BT_QUAT_0,o=FPt;if(zr.fromRT(o,e.node.worldRotation,e.node.worldPosition),zr.invert(o,o),zr.getRotation(n,o),zr.getTranslation(i,o),KPt(CPt.Transform_getOrigin(r),i),ZPt(a,n),CPt.Transform_setRotation(r,a),t){var h=t.body.sharedBody;zr.fromRT(o,h.node.worldRotation,h.node.worldPosition),zr.invert(o,o),zr.getRotation(n,o),zr.getTranslation(i,o),KPt(CPt.Transform_getOrigin(s),i),ZPt(a,n),CPt.Transform_setRotation(s,a)}else CPt.Transform_setIdentity(s);CPt.FixedConstraint_setFrames(this._impl,r,s)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(TNt),DNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setLimitEnabled=function(){this.constraint.limitEnabled?CPt.HingeConstraint_setLimit(this._impl,Ji(this.constraint.lowerLimit),Ji(this.constraint.upperLimit),.9,.3,1):CPt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&CPt.HingeConstraint_setLimit(this._impl,Ji(this.constraint.lowerLimit),Ji(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&CPt.HingeConstraint_setLimit(this._impl,Ji(this.constraint.lowerLimit),Ji(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){CPt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=eEt(this.constraint.motorForceLimit,SEt.instance.fixedTimeStep);CPt.HingeConstraint_setMotorVelocity(this._impl,e),CPt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;CPt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=eEt(t,SEt.instance.fixedTimeStep);CPt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:CPt.TypedConstraint_getFixedBody(),n=MPt.instance.BT_TRANSFORM_0,r=MPt.instance.BT_TRANSFORM_1;this._impl=CPt.HingeConstraint_new(e,i,n,r),this.setLimitEnabled(this.constraint.limitEnabled),this.setLowerLimit(this.constraint.lowerLimit),this.setUpperLimit(this.constraint.upperLimit),this.setMotorEnabled(this.constraint.motorEnabled),this.setMotorVelocity(this.constraint.motorVelocity),this.setMotorForceLimit(this.constraint.motorForceLimit),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=PPt,n=OPt,r=RPt,s=MPt.instance.BT_TRANSFORM_0;Kn.multiply(i,e.worldScale,t.pivotA),KPt(CPt.Transform_getOrigin(s),i);var a=MPt.instance.BT_QUAT_0;Kn.normalize(i,t.axis),Cr.rotationTo(r,Kn.UNIT_Z,i),ZPt(a,r),CPt.Transform_setRotation(s,a);var o=MPt.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(Kn.multiply(i,h.node.worldScale,t.pivotB),Cr.multiply(r,e.worldRotation,r),Cr.invert(n,h.node.worldRotation),Cr.multiply(r,n,r)):(Kn.multiply(i,e.worldScale,t.pivotA),Kn.transformQuat(i,i,e.worldRotation),Kn.add(i,i,e.worldPosition),Cr.multiply(r,e.worldRotation,r)),KPt(CPt.Transform_getOrigin(o),i),ZPt(a,r),CPt.Transform_setRotation(o,a),CPt.HingeConstraint_setFrames(this._impl,s,o)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(TNt),INt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i._setLimit=function(t,e,i,n){switch(t){case 2:CPt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case 1:CPt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case 0:CPt.Generic6DofSpring2Constraint_setLimit(this._impl,e,1,0)}},i.setConstraintMode=function(t,e){var i=this.constraint.linearLimitSettings,n=this.constraint.angularLimitSettings,r=[0,0,0],s=[0,0,0],a=0,o=0;switch(t){case 0:case 1:case 2:Kn.toArray(r,i.lower),Kn.toArray(s,i.upper),o=r[t],a=s[t];break;case 3:o=-(a=.5*Ji(n.twistExtent));break;case 4:o=-(a=.5*Ji(n.swingExtent1));break;case 5:o=-(a=.5*Ji(n.swingExtent2));break;default:Y("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,o,a)},i.setLinearLimit=function(t,e,i){var n=0,r=this.constraint.linearLimitSettings;switch(t){case 0:n=r.xMotion;break;case 1:n=r.yMotion;break;case 2:n=r.zMotion}this._setLimit(n,t,e,i)},i.setAngularExtent=function(t,e,i){var n=this.constraint.angularLimitSettings;this._setLimit(n.twistMotion,3,.5*-Ji(t),.5*Ji(t)),this._setLimit(n.swingMotion1,4,.5*-Ji(e),.5*Ji(e)),this._setLimit(n.swingMotion2,5,.5*-Ji(i),.5*Ji(i))},i.setSwingSoftConstraint=function(t){CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,4,t),CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,5,t)},i.setTwistSoftConstraint=function(t){CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,3,t)},i.setLinearSoftConstraint=function(t){CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,0,t),CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,1,t),CPt.Generic6DofSpring2Constraint_enableSpring(this._impl,2,t)},i.setLinearStiffness=function(t){CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,0,t),CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,1,t),CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,2,t)},i.setLinearDamping=function(t){CPt.Generic6DofSpring2Constraint_setDamping(this._impl,0,t),CPt.Generic6DofSpring2Constraint_setDamping(this._impl,1,t),CPt.Generic6DofSpring2Constraint_setDamping(this._impl,2,t)},i.setLinearRestitution=function(t){CPt.Generic6DofSpring2Constraint_setBounce(this._impl,0,t),CPt.Generic6DofSpring2Constraint_setBounce(this._impl,1,t),CPt.Generic6DofSpring2Constraint_setBounce(this._impl,2,t)},i.setSwingStiffness=function(t){CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,4,t),CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,5,t)},i.setSwingDamping=function(t){CPt.Generic6DofSpring2Constraint_setDamping(this._impl,4,t),CPt.Generic6DofSpring2Constraint_setDamping(this._impl,5,t)},i.setSwingRestitution=function(t){CPt.Generic6DofSpring2Constraint_setBounce(this._impl,4,t),CPt.Generic6DofSpring2Constraint_setBounce(this._impl,5,t)},i.setTwistStiffness=function(t){CPt.Generic6DofSpring2Constraint_setStiffness(this._impl,3,t)},i.setTwistDamping=function(t){CPt.Generic6DofSpring2Constraint_setDamping(this._impl,3,t)},i.setTwistRestitution=function(t){CPt.Generic6DofSpring2Constraint_setBounce(this._impl,3,t)},i.setDriverMode=function(t,e){0===e?CPt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):1===e?(CPt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),CPt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):2===e&&(CPt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),CPt.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=0,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,a=this.constraint.angularDriverSettings;switch(t){case 0:i=0,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=1,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=2,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=3,e=a.twistDrive,n=-Ji(a.targetOrientation.x),r=-Ji(a.targetVelocity.x);break;case 4:i=4,e=a.swingDrive1,n=-Ji(a.targetOrientation.y),r=-Ji(a.targetVelocity.y);break;case 5:i=5,e=a.swingDrive2,n=-Ji(a.targetOrientation.z),r=-Ji(a.targetVelocity.z)}var o=t>2?a.strength:s.strength;CPt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),1===e?t>2?CPt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*o*.1):CPt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*o*.1):2===e&&CPt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,r)},i.setLinearMotorTarget=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorVelocity=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorForceLimit=function(t){CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,0,t),CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,1,t),CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,2,t)},i.setAngularMotorTarget=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorVelocity=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorForceLimit=function(t){CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,3,t),CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,4,t),CPt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,5,t)},i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAutoPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setSecondaryAxis=function(){this.updateFrames()},i.setBreakForce=function(){var t=eEt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),SEt.instance.fixedTimeStep);CPt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=eEt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),SEt.instance.fixedTimeStep);CPt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||CPt.TypedConstraint_getFixedBody(),n=MPt.instance.BT_TRANSFORM_0,r=MPt.instance.BT_TRANSFORM_1;this._impl=CPt.Generic6DofSpring2Constraint_new(e,i,n,r,3);var s=this.constraint.linearLimitSettings,a=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,a.twistMotion),this.setConstraintMode(4,a.swingMotion1),this.setConstraintMode(5,a.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(a.enableSoftConstraintSwing),this.setSwingRestitution(a.swingRestitution),this.setSwingStiffness(a.swingStiffness),this.setSwingDamping(a.swingDamping),this.setTwistSoftConstraint(a.enableSoftConstraintTwist),this.setTwistRestitution(a.twistRestitution),this.setTwistStiffness(a.twistStiffness),this.setTwistDamping(a.twistDamping);var o=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,o.xDrive),this.setDriverMode(1,o.yDrive),this.setDriverMode(2,o.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(o.targetPosition),this.setLinearMotorVelocity(o.targetVelocity),this.setLinearMotorForceLimit(o.strength),this.setAngularMotorTarget(h.targetOrientation),this.setAngularMotorVelocity(h.targetVelocity),this.setAngularMotorForceLimit(h.strength),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=PPt,n=OPt,r=RPt,s=MPt.instance.BT_TRANSFORM_0;Kn.multiply(i,e.worldScale,t.pivotA),KPt(CPt.Transform_getOrigin(s),i);var a=MPt.instance.BT_QUAT_0,o=t.axis,h=t.secondaryAxis,u=Kn.cross(EPt,o,h);zr.set(FPt,o.x,o.y,o.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),ZPt(a,n),CPt.Transform_setRotation(s,a);var l=MPt.instance.BT_TRANSFORM_1,c=this.constraint.connectedBody;c?(Cr.multiply(n,e.worldRotation,n),Cr.invert(r,c.node.worldRotation),Cr.multiply(n,r,n),t.autoPivotB?(Kn.multiply(i,t.node.worldScale,t.pivotA),Kn.transformQuat(i,i,e.worldRotation),Kn.add(i,i,t.node.worldPosition),Kn.subtract(i,i,c.node.worldPosition),Kn.transformQuat(i,i,r)):Kn.multiply(i,c.node.worldScale,t.pivotB)):(Kn.multiply(i,e.worldScale,t.pivotA),Kn.transformQuat(i,i,e.worldRotation),Kn.add(i,i,e.worldPosition),Cr.multiply(n,e.worldRotation,n)),KPt(CPt.Transform_getOrigin(l),i),ZPt(a,n),CPt.Transform_setRotation(l,a),CPt.Generic6DofSpring2Constraint_setFrames(this._impl,s,l)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(TNt),BNt=new Kn(0,0,0),MNt=new Kn(0,0,0);new Kn(0,0,0);var PNt=function(){function t(){this.wrappedWorld=void 0,this._isEnabled=!1,this._impl=0,this._comp=null,this._btCollisionFlags=0,this._word3=0,this._dirty=!1,this._collisionFilterGroup=1,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=SEt.instance.physicsWorld}var e=t.prototype;return e.onComponentSet=function(){},e.updateScale=function(){},e.initialize=function(t){this._comp=t;var e=this._comp.group,i=SEt.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(Y("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){MPt.setWrapper(this._impl,APt.CCT_CACHE_NAME,this);var t=CPt.CharacterController_getCollisionShape(this.impl);MPt.setWrapper(t,APt.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),SEt.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){CPt._safe_delete(this._impl,6),MPt.delWrapper(this._impl,APt.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&JPt(t,CPt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(KPt(CPt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&CPt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&CPt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&CPt.CharacterController_setSlopeLimit(this._impl,$e(t))},e.setDetectCollisions=function(t){this._impl&&CPt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&CPt.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(4&t.hasChangedFlags&&this.syncScale(),1&t.hasChangedFlags&&(Kn.add(BNt,t.worldPosition,this.scaledCenter),this.setPosition(BNt)))},e.syncPhysicsToScene=function(){this.getPosition(BNt),BNt.subtract(this.scaledCenter),this._comp.node.setWorldPosition(BNt)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=MPt.instance.BT_V3_0;CPt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=CPt.CharacterController_move(this.impl,n,e,i)}},e.setGroup=function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this._dirty=!0)},e.getGroup=function(){return this._collisionFilterGroup},e.addGroup=function(t){this._collisionFilterGroup|=t,this._dirty=!0},e.removeGroup=function(t){this._collisionFilterGroup&=~t,this._dirty=!0},e.setMask=function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this._dirty=!0)},e.getMask=function(){return this._collisionFilterMask},e.addMask=function(t){this._collisionFilterMask|=t,this._dirty=!0},e.removeMask=function(t){this._collisionFilterMask&=~t,this._dirty=!0},e.updateEventListener=function(){this.wrappedWorld.updateNeedEmitCCTEvents(this.characterController.needCollisionEvent)},e.updateDirty=function(){this._dirty&&(SEt.instance.physicsWorld.removeCCT(this),SEt.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=CPt.ControllerShapeHit_getHitShape(t),i=SEt.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new Kn;JPt(n,CPt.ControllerHit_getHitWorldPos(t));var r=new Kn;JPt(r,CPt.ControllerHit_getHitWorldNormal(t));var s=new Kn;JPt(s,CPt.ControllerHit_getHitMotionDir(t));var a=CPt.ControllerHit_getHitMotionLength(t),o=MPt.getWrapper(e,nNt.TYPE);o&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:o,worldPos:n,worldNormal:r,motionDir:s,motionLength:a})},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"impl",get:function(){return this._impl}},{key:"characterController",get:function(){return this._comp}},{key:"scaledCenter",get:function(){return Kn.multiply(MNt,this._comp.center,this._comp.node.worldScale),MNt}}]),t}();PNt.idCounter=0;var ENt,kNt,ONt,RNt,FNt,LNt,VNt,NNt=new Kn(0,0,0),zNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(NNt),NNt.add(this.scaledCenter);var t=MPt.instance.BT_V3_0;CPt.Vec3_set(t,NNt.x,NNt.y,NNt.z);var e=Kn.UNIT_Y,i=MPt.instance.BT_V3_1;CPt.Vec3_set(i,e.x,e.y,e.z);var n=CPt.ControllerHitReport.implement(KVt).$$.ptr,r=SEt.instance.physicsWorld,s=CPt.CapsuleCharacterControllerDesc_new($e(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=CPt.CapsuleCharacterController_new(r.impl,s,0),this.updateScale()},i.setRadius=function(){this.updateScale()},i.setHeight=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale,e=this.component.radius*fn(t.x,t.z),i=this.component.height*Math.abs(t.y);CPt.CapsuleCharacterController_setRadius(this.impl,e),CPt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(PNt),GNt=new Kn(0,0,0),UNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(GNt),GNt.add(this.scaledCenter);var t=MPt.instance.BT_V3_0;CPt.Vec3_set(t,GNt.x,GNt.y,GNt.z);var e=Kn.UNIT_Y,i=MPt.instance.BT_V3_1;CPt.Vec3_set(i,e.x,e.y,e.z);var n=CPt.ControllerHitReport.implement(KVt).$$.ptr,r=SEt.instance.physicsWorld,s=CPt.BoxCharacterControllerDesc_new($e(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=CPt.BoxCharacterController_new(r.impl,s,0),this.updateScale()},i.setHalfHeight=function(){this.updateScale()},i.setHalfSideExtent=function(){this.updateScale()},i.setHalfForwardExtent=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale;CPt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),CPt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),CPt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(PNt);bk.once(yk.EVENT_PRE_SUBSYSTEM_INIT,(function(){hPt.register("bullet",{PhysicsWorld:dNt,RigidBody:QVt,BoxShape:_Nt,SphereShape:pNt,CapsuleShape:mNt,TrimeshShape:vNt,CylinderShape:yNt,ConeShape:bNt,TerrainShape:SNt,SimplexShape:xNt,PlaneShape:wNt,PointToPointConstraint:CNt,HingeConstraint:DNt,FixedConstraint:ANt,ConfigurableConstraint:INt,BoxCharacterController:UNt,CapsuleCharacterController:zNt})}));var HNt={BOX:0,SPHERE:1,CYLINDER:2,CONE:3,CAPSULE:4,TORUS:5,PLANE:6,QUAD:7};Me(HNt);var WNt=t("f_",(ENt=Bh("cc.Primitive"),kNt=fu(HNt),ENt((VNt=function(t){function e(e){var i;return void 0===e&&(e=0),(i=t.call(this)||this).type=FNt&&FNt(),i.info=LNt&&LNt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){aO((0,kK[HNt[this.type].toLowerCase()])(this.info),this)},e}(Qk),VNt.PrimitiveType=HNt,FNt=yh((RNt=VNt).prototype,"type",[kNt],(function(){return 0})),LNt=yh(RNt.prototype,"info",[Uh],(function(){return{}})),ONt=RNt))||ONt));T.Primitive=WNt,C.primitives=kK;var jNt,qNt=function(){function t(t,e,i){this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return void 0!==this._opts.below&&this._valuethis._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},n(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),XNt=Bh("cc.PerfCounter")(jNt=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}s(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(qNt))||jNt,YNt="0123456789. ",QNt=500,KNt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},JNt={fps:{desc:"Framerate (FPS)",below:30,average:QNt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:QNt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:QNt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:QNt},render:{desc:"Renderer (ms)",min:0,max:50,average:QNt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:QNt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},ZNt=t("f$",function(t){function e(){var e;return(e=t.call(this)||this)._profilerStats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new kd,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(JNt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=D.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}s(e,t);var i=e.prototype;return i.init=function(){Ve.querySettings("profiling","showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),wE.off("director_before_update",this.beforeUpdate,this),wE.off("director_after_update",this.afterUpdate,this),wE.off("director_before_physics",this.beforePhysics,this),wE.off("director_after_physics",this.afterPhysics,this),wE.off("director_before_draw",this.beforeDraw,this),wE.off("director_after_render",this.afterRender,this),wE.off("director_after_draw",this.afterPresent,this),this._showFPS=!1,wE.root.pipeline.profiler=null,T.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=T.director.root;this._device=vp.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),T.game.once(T.Game.EVENT_ENGINE_INITED,this.generateNode,this),T.game.on(T.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),wE.on("director_before_update",this.beforeUpdate,this),wE.on("director_after_update",this.afterUpdate,this),wE.on("director_before_physics",this.beforePhysics,this),wE.on("director_after_physics",this.afterPhysics,this),wE.on("director_before_draw",this.beforeDraw,this),wE.on("director_after_render",this.afterRender,this),wE.on("director_after_draw",this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,T.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new jd(1,6,35,280,280)),this._region.texExtent.width=280,this._region.texExtent.height=280)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._profilerStats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in JNt){var n=JNt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new XNt(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<12;++r){var s=this._ctx.measureText(YNt[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<12;++a)this._ctx.fillText(YNt[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=JNt,this._canvasArr[0]=this._canvas,this._device.copyTexImagesToTexture(this._canvasArr,this._texture,this._regionArr)}},i.generateNode=function(){if(!this._rootNode||!this._rootNode.isValid){this._rootNode=new ry("PROFILER_NODE"),this._rootNode._objFlags=T.Object.Flags.DontSave|T.Object.Flags.HideInHierarchy,bk.addPersistRootNode(this._rootNode);var t=new ry("Profiler_Root");t.parent=this._rootNode;for(var e=.4,i=e/this._totalLines,n=e/this._wordHeight,r=i/23,s=this._eachNumWidth*this._canvas.width*r,a=[0,e,0,n,e,0,n,0,0,0,0,0],o=[0,2,1,0,3,2],h=[0,0,-1,0,1,0,-1,0,1,this._wordHeight,-1,0,0,this._wordHeight,-1,0],u=0,l=0;l=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=KNt[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return st(16381),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(df)),$Nt=t("g0",new ZNt);wE.registerSystem("profiler",$Nt,0),T.profiler=$Nt;var tzt=function(){function t(t){this.jointTexturePool=void 0,this.jointAnimationInfo=void 0,this.jointTexturePool=new kY(t),this.jointAnimationInfo=new OY(t)}var e=t.prototype;return e.releaseSkeleton=function(t){this.jointTexturePool.releaseSkeleton(t)},e.releaseAnimationClip=function(t){this.jointTexturePool.releaseAnimationClip(t)},e.clear=function(){this.jointTexturePool.clear(),this.jointAnimationInfo.clear()},t}();T.internal.DataPoolManager=tzt;var ezt,izt,nzt,rzt,szt,azt,ozt,hzt,uzt,lzt,czt,fzt,dzt,_zt,pzt,mzt=new zr,gzt=new zr,vzt=t("g2",function(t){function e(e,i){var n;return void 0===i&&(i=""),(n=t.call(this,e,i)||this)._frames=1,n._bakedDuration=0,n._animInfo=null,n._sockets=[],n._animInfoMgr=void 0,n._parent=null,n._curvesInited=!1,n._animInfoMgr=T.director.root.dataPoolManager.jointAnimationInfo,n}s(e,t);var i=e.prototype;return i.initialize=function(e){if(!this._curveLoaded){this._parent=e.getComponent("cc.SkeletalAnimation");var i=this._parent.useBakedAnimation;this._doNotCreateEval=i,t.prototype.initialize.call(this,e),this._curvesInited=!i;var n=vY.getOrExtract(this.clip),r=n.frames,s=n.samples;this._frames=r-1,this._animInfo=this._animInfoMgr.getData(e.uuid),this._bakedDuration=this._frames/s,this.setUseBaked(i)}},i.onPlay=function(){var e=this;t.prototype.onPlay.call(this),this._parent.useBakedAnimation&&(this._animInfoMgr.switchClip(this._animInfo,this.clip),this._parent.getUsers().forEach((function(t){t.uploadAnimation(e.clip)})))},i.setUseBaked=function(e){e?(this._sampleCurves=this._sampleCurvesBaked,this.duration=this._bakedDuration):(this._sampleCurves=t.prototype._sampleCurves,this.duration=this.clip.duration,this._curvesInited||(this._curveLoaded=!1,t.prototype.initialize.call(this,this._targetNode),this._curvesInited=!0))},i.rebuildSocketCurves=function(t){if(this._sockets.length=0,this._targetNode)for(var e=this._targetNode,i=0;ii?i:t},t.cosDeg=function(t){return Math.cos(t*u)},t.sinDeg=function(t){return Math.sin(t*u)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var n=Math.random(),r=e-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):e-Math.sqrt((1-n)*r*(e-i))},t}(),e.PI=r,e.PI2=s,e.radiansToDegrees=a,e.radDeg=o,e.degreesToRadians=h,e.degRad=u,e)}(wzt||(wzt={}));var Czt=wzt;function Azt(t,e){return t?e===t.length?t:e=this._maxFrameIdex&&(this.isCompleted=!0)}while(this.needToUpdate(t))},e.getFrame=function(t){var e=t%this._maxFrameIdex;return this.frames[e]},e.invalidAnimationFrames=function(){this._curIndex=-1,this._isCompleted=!1,this.frames.length=0},e.updateRenderData=function(t,e){var i=e.vCount,n=e.iCount,r=gGt/4,s=new Uint8Array(4*r*i),a=new Uint16Array(n),o=Czt.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=4*i*r;s.set(o.subarray(h,h+u));var l=e.iPtr,c=2*n;new Uint8Array(a.buffer).set(o.subarray(l,l+c));var f=new yGt;f.vCount=i,f.iCount=n,f.vData=s,f.iData=a;for(var d=e.getData(),_=d.size(),p=0;p<_;p+=6){var m=new bGt;m.iCount=d.get(p+3),m.blendMode=d.get(p+4),m.textureID=d.get(p+5),f.meshes.push(m)}var g=this._skeleton.bones,v=[];g.forEach((function(t){var e=new vGt;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.worldX=t.worldX,e.worldY=t.worldY,v.push(e)})),this.frames[t]={model:f,boneInfos:v}},e.begin=function(){if(this._invalid){var t=this._skeletonInfo,e=null==t?void 0:t.curAnimationCache;e&&e!==this&&(this._privateMode?e.invalidAllFrame():e.updateToFrame(0));var i=null==t?void 0:t.listener;this._instance.setAnimation(0,this._animationName,!1),this.bind(i),t.curAnimationCache=this,this._frameIdx=-1,this.isCompleted=!1,this.totalTime=0,this._invalid=!1}},e.end=function(){this.needToUpdate()||(this._skeletonInfo.curAnimationCache=null,this.frames.length=this._frameIdx+1,this.isCompleted=!0,this.unbind(this._skeletonInfo.listener))},e.bind=function(t){var e=this;t.complete=function(t){t&&t.animation.name===e._animationName&&(e.isCompleted=!0)}},e.unbind=function(t){t.complete=null},e.needToUpdate=function(t){return!this.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx0)return void this._sharedCacheMap.set(t,i);this._sharedCacheMap.delete(t)}}var n=this._skeletonCache[t];if(n){var r=this._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},s=n.animationsCache;for(var a in s){var o=s[a];o&&r(a,o)}n.skeleton&&Czt.wasmUtil.destroySpineSkeleton(n.skeleton),delete this._skeletonCache[t]}},e.createSkeletonInfo=function(t){var e=t.uuid,i=t.getRuntimeData();if(!this._privateMode){var n=this._sharedCacheMap.get(e);n?n+=1:n=1,this._sharedCacheMap.set(e,n)}if(this._skeletonCache[e])return this._skeletonCache[e];var r=new Czt.Skeleton(i),s=new sGt;return this._skeletonCache[e]={skeleton:r,clipper:null,state:null,listener:s,animationsCache:{},curAnimationCache:null,assetUUID:e}},e.getSkeletonInfo=function(t){var e=t.uuid;return this._skeletonCache[e]},e.getAnimationCache=function(t,e){var i=this._skeletonCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e,i){var n=e.getRuntimeData();if(!n)return null;var r=this._skeletonCache[t];if(!r||!r.skeleton)return null;var s=r.animationsCache,a=s[i];if(!a){var o=t+"#"+i;(a=this._animationPool[o])?delete this._animationPool[o]:(a=new SGt(n))._privateMode=this._privateMode,a.init(r,i),s[i]=a}return a.init(r,i),a.setAnimation(i),a},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i]);var n=this._skeletonCache[t],r=n&&n.skeleton;r&&Czt.wasmUtil.destroySpineSkeleton(r),n&&delete this._skeletonCache[t]}else{var s=this._animationPool;for(var a in s)s[a].destroy(),delete s[a]}},t}();iGt=xGt,xGt.FrameTime=aGt,xGt.sharedCache=new iGt;var wGt=(oGt=Bh("sp.SkeletonData"),hGt=fu([hv]),uGt=fu([ci]),oGt((cGt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=fGt&&fGt(),e.textures=dGt&&dGt(),e.textureNames=_Gt&&_Gt(),e.scale=pGt&&pGt(),e._atlasText=mGt&&mGt(),e._buffer=void 0,e._skeletonCache=null,e._skinsEnum=null,e._animsEnum=null,e.reset(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new ry(this.name);return e.addComponent("cc.Skeleton").skeletonData=this,t(null,e)},i.reset=function(){this._skeletonCache=null},i.resetEnums=function(){},i.getRuntimeData=function(t){if(this._skeletonCache)return this._skeletonCache;if(!(this.textures&&this.textures.length>0)&&this.textureNames&&this.textureNames.length>0)return t||Y(this.name+" no textures found!"),null;var e=this.mergedUUID(),i=Czt.wasmUtil.querySpineSkeletonDataByUUID(e);if(i)this._skeletonCache=i;else if(this._skeletonJson)this._skeletonCache=Czt.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),Czt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,e);else{var n=new Uint8Array(this._nativeAsset),r=n.length,s=Czt.wasmUtil.queryStoreMemory(r);Czt.wasmUtil.wasm.HEAPU8.subarray(s,s+r).set(n),this._skeletonCache=Czt.wasmUtil.createSpineSkeletonDataWithBinary(r,this._atlasText),Czt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,e)}return this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n":0};ke(oUt);var hUt=oUt,uUt=(CGt=Bh("sp.Skeleton.SpineSocket"),AGt=fu(ry),CGt((IGt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=BGt&&BGt(),this.target=MGt&&MGt(),this.path=t,this.target=e},BGt=yh(IGt.prototype,"path",[Uh],(function(){return""})),MGt=yh(IGt.prototype,"target",[AGt,Uh],(function(){return null})),DGt=IGt))||DGt);ue(uUt,"sp.Skeleton.SpineSocket");var lUt=(PGt=Bh("sp.Skeleton"),EGt=fu(wGt),kGt=fu(aUt),OGt=fu(oUt),RGt=fu(rUt),FGt=fu([uUt]),LGt=fu(Xw),PGt((tUt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=zGt&&zGt(),e.defaultSkin=GGt&&GGt(),e.defaultAnimation=UGt&&UGt(),e._premultipliedAlpha=HGt&&HGt(),e._timeScale=WGt&&WGt(),e._preCacheMode=jGt&&jGt(),e._cacheMode=qGt&&qGt(),e._sockets=XGt&&XGt(),e._useTint=YGt&&YGt(),e._debugMesh=QGt&&QGt(),e._debugBones=KGt&&KGt(),e._debugSlots=JGt&&JGt(),e._enableBatch=ZGt&&ZGt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Ua((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=Me({}),e._enumAnimations=Me({}),e.attachUtil=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._startEntry=void 0,e._endEntry=void 0,e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animCache=null,e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._playTimes=0,e._curFrame=null,e._needUpdateSkeltonData=!0,e._listener=null,e._debugRenderer=null,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._slotTextures=null,e._vLength=0,e._vBuffer=null,e._iLength=0,e._iBuffer=null,e._model=void 0,e._tempColor={r:0,g:0,b:0,a:0},e._eventListenerID=-1,e.loop=$Gt&&$Gt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new Czt.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new iUt,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._instance&&(this._instance.enable=!0),this._flushAssembler(),TGt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),TGt.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(sGt.removeListener(this._eventListenerID),this._eventListenerID=-1),this._drawList.destroy(),this.destroyRenderData(),this._cleanMaterialCache(),this._vBuffer=null,this._iBuffer=null,this.attachUtil.reset(),null===(e=this._slotTextures)||void 0===e||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,TGt.getInstance().remove(this),this._instance&&(this._instance.destroy(),this._instance=null),this._destroySkeletonInfo(this._skeletonCache),this._skeletonCache=null,t.prototype.onDestroy.call(this)},i.clearAnimation=function(t){this.isAnimationCached()||(this.clearTrack(t||0),this.setToSetupPose())},i.clearAnimations=function(){this.isAnimationCached()||(this.clearTracks(),this.setToSetupPose())},i._updateSkeletonData=function(){var t=this._skeletonData;if(!t)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._instance&&(this._instance.dtRate=1*this._timeScale),this._needUpdateSkeltonData=!1,this._runtimeData=t.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._textures=t.textures,this._refreshInspector(),this.defaultAnimation&&(this.animation=this.defaultAnimation.toString()),this.defaultSkin&&""!==this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(1===this._cacheMode?this._skeletonCache=xGt.sharedCache:2===this._cacheMode?(this._skeletonCache=new xGt,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&X("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData)),this._skeletonInfo&&(this._skeleton=this._skeletonInfo.skeleton)}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setSlotsRange=function(t,e){this.isAnimationCached()?X("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},i.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},i.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},i.getTextureAtlas=function(t){return t.region},i.setAnimation=function(t,e,i){if("string"!=typeof e)return et(7511),null;var n=this._skeleton;if(!n||!n.data.findAnimation(e))return et(7509,e),null;var r=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&X("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||(s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))&&this._skinName&&s.setSkin(this._skinName),s&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=s,this._socketNodes.size>0&&this._animCache.enableCacheAttachedInfo(),this._animCache.updateToFrame(0),this._curFrame=this._animCache.frames[0])}else this._animationName=e,r=this._instance.setAnimation(t,e,i);return this.markForUpdateRenderData(),r},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&X("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n}),null;if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(et(7510,e),null)}return null},i.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},i.getCurrent=function(t){if(this.isAnimationCached())X("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(t){t&&(this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t),this.isAnimationCached()&&this._animCache&&this._animCache.setSkin(t),this._skinName=t,this.invalidAnimationCache())},i.updateAnimation=function(t){if(this.markForUpdateRenderData(),!this.paused)if(this.isAnimationCached()){if(t*=1*this._timeScale,this._isAniComplete){var e;if(0===this._animationQueue.length&&!this._headAniInfo){var i=this._animCache;if(i&&i.isInvalid()){i.updateToFrame(0);var n=i.frames;this._curFrame=n[n.length-1]}return}if(this._headAniInfo||(this._headAniInfo=this._animationQueue.shift()),this._accTime+=t,this._accTime>(null===(e=this._headAniInfo)||void 0===e?void 0:e.delay)){var r=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,null==r?void 0:r.animationName,null==r?void 0:r.loop)}return}this._updateCache(t)}else this._instance.updateAnimation(t)},i._updateCache=function(t){var e=this._animCache;if(e.isInited()){var i=e.frames,n=xGt.FrameTime;0===this._accTime&&0===this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),this._curFrame=i[r],void 0!==this._curFrame&&this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._curFrame=i[r],this._emitCacheCompleteEvent()}}},i._emitCacheCompleteEvent=function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},i.updateRenderData=function(){return this.isAnimationCached()?this._curFrame?this._curFrame.model:null:this._instance.updateRenderData()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._skeleton&&this._assembler&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData(),this._updateColor())},i._render=function(t){var e=0;if(this.renderData&&this._drawList.length>0){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;o":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i0?Array.from(this._cachedSockets.keys()).sort():[]):[]},i._updateUseTint=function(){this._cleanMaterialCache(),this.destroyRenderData(),this.isAnimationCached()||this._instance.setUseTint(this._useTint),this._assembler&&this._skeleton&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData())},i._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},i._updateDebugDraw=function(){if(this.debugBones||this.debugSlots||this.debugMesh){if(!this._debugRenderer){var t=new ry("DEBUG_DRAW_NODE");t.layer=this.node.layer,t.hideFlags|=eo.Flags.DontSave|eo.Flags.HideInHierarchy;var e=t.addComponent(tN);e.lineWidth=5,e.strokeColor=new nr(255,0,0,255),this._debugRenderer=e,t.parent=this.node,this.node.on("layer-changed",this._applyLayer,this)}this.isAnimationCached()?X("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this.node.off("layer-changed",this._applyLayer,this),this._debugRenderer.node.destroy(),this._debugRenderer=null,this.isAnimationCached()||this._instance&&this._instance.setDebugMode(!1))},i._updateUITransform=function(){var t=this.node._uiProps.uiTransformComp,e=this._runtimeData;if(!e)return t.setContentSize(100,100),t.anchorX=.5,void(t.anchorX=.5);var i=e.width,n=e.height;i&&n&&(t.setContentSize(i,n),0!==i&&(t.anchorX=Math.abs(e.x)/i),0!==n&&(t.anchorY=Math.abs(e.y)/n))},i._updateColor=function(){var t=this.node._uiProps.opacity;if(this._tempColor.r!==this._color.r||this._tempColor.g!==this._color.g||this._tempColor.b!==this._color.b||this._tempColor.a!==t){this.node._uiProps.colorDirty=!0,this._tempColor.r=this._color.r,this._tempColor.g=this._color.g,this._tempColor.b=this._color.b,this._tempColor.a=t;var e=this._color.r/255,i=this._color.g/255,n=this._color.b/255;this._instance.setColor(e,i,n,t)}},i.setVertexEffectDelegate=function(t){if(this._instance)if(t){var e=null==t?void 0:t.getEffectType();if("jitter"===e){var i=null==t?void 0:t.getJitterVertexEffect();this._instance.setJitterEffect(i)}else if("swirl"===e){var n=null==t?void 0:t.getJitterVertexEffect();this._instance.setSwirlEffect(n)}}else this._instance.clearEffect()},i._ensureListener=function(){this._listener||(this._listener=new sGt,this._eventListenerID=sGt.addListener(this._listener),this._instance.setListener(this._eventListenerID))},i.setStartListener=function(t){this._ensureListener(),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener(),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener(),this._listener.event=t},i.setTrackStartListener=function(t,e){sGt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){sGt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){sGt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){sGt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){sGt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){sGt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())Y("Cached mode can't change texture of slot");else if(this.findSlot(t)){var n=e.width,r=e.height,s=i||!1;this._instance.resizeSlotRegion(t,n,r,s),this._slotTextures||(this._slotTextures=new Map);var a=0;this._slotTextures.forEach((function(t,i){t===e&&(a=i)})),0===a&&(a=++nUt,this._slotTextures.set(a,e)),this._instance.setSlotTexture(t,a)}else Y("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},i._applyLayer=function(){this._debugRenderer&&(this._debugRenderer.node.layer=this.node.layer)},n(e,[{key:"drawList",get:function(){return this._drawList}},{key:"skeletonData",get:function(){return this._skeletonData},set:function(t){t&&t.resetEnums(),this._skeletonData!==t&&(this.destroyRenderData(),this._skeletonData=t,this.defaultSkin="",this.defaultAnimation="",this._animationName="",this._skinName="",this._updateSkeletonData(),this._updateUITransform())}},{key:"_defaultSkinIndex",get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),e){var i=e[t];void 0!==i?(this.defaultSkin=String(i),this.setSkin(this.defaultSkin),this._refreshInspector(),this.markForUpdateRenderData()):Y(this.name+" skin enums are invalid")}else Y(this.name+" skin enums are invalid")}},{key:"_animationIndex",get:function(){var t=this.animation;if(this.skeletonData)if(t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}else this._refreshInspector();return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),e){var i=String(e[t]);void 0!==i?(this.animation=i,this.animation=i):Y(this.name+" animation enums are invalid")}else Y(this.name+" animation enums are invalid")}},{key:"defaultCacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode=t,this.setAnimationCacheMode(this._cacheMode)}},{key:"premultipliedAlpha",get:function(){return this._premultipliedAlpha},set:function(t){t!==this._premultipliedAlpha&&(this._premultipliedAlpha=t,this._instance.setPremultipliedAlpha(t),this.markForUpdateRenderData())}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){t!==this._timeScale&&(this._timeScale=t,this._instance&&(this._instance.dtRate=1*this._timeScale))}},{key:"useTint",get:function(){return this._useTint},set:function(t){t!==this._useTint&&(this._useTint=t,this._updateUseTint())}},{key:"enableBatch",get:function(){return this._enableBatch},set:function(t){t!==this._enableBatch&&(this._enableBatch=t,this._updateBatch())}},{key:"sockets",get:function(){return this._sockets},set:function(t){this._sockets=t,this._updateSocketBindings(),this.attachUtil.init(this)}},{key:"debugSlots",get:function(){return this._debugSlots},set:function(t){t!==this._debugSlots&&(this._debugSlots=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){t!==this._debugBones&&(this._debugBones=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugMesh",get:function(){return this._debugMesh},set:function(t){t!==this._debugMesh&&(this._debugMesh=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"animation",get:function(){return this._animationName},set:function(t){t?this.setAnimation(0,t,this.loop):this.clearAnimation(0)}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),e}(VF),tUt.SpineSocket=uUt,tUt.AnimationCacheMode=rUt,zGt=yh((NGt=tUt).prototype,"_skeletonData",[Uh],(function(){return null})),GGt=yh(NGt.prototype,"defaultSkin",[Uh],(function(){return""})),UGt=yh(NGt.prototype,"defaultAnimation",[Uh],(function(){return""})),HGt=yh(NGt.prototype,"_premultipliedAlpha",[Uh],(function(){return!0})),WGt=yh(NGt.prototype,"_timeScale",[Uh],(function(){return 1})),jGt=yh(NGt.prototype,"_preCacheMode",[Uh],(function(){return-1})),qGt=yh(NGt.prototype,"_cacheMode",[Uh],(function(){return 0})),XGt=yh(NGt.prototype,"_sockets",[Uh],(function(){return[]})),YGt=yh(NGt.prototype,"_useTint",[Uh],(function(){return!1})),QGt=yh(NGt.prototype,"_debugMesh",[Uh],(function(){return!1})),KGt=yh(NGt.prototype,"_debugBones",[Uh],(function(){return!1})),JGt=yh(NGt.prototype,"_debugSlots",[Uh],(function(){return!1})),ZGt=yh(NGt.prototype,"_enableBatch",[Uh],(function(){return!1})),y(NGt.prototype,"skeletonData",[EGt],Object.getOwnPropertyDescriptor(NGt.prototype,"skeletonData"),NGt.prototype),y(NGt.prototype,"_defaultSkinIndex",[kGt],Object.getOwnPropertyDescriptor(NGt.prototype,"_defaultSkinIndex"),NGt.prototype),y(NGt.prototype,"_animationIndex",[OGt],Object.getOwnPropertyDescriptor(NGt.prototype,"_animationIndex"),NGt.prototype),y(NGt.prototype,"defaultCacheMode",[RGt],Object.getOwnPropertyDescriptor(NGt.prototype,"defaultCacheMode"),NGt.prototype),$Gt=yh(NGt.prototype,"loop",[Uh],(function(){return!0})),y(NGt.prototype,"sockets",[FGt],Object.getOwnPropertyDescriptor(NGt.prototype,"sockets"),NGt.prototype),y(NGt.prototype,"customMaterial",[Su,LGt],Object.getOwnPropertyDescriptor(NGt.prototype,"customMaterial"),NGt.prototype),VGt=NGt))||VGt);C.internal.SpineSkeleton=lUt;var cUt,fUt,dUt,_Ut,pUt=function(){function t(){this.name="sp.VertexEffectDelegate",this._vertexEffect=void 0,this._interpolation=void 0,this._effectType=void 0,this._vertexEffect=null,this._interpolation=null,this._effectType="none"}var e=t.prototype;return e.clear=function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},e.initJitter=function(t,e){return this._effectType="jitter",this._vertexEffect=new Czt.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new Czt.Pow(e),this._vertexEffect=new Czt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new Czt.PowOut(e),this._vertexEffect=new Czt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.getJitterVertexEffect=function(){return this._vertexEffect},e.getSwirlVertexEffect=function(){return this._vertexEffect},e.getVertexEffect=function(){return this._vertexEffect},e.getEffectType=function(){return this._effectType},t}(),mUt=new nr(0,0,255,255),gUt=new nr(255,0,0,255),vUt=new nr(0,255,0,255),yUt=new nr(255,255,0,255),bUt=null,SUt=null,xUt=!1,wUt=!1,TUt=WR(zR),CUt=WR(UR),AUt=new Kn(0,0,0);function DUt(t,e){var i,n;switch(t){case 1:i=xUt?1:2,n=1;break;case 2:i=7,n=4;break;case 3:i=xUt?1:2,n=8;break;default:i=xUt?1:2,n=4}return e.getMaterialForBlendAndTint(i,n,wUt?1:0)}var IUt={vCount:32767,ensureAccessor:function(t){var e=t?SUt:bUt;if(!e){var i=wE.root.device,n=wE.root.batcher2D,r=t?UR:zR;t?(e=SUt=new QR(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),SUt)):(e=bUt=new QR(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),bUt))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=lF.add(i?UR:zR,n)}return e},updateRenderData:function(t){var e;t._skeleton&&t.node.active&&null!==(e=t.skeletonData)&&void 0!==e&&e.isValid&&BUt(t)}};function BUt(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),xUt=t.premultipliedAlpha,wUt=t.useTint||t.isAnimationCached(),t.isAnimationCached()?PUt(t):MUt(t);var e=t.renderData,i=wUt?SUt:bUt;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}function MUt(t){var e,i,n=(t.useTint?CUt:TUt)/4,r=t.updateRenderData(),s=r.vCount,a=r.iCount;if(!(s<1||a<1)){var o=t.renderData;o.vertexCount===s&&o.indexCount===a||(o.resize(s,a),o.indices=new Uint16Array(a),t._vLength=4*s*n,t._vBuffer=new Uint8Array(o.chunk.vb.buffer,o.chunk.vb.byteOffset,4*o.chunk.vb.length),t._iLength=2*a,t._iBuffer=new Uint8Array(o.indices.buffer));var h=o.chunk.vb,u=r.vPtr,l=r.iPtr,c=o.indices,f=Czt.wasmUtil.wasm.HEAPU8;null===(e=t._vBuffer)||void 0===e||e.set(f.subarray(u,u+t._vLength),0),null===(i=t._iBuffer)||void 0===i||i.set(f.subarray(l,l+t._iLength),0);for(var d=o.chunk.vertexOffset,_=0;_ji||4294967295!==nr.toUint32(o)||xUt){cUt=o.r/255,fUt=o.g/255,dUt=o.b/255,_Ut=h;for(var u=0;u>t,n=0;if(t<3&&(i-=2,n=e*bHt+e),0!==i&&0!==i){var r=i*i*6;this._bodyIndexPool[t].indices=new Uint16Array(r);for(var s=0,a=new Uint16Array(r),o=n,h=o+bHt*e,u=0;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=1056,h[o++]=1056;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=0,h[o++]=0;for(var u=1;u>e,o=0,h=new Uint16Array(2*a+2);h[o++]=32,h[o++]=32;for(var u=1;u0&&(this._brushPass=n.passes[0],this._currentMaterial.passes.push(this._brushPass),n.passes.pop())}return e&&this._model.initSubModel(0,this._meshData,this._currentMaterial),this.setSharedMaterial(this._currentMaterial,0),this._currentMaterialLayers=i,this._model.enabled=!0,this._model.receiveShadow=t.getTerrain().receiveShadow,!0}return!1},i._updateLightingmap=function(t,e){null!=this._model&&(this._lightmap=t,this._updateReceiveDirLight(),this._model.updateLightingmap(t,e))},i._onMaterialModified=function(t,e){null!=this._model&&this._onRebuildPSO(t,e||this._getBuiltinMaterial())},i._onRebuildPSO=function(t,e){this._model&&this._model.setSubModelMaterial(t,e)},i._clearMaterials=function(){null!=this._model&&this._onMaterialModified(0,null)},i._onUpdateReceiveDirLight=function(t,e){void 0===e&&(e=!1),this._model&&(e?this._model.receiveDirLight=!1:this.node&&(t&this.node.layer)===this.node.layer||t&this._model.visFlags?this._model.receiveDirLight=!0:this._model.receiveDirLight=!1)},i._updateReceiveDirLight=function(){var t=this.node.scene;if(t&&t.renderScene){var e=t.renderScene.mainLight;if(e){var i=e.visibility;e.node&&(e.node.mobility===kv.Static&&this._lightmap?this._onUpdateReceiveDirLight(i,!0):this._onUpdateReceiveDirLight(i))}}},i._getBuiltinMaterial=function(){return Cw.get("missing-material")},e}(aG),BHt=t("ga",Bh("cc.TerrainBlockLightmapInfo")((KUt=function(){this.texture=JUt&&JUt(),this.UOff=ZUt&&ZUt(),this.VOff=$Ut&&$Ut(),this.UScale=tHt&&tHt(),this.VScale=eHt&&eHt()},JUt=yh(KUt.prototype,"texture",[Uh],(function(){return null})),ZUt=yh(KUt.prototype,"UOff",[Uh],(function(){return 0})),$Ut=yh(KUt.prototype,"VOff",[Uh],(function(){return 0})),tHt=yh(KUt.prototype,"UScale",[Uh],(function(){return 0})),eHt=yh(KUt.prototype,"VScale",[Uh],(function(){return 0})),QUt=KUt))||QUt),MHt=t("gb",function(){function t(t,e,i){this._terrain=void 0,this._node=void 0,this._renderable=void 0,this._index=[1,1],this._weightMap=null,this._lightmapInfo=null,this._lodLevel=0,this._lodKey=new xHt,this._errorMetrics=[0,0,0,0],this._LevelDistances=[SHt,SHt,SHt,SHt],this._bbMin=new Kn,this._bbMax=new Kn,this._terrain=t,this._index[0]=e,this._index[1]=i,this._lightmapInfo=t._getLightmapInfo(e,i),this._node=new ry("TerrainBlock"),this._node.setParent(this._terrain.node),this._node.hideFlags|=eo.Flags.DontSave|eo.Flags.HideInHierarchy,this._node.layer=this._terrain.node.layer,this._renderable=this._node.addComponent(IHt)}var e=t.prototype;return e.build=function(){var t=wE.root.device,e=new Float32Array(uOt*hOt*hOt);this._buildVertexData(e);var i=t.createBuffer(new zd(10,1,4*uOt*hOt*hOt,4*uOt));i.update(e),this._buildBoundingBox();var n=[new n_("a_position",32),new n_("a_normal",32),new n_("a_texCoord",21)];this._renderable._meshData=new OE([i],n,7,this._terrain._getSharedIndexBuffer(),null,!1),this._renderable._model=C.director.root.createModel(_M),this._renderable._model.createBoundingShape(this._bbMin,this._bbMax),this._renderable._model.node=this._renderable._model.transform=this._node,null!=this._renderable.node.scene&&(this.visible=!0),this._updateWeightMap(),this._updateMaterial(!0),this._terrain.lodEnable&&(this._updateLodBuffer(e),this._updateIndexBuffer())},e.rebuild=function(){this._updateHeight(),this._updateWeightMap(),this._renderable._invalidMaterial(),this._updateMaterial(!1)},e.destroy=function(){this.visible=!1,this._renderable._destroyModel(),null!=this._node&&this._node.isValid&&this._node.destroy(),null!=this._weightMap&&this._weightMap.destroy()},e.update=function(){this._updateMaterial(!1),this.lightmap!==this._renderable._lightmap&&this._renderable._updateLightingmap(this.lightmap,this.lightmapUVParam);var t=this._terrain.useNormalMap,e=this._terrain.usePBR,i=function(t){return null!==t?t.detailMap:null},n=function(t){var e=null!==t?t.normalMap:null;return null===e&&(e=Cw.get("normal-texture")),e},r=this._renderable._currentMaterial;if(null!==r){var s=this.getMaxLayer(),a=new kn(1,1,1,1),o=new kn(1,1,1,1),h=new kn(0,0,0,0);if(0===s)if(-1!==this.layers[0]){var u=this._terrain.getLayer(this.layers[0]);null!==u&&(a.x=1/u.tileSize,o.x=u.roughness,h.x=u.metallic),r.setProperty("detailMap0",i(u)),t&&r.setProperty("normalMap0",n(u))}else r.setProperty("detailMap0",Cw.get("default-texture")),t&&r.setProperty("normalMap0",Cw.get("normal-texture"));else if(1===s){var l=this._terrain.getLayer(this.layers[0]),c=this._terrain.getLayer(this.layers[1]);null!==l&&(a.x=1/l.tileSize,o.x=l.roughness,h.x=l.metallic),null!==c&&(a.y=1/c.tileSize,o.y=c.roughness,h.y=c.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(l)),r.setProperty("detailMap1",i(c)),t&&(r.setProperty("normalMap0",n(l)),r.setProperty("normalMap1",n(c)))}else if(2===s){var f=this._terrain.getLayer(this.layers[0]),d=this._terrain.getLayer(this.layers[1]),_=this._terrain.getLayer(this.layers[2]);null!==f&&(a.x=1/f.tileSize,o.x=f.roughness,h.x=f.metallic),null!==d&&(a.y=1/d.tileSize,o.y=d.roughness,h.y=d.metallic),null!==_&&(a.z=1/_.tileSize,o.z=_.roughness,h.z=_.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(f)),r.setProperty("detailMap1",i(d)),r.setProperty("detailMap2",i(_)),t&&(r.setProperty("normalMap0",n(f)),r.setProperty("normalMap1",n(d)),r.setProperty("normalMap2",n(_)))}else if(3===s){var p=this._terrain.getLayer(this.layers[0]),m=this._terrain.getLayer(this.layers[1]),g=this._terrain.getLayer(this.layers[2]),v=this._terrain.getLayer(this.layers[3]);null!==p&&(a.x=1/p.tileSize,o.x=p.roughness,h.x=p.metallic),null!==m&&(a.y=1/m.tileSize,o.y=m.roughness,h.y=m.metallic),null!==g&&(a.z=1/g.tileSize,o.z=g.roughness,h.z=g.metallic),null!==v&&(a.w=1/v.tileSize,o.w=v.roughness,h.w=v.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(p)),r.setProperty("detailMap1",i(m)),r.setProperty("detailMap2",i(g)),r.setProperty("detailMap3",i(v)),t&&(r.setProperty("normalMap0",n(p)),r.setProperty("normalMap1",n(m)),r.setProperty("normalMap2",n(g)),r.setProperty("normalMap3",n(v)))}r.setProperty("UVScale",a),e&&(r.setProperty("roughness",o),r.setProperty("metallic",h))}},e._buildLodInfo=function(){var t=new Float32Array(uOt*hOt*hOt);this._buildVertexData(t),this._updateLodBuffer(t),this._updateIndexBuffer()},e._updateLevel=function(t){var e=new Kn,i=new Kn;Kn.add(e,this._bbMin,this._terrain.node.getWorldPosition()),Kn.add(i,this._bbMax,this._terrain.node.getWorldPosition());var n=Kn.distance(e,t),r=Kn.distance(i,t),s=Math.min(n,r);for(s-=this._terrain.LodBias,this._lodLevel=0;this._lodLevel<3&&!(s<=this._LevelDistances[this._lodLevel+1]);)++this._lodLevel},e.setBrushMaterial=function(t){this._renderable._brushMaterial!==t&&(this._renderable._invalidMaterial(),this._renderable._brushMaterial=t)},e._getBrushMaterial=function(){return this._renderable?this._renderable._brushMaterial:null},e._getBrushPass=function(){return this._renderable?this._renderable._brushPass:null},e.getTerrain=function(){return this._terrain},e.getIndex=function(){return this._index},e.getRect=function(){var t=new cs;return t.x=this._index[0]*oOt,t.y=this._index[1]*oOt,t.width=oOt,t.height=oOt,t},e.setLayer=function(t,e){this.layers[t]!==e&&(this._terrain.setBlockLayer(this._index[0],this._index[1],t,e),this._renderable._invalidMaterial(),this._updateMaterial(!1))},e.getLayer=function(t){return this.layers[t]},e.getMaxLayer=function(){return this.layers[3]>=0?3:this.layers[2]>=0?2:this.layers[1]>=0?1:0},e._getMaterialDefines=function(t){var e=1;return this._terrain.node&&this._terrain.node.scene&&this._terrain.node.scene.globals.bakedWithStationaryMainLight&&(e=2),{LAYERS:t+1,CC_USE_LIGHTMAP:null!==this.lightmap?e:0,USE_NORMALMAP:this._terrain.useNormalMap?1:0,USE_PBR:this._terrain.usePBR?1:0}},e._invalidMaterial=function(){this._renderable._invalidMaterial()},e._updateMaterial=function(t){this._renderable._updateMaterial(this,t)&&(null!==this.lightmap&&this.lightmap.setWrapMode(3,3),this._renderable._updateLightingmap(this.lightmap,this.lightmapUVParam))},e._updateHeight=function(){if(null!=this._renderable._meshData){var t=new Float32Array(uOt*hOt*hOt);this._buildVertexData(t),this._renderable._meshData.vertexBuffers[0].update(t),this._buildBoundingBox(),this._renderable._model.createBoundingShape(this._bbMin,this._bbMax),this._renderable._model.updateWorldBound(),this._updateLodBuffer(t),this._updateIndexBuffer()}},e._updateWeightMap=function(){if(0!==this.getMaxLayer()){null==this._weightMap&&(this._weightMap=new hv,this._weightMap.create(this._terrain.weightMapSize,this._terrain.weightMapSize,35),this._weightMap.setFilters(2,2),this._weightMap.setWrapMode(2,2));for(var t=new Uint8Array(this._terrain.weightMapSize*this._terrain.weightMapSize*4),e=0,i=0;i0){var e=this.getTerrain().getBlock(this._index[0]-1,this._index[1]);t.west=e._lodLevel,t.west0){var n=this.getTerrain().getBlock(this._index[0],this._index[1]-1);t.north=n._lodLevel,t.north>t,o=s-1>>t,h=0;hthis.vertexCount[0]-1||s<0||s>this.vertexCount[1]-1)return null;r=Yi(r,0,this.vertexCount[0]-1),s=Yi(s,0,this.vertexCount[1]-1),a=Yi(a,0,this.vertexCount[0]-1),o=Yi(o,0,this.vertexCount[1]-1);var l=this.getHeight(r,s),c=this.getHeight(a,s),f=this.getHeight(r,o),d=this.getHeight(a,o),_=.5*(c+f);return h+u<=1?d=_+(_-l):l=_+(_-d),(l*(1-h)+c*h)*(1-u)+(f*(1-h)+d*h)*u},i._setNormal=function(t,e,i){var n=e*this.vertexCount[0]+t;this._normals[3*n+0]=i.x,this._normals[3*n+1]=i.y,this._normals[3*n+2]=i.z},i.getNormal=function(t,e){var i=e*this.vertexCount[0]+t,n=new Kn;return n.x=this._normals[3*i+0],n.y=this._normals[3*i+1],n.z=this._normals[3*i+2],n},i.getNormalAt=function(t,e){var i=t/this.tileSize,n=e/this.tileSize,r=Math.floor(i),s=Math.floor(n),a=r+1,o=s+1,h=i-r,u=n-s;if(r<0||r>this.vertexCount[0]-1||s<0||s>this.vertexCount[1]-1)return null;r=Yi(r,0,this.vertexCount[0]-1),s=Yi(s,0,this.vertexCount[1]-1),a=Yi(a,0,this.vertexCount[0]-1),o=Yi(o,0,this.vertexCount[1]-1);var l=this.getNormal(r,s),c=this.getNormal(a,s),f=this.getNormal(r,o),d=this.getNormal(a,o),_=new Kn;Kn.add(_,c,f).multiplyScalar(.5),h+u<=1?(d.set(_),d.subtract(l),d.add(_)):(l.set(_),l.subtract(d),l.add(_));var p=new Kn,m=new Kn,g=new Kn;return Kn.lerp(p,l,c,h),Kn.lerp(m,f,d,h),Kn.lerp(g,p,m,u),g},i.setWeight=function(t,e,i){var n=e*this._weightMapSize*this._blockCount[0]+t;this._weights[4*n+0]=255*i.x,this._weights[4*n+1]=255*i.y,this._weights[4*n+2]=255*i.z,this._weights[4*n+3]=255*i.w},i.getWeight=function(t,e){var i=e*this._weightMapSize*this._blockCount[0]+t,n=new kn;return n.x=this._weights[4*i+0]/255,n.y=this._weights[4*i+1]/255,n.z=this._weights[4*i+2]/255,n.w=this._weights[4*i+3]/255,n},i.getWeightAt=function(t,e){var i=this.weightMapSize*this.blockCount[0],n=this.weightMapSize*this.blockCount[1];if(0===i||0===n)return null;var r=t/i,s=e/n,a=Math.floor(r),o=Math.floor(s),h=a+1,u=o+1,l=r-a,c=s-o;if(a<0||a>i-1||o<0||o>n-1)return null;a=Yi(a,0,i-1),o=Yi(o,0,n-1),h=Yi(h,0,i-1),u=Yi(u,0,n-1);var f=this.getWeight(a,o),d=this.getWeight(h,o),_=this.getWeight(a,u),p=this.getWeight(h,u),m=new kn;kn.add(m,d,_).multiplyScalar(.5),l+c<=1?(p=new kn,kn.subtract(p,m,f).add(m)):(f=new kn,kn.subtract(f,m,p).add(m));var g=new kn,v=new kn,y=new kn;return kn.lerp(g,f,d,l),kn.lerp(v,_,p,l),kn.lerp(y,g,v,c),y},i.getMaxWeightLayerAt=function(t,e){var i=this.weightMapSize*this.blockCount[0],n=this.weightMapSize*this.blockCount[1];if(0===i||0===n)return null;var r=t/i,s=e/n,a=Math.floor(r),o=Math.floor(s);if(a<0||a>i-1||o<0||o>n-1)return null;var h=this.getWeight(a,o),u=Math.floor(t/this.weightMapSize),l=Math.floor(e/this.weightMapSize),c=this.getBlock(u,l),f=0;return h.y>h[f]&&-1!==c.getLayer(1)&&(f=1),h.y>h[f]&&-1!==c.getLayer(2)&&(f=2),h.z>h[f]&&-1!==c.getLayer(3)&&(f=3),f=c.getLayer(f),this.getLayer(f)},i.getBlockLayers=function(t,e){var i=(e*this._blockCount[0]+t)*sOt;return[this._layerBuffer[i],this._layerBuffer[i+1],this._layerBuffer[i+2],this._layerBuffer[i+3]]},i.getBlockLayer=function(t,e,i){var n=(e*this._blockCount[0]+t)*sOt;return this._layerBuffer[n+i]},i.setBlockLayer=function(t,e,i,n){var r=(e*this._blockCount[0]+t)*sOt;this._layerBuffer[r+i]=n},i.getBlock=function(t,e){return this._blocks[e*this._blockCount[0]+t]},i.getBlocks=function(){return this._blocks},i.rayCheck=function(t,e,i,n){void 0===n&&(n=!0);var r=t;n&&Kn.subtract(r,t,this.node.getWorldPosition());var s=new Kn;s.set(e),s.multiplyScalar(i);var a=null;if(e.equals(new Kn(0,1,0))){var o=this.getHeightAt(r.x,r.z);null!=o&&r.y<=o&&(a=new Kn(r.x,o,r.z))}else if(e.equals(new Kn(0,-1,0))){var h=this.getHeightAt(r.x,r.z);null!=h&&r.y>=h&&(a=new Kn(r.x,h,r.z))}else{for(var u=0;u++<2e3;){var l=this.getHeightAt(r.x,r.z);if(null!=l&&r.y<=l)break;r.add(e)}for(;u++<2e3;){var c=this.getHeightAt(r.x,r.z);if(null!=c&&r.y<=c){a=new Kn(r.x,c,r.z);break}r.add(s)}}return a},i._createSharedIndexBuffer=function(){var t=vp.gfxDevice;if(null!==this._lod){var e=t.createBuffer(new zd(6,1,2*this._lod._indexBuffer.length,2));return e.update(this._lod._indexBuffer),e}for(var i=new Uint16Array(oOt*oOt*6),n=0,r=0;r0}},{key:"info",get:function(){var t=new AHt;return t.tileSize=this.tileSize,t.blockCount[0]=this.blockCount[0],t.blockCount[1]=this.blockCount[1],t.weightMapSize=this.weightMapSize,t.lightMapSize=this.lightMapSize,t}}]),e}(Ym),fHt=yh(cHt.prototype,"__asset",[nHt,Uh],(function(){return null})),dHt=yh(cHt.prototype,"_effectAsset",[rHt,Uh],(function(){return null})),_Ht=yh(cHt.prototype,"_lightmapInfos",[sHt,Uh],(function(){return[]})),pHt=yh(cHt.prototype,"_receiveShadow",[Uh],(function(){return!1})),mHt=yh(cHt.prototype,"_useNormalmap",[Uh],(function(){return!1})),gHt=yh(cHt.prototype,"_usePBR",[Uh],(function(){return!1})),vHt=yh(cHt.prototype,"_lodEnable",[Uh],(function(){return!1})),yHt=yh(cHt.prototype,"_lodBias",[aHt,Uh],(function(){return 0})),y(cHt.prototype,"_asset",[oHt],Object.getOwnPropertyDescriptor(cHt.prototype,"_asset"),cHt.prototype),y(cHt.prototype,"effectAsset",[hHt],Object.getOwnPropertyDescriptor(cHt.prototype,"effectAsset"),cHt.prototype),y(cHt.prototype,"info",[uHt],Object.getOwnPropertyDescriptor(cHt.prototype,"info"),cHt.prototype),lHt=cHt))||lHt)||lHt)),{ORTHO:0,HEX:1,ISO:2});ke(PHt);var EHt={NONE:0,MAP:1,LAYER:2,OBJECTGROUP:3,OBJECT:4,TILE:5};ke(EHt);var kHt={HORIZONTAL:2147483648,VERTICAL:1073741824,DIAGONAL:536870912,FLIPPED_ALL:4026531840,FLIPPED_MASK:268435455};ke(kHt);var OHt={STAGGERAXIS_X:0,STAGGERAXIS_Y:1};ke(OHt);var RHt={STAGGERINDEX_ODD:0,STAGGERINDEX_EVEN:1};ke(RHt);var FHt={RightDown:0,RightUp:1,LeftDown:2,LeftUp:3};ke(FHt);var LHt={RECT:0,ELLIPSE:1,POLYGON:2,POLYLINE:3,IMAGE:4,TEXT:5};ke(LHt);var VHt=function(){function t(){this.name="",this.firstGid=0,this.spacing=0,this.margin=0,this.sourceImage=void 0,this.imageName=null,this.imageOffset=null,this.imageSize=new os(0,0),this.tileOffset=new ns(0,0),this._tileSize=new os(0,0),this.collection=!1}return t.prototype.rectForGID=function(t,e){var i=e||new cs(0,0,0,0);i.width=this._tileSize.width,i.height=this._tileSize.height;var n=t;if(n&=268435455,n-=this.firstGid,this.imageOffset)i.x=this.imageOffset.x,i.y=this.imageOffset.y;else{var r=Math.floor((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing));i.x=Math.round(n%r*(this._tileSize.width+this.spacing)+this.margin),i.y=Math.round(Math.floor(n/r)*(this._tileSize.height+this.spacing)+this.margin)}return i},t}(),NHt=function(){function t(){this.properties={},this.name="",this.objects=[],this.visible=!0,this.opacity=0,this.color=new nr(255,255,255,255),this.offset=new ns(0,0),this.draworder="topdown",this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}(),zHt=function(){function t(){this.properties={},this.name="",this.layerSize=null,this.tiles=[],this.visible=!0,this.opacity=0,this.ownTiles=!0,this.minGID=1e5,this.maxGID=0,this.offset=new ns(0,0),this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}();zHt.ATTRIB_NONE=1,zHt.ATTRIB_BASE64=2,zHt.ATTRIB_GZIP=4,zHt.ATTRIB_ZLIB=8;var GHt=function(){this.name="",this.visible=!0,this.width=0,this.height=0,this.offset=new ns(0,0),this.opacity=0,this.trans=new nr(255,255,255,255),this.sourceImage=void 0,this.tintColor=null};function UHt(t){if(t.length%4!=0)return null;for(var e=t.length/4,i=window.Uint32Array?new Uint32Array(e):[],n=0;n1,x=b[0],w=x.getAttribute("source");w=w.replace(/\\/g,"/");var T=m.getElementsByTagName("tile"),C=T&&T.length||1,A=null,D=m.getAttribute("name")||"",I=parseInt(m.getAttribute("spacing"))||0,B=parseInt(m.getAttribute("margin"))||0,M=i||parseInt(m.getAttribute("firstgid"))||0,P=new os(0,0);P.width=parseFloat(m.getAttribute("tilewidth")),P.height=parseFloat(m.getAttribute("tileheight"));var E=m.getElementsByTagName("tileoffset")[0],k=0,O=0;E&&(k=parseFloat(E.getAttribute("x"))||0,O=parseFloat(E.getAttribute("y"))||0);for(var R=null,F=0;F0){var H=G[0],W=H.getAttribute("source");if(W=W.replace(/\\/g,"/"),R.imageName=W,R.imageSize.width=parseFloat(H.getAttribute("width"))||0,R.imageSize.height=parseFloat(H.getAttribute("height"))||0,U||(R._tileSize.width=R.imageSize.width,R._tileSize.height=R.imageSize.height),R.sourceImage=this._spriteFrameMap[W],!R.sourceImage){var j=t.getNameWithPostfix(W);if(R.imageName=j,R.sourceImage=this._spriteFrameMap[j],!R.sourceImage){var q=t.getShortName(W);R.imageName=q,R.sourceImage=this._spriteFrameMap[q],R.sourceImage||(ot(7221,W),X("Please try asset type of "+W+" to 'sprite-frame'"))}}R.firstGid=268435455&this.parentGID}var Q=(268435455&this.parentGID)>>>0;this._tileProperties.set(Q,qHt(A));var K=A.getElementsByTagName("animation");if(K&&K.length>0){var J=K[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(Q,Z);for(var $=Z.frames,tt=0;tt0){var d=f[0];l.type=5,l.wrap="1"===d.getAttribute("wrap"),l.color=jHt(d.getAttribute("color")),l.halign=HHt(d.getAttribute("halign")),l.valign=WHt(d.getAttribute("valign")),l.pixelsize=parseInt(d.getAttribute("pixelsize"))||16,l.text=d.childNodes[0].nodeValue}var _=u.getAttribute("gid");_&&(l.gid=parseInt(_),l.type=4);var p=u.getElementsByTagName("ellipse");p&&p.length>0&&(l.type=1);var m=u.getElementsByTagName("polygon");if(m&&m.length>0){l.type=2;var g=m[0].getAttribute("points");g&&(l.points=this._parsePointsString(g))}var v=u.getElementsByTagName("polyline");if(v&&v.length>0){l.type=3;var y=v[0].getAttribute("points");y&&(l.polylinePoints=this._parsePointsString(y))}l.type||(l.type=0),e.objects.push(l)}"index"!==a&&e.objects.sort((function(t,e){return t.y-e.y}))}return e},e._parsePointsString=function(t){if(!t)return null;for(var e=[],i=t.split(" "),n=0;n1||t.imageOffset)if(i){y._name=i.name;var w=i.unbiasUV[0],T=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];y.l=w+y.x/c,y.t=T+y.y/f,y.r=w+(y.x+y.width)/c,y.b=T+(y.y+y.height)/f,y._rect=new cs(y.x,y.y,y.width,y.height)}else y.l=y.x/c,y.t=y.y/f,y.r=(y.x+y.width)/c,y.b=(y.y+y.height)/f,y._rect=new cs(y.x,y.y,y.width,y.height);else i.rotated?(y._rotated=!0,y._name=i.name,y._rect=i.getRect(),y.l=i.unbiasUV[0],y.t=i.unbiasUV[1],y.r=i.unbiasUV[4],y.b=i.unbiasUV[3]):(y._name=i.name,y._rect=i.getRect(),y.l=i.unbiasUV[0],y.t=i.unbiasUV[5],y.r=i.unbiasUV[2],y.b=i.unbiasUV[1]);y.cx=(y.l+y.r)/2,y.cy=(y.t+y.b)/2,e.set(x,y)}}for(var uWt,lWt,cWt,fWt,dWt,_Wt,pWt,mWt,gWt,vWt,yWt,bWt,SWt,xWt,wWt,TWt,CWt,AWt,DWt,IWt,BWt,MWt,PWt,EWt,kWt,OWt,RWt,FWt,LWt,VWt,NWt,zWt,GWt=new zr,UWt=new ns,HWt=new Kn,WWt=new Kn,jWt={row:0,col:0},qWt=t("gG",Bh("cc.TiledUserNodeData")(rWt=function(t){function e(){var e;return(e=t.call(this)||this)._index=-1,e._row=-1,e._col=-1,e._tiledLayer=null,e}return s(e,t),e}(Ym))||rWt),XWt=t("gH",Bh("cc.TiledLayer")(sWt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._userNodeGrid={},e._userNodeMap={},e._userNodeDirty=!1,e.tiledTiles=[],e._viewPort={x:-1,y:-1,width:-1,height:-1},e._cullingRect={leftDown:{row:-1,col:-1},rightTop:{row:-1,col:-1}},e._cullingDirty=!0,e._rightTop={row:-1,col:-1},e._layerInfo=null,e._mapInfo=null,e._topOffset=0,e._downOffset=0,e._leftOffset=0,e._rightOffset=0,e.tiles=[],e.vertices=[],e._verticesDirty=!0,e._layerName="",e._layerSize=void 0,e._minGID=void 0,e._maxGID=void 0,e._layerOrientation=null,e._opacity=void 0,e._tintColor=void 0,e.texGrids=null,e._textures=[],e._tilesets=[],e._leftDownToCenterX=0,e._leftDownToCenterY=0,e._hasTiledNodeGrid=!1,e._hasAniGrid=!1,e._animations=null,e._enableCulling=void 0,e.colorChanged=!1,e._properties=void 0,e.renderOrder=void 0,e._staggerAxis=void 0,e._staggerIndex=void 0,e._hexSideLength=void 0,e._mapTileSize=void 0,e._odd_even=void 0,e._diffX1=void 0,e._diffY1=void 0,e._useAutomaticVertexZ=void 0,e._vertexZvalue=void 0,e._offset=void 0,e._tiledDataArray=[],e._cameraNode=void 0,e._drawInfoList=[],e._tiledDataArrayIdx=0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new oF,this._drawInfoList[t].setDrawInfoType(2)),this._drawInfoList[t]},e.hasTiledNode=function(){return this._hasTiledNodeGrid},e.hasAnimation=function(){return this._hasAniGrid},e.addUserNode=function(t){var e=t.getComponent(qWt);return e?(X("CCTiledLayer:addUserNode node has been added"),!1):(e=t.addComponent(qWt),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),UWt),this._positionToRowCol(UWt.x,UWt.y,jWt),this._addUserNodeToGrid(e,jWt),this._updateCullingOffsetByUserNode(t),t.on("transform-changed",this._userNodePosChange,e),t.on("size-changed",this._userNodeSizeChange,e),!0)},e.removeUserNode=function(t){var e=t.getComponent(qWt);return e?(t.off("transform-changed",this._userNodePosChange,e),t.off("size-changed",this._userNodeSizeChange,e),this._removeUserNodeFromGrid(e),delete this._userNodeMap[t.uuid],t._removeComponent(e),e.destroy(),t.removeFromParent(),!0):(X("CCTiledLayer:removeUserNode node is not exist"),!1)},e.destroyUserNode=function(t){this.removeUserNode(t),t.destroy()},e._nodeLocalPosToLayerPos=function(t,e){e.x=t.x+this._leftDownToCenterX,e.y=t.y+this._leftDownToCenterY},e.getNodesByRowCol=function(t,e){var i=this._userNodeGrid[t];return i?i[e]:null},e.getNodesCountByRow=function(t){var e=this._userNodeGrid[t];return e?e.count:0},e._updateAllUserNode=function(){for(var t in this._userNodeGrid={},this._userNodeMap){var e=this._userNodeMap[t];this._nodeLocalPosToLayerPos(e.node.getPosition(),UWt),this._positionToRowCol(UWt.x,UWt.y,jWt),this._addUserNodeToGrid(e,jWt),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._uiProps.uiTransformComp.contentSize;this._topOffsetthis._rightTop.row&&(t.row=this._rightTop.row),i<0&&(t.col=0),i>this._rightTop.col&&(t.col=this._rightTop.col)},e._addUserNodeToGrid=function(t,e){var i=e.row,n=e.col,r=this._userNodeGrid[i]=this._userNodeGrid[i]||{count:0},s=r[n]=r[n]||{count:0,list:[]};t._row=i,t._col=n,t._index=s.list.length,r.count++,s.count++,s.list.push(t),this._userNodeDirty=!0,this.markForUpdateRenderData()},e.isUserNodeDirty=function(){return this._userNodeDirty},e.setUserNodeDirty=function(t){this._userNodeDirty=t},e._reinstallCamera=function(){var t=wE.root.batcher2D.getFirstRenderCamera(this.node),e=null==t?void 0:t.node;return this._cameraNode!==e&&(this._uninstallCamera(),e&&(e.on("transform-changed",this.updateCulling,this),e.on("size-changed",this.updateCulling,this),this._cameraNode=e)),t},e._uninstallCamera=function(){this._cameraNode&&(this._cameraNode.off("transform-changed",this.updateCulling,this),this._cameraNode.off("size-changed",this.updateCulling,this),delete this._cameraNode)},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on("anchor-changed",this._syncAnchorPoint,this),this.node.on("transform-changed",this.updateCulling,this),this.node.on("size-changed",this.updateCulling,this),this.node.parent.on("transform-changed",this.updateCulling,this),this.node.parent.on("size-changed",this.updateCulling,this),this.markForUpdateRenderData(),this.scheduleOnce(this.updateCulling.bind(this))},e.onDisable=function(){var e,i;t.prototype.onDisable.call(this),null===(e=this.node.parent)||void 0===e||e.off("size-changed",this.updateCulling,this),null===(i=this.node.parent)||void 0===i||i.off("transform-changed",this.updateCulling,this),this.node.off("size-changed",this.updateCulling,this),this.node.off("transform-changed",this.updateCulling,this),this.node.off("anchor-changed",this._syncAnchorPoint,this),this._uninstallCamera()},e._syncAnchorPoint=function(){var t=this.node,e=t._uiProps.uiTransformComp,i=t.getScale();this._leftDownToCenterX=e.width*e.anchorX*i.x,this._leftDownToCenterY=e.height*e.anchorY*i.y,this._cullingDirty=!0,this.markForUpdateRenderData()},e.getLayerName=function(){return this._layerName},e.setLayerName=function(t){this._layerName=t},e.getProperty=function(t){return this._properties[t]},e.getPositionAt=function(t,e){var i;switch(void 0!==e?(i=Math.floor(t),e=Math.floor(e)):(i=Math.floor(t.x),e=Math.floor(t.y)),this._layerOrientation){case 0:return this._positionForOrthoAt(i,e);case 2:return this._positionForIsoAt(i,e);case 1:return this._positionForHexAt(i,e)}return null},e.isInvalidPosition=function(t,e){return t>=this._layerSize.width||e>=this._layerSize.height||t<0||e<0},e._positionForIsoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(268435455&s)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new ns(.5*this._mapTileSize.width*(this._layerSize.height+t-e-1)+i,.5*this._mapTileSize.height*(this._layerSize.width-t+this._layerSize.height-e-2)-n)},e._positionForOrthoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(268435455&s)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new ns(t*this._mapTileSize.width+i,(this._layerSize.height-e-1)*this._mapTileSize.height-n)},e._positionForHexAt=function(t,e){var i,n=this._mapTileSize.width,r=this._mapTileSize.height,s=this._layerSize.height,a=Math.floor(t)+Math.floor(e)*this._layerSize.width,o=(268435455&this.tiles[a])>>>0;i=this.texGrids.get(o)?this.texGrids.get(o).tileset.tileOffset:{x:0,y:0};var h=0===this._staggerIndex?1:-1,u=0,l=0,c=0,f=0;switch(this._staggerAxis){case 1:c=0,e%2==1&&(c=n/2*h),u=t*n+c+i.x,l=(s-e-1)*(r-(r-this._hexSideLength)/2)-i.y;break;case 0:f=0,t%2==1&&(f=r/2*-h),u=t*(n-(n-this._hexSideLength)/2)+i.x,l=(s-e-1)*r+f-i.y}return new ns(u,l)},e.setTilesGIDAt=function(t,e,i,n){if(t&&0!==t.length&&!(n<=0)){i<0&&(i=0),e<0&&(e=0);for(var r=0,s=e+n,a=i;;a++)for(var o=e;o=t.length)return;this._updateTileForGID(t[r],o,a),r++}}},e.setTileGIDAt=function(t,e,i,n){var r=(268435455&t)>>>0;if(e=Math.floor(e),i=Math.floor(i),this.isInvalidPosition(e,i))throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");this.tiles&&this._tilesets&&0!==this._tilesets.length?0!==r&&r>>0,e,i)):et(7238)},e._updateTileForGID=function(t,e,i){var n=0|e+i*this._layerSize.width;if(!(n>=this.tiles.length)&&t!==this.tiles[n]){var r=(268435455&t)>>>0;this.texGrids.get(r)?(this.tiles[n]=t,this._updateVertex(e,i)):this.tiles[n]=0,this._cullingDirty=!0}},e.getTileGIDAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");if(!this.tiles)return et(7237),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(268435455&this.tiles[i])>>>0},e.getTileFlagsAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this.tiles)return et(7240),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(4026531840&this.tiles[i])>>>0},e.setCullingDirty=function(t){this._cullingDirty=t},e.isCullingDirty=function(){return this._cullingDirty},e.updateViewPort=function(t,e,i,n){if(this._viewPort.width!==i||this._viewPort.height!==n||this._viewPort.x!==t||this._viewPort.y!==e){this._viewPort.x=t,this._viewPort.y=e,this._viewPort.width=i,this._viewPort.height=n;var r=1;2===this._layerOrientation&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,a=this._viewPort.y-this._offset.y+this._leftDownToCenterY,o=s-this._leftOffset,h=a-this._downOffset,u=s+i+this._rightOffset,l=a+n+this._topOffset,c=this._cullingRect.leftDown,f=this._cullingRect.rightTop;o<0&&(o=0),h<0&&(h=0),this._positionToRowCol(o,h,jWt),jWt.row-=r,jWt.col-=r,jWt.row=jWt.row>0?jWt.row:0,jWt.col=jWt.col>0?jWt.col:0,jWt.row===c.row&&jWt.col===c.col||(c.row=jWt.row,c.col=jWt.col,this._cullingDirty=!0),u<0||l<0?(jWt.row=-1,jWt.col=-1):(this._positionToRowCol(u,l,jWt),jWt.row++,jWt.col++),jWt.row===f.row&&jWt.col===f.col||(f.row=jWt.row,f.col=jWt.col,this._cullingDirty=!0),this._cullingDirty&&this.markForUpdateRenderData()}},e._positionToRowCol=function(t,e,i){var n=this._mapTileSize.width,r=this._mapTileSize.height,s=.5*n,a=.5*r,o=0,h=0,u=0,l=0,c=this._staggerAxis;switch(this._layerOrientation){case 0:h=Math.floor(t/n),o=Math.floor(e/r);break;case 2:h=Math.floor(t/s),o=Math.floor(e/a);break;case 1:1===c?(u=(o=Math.floor(e/(r-this._diffY1)))%2==1?s*this._odd_even:0,h=Math.floor((t-u)/n)):(l=(h=Math.floor(t/(n-this._diffX1)))%2==1?a*-this._odd_even:0,o=Math.floor((e-l)/r))}return i.row=o,i.col=h,i},e.updateCulling=function(){if(this._enableCulling){this.node.updateWorldTransform(),zr.invert(GWt,this.node.getWorldMatrix());var t=this._reinstallCamera();t&&(HWt.x=0,HWt.y=0,HWt.z=0,WWt.x=t.width,WWt.y=t.height,WWt.z=0,t.screenToWorld(HWt,HWt),t.screenToWorld(WWt,WWt),Kn.transformMat4(HWt,HWt,GWt),Kn.transformMat4(WWt,WWt,GWt),this.updateViewPort(HWt.x,HWt.y,WWt.x-HWt.x,WWt.y-HWt.y))}},e.getLayerOrientation=function(){return this._layerOrientation},e.getProperties=function(){return this._properties},e._updateVertex=function(t,e){var i=this.vertices,n=this._layerOrientation,r=this.tiles;if(r){var s,a,o,h,u=this._rightTop,l=this._mapTileSize.width,c=this._mapTileSize.height,f=.5*l,d=.5*c,_=this._layerSize.height,p=this._layerSize.width,m=this.texGrids,g=0,v=0;1===n&&(s=this._staggerAxis,a=this._diffX1,o=this._diffY1,h=this._odd_even);var y,b,S,x=0,w=0,T=0,C=0,A=e*p+t;y=(268435455&r[A])>>>0;var D=m.get(y);if(D){switch(this._animations.get(y)&&(this._hasAniGrid=this._hasAniGrid||!0),n){case 0:g=(x=t)*l,v=(w=_-e-1)*c;break;case 2:g=f*(x=_+t-e-1),v=d*(w=_+p-t-e-2);break;case 1:g=t*(l-a)+(1===s&&e%2==1?f*h:0),v=(_-e-1)*(c-o)+(0===s&&t%2==1?d*-h:0),x=t,w=_-e-1}var I=i[w]=i[w]||{minCol:0,maxCol:0},B=I[x]=I[x]||{left:0,bottom:0,index:0};I.minCol>x&&(I.minCol=x),I.maxCol=0&&this._textures.length>t?this._textures[t]:null},e.getTextures=function(){return this._textures},e.setTexture=function(t){this.setTextures([t])},e.setTextures=function(t){this._textures=t,this.markForUpdateRenderData()},e.getLayerSize=function(){return this._layerSize},e.getMapTileSize=function(){return this._mapTileSize},e.getTileSet=function(t){return t=t||0,this._tilesets&&t>=0&&this._tilesets.length>t?this._tilesets[t]:null},e.getTileSets=function(){return this._tilesets},e.setTileSet=function(t){this.setTileSets([t])},e.setTileSets=function(t){this._tilesets=t;var e=this._textures=[],i=this.texGrids;i.clear();for(var n=0;n0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length;)t.pop();if(t.length>0){var e=t[t.length-1];if(e.renderData&&0===e.renderData.vertexCount)return e}var i={renderData:null,texture:null};return this._tiledDataArray.push(i),i},e.requestSubNodesData=function(){var t=this._tiledDataArray;if(t.length>0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length)return t[t.length-1];var e={subNodes:[]};return this._tiledDataArray.push(e),e},e.destroyRenderData=function(){this._tiledDataArray.forEach((function(t){var e=t.renderData;e&&lF.remove(e)})),this._tiledDataArray.length=0,t.prototype.destroyRenderData.call(this)},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t,this._assembler.createData(this)),0===this._tiledDataArray.length&&(this.markForUpdateRenderData(),this._updateColor())},e._render=function(t){for(var e=0;e>>0,B=i.get(I);if(!B)continue;var M=B.tileset,P="img"+g.id;_[P]=!0;var E=this.node.getChildByName(P);g.width=g.width||B.width,g.height=g.height||B.height,E&&E._objFlags&eo.Flags.HideInHierarchy&&(E.removeFromParent(),E.hideFlags|=eo.Flags.DontSave,E.destroy(),E=null),E||(E=new ry),this._animations.get(I)&&(this.aniObjects.push({object:g,imgNode:E,gridGID:I}),this._hasAniObj=!0);var k=M.tileOffset.x,O=M.tileOffset.y;E.active=g.visible,E.setRotationFromEuler(0,0,-g.rotation),E.setPosition(g.x-c,g.y-f),E.name=P,E.parent=this.node,E.setSiblingIndex(p),E.layer=this.node.layer;var R=E.getComponent(_N);R||(R=E.addComponent(_N));var F=E._uiProps.uiTransformComp;h?(F.anchorX=.5+k/g.width,F.anchorY=O/g.height):(F.anchorX=k/g.width,F.anchorY=O/g.height),this._tintColor?(o.set(this._tintColor),o.a*=this._opacity/255,R.color.set(o)):R.color.a*=this._opacity/255,R.sizeMode=_N.SizeMode.CUSTOM;var L=this._premultiplyAlpha?1:2;R.srcBlendFactor!==L&&(R.srcBlendFactor=L,R.material&&R._updateBlendFunc());var V=B.spriteFrame;V=V?V.clone():new yO,(2147483648&D)>>>0&&(V.flipUVX=!V.flipUVX),(1073741824&D)>>>0&&(V.flipUVY=!V.flipUVY),V.rotated=B._rotated,V.rect=B._rect,R.spriteFrame=V,F.setContentSize(g.width,g.height),R.markForUpdateRenderData()}}this._objects=d;for(var N=this.node.children,z=/^(?:img|text)\d+$/,G=0,U=N.length;G0&&(m[_[g]]=p[g].text);var v=new aWt(i.tmxXmlStr,m,a,o,c),y=v.getTilesets();y&&0!==y.length||et(7241),this._buildWithMapInfo(v)}else this._releaseMapInfo()},i._releaseMapInfo=function(){for(var t=this._layers,e=0,i=t.length;e0)for(var x=0,w=v.length;x=o.length&&(a.frameIdx=0),h=o[a.frameIdx]),n.set(s,h.grid)}for(var u=this.getLayers(),l=0,c=u.length;l>>0&&(i=ajt,ajt=ojt,ojt=i),(2147483648&e)>>>0&&(i=sjt,sjt=ojt,ojt=i,i=ajt,ajt=hjt,hjt=i),(1073741824&e)>>>0&&(i=sjt,sjt=ajt,ajt=i,i=ojt,ojt=hjt,hjt=i)}function gjt(){if(!(fjt<1)&&djt){var t=4*fjt,e=6*fjt,i=tjt.requestTiledRenderData();i.renderData=lF.add(NR),i.texture=djt;var n=i.renderData;n.resize(t,e),n.chunk.vb.set($Wt.subarray(0,9*t),0),fjt=0,djt=null}}function vjt(t,e,i,n,r){if(!(e.row<0||e.col<0)){tjt=r;var s=r.node.worldMatrix;ujt=0;var a,o,h,u,l,c,f,d,_,p=r.tiledTiles,m=r.texGrids,g=r.tiles,v=18,y=27,b=r.vertices,S=0,x=0,w=0,T=0,C=0,A=0,D=!0;ejt=mjt;var I=new Float32Array(4);I[0]=r.color.r/255,I[1]=r.color.g/255,I[2]=r.color.b/255,I[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var B=Math.abs(t.row-e.row)+1,M=Math.abs(e.col-t.col)+1;$Wt=new Float32Array(B*M*36),fjt=0;for(var P=$Wt;(l-u)*i>=0;u+=i)for(a=b[u],A=r.getNodesCountByRow(u),D=a&&0===A,1===n?(o=D&&t.cola.maxCol?a.maxCol:e.col):(o=D&&e.col>a.maxCol?a.maxCol:e.col,h=D&&t.col=0;o+=n){if(c=a&&a[o],A>0){gjt();var E=r.requestSubNodesData(),k=r.getNodesByRowCol(u,o);k&&k.count>0&&(E.subNodes=k.list)}c&&(S=g[c.index],(d=m.get((268435455&S)>>>0))&&(djt!==d.texture&&(gjt(),djt=d.texture),f=d.tileset._tileSize,x=c.left-ljt,w=c.bottom-cjt,T=x+f.width,C=w+f.height,_=p[c.index],ujt=36*fjt,_?_.node.active&&yjt(_.node,I,P,x,T,C,w):(JWt[0].x=x,JWt[0].y=C,JWt[1].x=x,JWt[1].y=w,JWt[2].x=T,JWt[2].y=C,JWt[3].x=T,JWt[3].y=w,JWt[0].transformMat4(s),P[ujt]=JWt[0].x,P[ujt+1]=JWt[0].y,P[ujt+2]=JWt[0].z,JWt[1].transformMat4(s),P[ujt+9]=JWt[1].x,P[ujt+9+1]=JWt[1].y,P[ujt+9+2]=JWt[1].z,JWt[2].transformMat4(s),P[ujt+v]=JWt[2].x,P[ujt+v+1]=JWt[2].y,P[ujt+v+2]=JWt[2].z,JWt[3].transformMat4(s),P[ujt+y]=JWt[3].x,P[ujt+y+1]=JWt[3].y,P[ujt+y+2]=JWt[3].z,P.set(I,ujt+5),P.set(I,ujt+9+5),P.set(I,ujt+v+5),P.set(I,ujt+y+5)),ejt(d,S),P[ujt+3]=sjt.x,P[ujt+4]=sjt.y,P[ujt+9+3]=ajt.x,P[ujt+9+4]=ajt.y,P[ujt+v+3]=ojt.x,P[ujt+v+4]=ojt.y,P[ujt+y+3]=hjt.x,P[ujt+y+4]=hjt.y,++fjt>=KWt&&gjt()))}gjt()}}function yjt(t,e,i,n,r,s,a){t.updateWorldTransform(),zr.fromRTS(ijt,t.rotation,t.position,t.scale),Kn.set(njt,-(n+ljt),-(a+cjt),0),zr.transform(ijt,ijt,njt),zr.multiply(ijt,t.parent.worldMatrix,ijt);var o=ijt,h=o.m12,u=o.m13,l=o.m00,c=o.m01,f=o.m04,d=o.m05;1===l&&0===c&&0===f&&1===d?(i[ujt]=n+h,i[ujt+1]=s+u,i[ujt+9]=n+h,i[ujt+9+1]=a+u,i[ujt+18]=r+h,i[ujt+18+1]=s+u,i[ujt+27]=r+h,i[ujt+27+1]=a+u):(i[ujt]=n*l+s*f+h,i[ujt+1]=n*c+s*d+u,i[ujt+9]=n*l+a*f+h,i[ujt+9+1]=n*c+a*d+u,i[ujt+18]=r*l+s*f+h,i[ujt+18+1]=r*c+s*d+u,i[ujt+27]=r*l+a*f+h,i[ujt+27+1]=r*c+a*d+u),i.set(e,ujt+5),i.set(e,ujt+9+5),i.set(e,ujt+18+5),i.set(e,ujt+27+5)}var bjt=t("gK",{getAssembler:function(){return pjt}});XWt.Assembler=bjt;var Sjt=new Kn,xjt=new Kn;function wjt(t,e){var i=null;return{value:e.length>0?e[e.length-1]:Kn.ZERO,progress:function(t,e,n,r){return i.getPoint(r)},clone:function(t){return Kn.clone(t)},add:function(t,e){return t.clone().add(e)},sub:function(t,e){return t.clone().subtract(e)},onStart:function(n){var r=n.start,s=n.end,a=n.relative,o=n.reversed;(i=tf.create(t)).addKnot(r);var h=null;a&&o&&(h=xjt,Kn.subtract(h,r,e[e.length-1]));for(var u=0,l=e.length;u0&&i.addKnot(Kn.copy(Sjt,h).add(c)):i.addKnot(Kn.copy(Sjt,r).add(c)):i.addKnot(c)}a&&o&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}var Tjt=Object.freeze({__proto__:null,bezier:function(){for(var t=arguments.length,e=new Array(t),i=0;i=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;-1===t&&et(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;-1===t&&et(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){-1===t&&et(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&(e.target instanceof ry&&this._unregisterNodeEvent(e.target),this._deleteHashElement(e))},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;nthis._duration?this._duration:t,this._startTime=t},i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ne.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},i._cloneDecoration=function(t){t._speed=this._speed},i.step=function(t){if(!this._paused&&0!==this._speed){t*=this._speed,this._firstTick?this._elapsed=this._startTime:this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this.isUnknownDuration()&&!this._firstTick&&(this._elapsed-=t),this._firstTick&&(this._firstTick=!1,this._startTime>0&&(this._startTime=0))}},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._elapsed=0,this._firstTick=!0},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.getDurationScaled=function(){return this._duration/this._speed},e}(Ijt),Vjt=function(t){function e(i){var n;if((n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1,!i||0===i.length)return f(n);1===i.length&&i.push(new Fjt);var r=i.length-1;if(r>=0&&null==i[r]&&et(1015),r>=0){for(var s,a=i[0],o=1;o1?i%1:i),this._last=n)}},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),t._reversed=!0,t},i.updateOwner=function(t){if(!(this._actions.length<2)){var i=this._actions[0],n=this._actions[1];n._owner||(n._owner=t),i instanceof e||i instanceof Wjt?i.updateOwner(t):i._owner||(i._owner=t)}},i.findAction=function(t){for(var i=0,n=this._actions.length;i=r){for(;t>r&&this._total1?1:r}if(t>=1&&this._total=0&&null==i[r]&&et(1015),r>=0){for(var s,a=i[0],o=1;or?this._two=Vjt._actionOneTwo(e,qjt(n-r)):n0&&this._actions[this._actions.length-1].setId(t),this})),e.then=function(t){var e=t._union(!0);return e&&(e.setSpeed(t._timeScale),this._actions.push(e)),this},e.reverse=function(e,i){if(null==e&&null==i)return this.reverseTween();var n,r;if(e instanceof t?(n=e,void 0!==i&&(r=i)):"number"==typeof e&&(n=this,r=e),n){var s=t.reverseAction(n,r);s&&this._actions.push(s)}return this},e.reverseTween=function(){if(0===this._actions.length)return st(16388),this.clone(this._target);var t=this._union(!1),e=Bqt(this._target);return e._timeScale=this._timeScale,t&&e.insertAction(t.reverse()),e},t.reverseAction=function(t,e){var i=t._actions;if(0===i.length)return null;var n=null,r=null;return"number"==typeof e?n=t.findAction(e,i):t&&(n=t._union(!1)),n?(r=n.reverse())._owner=t:st(16391,""+e),r},e.findAction=function(t,e){for(var i=null,n=0,r=e.length;n1){var s=n.splice(r);1===s.length?n.push(s[0]):n.push(Njt(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new Aqt(t,e,n);return this._actions.push(r),this},e.by=function(t,e,i){var n=i||Object.create(null);n.relative=!0;var r=new Aqt(t,e,n);return this._actions.push(r),this},e.update=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?e-1:0),n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),1===this._transition){var n=e._uiProps.uiComp;nr.lerp(Pqt,this._fromColor,this._toColor,i),n&&(n.color=Pqt)}else 3===this.transition&&(e.getScale(this._targetScale),this._targetScale.x=Ki(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ki(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(1===e&&this._interactable){var i=t.getComponent(VF);i&&(i.color=this._normalColor)}else 3===e&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on("touch-start",this._onTouchBegan,this),this.node.on("touch-move",this._onTouchMove,this),this.node.on("touch-end",this._onTouchEnded,this),this.node.on("touch-cancel",this._onTouchCancel,this),this.node.on("mouse-enter",this._onMouseMoveIn,this),this.node.on("mouse-leave",this._onMouseMoveOut,this),this.node.on("xrui-hover-entered",this._xrHoverEnter,this),this.node.on("xrui-hover-exited",this._xrHoverExit,this),this.node.on("xrui-click",this._xrClick,this),this.node.on("xrui-unclick",this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on("transform-changed",this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off("touch-start",this._onTouchBegan,this),this.node.off("touch-move",this._onTouchMove,this),this.node.off("touch-end",this._onTouchEnded,this),this.node.off("touch-cancel",this._onTouchCancel,this),this.node.off("mouse-enter",this._onMouseMoveIn,this),this.node.off("mouse-leave",this._onMouseMoveOut,this),this.node.off("xrui-hover-entered",this._xrHoverEnter,this),this.node.off("xrui-hover-exited",this._xrHoverExit,this),this.node.off("xrui-click",this._xrClick,this),this.node.off("xrui-unclick",this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off("transform-changed")},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(_N)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new Kn),Kn.copy(this._originalScale,this.target.scale),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){2===this._transition&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case 0:this._normalSprite=t;break;case 1:this._hoverSprite=t;break;case 2:this._pressedSprite=t;break;case 3:this._disabledSprite=t}},i._onTargetColorChanged=function(t){1===this._transition&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case 0:this._normalColor=t;break;case 1:this._hoverColor=t;break;case 2:this._pressedColor=t;break;case 3:this._disabledColor=t}},i._onTargetTransformChanged=function(t){4&t&&this._originalScale&&3===this._transition&&this._transitionFinished&&Kn.copy(this._originalScale,this.target.scale)},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation(),t.windowId);3===this._transition&&this.target&&this._originalScale?n?(Kn.copy(this._fromScale,this._originalScale),Kn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?2:0,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(jm.emitEvents(this.clickEvents,t),this.node.emit("click",this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(2!==this._transition||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=0;return this._interactable?this._pressed?t=2:this._hovered&&(t=1):t=3,t},i._updateColorTransition=function(t){var e,i=this._getColorByState(t),n=null===(e=this.target)||void 0===e?void 0:e.getComponent(VF);n&&(3===t?(n.color=i,this._transitionFinished=!0):(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this._getSpriteFrameByState(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(2===t?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(Kn.copy(this._fromScale,this._originalScale),Kn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(Kn.copy(this._fromScale,this.target.scale),Kn.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;1===e?this._updateColorTransition(t):2===e?this._updateSpriteTransition(t):3===e&&this._updateScaleTransition(t)},i._getSpriteFrameByState=function(t){switch(t){case 0:return this._normalSprite;case 3:return this._disabledSprite;case 1:return this.hoverSprite;case 2:return this._pressedSprite;default:return null}},i._getColorByState=function(t){switch(t){case 0:return this._normalColor;case 3:return this._disabledColor;case 1:return this._hoverColor;case 2:return this._pressedColor;default:return new nr}},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(jm.emitEvents(this.clickEvents,this),this.node.emit("click",this)),this._pressed=!1,this._updateState())},n(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(1===this._transition?this._updateColorTransition(0):2===this._transition&&this._updateSpriteTransition(0),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(_N);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(Ym),Cqt.Transition=Eqt,Cqt.EventType=kqt,y((lqt=Cqt).prototype,"target",[iqt],Object.getOwnPropertyDescriptor(lqt.prototype,"target"),lqt.prototype),y(lqt.prototype,"transition",[nqt],Object.getOwnPropertyDescriptor(lqt.prototype,"transition"),lqt.prototype),y(lqt.prototype,"normalSprite",[rqt],Object.getOwnPropertyDescriptor(lqt.prototype,"normalSprite"),lqt.prototype),y(lqt.prototype,"pressedSprite",[sqt],Object.getOwnPropertyDescriptor(lqt.prototype,"pressedSprite"),lqt.prototype),y(lqt.prototype,"hoverSprite",[aqt],Object.getOwnPropertyDescriptor(lqt.prototype,"hoverSprite"),lqt.prototype),y(lqt.prototype,"disabledSprite",[oqt],Object.getOwnPropertyDescriptor(lqt.prototype,"disabledSprite"),lqt.prototype),cqt=yh(lqt.prototype,"clickEvents",[hqt,Uh],(function(){return[]})),fqt=yh(lqt.prototype,"_interactable",[Uh],(function(){return!0})),dqt=yh(lqt.prototype,"_transition",[Uh],(function(){return 0})),_qt=yh(lqt.prototype,"_normalColor",[Uh],(function(){return nr.WHITE.clone()})),pqt=yh(lqt.prototype,"_hoverColor",[Uh],(function(){return new nr(211,211,211,255)})),mqt=yh(lqt.prototype,"_pressedColor",[Uh],(function(){return nr.WHITE.clone()})),gqt=yh(lqt.prototype,"_disabledColor",[Uh],(function(){return new nr(124,124,124,255)})),vqt=yh(lqt.prototype,"_normalSprite",[Uh],(function(){return null})),yqt=yh(lqt.prototype,"_hoverSprite",[Uh],(function(){return null})),bqt=yh(lqt.prototype,"_pressedSprite",[Uh],(function(){return null})),Sqt=yh(lqt.prototype,"_disabledSprite",[Uh],(function(){return null})),xqt=yh(lqt.prototype,"_duration",[Uh],(function(){return.1})),wqt=yh(lqt.prototype,"_zoomScale",[Uh],(function(){return 1.2})),Tqt=yh(lqt.prototype,"_target",[Uh],(function(){return null})),uqt=lqt))||uqt)||uqt)||uqt));C.Button=Oqt;var Rqt=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();Rqt._tabIndexList=[];var Fqt=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.beforeDraw=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),Lqt=D.document,Vqt=new zr,Nqt=new zr,zqt=new Kn,Gqt=null,Uqt=0,Hqt=function(t){function e(){var e;return(e=t.call(this)||this)._delegate=null,e._inputMode=-1,e._inputFlag=-1,e._returnType=-1,e.__eventListeners={},e.__autoResize=!1,e.__orientationChanged=void 0,e._edTxt=null,e._isTextArea=!1,e._textLabelFont=null,e._textLabelFontSize=null,e._textLabelFontColor=null,e._textLabelAlign=null,e._placeholderLabelFont=null,e._placeholderLabelFontSize=null,e._placeholderLabelFontColor=null,e._placeholderLabelAlign=null,e._placeholderLineHeight=null,e._placeholderStyleSheet=null,e._domId="EditBoxId_"+ ++Uqt,e._forceUpdate=!1,e}s(e,t);var i=e.prototype;return i.init=function(t){t&&(this._delegate=t,0===t.inputMode?this._createTextArea():this._createInput(),Rqt.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),rk.instance.on("canvas-resize",this._resize,this),Ho.on("window-resize",this._resize,this))},i.clear=function(){rk.instance.off("canvas-resize",this._resize,this),Ho.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),Rqt.remove(this),Gqt===this&&(Gqt=null),this._delegate=null},i._resize=function(){this._forceUpdate=!0},i.beforeDraw=function(){(this._delegate.node.hasChangedFlags||this._forceUpdate)&&(this._forceUpdate=!1,this._updateMatrix())},i.setTabIndex=function(t){this._edTxt.tabIndex=t,Rqt.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){Gqt&&Gqt!==this&&Gqt.setFocus(!1),this._editing=!0,Gqt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=Lqt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=Lqt.createElement("textarea")},i._addDomToGameContainer=function(){bk.container&&this._edTxt&&(bk.container.appendChild(this._edTxt),Lqt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Ye(bk.container,this._edTxt)&&this._edTxt&&bk.container.removeChild(this._edTxt),Ye(Lqt.head,this._placeholderStyleSheet)&&Lqt.head.removeChild(this._placeholderStyleSheet),this._edTxt=null,this._placeholderStyleSheet=null},i._showDom=function(){this._updateMaxLength(),this._updateInputType(),this._updateStyleSheet(),this._edTxt&&this._delegate&&(this._edTxt.style.display="",this._delegate._hideLabels()),qo.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),qo.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){qo.os!==go.ANDROID&&qo.os!==go.OHOS||(Ho.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){qo.os!==go.ANDROID&&qo.os!==go.OHOS||(Ho.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(D.innerHeight||Lqt.documentElement.clientHeight)&&t.right<=(D.innerWidth||Lqt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){D.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){qo.browserType!==_o.WECHAT||qo.os!==go.IOS?D.scrollTo(0,0):D.top&&D.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=pk.getScaleX(),i=pk.getScaleY(),n=pk.getViewportRect(),r=Ho.devicePixelRatio;t.getWorldMatrix(Vqt);var s=t._uiProps.uiTransformComp;if(s&&(Kn.set(zqt,-s.anchorX*s.width,-s.anchorY*s.height,zqt.z),zr.transform(Vqt,Vqt,zqt)),t._uiProps.uiTransformComp){var a=wE.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(Nqt);var o=Nqt.m12,h=Nqt.m13,u=Xo.center;Nqt.m12=u.x-(Nqt.m00*o+Nqt.m04*h),Nqt.m13=u.y-(Nqt.m01*o+Nqt.m05*h),e/=r,i/=r,Kn.set(zqt,e,i,1),zr.scale(Nqt,Nqt,zqt);var l=bk.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var f=parseInt(l&&l.style.paddingBottom||"0");f+=n.y/r,Nqt.m12+=c,Nqt.m13+=f,zr.multiply(Nqt,Nqt,Vqt);var d="matrix("+Nqt.m00+","+-Nqt.m01+","+-Nqt.m04+","+Nqt.m05+","+Nqt.m12+","+-Nqt.m13+")";this._edTxt.style.transform=d,this._edTxt.style["-webkit-transform"]=d,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return 4===i?s="uppercase":2===i&&(s="capitalize"),void(r.style.textTransform=s)}if(0===i)return r.type="password",void(r.style.textTransform="none");var a=r.type;1===e?a="email":2===e?a="number":5===e?a="digit":3===e?(a="tel",r.addEventListener("wheel",(function(){return!1}))):4===e?a="url":(a="text",3===n&&(a="search")),r.type=a;var o="none";4===i?o="uppercase":2===i&&(o="capitalize"),r.style.textTransform=o}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):(t.type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=Lqt.createElement("style")}},i._updateStyleSheet=function(){var t=this._delegate,e=this._edTxt;e&&t&&(e.value=t.string,this._updateTextLabel(t.textLabel))},i._updateTextLabel=function(t){if(t){var e=t.font;e=!e||e instanceof CR?t.fontFamily:e._fontFamily;var i=t.fontSize*t.node.scale.y;if((this._textLabelFont!==e||this._textLabelFontSize!==i||this._textLabelFontColor!==t.fontColor||this._textLabelAlign!==t.horizontalAlign)&&(this._textLabelFont=e,this._textLabelFontSize=i,this._textLabelFontColor=t.fontColor,this._textLabelAlign=t.horizontalAlign,this._edTxt)){var n=this._edTxt;switch(n.style.fontSize=i+"px",n.style.color=t.color.toCSS(),n.style.fontFamily=e,t.horizontalAlign){case DL.HorizontalAlign.LEFT:n.style.textAlign="left";break;case DL.HorizontalAlign.CENTER:n.style.textAlign="center";break;case DL.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof CR?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,a="";switch(t.horizontalAlign){case DL.HorizontalAlign.LEFT:a="left";break;case DL.HorizontalAlign.CENTER:a="center";break;case DL.HorizontalAlign.RIGHT:a="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}",qo.browserType===_o.EDGE&&(n.innerHTML+="#"+this._domId+"::-ms-clear{display: none;}")}}},i._registerEventListeners=function(){var t=this;if(this._edTxt){var e=this._edTxt,i=!1,n=this.__eventListeners;n.compositionStart=function(){i=!0},n.compositionEnd=function(){i=!1,t._delegate._editBoxTextChanged(e.value)},n.onInput=function(){if(!i){var n=t._delegate,r=n.maxLength;r>=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&qo.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){13===i.keyCode?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):9===i.keyCode&&(i.propagationStopped=!0,i.preventDefault(),Rqt.next(t))},n.onBlur=function(){qo.isMobile&&i&&n.compositionEnd(),t._editing=!1,Gqt=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(Fqt),Wqt={DEFAULT:0,DONE:1,SEND:2,SEARCH:3,GO:4,NEXT:5};Me(Wqt);var jqt={ANY:0,EMAIL_ADDR:1,NUMERIC:2,PHONE_NUMBER:3,URL:4,DECIMAL:5,SINGLE_LINE:6};Me(jqt);var qqt,Xqt,Yqt,Qqt,Kqt,Jqt,Zqt,$qt,tXt,eXt,iXt,nXt,rXt,sXt,aXt,oXt,hXt,uXt,lXt,cXt,fXt,dXt,_Xt,pXt,mXt,gXt,vXt,yXt,bXt,SXt={PASSWORD:0,SENSITIVE:1,INITIAL_CAPS_WORD:2,INITIAL_CAPS_SENTENCE:3,INITIAL_CAPS_ALL_CHARACTERS:4,DEFAULT:5};Me(SXt);var xXt,wXt,TXt,CXt,AXt,DXt,IXt,BXt,MXt,PXt,EXt,kXt,OXt,RXt,FXt,LXt,VXt,NXt,zXt,GXt,UXt,HXt,WXt,jXt,qXt,XXt,YXt,QXt,KXt=t("gS",(qqt=Bh("cc.EditBox"),Xqt=Ph(110),Yqt=Mh(bF),Qqt=fu(DL),Kqt=fu(DL),Jqt=fu(yO),Zqt=fu(SXt),$qt=fu(jqt),tXt=fu(Wqt),eXt=fu([jm]),iXt=fu([jm]),nXt=fu([jm]),rXt=fu([jm]),qqt(sXt=Xqt(sXt=Yqt((bXt=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=oXt&&oXt(),e.textChanged=hXt&&hXt(),e.editingDidEnded=uXt&&uXt(),e.editingReturn=lXt&&lXt(),e._impl=null,e._background=null,e._textLabel=cXt&&cXt(),e._placeholderLabel=fXt&&fXt(),e._returnType=dXt&&dXt(),e._string=_Xt&&_Xt(),e._tabIndex=pXt&&pXt(),e._backgroundImage=mXt&&mXt(),e._inputFlag=gXt&&gXt(),e._inputMode=vXt&&vXt(),e._maxLength=yXt&&yXt(),e._isLabelVisible=!1,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._init()},i.onEnable=function(){this._registerEvent(),this._ensureBackgroundSprite(),this._impl&&this._impl.onEnable()},i._beforeDraw=function(){this._impl&&this._impl.beforeDraw()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){wE.off("director_before_draw",this._beforeDraw,this),this._impl&&this._impl.clear()},i.setFocus=function(){this._impl&&this._impl.setFocus(!0)},i.focus=function(){this._impl&&this._impl.setFocus(!0)},i.blur=function(){this._impl&&this._impl.setFocus(!1)},i.isFocused=function(){return!!this._impl&&this._impl.isFocused()},i._editBoxEditingDidBegan=function(){jm.emitEvents(this.editingDidBegan,this),this.node.emit("editing-did-began",this)},i._editBoxEditingDidEnded=function(t){jm.emitEvents(this.editingDidEnded,this),this.node.emit("editing-did-ended",this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,jm.emitEvents(this.textChanged,t,this),this.node.emit("text-changed",this)},i._editBoxEditingReturn=function(t){jm.emitEvents(this.editingReturn,this),this.node.emit("editing-return",this,t)},i._showLabels=function(){this._isLabelVisible=!0,this._updateLabels()},i._hideLabels=function(){this._isLabelVisible=!1,this._textLabel&&(this._textLabel.node.active=!1),this._placeholderLabel&&(this._placeholderLabel.node.active=!1)},i._onTouchBegan=function(t){t.propagationStopped=!0},i._onTouchCancel=function(t){t.propagationStopped=!0},i._onTouchEnded=function(t){this._impl&&this._impl.beginEditing(),t.propagationStopped=!0},i._init=function(){this._updatePlaceholderLabel(),this._updateTextLabel(),this._isLabelVisible=!0,this.node.on("size-changed",this._resizeChildNodes,this),wE.on("director_before_draw",this._beforeDraw,this),(this._impl=new e._EditBoxImpl).init(this),this._updateString(this._string),this._syncSize()},i._ensureBackgroundSprite=function(){if(!this._background){var t=this.node.getComponent(_N);t||(t=this.node.addComponent(_N)),t!==this._background&&(t.type=_N.Type.SLICED,t.spriteFrame=this._backgroundImage,this._background=t,this._registerBackgroundEvent())}},i._updateTextLabel=function(){var t=this._textLabel;if(!t){var e=this.node.getChildByName("TEXT_LABEL");e||((e=new ry("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(DL))||(t=e.addComponent(DL)),e.parent=this.node,this._textLabel=t}0===this._inputMode?(t.verticalAlign=0,t.enableWrapText=!0):t.enableWrapText=!1,t.string=this._updateLabelStringStyle(this._string)},i._updatePlaceholderLabel=function(){var t=this._placeholderLabel;if(!t){var e=this.node.getChildByName("PLACEHOLDER_LABEL");e||((e=new ry("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(DL))||(t=e.addComponent(DL)),e.parent=this.node,this._placeholderLabel=t}0===this._inputMode?t.enableWrapText=!0:t.enableWrapText=!1,t.string=this.placeholder},i._syncSize=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(this._background){var i=this._background.node._uiProps.uiTransformComp;i.anchorPoint=t.anchorPoint,i.setContentSize(e)}this._updateLabelPosition(e),this._impl&&this._impl.setSize(e.width,e.height)},i._updateLabels=function(){if(this._isLabelVisible){var t=this._string;this._textLabel&&(this._textLabel.node.active=""!==t),this._placeholderLabel&&(this._placeholderLabel.node.active=""===t)}},i._updateString=function(t){var e=this._textLabel;if(e){var i=t;i&&(i=this._updateLabelStringStyle(i)),e.string=i,this._updateLabels()}},i._updateLabelStringStyle=function(t,e){void 0===e&&(e=!1);var i,n=this._inputFlag;if(e||0!==n)4===n?t=t.toUpperCase():2===n?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):3===n&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,a=0;a=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(Ym),bXt._EditBoxImpl=Fqt,bXt.KeyboardReturnType=Wqt,bXt.InputFlag=SXt,bXt.InputMode=jqt,bXt.EventType={EDITING_DID_BEGAN:"editing-did-began",EDITING_DID_ENDED:"editing-did-ended",TEXT_CHANGED:"text-changed",EDITING_RETURN:"editing-return",XR_EDITING_DID_BEGAN:"xr-editing-did-began",XR_EDITING_DID_ENDED:"xr-editing-did-ended"},y((aXt=bXt).prototype,"textLabel",[Qqt],Object.getOwnPropertyDescriptor(aXt.prototype,"textLabel"),aXt.prototype),y(aXt.prototype,"placeholderLabel",[Kqt],Object.getOwnPropertyDescriptor(aXt.prototype,"placeholderLabel"),aXt.prototype),y(aXt.prototype,"backgroundImage",[Jqt],Object.getOwnPropertyDescriptor(aXt.prototype,"backgroundImage"),aXt.prototype),y(aXt.prototype,"inputFlag",[Zqt],Object.getOwnPropertyDescriptor(aXt.prototype,"inputFlag"),aXt.prototype),y(aXt.prototype,"inputMode",[$qt],Object.getOwnPropertyDescriptor(aXt.prototype,"inputMode"),aXt.prototype),y(aXt.prototype,"returnType",[tXt],Object.getOwnPropertyDescriptor(aXt.prototype,"returnType"),aXt.prototype),oXt=yh(aXt.prototype,"editingDidBegan",[eXt,Uh],(function(){return[]})),hXt=yh(aXt.prototype,"textChanged",[iXt,Uh],(function(){return[]})),uXt=yh(aXt.prototype,"editingDidEnded",[nXt,Uh],(function(){return[]})),lXt=yh(aXt.prototype,"editingReturn",[rXt,Uh],(function(){return[]})),cXt=yh(aXt.prototype,"_textLabel",[Uh],(function(){return null})),fXt=yh(aXt.prototype,"_placeholderLabel",[Uh],(function(){return null})),dXt=yh(aXt.prototype,"_returnType",[Uh],(function(){return 0})),_Xt=yh(aXt.prototype,"_string",[Uh],(function(){return""})),pXt=yh(aXt.prototype,"_tabIndex",[Uh],(function(){return 0})),mXt=yh(aXt.prototype,"_backgroundImage",[Uh],(function(){return null})),gXt=yh(aXt.prototype,"_inputFlag",[Uh],(function(){return 5})),vXt=yh(aXt.prototype,"_inputMode",[Uh],(function(){return 0})),yXt=yh(aXt.prototype,"_maxLength",[Uh],(function(){return 20})),sXt=aXt))||sXt)||sXt)||sXt));"object"==typeof window&&"object"==typeof document&&(KXt._EditBoxImpl=Hqt),C.internal.EditBox=KXt;var JXt={NONE:0,HORIZONTAL:1,VERTICAL:2,GRID:3};ke(JXt);var ZXt={NONE:0,CONTAINER:1,CHILDREN:2};ke(ZXt);var $Xt={HORIZONTAL:0,VERTICAL:1};ke($Xt);var tYt={BOTTOM_TO_TOP:0,TOP_TO_BOTTOM:1};ke(tYt);var eYt={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1};ke(eYt);var iYt={NONE:0,FIXED_ROW:1,FIXED_COL:2};ke(iYt);var nYt,rYt,sYt,aYt,oYt,hYt,uYt,lYt,cYt,fYt,dYt,_Yt,pYt,mYt=new Kn,gYt=t("gT",(xXt=Bh("cc.Layout"),wXt=Ph(110),TXt=Mh(bF),CXt=fu(JXt),AXt=fu(ZXt),DXt=fu($Xt),IXt=fu(tYt),BXt=fu(eYt),MXt=fu(iYt),xXt(PXt=wXt(PXt=TXt((QXt=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=kXt&&kXt(),e._layoutType=OXt&&OXt(),e._cellSize=RXt&&RXt(),e._startAxis=FXt&&FXt(),e._paddingLeft=LXt&&LXt(),e._paddingRight=VXt&&VXt(),e._paddingTop=NXt&&NXt(),e._paddingBottom=zXt&&zXt(),e._spacingX=GXt&&GXt(),e._spacingY=UXt&&UXt(),e._verticalDirection=HXt&&HXt(),e._horizontalDirection=WXt&&WXt(),e._constraint=jXt&&jXt(),e._constraintNum=qXt&&qXt(),e._affectedByScale=XXt&&XXt(),e._isAlign=YXt&&YXt(),e._layoutSize=new os(300,200),e._layoutDirty=!0,e._childrenDirty=!1,e._usefulLayoutObj=[],e._init=!1,e}s(e,t);var i=e.prototype;return i.updateLayout=function(t){void 0===t&&(t=!1),(this._layoutDirty||t)&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(os.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;ef&&(d=Math.max(f,d),c=f||D,f=D),u+=a*(C*A+this._spacingX);var I=a*(1-C)*A;if(e){if(s>0)(_=y/s>0&&y%s==0)&&(c=f>D?f:c);else if(A>t-g)u>h+a*C*A&&(_=!0);else{var B=(1-this._horizontalDirection-r.x)*t,M=u+I+a*(a>0?this._paddingRight:this._paddingLeft);_=Math.abs(M)>Math.abs(B)}_&&(u=h+a*C*A,D!==f&&(c=f),l+=c+this._spacingY,c=f=D)}var P=i(S,b,l);n&&S.setPosition(u,P),u+=I}return c=Math.max(c,f),Math.max(d,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;1===this._verticalDirection&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,l=0,c=0,f=0,d=0,_=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();3!==this._layoutType&&2===this._resizeMode&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yl&&(c=Math.max(l,c),f=l||A,l=A),u+=a*(C*D+this._spacingY);var I=a*(1-C)*D;if(e){if(s>0)(_=y/s>0&&y%s==0)&&(f=l>D?l:f);else if(D>t-g)u>h+a*C*D&&(_=!0);else{var B=(1-this._verticalDirection-r.y)*t,M=u+I+a*(a>0?this._paddingTop:this._paddingBottom);_=Math.abs(M)>Math.abs(B)}_&&(u=h+a*C*D,A!==l&&(f=l),d+=f+this._spacingX,f=l=A)}var P=i(S,b,d);n&&(S.getPosition(mYt),S.setPosition(P,u,mYt.z)),u+=I}return f=Math.max(f,l),Math.max(c,d+f)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;1===this._verticalDirection&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;1===this._resizeMode&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,1===this._verticalDirection&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),1===this._resizeMode&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;1===this._horizontalDirection&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;1===this._resizeMode&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,1===this._horizontalDirection&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),1===this._resizeMode&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;0===this.startAxis?this._doLayoutGridAxisHorizontal(e,i):1===this.startAxis&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(1===this._resizeMode){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=Qi(h=r/o));var u=(n-a)*h;1===this._direction?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===FYt.x&&n.y===FYt.y||e.setAnchorPoint(FYt),0===this._direction?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(ns.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(ns.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(Ym),PYt.Direction=NYt,y((CYt=PYt).prototype,"handle",[xYt],Object.getOwnPropertyDescriptor(CYt.prototype,"handle"),CYt.prototype),y(CYt.prototype,"direction",[wYt],Object.getOwnPropertyDescriptor(CYt.prototype,"direction"),CYt.prototype),AYt=yh(CYt.prototype,"_scrollView",[Uh],(function(){return null})),DYt=yh(CYt.prototype,"_handle",[Uh],(function(){return null})),IYt=yh(CYt.prototype,"_direction",[Uh],(function(){return 0})),BYt=yh(CYt.prototype,"_enableAutoHide",[Uh],(function(){return!1})),MYt=yh(CYt.prototype,"_autoHideTime",[Uh],(function(){return 1})),TYt=CYt))||TYt)||TYt)||TYt));C.ScrollBar=GYt;var UYt,HYt,WYt,jYt,qYt,XYt,YYt,QYt,KYt,JYt,ZYt,$Yt,tQt,eQt,iQt,nQt,rQt,sQt,aQt,oQt,hQt,uQt=t("g_",Bh("cc.ViewGroup")(zYt=Ph(110)(zYt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ym))||zYt)||zYt);C.ViewGroup=uQt;var lQt,cQt,fQt,dQt,_Qt,pQt,mQt,gQt,vQt,yQt,bQt,SQt,xQt,wQt=1e-4,TQt=Jn(),CQt=Jn(),AQt=rs(),DQt=rs(),IQt=function(){return(new Date).getMilliseconds()},BQt={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12},MQt={anchor:rs(),applyToHorizontal:!1,applyToVertical:!1},PQt=function(t,e,i,n){MQt.anchor.set(t,e),MQt.applyToHorizontal=i,MQt.applyToVertical=n},EQt={NONE:"",SCROLL_TO_TOP:"scroll-to-top",SCROLL_TO_BOTTOM:"scroll-to-bottom",SCROLL_TO_LEFT:"scroll-to-left",SCROLL_TO_RIGHT:"scroll-to-right",SCROLL_BEGAN:"scroll-began",SCROLL_ENDED:"scroll-ended",BOUNCE_TOP:"bounce-top",BOUNCE_BOTTOM:"bounce-bottom",BOUNCE_LEFT:"bounce-left",BOUNCE_RIGHT:"bounce-right",SCROLLING:"scrolling",SCROLL_ENG_WITH_THRESHOLD:"scroll-ended-with-threshold",TOUCH_UP:"touch-up"},kQt=t("gW",(UYt=Bh("cc.ScrollView"),HYt=Ph(110),WYt=Mh(bF),jYt=fu(ry),qYt=fu(GYt),XYt=fu(GYt),YYt=fu([jm]),UYt(QYt=HYt(QYt=WYt((hQt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=JYt&&JYt(),e.brake=ZYt&&ZYt(),e.elastic=$Yt&&$Yt(),e.inertia=tQt&&tQt(),e.horizontal=eQt&&eQt(),e.vertical=iQt&&iQt(),e.cancelInnerEvents=nQt&&nQt(),e.scrollEvents=rQt&&rQt(),e._autoScrolling=!1,e._scrolling=!1,e._content=sQt&&sQt(),e._horizontalScrollBar=aQt&&aQt(),e._verticalScrollBar=oQt&&oQt(),e._topBoundary=0,e._bottomBoundary=0,e._leftBoundary=0,e._rightBoundary=0,e._touchMoveDisplacements=[],e._touchMoveTimeDeltas=[],e._touchMovePreviousTimestamp=0,e._touchMoved=!1,e._autoScrollAttenuate=!1,e._autoScrollStartPosition=new Kn,e._autoScrollTargetDelta=new Kn,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new Kn,e._outOfBoundaryAmount=new Kn,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new Kn,e._deltaPos=new Kn,e._deltaAmount=new Kn,e._hoverIn=0,e}s(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!1,!0,t,e)},i.scrollToTop=function(t,e){void 0===e&&(e=!0),this._doScroll(0,1,!1,!0,t,e)},i.scrollToLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!0,!1,t,e)},i.scrollToRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,0,!0,!1,t,e)},i.scrollToTopLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,1,!0,!0,t,e)},i.scrollToTopRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,1,!0,!0,t,e)},i.scrollToBottomLeft=function(t,e){void 0===e&&(e=!0),this._doScroll(0,0,!0,!0,t,e)},i.scrollToBottomRight=function(t,e){void 0===e&&(e=!0),this._doScroll(1,0,!0,!0,t,e)},i.scrollToOffset=function(t,e,i){void 0===i&&(i=!0);var n=this.getMaxScrollOffset(),r=rs();0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},i.getScrollOffset=function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return new ns(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return ns.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new ns(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){this._doScroll(t,0,!0,!1,e,i)},i.scrollTo=function(t,e,i){this._doScroll(t.x,t.y,!0,!0,e,i)},i.scrollToPercentVertical=function(t,e,i){this._doScroll(0,t,!1,!0,e,i)},i._doScroll=function(t,e,i,n,r,s){void 0===s&&(s=!0),PQt(t,e,i,n);var a=this._calculateMovePercentDelta(MQt);r?this._startAutoScroll(a,r,s):this._moveContent(a)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!i._touchMoved&&t.target!==i.node){var s=new XI(t.getTouches(),t.bubbles,"touch-cancel");s.touch=t.touch,s.simulate=!0,t.target.dispatchEvent(s),i._touchMoved=!0}i._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){var i=this;if(i.enabledInHierarchy&&i._content&&t&&!i._hasNestedViewGroup(t,e)){i._dispatchEvent("touch-up");var n=t.touch;i._handleReleaseLogic(n),i._touchMoved?t.propagationStopped=!0:i._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){var i=this;i.enabledInHierarchy&&i._content&&(i._hasNestedViewGroup(t,e)||(t&&!t.simulate&&i._handleReleaseLogic(t.touch),i._stopPropagationIfTargetIsMe(t)))},i._calculateBoundary=function(){var t=this;if(t._content&&t.view){var e=t._content.getComponent(gYt);e&&e.enabledInHierarchy&&e.updateLayout();var i=t.view,n=i.width*i.anchorX,r=i.height*i.anchorY;t._leftBoundary=-n,t._bottomBoundary=-r,t._rightBoundary=t._leftBoundary+i.width,t._topBoundary=t._bottomBoundary+i.height,t._moveContentToTopLeft(i.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==UI.CAPTURING_PHASE)return!1;if(e)for(var i,n=p(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(uQt));if(r.getComponent(uQt))return!0}return!1},i._startInertiaScroll=function(t){TQt.set(t),TQt.multiplyScalar(.7),this._startAttenuatingAutoScroll(TQt,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;this.brake>0&&l>7?(l=Math.sqrt(l),i.set(t),i.multiplyScalar(l+1)):i.add(t);var c=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(c*=l=3),0===this.brake&&l>1&&(c*=l),this._startAutoScroll(i,c,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this,r=n._flattenVectorByDirection(t);n._autoScrolling=!0,n._autoScrollTargetDelta=r,n._autoScrollAttenuate=i,Kn.copy(n._autoScrollStartPosition,n._getContentPosition()),n._autoScrollTotalTime=e,n._autoScrollAccumulatedTime=0,n._autoScrollBraking=!1,n._isScrollEndedWithThresholdEventFired=!1,n._autoScrollBrakingStartPosition.set(0,0,0),n._getHowMuchOutOfBoundary().equals(Kn.ZERO,wQt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new Kn,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(Kn.ZERO);else{var i=TQt;i.set(0,0,0),i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){return this.horizontal||(t.x=0),this.vertical||(t.y=0),t},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);TQt.set(this._getContentPosition()),TQt.add(i),TQt.set(Math.round(1e4*TQt.x)*wQt,Math.round(1e4*TQt.y)*wQt,TQt.z),this._setContentPosition(TQt);var n=this._getHowMuchOutOfBoundary();AQt.set(n.x,n.y),this._updateScrollBar(AQt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if(t||(t=Kn.ZERO),t.equals(Kn.ZERO,wQt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new Kn,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(Kn.ZERO,wQt)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onScroll(t),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchBegan(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchEnded(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if("scroll-ended"===t)this._scrollEventEmitMask=0;else if("scroll-to-top"===t||"scroll-to-bottom"===t||"scroll-to-left"===t||"scroll-to-right"===t){var e=1<0?c.y-h*l+n.y>=e._bottomBoundary&&(r="scroll-to-bottom"):n.y<0&&c.y-h*l+l+n.y<=e._topBoundary&&(r="scroll-to-top")),e.horizontal&&(n.x<0?c.x-o*u+u+n.x<=e._rightBoundary&&(s="scroll-to-right"):n.x>0&&c.x-o*u+n.x>=e._leftBoundary&&(s="scroll-to-left"))}e._moveContent(n,!1),(e.horizontal&&0!==n.x||e.vertical&&0!==n.y)&&(e._scrolling||(e._scrolling=!0,e._dispatchEvent("scroll-began")),e._dispatchEvent("scrolling")),""!==r&&e._dispatchEvent(r),""!==s&&e._dispatchEvent(s)},i._handlePressLogic=function(){var t=this;t._autoScrolling&&t._dispatchEvent("scroll-ended"),t._autoScrolling=!1,t._isBouncing=!1,t._touchMovePreviousTimestamp=IQt(),t._touchMoveDisplacements.length=0,t._touchMoveTimeDeltas.length=0,t._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width=5;)e._touchMoveDisplacements.shift(),e._touchMoveTimeDeltas.shift();e._touchMoveDisplacements.push(i);var n=IQt();e._touchMoveTimeDeltas.push((n-e._touchMovePreviousTimestamp)/1e3),e._touchMovePreviousTimestamp=n},i._startBounceBackIfNeeded=function(){var t=this;if(!t.elastic)return!1;var e=t._getHowMuchOutOfBoundary();if(t._clampDelta(e),e.equals(Kn.ZERO,wQt))return!1;var i=Math.max(t.bounceDuration,0);return t._startAutoScroll(e,i,!0),t._isBouncing||(e.y>0&&t._dispatchEvent("bounce-top"),e.y<0&&t._dispatchEvent("bounce-bottom"),e.x>0&&t._dispatchEvent("bounce-right"),e.x<0&&t._dispatchEvent("bounce-left"),t._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(Kn.ZERO,wQt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(Kn.ZERO,wQt)},i._isNecessaryAutoScrollBrake=function(){var t=this;if(t._autoScrollBraking)return!0;if(t._isOutOfBoundary()){if(!t._autoScrollCurrentlyOutOfBoundary)return t._autoScrollCurrentlyOutOfBoundary=!0,t._autoScrollBraking=!0,Kn.copy(t._autoScrollBrakingStartPosition,t._getContentPosition()),!0}else t._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this,i=e._isNecessaryAutoScrollBrake(),n=i?.05:1;e._autoScrollAccumulatedTime+=t*(1/n);var r,s=Math.min(1,e._autoScrollAccumulatedTime/e._autoScrollTotalTime);e._autoScrollAttenuate&&(r=s,s=(r-=1)*r*r*r*r+1);var a=e._autoScrollTargetDelta.clone();a.multiplyScalar(s);var o=e._autoScrollStartPosition.clone();o.add(a);var h=Math.abs(s-1)<=wQt;if(Math.abs(s-1)<=e.getScrollEndedEventTiming()&&!e._isScrollEndedWithThresholdEventFired&&(e._dispatchEvent("scroll-ended-with-threshold"),e._isScrollEndedWithThresholdEventFired=!0),e.elastic){var u=o.clone();u.subtract(e._autoScrollBrakingStartPosition),i&&u.multiplyScalar(n),o.set(e._autoScrollBrakingStartPosition),o.add(u)}else{var l=o.clone();l.subtract(e.getContentPosition());var c=e._getHowMuchOutOfBoundary(l);c.equals(Kn.ZERO,wQt)||(o.add(c),h=!0)}h&&(e._autoScrolling=!1);var f=o.clone();f.subtract(e._getContentPosition()),e._clampDelta(f),e._moveContent(f,h),e._dispatchEvent("scrolling"),e._autoScrolling||(e._isBouncing=!1,e._scrolling=!1,e._dispatchEvent("scroll-ended"))},i._checkMouseWheel=function(t){var e=this;if(!e._getHowMuchOutOfBoundary().equals(Kn.ZERO,wQt))return e._processInertiaScroll(),e._scrolling&&(e._scrolling=!1,e._autoScrolling||e._dispatchEvent("scroll-ended")),e.unschedule(e._checkMouseWheel),void(e._stopMouseWheel=!1);e._mouseWheelEventElapsedTime+=t,e._mouseWheelEventElapsedTime>.1&&(e._onScrollBarTouchEnded(),e._scrolling&&(e._scrolling=!1,e._autoScrolling||e._dispatchEvent("scroll-ended")),e.unschedule(e._checkMouseWheel),e._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical,r=this;r._calculateBoundary(),e.clampf(ns.ZERO,ns.ONE);var s=r._getContentBottomBoundary()-r._bottomBoundary;s=-s;var a=r._getContentLeftBoundary()-r._leftBoundary;a=-a;var o=new Kn;if(r._content&&r.view){var h=0,u=r._content._uiProps.uiTransformComp.contentSize,l=r.view.contentSize;i&&(h=u.width-l.width,o.x=a-h*e.x),n&&(h=u.height-l.height,o.y=s-h*e.y)}return o},i._moveContentToTopLeft=function(t){var e=this,i=e._getContentBottomBoundary()-e._bottomBoundary;i=-i;var n=new Kn,r=0,s=e._getContentLeftBoundary()-e._leftBoundary;if(s=-s,e._content){var a=e._content._uiProps.uiTransformComp.contentSize;a.height1)for(var n=i[0],r=0;r0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:Xo;this.isAlignLeft&&8===t?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&32===t?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&16===t?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&1===t?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&4===t?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&2===t&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(bF)&&(t.on("transform-changed",this._setDirtyByMode,this),t.on("size-changed",this._setDirtyByMode,this),t.on("anchor-changed",this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off("transform-changed",this._setDirtyByMode,this),t.off("size-changed",this._setDirtyByMode,this),t.off("anchor-changed",this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off("transform-changed",this._setDirtyByMode,this),e.off("size-changed",this._setDirtyByMode,this))},i._setDirtyByMode=function(){1===this.alignMode&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(40&t)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(1&this._alignFlags)>0},set:function(t){this._setAlign(1,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(4&this._alignFlags)>0},set:function(t){this._setAlign(4,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(8&this._alignFlags)>0},set:function(t){this._setAlign(8,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(32&this._alignFlags)>0},set:function(t){this._setAlign(32,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(2&this._alignFlags)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=2):this._alignFlags&=-3,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(16&this._alignFlags)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=16):this._alignFlags&=-17,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return!(40&~this._alignFlags)}},{key:"isStretchHeight",get:function(){return!(5&~this._alignFlags)}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(1,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(4,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(8,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(32,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(16,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(2,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(Ym),IKt.AlignMode=kKt,y((uKt=IKt).prototype,"target",[aKt],Object.getOwnPropertyDescriptor(uKt.prototype,"target"),uKt.prototype),y(uKt.prototype,"alignMode",[oKt],Object.getOwnPropertyDescriptor(uKt.prototype,"alignMode"),uKt.prototype),lKt=yh(uKt.prototype,"_alignFlags",[Uh],(function(){return 0})),cKt=yh(uKt.prototype,"_target",[Uh],(function(){return null})),fKt=yh(uKt.prototype,"_left",[Uh],(function(){return 0})),dKt=yh(uKt.prototype,"_right",[Uh],(function(){return 0})),_Kt=yh(uKt.prototype,"_top",[Uh],(function(){return 0})),pKt=yh(uKt.prototype,"_bottom",[Uh],(function(){return 0})),mKt=yh(uKt.prototype,"_horizontalCenter",[Uh],(function(){return 0})),gKt=yh(uKt.prototype,"_verticalCenter",[Uh],(function(){return 0})),vKt=yh(uKt.prototype,"_isAbsLeft",[Uh],(function(){return!0})),yKt=yh(uKt.prototype,"_isAbsRight",[Uh],(function(){return!0})),bKt=yh(uKt.prototype,"_isAbsTop",[Uh],(function(){return!0})),SKt=yh(uKt.prototype,"_isAbsBottom",[Uh],(function(){return!0})),xKt=yh(uKt.prototype,"_isAbsHorizontalCenter",[Uh],(function(){return!0})),wKt=yh(uKt.prototype,"_isAbsVerticalCenter",[Uh],(function(){return!0})),TKt=yh(uKt.prototype,"_originalWidth",[Uh],(function(){return 0})),CKt=yh(uKt.prototype,"_originalHeight",[Uh],(function(){return 0})),AKt=yh(uKt.prototype,"_alignMode",[Uh],(function(){return 2})),DKt=yh(uKt.prototype,"_lockFlags",[Uh,Wh],(function(){return 0})),hKt=uKt))||hKt)||hKt)||hKt));T.internal.computeInverseTransForTarget=EKt,T.internal.getReadonlyNodeSize=PKt,T.Widget=XKt;var YKt=new nr,QKt={HORIZONTAL:0,VERTICAL:1};ke(QKt);var KKt,JKt,ZKt,$Kt,tJt,eJt,iJt,nJt,rJt,sJt,aJt,oJt,hJt,uJt,lJt,cJt,fJt,dJt,_Jt,pJt,mJt,gJt,vJt,yJt,bJt=t("h1",(OKt=Bh("cc.PageViewIndicator"),RKt=Ph(110),FKt=fu(yO),LKt=fu(QKt),VKt=fu(os),OKt(NKt=RKt((jKt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=GKt&&GKt(),e._spriteFrame=UKt&&UKt(),e._direction=HKt&&HKt(),e._cellSize=WKt&&WKt(),e._layout=null,e._pageView=null,e._indicators=[],e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._updateLayout()},i.setPageView=function(t){this._pageView=t,this._refresh()},i._updateLayout=function(){this._layout=this.getComponent(gYt),this._layout||(this._layout=this.addComponent(gYt));var t=this._layout;0===this.direction?(t.type=1,t.spacingX=this.spacing):1===this.direction&&(t.type=2,t.spacingY=this.spacing),t.resizeMode=1},i._createIndicator=function(){var t=new ry;t.layer=this.node.layer;var e=t.addComponent(_N);return e.spriteFrame=this.spriteFrame,e.sizeMode=_N.SizeMode.CUSTOM,t.parent=this.node,t._uiProps.uiTransformComp.setContentSize(this._cellSize),t},i._changedState=function(){var t=this._indicators;if(0!==t.length&&this._pageView){var e=this._pageView.curPageIdx;if(!(e>=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},n(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(Ym),jKt.Direction=QKt,y((zKt=jKt).prototype,"spriteFrame",[FKt],Object.getOwnPropertyDescriptor(zKt.prototype,"spriteFrame"),zKt.prototype),y(zKt.prototype,"direction",[LKt],Object.getOwnPropertyDescriptor(zKt.prototype,"direction"),zKt.prototype),y(zKt.prototype,"cellSize",[VKt],Object.getOwnPropertyDescriptor(zKt.prototype,"cellSize"),zKt.prototype),GKt=yh(zKt.prototype,"spacing",[Uh],(function(){return 0})),UKt=yh(zKt.prototype,"_spriteFrame",[Uh],(function(){return null})),HKt=yh(zKt.prototype,"_direction",[Uh],(function(){return 0})),WKt=yh(zKt.prototype,"_cellSize",[Uh],(function(){return new os(20,20)})),NKt=zKt))||NKt)||NKt));C.PageViewIndicator=bJt;var SJt=new ns,xJt={Unified:0,Free:1};ke(xJt);var wJt={HORIZONTAL:0,VERTICAL:1};ke(wJt);var TJt=t("h0",(KKt=Bh("cc.PageView"),JKt=Ph(110),ZKt=fu(xJt),$Kt=fu(wJt),tJt=fu(bJt),eJt=fu(GYt),iJt=fu(GYt),nJt=fu([jm]),rJt=fu([jm]),KKt(sJt=JKt((yJt=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=oJt&&oJt(),e.horizontal=hJt&&hJt(),e.vertical=uJt&&uJt(),e.cancelInnerEvents=lJt&&lJt(),e.scrollEvents=cJt&&cJt(),e.pageTurningSpeed=fJt&&fJt(),e.pageEvents=dJt&&dJt(),e._sizeMode=_Jt&&_Jt(),e._direction=pJt&&pJt(),e._scrollThreshold=mJt&&mJt(),e._pageTurningEventTiming=gJt&&gJt(),e._indicator=vJt&&vJt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=Jn(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=rs(),e._touchEndPosition=rs(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on("size-changed",this._updateAllPagesSize,this),this.node.on(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off("size-changed",this._updateAllPagesSize,this),this.node.off(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onLoad=function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},i.getCurrentPageIndex=function(){return this._curPageIdx},i.setCurrentPageIndex=function(t){this.scrollToPage(t,1)},i.getPages=function(){return this._pages},i.addPage=function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(t._uiProps.uiTransformComp?(this.content.addChild(t),this._pages.push(t),this._updatePageView()):et(4301))},i.insertPage=function(t,e){if(!(e<0)&&t&&-1===this._pages.indexOf(t)&&this.content)if(e>=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void et(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):st(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(gYt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;0===this.direction?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):1===this.direction&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,jm.emitEvents(this.pageEvents,this,"page-turning"),this.node.emit("page-turning",this))},i._isQuicklyScrollable=function(t){if(0===this.direction){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(1===this.direction&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new ns;if(1===this._sizeMode)0===this.direction?e.x=this._scrollCenterOffsetX[t]:1===this.direction&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;0===this.direction?e.x=t*i.width:1===this.direction&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return 0===this._direction?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(1===this._sizeMode){var n=0,r=0;if(0===this.direction)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(1===this.direction)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(0===this.direction)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(1===this.direction)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new ns;ns.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=BJt;s.set(0,0);var a=MJt;if(a.set(1,1),t.target&&EKt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:AJt,u=n._uiProps.uiTransformComp,l=PKt(r),c=u.anchorPoint,f=n.position,d=qKt,_=n.scale,p=0;if(e&d.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=f.x-c.x*u.width*Math.abs(_.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&d.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(f.x+(1-c.x)*u.width*Math.abs(_.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*l.height;v+=s.y,p=(v*=a.y)-(f.y+(1-c.y)*u.height*Math.abs(_.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*l.height;y+=s.y,y*=a.y,p=f.y-c.y*u.height*Math.abs(_.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&ry.isNode(i)&&t(i);var n=e.getComponent(XKt);n&&i&&PJt(e,n)},AlignMode:kKt,AlignFlags:qKt});wE.on("director_init",(function(){VJt.init()}));var NJt,zJt,GJt,UJt,HJt,WJt,jJt,qJt,XJt,YJt,QJt,KJt,JJt=t("h2",Bh("cc.SafeArea")(OJt=Ph(110)(OJt=Mh(XKt)((RJt=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=FJt&&FJt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),Ho.on("window-resize",this.updateArea,this),Ho.on("orientation-change",this.updateArea,this)},i.onDisable=function(){Ho.off("window-resize",this.updateArea,this),Ho.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(XKt),e=this.node.getComponent(bF);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=pk.getVisibleSize(),s=r.width,a=r.height,o=qo.getSafeAreaRect(this._symmetric);t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,l=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,l),VJt.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(Ym),FJt=yh(RJt.prototype,"_symmetric",[Uh],(function(){return!0})),OJt=RJt))||OJt)||OJt)||OJt);C.SafeArea=JJt;var ZJt,$Jt=t("h3",(NJt=Bh("cc.UICoordinateTracker"),zJt=Ph(110),GJt=fu(ry),UJt=fu(vz),HJt=fu([jm]),NJt(WJt=zJt((jJt=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=qJt&&qJt(),e._target=XJt&&XJt(),e._camera=YJt&&YJt(),e._useScale=QJt&&QJt(),e._distance=KJt&&KJt(),e._transformPos=Jn(),e._viewPos=Jn(),e._canMove=!0,e._lastWPos=Jn(),e._lastCameraPos=Jn(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this._checkCanMove()},i.update=function(){var t=this.node.worldPosition,e=this._camera;if(this._canMove&&e&&e.camera&&(!this._lastWPos.equals(t)||!this._lastCameraPos.equals(e.node.worldPosition))&&(this._lastWPos.set(t),this._lastCameraPos.set(e.node.worldPosition),e.camera.update(),e.convertToUINode(t,this._target,this._transformPos),this._useScale&&Kn.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);jm.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(Ym),y(jJt.prototype,"target",[GJt],Object.getOwnPropertyDescriptor(jJt.prototype,"target"),jJt.prototype),y(jJt.prototype,"camera",[UJt],Object.getOwnPropertyDescriptor(jJt.prototype,"camera"),jJt.prototype),qJt=yh(jJt.prototype,"syncEvents",[HJt,Uh],(function(){return[]})),XJt=yh(jJt.prototype,"_target",[Uh],(function(){return null})),YJt=yh(jJt.prototype,"_camera",[Uh],(function(){return null})),QJt=yh(jJt.prototype,"_useScale",[Uh],(function(){return!0})),KJt=yh(jJt.prototype,"_distance",[Uh],(function(){return 1})),WJt=jJt))||WJt)||WJt)),tZt=["touch-start","touch-end","touch-move","mouse-down","mouse-move","mouse-up","mouse-enter","mouse-leave","mouse-wheel"];function eZt(t){t.propagationStopped=!0}var iZt,nZt,rZt,sZt,aZt,oZt=t("h4",Bh("cc.BlockInputEvents")(ZJt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=pk.getViewportRect(),a=e.getBoundingBoxToWorld(),o=pk.getVisibleSize(),h=Ho.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,l=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,f=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:f})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on("transform-changed",this._updateSubContextView,this),this.node.on("size-changed",this._updateSubContextView,this),this.node.on("layer-changed",this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off("transform-changed",this._updateSubContextView,this),this.node.off("size-changed",this._updateSubContextView,this),this.node.off("layer-changed",this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},n(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(Ym),rZt=yh(nZt.prototype,"_fps",[Uh],(function(){return 60})),sZt=yh(nZt.prototype,"_designResolutionSize",[Uh],(function(){return new os(640,960)})),iZt=nZt))||iZt)||iZt)||iZt);C.SubContextView=hZt,At({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var uZt,lZt,cZt,fZt=t("ha",Bh("cc.UIReorderComponent")(aZt=function(){st(1408,"UIReorderComponent")})||aZt);C.UIReorderComponent=fZt,C.ButtonComponent=Oqt,ue(Oqt,"cc.ButtonComponent"),C.EditBoxComponent=KXt,ue(KXt,"cc.EditBoxComponent"),C.LayoutComponent=gYt,ue(gYt,"cc.LayoutComponent"),C.ProgressBarComponent=EYt,ue(EYt,"cc.ProgressBarComponent"),C.ScrollViewComponent=kQt,ue(kQt,"cc.ScrollViewComponent"),C.ScrollBarComponent=GYt,ue(GYt,"cc.ScrollBarComponent"),C.SliderComponent=XQt,ue(XQt,"cc.SliderComponent"),C.ToggleComponent=iKt,ue(iKt,"cc.ToggleComponent"),C.ToggleContainerComponent=BKt,ue(BKt,"cc.ToggleContainerComponent"),C.WidgetComponent=XKt,ue(XKt,"cc.WidgetComponent"),C.PageViewComponent=TJt,ue(TJt,"cc.PageViewComponent"),C.PageViewIndicatorComponent=bJt,ue(bJt,"cc.PageViewIndicatorComponent"),C.SafeAreaComponent=JJt,ue(JJt,"cc.SafeAreaComponent"),ue($Jt,"cc.UICoordinateTrackerComponent"),C.BlockInputEventsComponent=oZt,ue(oZt,"cc.BlockInputEventsComponent"),pt(rk.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),mt(rk.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}]);var dZt=t("hb",Bh("cc.VideoClip")((lZt=function(t){function e(){var e;return(e=t.call(this)||this)._duration=cZt&&cZt(),e._video=null,e}return s(e,t),n(e,[{key:"_nativeAsset",get:function(){return this._video},set:function(t){this._video=t,this._duration=t?t.duration:0}}]),e}(em),cZt=yh(lZt.prototype,"_duration",[Uh],(function(){return 0})),uZt=lZt))||uZt),_Zt=D.document;function pZt(t,e,i){var n=_Zt.createElement("video"),r=_Zt.createElement("source");n.appendChild(r);var s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob",s.onload=function(){200===this.status||0===this.status?(r.src=URL.createObjectURL(this.response),i(null,n)):i(new Error(s.status+"(no response)"))},s.onerror=function(){var e="load video failure - "+t;q(e),i(new Error(e))},s.send()}function mZt(t,e,i,n){var r=new dZt;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Gx.register({".mp4":pZt,".avi":pZt,".mov":pZt,".mpg":pZt,".mpeg":pZt,".rm":pZt,".rmvb":pZt}),tw.register({".mp4":mZt,".avi":mZt,".mov":mZt,".mpg":mZt,".mpeg":mZt,".rm":mZt,".rmvb":mZt});var gZt=function(){function t(t){var e=this;this._componentEventList=new Map,this._state="none",this._video=null,this._onInterruptedBegin=void 0,this._onInterruptedEnd=void 0,this._interrupted=!1,this._loaded=!1,this._loadedMeta=!1,this._ignorePause=!1,this._fullScreenOnAwake=!1,this._visible=!0,this._playing=!1,this._cachedCurrentTime=-1,this._waitingFullscreen=!1,this._waitingPlay=!1,this._keepAspectRatio=!1,this._component=null,this._uiTrans=null,this._node=null,this._stayOnBottom=!1,this._dirty=!1,this._forceUpdate=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(bF),this._onInterruptedBegin=function(){e.video&&"playing"===e._state&&(e.video.pause(),e._interrupted=!0)},this._onInterruptedEnd=function(){e._interrupted&&e.video&&(e.video.play(),e._interrupted=!1)},C.game.on(C.Game.EVENT_PAUSE,this._onInterruptedBegin),C.game.on(C.Game.EVENT_RESUME,this._onInterruptedEnd)}var e=t.prototype;return e.onLoadedMetadata=function(t){this._loadedMeta=!0,this._forceUpdate=!0,this._visible?this.enable():this.disable(),this.dispatchEvent("meta-loaded");var e=t.target;this._keepAspectRatio&&e&&this.syncUITransform(e.videoWidth,e.videoHeight),this.delayedFullScreen(),this.delayedPlay()},e.onCanPlay=function(){this._loaded=!0,this.dispatchEvent("ready-to-play")},e.onPlay=function(){this._playing=!0,this.dispatchEvent("playing")},e.onPlaying=function(){this.dispatchEvent("playing")},e.onPause=function(){this._playing=!1,this._ignorePause?this._ignorePause=!1:this.dispatchEvent("paused")},e.onStoped=function(){this._playing=!1,this._ignorePause=!1,this.dispatchEvent("stopped")},e.onEnded=function(){this._playing=!1,this.dispatchEvent("completed")},e.onClick=function(){this.dispatchEvent("clicked")},e.onError=function(t){this.dispatchEvent("error");var e=t.target;e&&e.error&&Y("Error "+e.error.code+"; details: "+e.error.message)},e.play=function(){this._loadedMeta||this._loaded?this.canPlay():this._waitingPlay=!0},e.delayedPlay=function(){this._waitingPlay&&(this.canPlay(),this._waitingPlay=!1)},e.syncFullScreenOnAwake=function(t){this._fullScreenOnAwake=t,this._loadedMeta||this._loaded?this.canFullScreen(t):this._waitingFullscreen=!0},e.delayedFullScreen=function(){this._waitingFullscreen&&(this.canFullScreen(this._fullScreenOnAwake),this._waitingFullscreen=!1)},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);e&&(this._state=t,e.call(this))},e.syncUITransform=function(t,e){this._uiTrans&&(this._uiTrans.width=t,this._uiTrans.height=e)},e.syncCurrentTime=function(){this.video&&-1!==this._cachedCurrentTime&&this.video.currentTime!==this._cachedCurrentTime&&(this.seekTo(this._cachedCurrentTime),this._cachedCurrentTime=-1)},e.destroy=function(){this.removeVideoPlayer(),this._componentEventList.clear(),C.game.off(C.Game.EVENT_PAUSE,this._onInterruptedBegin),C.game.off(C.Game.EVENT_RESUME,this._onInterruptedEnd)},n(t,[{key:"fullScreenOnAwake",get:function(){return this._fullScreenOnAwake}},{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"video",get:function(){return this._video}},{key:"state",get:function(){return this._state}},{key:"isPlaying",get:function(){return this._playing}},{key:"UICamera",get:function(){return wE.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();C.internal.VideoPlayerImpl=gZt;var vZt=D.document,yZt=-Math.pow(2,15),bZt=Wr(),SZt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._eventList=new Map,i._clearColorA=-1,i._clearFlag=void 0,i}s(e,t);var i=e.prototype;return i.addListener=function(t,e){this._video&&(this._eventList.set(t,e),this._video.addEventListener(t,e))},i.removeAllListeners=function(){var t=this;this._eventList.forEach((function(e,i){t._video&&t._video.removeEventListener(i,e)})),this._eventList.clear()},i.canPlay=function(){var t=this;if(this.video){var e=this.video.play();D.Promise&&e instanceof Promise&&e.catch((function(){})).then((function(){t.syncCurrentTime()}))}},i.pause=function(){this.video&&(this.video.pause(),this._cachedCurrentTime=this.video.currentTime)},i.resume=function(){this.play()},i.stop=function(){var t=this;this.video&&(this._ignorePause=!0,this.video.currentTime=0,this.video.pause(),this._cachedCurrentTime=0,setTimeout((function(){t._ignorePause=!1,t.dispatchEvent("stopped")}),0))},i.syncClip=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t.nativeUrl)},i.syncURL=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t)},i.syncPlaybackRate=function(t){qo.browserType!==_o.UC?this.video&&(this.video.playbackRate=t):X("playbackRate is not supported by the uc mobile browser.")},i.syncVolume=function(t){this.video&&(this.video.volume=t)},i.syncMute=function(t){this.video&&(this.video.muted=t)},i.syncLoop=function(t){this.video&&(this.video.loop=t)},i.getDuration=function(){return this.video?this.video.duration:0},i.getCurrentTime=function(){return this.video?this.video.currentTime:-1},i.seekTo=function(t){this.video&&(this.video.currentTime=t,this._cachedCurrentTime=this.video.currentTime)},i.canFullScreen=function(t){var e=this,i=this._video;if(i&&4===i.readyState)return qo.os===go.IOS&&qo.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):jo.supportsFullScreen?void(t?(qo.browserType===_o.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),jo.requestFullScreen(i,(function(t){var n=qo.browserType===_o.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),jo.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?yZt:0,this._stayOnBottom=t),this._dirty=!0},i.syncKeepAspectRatio=function(t){this._keepAspectRatio=t,t&&this._loadedMeta&&this._video&&this.syncUITransform(this._video.videoWidth,this._video.videoHeight)},i.removeVideoPlayer=function(){var t=this._video;t&&Ye(bk.container,t)&&(bk.container.removeChild(t),this.removeAllListeners()),this._cachedCurrentTime=0,this._playing=!1,this._loaded=!1,this._loadedMeta=!1,this._video=null},i.createVideoPlayer=function(t){var e=this._video=vZt.createElement("video");e.className="cocosVideo",e.style.visibility="hidden",e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style["transform-origin"]="0px 100% 0px",e.style["-webkit-transform-origin"]="0px 100% 0px",e.setAttribute("preload","auto"),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""),e.setAttribute("playsinline",""),this._bindDomEvent(),bk.container.appendChild(e);var i=vZt.createElement("source");e.appendChild(i),i.src=t},i._bindDomEvent=function(){this._video,this.addListener("loadedmetadata",this.onLoadedMetadata.bind(this)),this.addListener("canplay",this.onCanPlay.bind(this)),this.addListener("canplaythrough",this.onCanPlay.bind(this)),this.addListener("play",this.onPlay.bind(this)),this.addListener("playing",this.onPlaying.bind(this)),this.addListener("pause",this.onPause.bind(this)),this.addListener("click",this.onClick.bind(this)),this.addListener("ended",this.onEnded.bind(this)),this.addListener("error",this.onError.bind(this))},i.onCanPlay=function(e){var i=e.target;if(!this._loaded||!i)switch(i.readyState){case 1:case 4:t.prototype.onCanPlay.call(this,e)}},i.enable=function(){if(this._video){if(this._visible=!0,"visible"===this._video.style.visibility)return;this._video.style.visibility="visible"}},i.disable=function(t){if(this._video){if(!t&&this._playing&&this._video.pause(),this._visible=!1,"hidden"===this._video.style.visibility)return;this._video.style.visibility="hidden"}},i.syncMatrix=function(){if(this._video&&this._visible&&this._component){var t=this.UICamera;if(t&&!jo.fullScreen()){this._dirty&&(this._dirty=!1,this._stayOnBottom?(this._clearColorA=t.clearColor.w,this._clearFlag=t.clearFlag,t.clearColor.w=0,t.clearFlag=7):this._clearFlag&&(t.clearColor.w=this._clearColorA,t.clearFlag=this._clearFlag,this._clearColorA=-1,this._clearFlag=null)),this._component.node.getWorldMatrix(bZt),t.update(!0),t.worldMatrixToScreen(bZt,bZt,bk.canvas.width,bk.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=Xo.width,i=Xo.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==bZt.m00||this._m01!==bZt.m01||this._m04!==bZt.m04||this._m05!==bZt.m05||this._m12!==bZt.m12||this._m13!==bZt.m13||this._w!==e||this._h!==i){this._m00=bZt.m00,this._m01=bZt.m01,this._m04=bZt.m04,this._m05=bZt.m05,this._m12=bZt.m12,this._m13=bZt.m13,this._w=e,this._h=i;var n=Ho.devicePixelRatio,r=1/n,s=1/n,a=bk.container,o=bZt.m00*r,h=bZt.m01,u=bZt.m04,l=bZt.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",qo.browserType!==_o.MOBILE_QQ?this._video.style.objectFit=this._keepAspectRatio?"none":"fill":X("keepAspectRatio is not supported by the qq mobile browser.");var c=this._w*r,f=this._h*s,d=this._uiTrans.anchorPoint,_=d.x,p=d.y,m=c*bZt.m00*_,g=f*bZt.m05*p,v=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,y=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,b="matrix("+o+","+-h+","+-u+","+l+","+(bZt.m12*r-m+v)+","+-(bZt.m13*s-g+y)+")";this._video.style.transform=b,this._video.style["-webkit-transform"]=b,qo.browserType!==_o.IE&&(this._forceUpdate=!1)}}}},e}(gZt),xZt=function(){function t(){}return t.getImpl=function(t){return new SZt(t)},t}();C.internal.VideoPlayerImplManager=xZt;var wZt,TZt,CZt,AZt,DZt,IZt,BZt,MZt,PZt,EZt,kZt,OZt,RZt,FZt,LZt,VZt,NZt,zZt,GZt,UZt,HZt,WZt=Me({REMOTE:0,LOCAL:1}),jZt=t("hc",(wZt=Bh("cc.VideoPlayer"),TZt=Mh(bF),CZt=fu(dZt),AZt=fu(WZt),DZt=fu(dZt),IZt=fu([jm]),wZt(BZt=TZt((HZt=function(t){function e(){var e;return(e=t.call(this)||this)._resourceType=PZt&&PZt(),e._remoteURL=EZt&&EZt(),e._clip=kZt&&kZt(),e._playOnAwake=OZt&&OZt(),e._volume=RZt&&RZt(),e._mute=FZt&&FZt(),e._playbackRate=LZt&&LZt(),e._loop=VZt&&VZt(),e._fullScreenOnAwake=NZt&&NZt(),e._stayOnBottom=zZt&&zZt(),e._keepAspectRatio=GZt&&GZt(),e._impl=null,e._cachedCurrentTime=0,e.videoPlayerEvent=UZt&&UZt(),e}s(e,t);var i=e.prototype;return i.syncSource=function(){this._impl&&(this._resourceType===WZt.REMOTE?this._impl.syncURL(this._remoteURL):this._impl.syncClip(this._clip),this._cachedCurrentTime=0,this._impl.syncLoop(this._loop),this._impl.syncVolume(this._volume),this._impl.syncMute(this._mute),this._impl.seekTo(this._cachedCurrentTime),this._impl.syncPlaybackRate(this._playbackRate),this._impl.syncStayOnBottom(this._stayOnBottom),this._impl.syncKeepAspectRatio(this._keepAspectRatio),this._impl.syncFullScreenOnAwake(this._fullScreenOnAwake))},i.__preload=function(){this._impl=xZt.getImpl(this),this.syncSource(),this._impl.componentEventList.set("meta-loaded",this.onMetaLoaded.bind(this)),this._impl.componentEventList.set("ready-to-play",this.onReadyToPlay.bind(this)),this._impl.componentEventList.set("playing",this.onPlaying.bind(this)),this._impl.componentEventList.set("paused",this.onPaused.bind(this)),this._impl.componentEventList.set("stopped",this.onStopped.bind(this)),this._impl.componentEventList.set("completed",this.onCompleted.bind(this)),this._impl.componentEventList.set("error",this.onError.bind(this)),this._impl.componentEventList.set("clicked",this.onClicked.bind(this)),this._playOnAwake&&this._impl.loaded&&this.play()},i.onEnable=function(){this._impl&&this._impl.enable()},i.onDisable=function(){this._impl&&this._impl.disable()},i.onDestroy=function(){this._impl&&(this._impl.destroy(),this._impl=null)},i.update=function(){this._impl&&this._impl.syncMatrix()},i.onMetaLoaded=function(){jm.emitEvents(this.videoPlayerEvent,this,"meta-loaded"),this.node.emit("meta-loaded",this)},i.onReadyToPlay=function(){this._playOnAwake&&!this.isPlaying&&this.play(),jm.emitEvents(this.videoPlayerEvent,this,"ready-to-play"),this.node.emit("ready-to-play",this)},i.onPlaying=function(){jm.emitEvents(this.videoPlayerEvent,this,"playing"),this.node.emit("playing",this)},i.onPaused=function(){jm.emitEvents(this.videoPlayerEvent,this,"paused"),this.node.emit("paused",this)},i.onStopped=function(){jm.emitEvents(this.videoPlayerEvent,this,"stopped"),this.node.emit("stopped",this)},i.onCompleted=function(){jm.emitEvents(this.videoPlayerEvent,this,"completed"),this.node.emit("completed",this)},i.onError=function(){jm.emitEvents(this.videoPlayerEvent,this,"error"),this.node.emit("error",this)},i.onClicked=function(){jm.emitEvents(this.videoPlayerEvent,this,"clicked"),this.node.emit("clicked",this)},i.play=function(){this._impl&&this._impl.play()},i.resume=function(){this._impl&&this._impl.resume()},i.pause=function(){this._impl&&this._impl.pause()},i.stop=function(){this._impl&&this._impl.stop()},n(e,[{key:"resourceType",get:function(){return this._resourceType},set:function(t){this._resourceType!==t&&(this._resourceType=t,this.syncSource())}},{key:"remoteURL",get:function(){return this._remoteURL},set:function(t){this._remoteURL!==t&&(this._remoteURL=t,this.syncSource())}},{key:"clip",get:function(){return this._clip},set:function(t){this._clip!==t&&(this._clip=t,this.syncSource())}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._impl&&this._impl.syncPlaybackRate(t)}},{key:"volume",get:function(){return this._volume},set:function(t){this._volume=t,this._impl&&this._impl.syncVolume(t)}},{key:"mute",get:function(){return this._mute},set:function(t){this._mute=t,this._impl&&this._impl.syncMute(t)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._impl&&this._impl.syncLoop(t)}},{key:"keepAspectRatio",get:function(){return this._keepAspectRatio},set:function(t){this._keepAspectRatio!==t&&(this._keepAspectRatio=t,this._impl&&this._impl.syncKeepAspectRatio(t))}},{key:"fullScreenOnAwake",get:function(){return this._impl?(this._fullScreenOnAwake=this._impl.fullScreenOnAwake,this._fullScreenOnAwake):this._fullScreenOnAwake},set:function(t){this._fullScreenOnAwake!==t&&(this._fullScreenOnAwake=t,this._impl&&this._impl.syncFullScreenOnAwake(t))}},{key:"stayOnBottom",get:function(){return this._stayOnBottom},set:function(t){this._stayOnBottom!==t&&(this._stayOnBottom=t,this._impl&&this._impl.syncStayOnBottom(t))}},{key:"nativeVideo",get:function(){return this._impl&&this._impl.video||null}},{key:"currentTime",get:function(){return this._impl?this._impl.getCurrentTime():this._cachedCurrentTime},set:function(t){Number.isNaN(t)?X("illegal video time! value:"+t):(t=Yi(t,0,this.duration),this._cachedCurrentTime=t,this._impl&&this._impl.seekTo(t))}},{key:"duration",get:function(){return this._impl?this._impl.getDuration():0}},{key:"state",get:function(){return this._impl?this._impl.state:"none"}},{key:"isPlaying",get:function(){return!!this._impl&&this._impl.isPlaying}}]),e}(Ym),HZt.EventType={NONE:"none",PLAYING:"playing",PAUSED:"paused",STOPPED:"stopped",COMPLETED:"completed",META_LOADED:"meta-loaded",READY_TO_PLAY:"ready-to-play",ERROR:"error",CLICKED:"clicked"},HZt.ResourceType=WZt,PZt=yh((MZt=HZt).prototype,"_resourceType",[Uh],(function(){return WZt.LOCAL})),EZt=yh(MZt.prototype,"_remoteURL",[Uh],(function(){return""})),kZt=yh(MZt.prototype,"_clip",[CZt,Uh],(function(){return null})),OZt=yh(MZt.prototype,"_playOnAwake",[Uh],(function(){return!0})),RZt=yh(MZt.prototype,"_volume",[Uh],(function(){return 1})),FZt=yh(MZt.prototype,"_mute",[Uh],(function(){return!1})),LZt=yh(MZt.prototype,"_playbackRate",[Uh],(function(){return 1})),VZt=yh(MZt.prototype,"_loop",[Uh],(function(){return!1})),NZt=yh(MZt.prototype,"_fullScreenOnAwake",[Uh],(function(){return!1})),zZt=yh(MZt.prototype,"_stayOnBottom",[Uh],(function(){return!1})),GZt=yh(MZt.prototype,"_keepAspectRatio",[Uh],(function(){return!0})),y(MZt.prototype,"resourceType",[AZt],Object.getOwnPropertyDescriptor(MZt.prototype,"resourceType"),MZt.prototype),y(MZt.prototype,"clip",[DZt],Object.getOwnPropertyDescriptor(MZt.prototype,"clip"),MZt.prototype),UZt=yh(MZt.prototype,"videoPlayerEvent",[Uh,IZt],(function(){return[]})),BZt=MZt))||BZt)||BZt));C.internal.VideoPlayer=jZt,_t(jZt.prototype,"VideoPlayer.prototype",[{name:"onPasued",newName:"onPaused"}]);var qZt=function(){function t(t){this._componentEventList=new Map,this._state="none",this._wrapper=void 0,this._webview=null,this._loaded=!1,this._forceUpdate=!1,this._component=null,this._uiTrans=null,this._node=null,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(bF),this.reset(),this.createWebView()}var e=t.prototype;return e.reset=function(){this._wrapper=null,this._webview=null,this._loaded=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._state="none",this._forceUpdate=!1},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);if(e){this._state=t;for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(34962,e.glBuffer),n.glArrayBuffer=e.glBuffer),i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null))}else if(4&e.usage){e.glTarget=34963;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(34963,e.glBuffer),n.glElementArrayBuffer=e.glBuffer),i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null))}else if(16&e.usage){e.glTarget=35345;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,n.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(35345,e.glBuffer),n.glUniformBuffer=e.glBuffer),i.bufferData(35345,e.size,r),i.bindBuffer(35345,null),n.glUniformBuffer=null)}else 64&e.usage||2&e.usage||1&e.usage||ot(16315),e.glTarget=0}function w$t(t,e){var i=t.gl,n=t.getStateCache(),r=t.extensions.useVAO;if(e.glBuffer){switch(e.glTarget){case 34962:r&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,i.bindBuffer(34962,null),n.glArrayBuffer=null;break;case 34963:r&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,i.bindBuffer(34963,null),n.glElementArrayBuffer=null;break;case 35345:i.bindBuffer(35345,null),n.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function T$t(t,e){var i=t.gl,n=t.getStateCache(),r=2&e.memUsage?35048:35044;8&e.usage?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(34962,e.glBuffer),e.buffer?i.bufferData(34962,e.buffer,r):i.bufferData(34962,e.size,r),i.bindBuffer(34962,null),n.glArrayBuffer=null):4&e.usage?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),F$t.gpuInputAssembler=null,n.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(34963,e.glBuffer),e.buffer?i.bufferData(34963,e.buffer,r):i.bufferData(34963,e.size,r),i.bindBuffer(34963,null),n.glElementArrayBuffer=null):16&e.usage?(n.glUniformBuffer!==e.glBuffer&&i.bindBuffer(35345,e.glBuffer),i.bufferData(35345,e.size,r),i.bindBuffer(35345,null),n.glUniformBuffer=null):(64&e.usage||2&e.usage||1&e.usage||ot(16315),e.glTarget=0)}function C$t(t,e,i,n,r){if(64&e.usage){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;ar.maxTextureSize&&ot(9100,u,r.maxTextureSize),1===e.samples){if(e.glTexture=i.createTexture(),e.size>0){var l=n.glTexUnits[n.texUnit];if(l.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),l.glTexture=e.glTexture),M_[e.format].isCompressed)for(var c=0;c>1),a=u$t(1,a>>1)}else 128&e.flags?i.texImage2D(3553,0,e.glInternalFmt,s,a,0,e.glFormat,e.glType,null):i.texStorage2D(3553,e.mipLevel,e.glInternalFmt,s,a)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(36161,e.samples,e.glInternalFmt,e.width,e.height));break;case 5:e.glTarget=35866;var _=u$t(s,a);if(_>r.maxTextureSize&&ot(9100,_,r.maxTextureSize),h>r.maxArrayTextureLayers&&ot(9100,h,r.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var p=n.glTexUnits[n.texUnit];if(p.glTexture!==e.glTexture&&(i.bindTexture(35866,e.glTexture),p.glTexture=e.glTexture),M_[e.format].isCompressed)for(var m=0;m>1),a=u$t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var y=u$t(u$t(s,a),o);if(y>r.max3DTextureSize&&ot(9100,y,r.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var b=n.glTexUnits[n.texUnit];if(b.glTexture!==e.glTexture&&(i.bindTexture(32879,e.glTexture),b.glTexture=e.glTexture),M_[e.format].isCompressed)for(var S=0;S>1),a=u$t(1,a>>1)}else i.texStorage3D(32879,e.mipLevel,e.glInternalFmt,s,a,o)}break;case 3:e.glTarget=34067;var T=u$t(s,a);if(T>r.maxCubeMapTextureSize&&ot(9100,T,r.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var C=n.glTexUnits[n.texUnit];if(C.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),C.glTexture=e.glTexture),M_[e.format].isCompressed)for(var A=0;A>1),a=u$t(1,a>>1)}else i.texStorage2D(34067,e.mipLevel,e.glInternalFmt,s,a)}break;default:ot(16317),e.type=1,e.glTarget=3553}}function D$t(t,e){var i=t.gl,n=t.getStateCache();if(e.glTexture){var r=n.glTexUnits,s=n.texUnit;i.deleteTexture(e.glTexture);for(var a=0;ar.maxTextureSize&&ot(9100,u,r.maxTextureSize),1===e.samples){var l=n.glTexUnits[n.texUnit];if(l.glTexture!==e.glTexture&&(i.bindTexture(3553,e.glTexture),l.glTexture=e.glTexture),M_[e.format].isCompressed)for(var c=0;c>1),a=u$t(1,a>>1)}else D$t(t,e),A$t(t,e)}else e.glRenderbuffer&&(n.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(36161,e.glRenderbuffer),n.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(36161,e.samples,e.glInternalFmt,e.width,e.height));break;case 5:e.glTarget=35866;var _=u$t(s,a);if(_>r.maxTextureSize&&ot(9100,_,r.maxTextureSize),h>r.maxArrayTextureLayers&&ot(9100,h,r.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var p=n.glTexUnits[n.texUnit];if(p.glTexture!==e.glTexture&&(i.bindTexture(35866,e.glTexture),p.glTexture=e.glTexture),M_[e.format].isCompressed)for(var m=0;m>1),a=u$t(1,a>>1)}else i.texStorage3D(35866,e.mipLevel,e.glInternalFmt,s,a,h)}break;case 2:e.glTarget=32879;var y=u$t(u$t(s,a),o);if(y>r.max3DTextureSize&&ot(9100,y,r.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var b=n.glTexUnits[n.texUnit];if(b.glTexture!==e.glTexture&&(i.bindTexture(32879,e.glTexture),b.glTexture=e.glTexture),M_[e.format].isCompressed)for(var S=0;S>1),a=u$t(1,a>>1)}else i.texStorage3D(32879,e.mipLevel,e.glInternalFmt,s,a,o)}break;case 3:e.type=3,e.glTarget=34067;var T=u$t(s,a);T>r.maxCubeMapTextureSize&&ot(9100,T,r.maxTextureSize);var C=n.glTexUnits[n.texUnit];if(C.glTexture!==e.glTexture&&(i.bindTexture(34067,e.glTexture),C.glTexture=e.glTexture),M_[e.format].isCompressed)for(var A=0;A<6;++A){s=e.width,a=e.height;for(var D=0;D>1),a=u$t(1,a>>1)}}else D$t(t,e),A$t(t,e);break;default:ot(16317),e.type=1,e.glTarget=3553}}}function B$t(t,e){for(var i=t.gl,n=e.glSamplers.values().next();!n.done;){i.deleteSampler(n.value);for(var r=t.getStateCache().glSamplerUnits,s=0;s>h.baseLevel),e.height=l$t(e.height,u.height>>h.baseLevel))}var l=e.gpuDepthStencilView;if(l){var c=l.gpuTexture,f=M_[c.format].hasStencil?33306:36096;c.glTexture?r.framebufferTexture2D(36160,f,c.glTarget,c.glTexture,e.gpuDepthStencilView.baseLevel):r.framebufferRenderbuffer(36160,f,36161,c.glRenderbuffer),e.width=l$t(e.width,c.width>>l.baseLevel),e.height=l$t(e.height,c.height>>l.baseLevel)}r.drawBuffers(s);var d=r.checkFramebufferStatus(36160);if(36053!==d)switch(d){case 36054:ot(16318);break;case 36055:ot(16319);break;case 36057:ot(16320);break;case 36061:ot(16321)}i.glFramebuffer!==e.glFramebuffer&&r.bindFramebuffer(36160,i.glFramebuffer)}}function P$t(t,e){var i=t.gl,n=t.getStateCache();e.glFramebuffer&&(i.deleteFramebuffer(e.glFramebuffer),n.glFramebuffer===e.glFramebuffer&&(i.bindFramebuffer(36160,null),n.glFramebuffer=null),e.glFramebuffer=null)}function E$t(t,e){for(var i,n=t.gl,r=t.getStateCache(),s=t.capabilities,a=function(){var t=e.gpuStages[o],i=0,r="",s=1;switch(t.type){case 1:r="VertexShader",i=35633;break;case 16:r="FragmentShader",i=35632;break;default:return ot(16322),{v:void 0}}var a=n.createShader(i);if(a&&(t.glShader=a,n.shaderSource(t.glShader,"#version 300 es\n"+t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,35713))){ot(16323,r,e.name),ot(16324,t.source.replace(/^|\n/g,(function(){return"\n"+s+++" "}))),Y(n.getShaderInfoLog(t.glShader));for(var h=0;h0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;O=0&&D.gpuDescriptors[I];if(B&&B.gpuBuffer){var M=T[A.set],P=M&&M[A.binding],E=B.gpuBuffer.glOffset;P>=0&&(E+=r[P]),h.glBindUBOs[A.glBinding]===B.gpuBuffer.glBuffer&&h.glBindUBOOffsets[A.glBinding]===E||(E?a.bindBufferRange(35345,A.glBinding,B.gpuBuffer.glBuffer,E,B.gpuBuffer.size):a.bindBufferBase(35345,A.glBinding,B.gpuBuffer.glBuffer),h.glUniformBuffer=h.glBindUBOs[A.glBinding]=B.gpuBuffer.glBuffer,h.glBindUBOOffsets[A.glBinding]=E)}}for(var k=d.glSamplerTextures.length,O=0;O=0&&F.gpuDescriptors[L],N=0;N0){G.glTexture!==H.glTexture&&(h.texUnit!==z&&(a.activeTexture(33984+z),h.texUnit=z),H.glTexture?a.bindTexture(H.glTarget,H.glTexture):a.bindTexture(H.glTarget,t.nullTex2D.gpuTexture.glTexture),G.glTexture=H.glTexture);var q=V.gpuSampler.getGLSampler(t,W,j);h.glSamplerUnits[z]!==q&&(a.bindSampler(z,q),h.glSamplerUnits[z]=q)}V=F.gpuDescriptors[++L]}}}if(i&&d&&(_||F$t.gpuInputAssembler!==i))if(F$t.gpuInputAssembler=i,t.extensions.useVAO){var X=i.glVAOs.get(d.glProgram);if(!X){var Y;X=a.createVertexArray(),i.glVAOs.set(d.glProgram,X),a.bindVertexArray(X),a.bindBuffer(34962,null),a.bindBuffer(34963,null),h.glArrayBuffer=null,h.glElementArrayBuffer=null;for(var Q=0;Q=0&&(a.enableVertexAttribArray(lt),h.glEnabledAttribLocs[lt]=!0),h.glCurrentAttribLocs[lt]=!0,a.vertexAttribPointer(lt,at.count,at.glType,at.isNormalized,at.stride,ct),a.vertexAttribDivisor(lt,at.isInstanced?1:0)}}}var ft=i.gpuIndexBuffer;ft&&h.glElementArrayBuffer!==ft.glBuffer&&(a.bindBuffer(34963,ft.glBuffer),h.glElementArrayBuffer=ft.glBuffer);for(var dt=0;dt0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var f=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}function z$t(t,e){if(t.length>1||e.length>1)return!1;if(t[0]instanceof HTMLVideoElement){var i=t[0];return 0===e[0].texOffset.x&&0===e[0].texOffset.y&&e[0].texExtent.width===i.videoWidth&&e[0].texExtent.height===i.videoHeight}return!1}function G$t(t,e,i,n){var r=t.gl,s=t.getStateCache(),a=s.glTexUnits[s.texUnit];a.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),a.glTexture=i.glTexture);var o=0,h=0;switch(i.glTarget){case 3553:if(128&i.flags||z$t(e,n))r.texImage2D(3553,n[0].texSubres.mipLevel,i.glInternalFmt,n[0].texExtent.width,n[0].texExtent.height,0,i.glFormat,i.glType,e[0]);else for(var u=0;u0?g.buffStride:d.width,p.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var y=g.texExtent.width+_.x===i.width>>v?g.texExtent.width:d.width,b=g.texExtent.height+_.y===i.height>>v?g.texExtent.height:d.height,S=void 0,x=e[o++];if(p.width===d.width&&p.height===d.height){var w=R_(i.format,y,b,1)/l.BYTES_PER_ELEMENT;ut(Number.isInteger(w),9101),S=new l(x.buffer,x.byteOffset+g.buffOffset,w)}else S=H$t(x,i.format,g.buffOffset,p,d);c?36196!==i.glInternalFmt?r.compressedTexSubImage2D(3553,v,_.x,_.y,y,b,i.glFormat,S):r.compressedTexImage2D(3553,v,i.glInternalFmt,y,b,0,S):r.texSubImage2D(3553,v,_.x,_.y,y,b,i.glFormat,i.glType,S)}break;case 35866:for(var T=0;T0?C.buffStride:d.width,p.height=C.buffTexHeight>0?C.buffTexHeight:d.height;var D=C.texExtent.width+_.x===i.width>>A?C.texExtent.width:d.width,I=C.texExtent.height+_.y===i.height>>A?C.texExtent.height:d.height,B=C.texSubres.baseArrayLayer+C.texSubres.layerCount;for(h=C.texSubres.baseArrayLayer;h0?O.buffStride:d.width,p.height=O.buffTexHeight>0?O.buffTexHeight:d.height;var F=O.texExtent.width+_.x===i.width>>R?O.texExtent.width:d.width,L=O.texExtent.height+_.y===i.height>>R?O.texExtent.height:d.height,V=void 0,N=e[o++];if(p.width===d.width&&p.height===d.height){var z=R_(i.format,F,L,d.depth)/l.BYTES_PER_ELEMENT;ut(Number.isInteger(z),9101),V=new l(N.buffer,N.byteOffset+O.buffOffset,z)}else V=H$t(N,i.format,O.buffOffset,p,d);c?36196!==i.glInternalFmt?r.compressedTexSubImage3D(35866,R,_.x,_.y,_.z,F,L,d.depth,i.glFormat,V):r.compressedTexImage3D(35866,R,i.glInternalFmt,F,L,d.depth,0,V):r.texSubImage3D(35866,R,_.x,_.y,_.z,F,L,d.depth,i.glFormat,i.glType,V)}break;case 34067:for(var G=0;G0?U.buffStride:d.width,p.height=U.buffTexHeight>0?U.buffTexHeight:d.height;var W=U.texExtent.width+_.x===i.width>>H?U.texExtent.width:d.width,j=U.texExtent.height+_.y===i.height>>H?U.texExtent.height:d.height,q=U.texSubres.baseArrayLayer+U.texSubres.layerCount;for(h=U.texSubres.baseArrayLayer;h0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=on(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),Q$t=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=X$t.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=X$t.instance.gl;t.deleteFramebuffer(this._srcFramebuffer),t.deleteFramebuffer(this._dstFramebuffer)},n(t,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),t}(),K$t=function(t){function e(){var e;return(e=t.call(this)||this)._gpuBuffer=null,e}s(e,t);var i=e.prototype;return i.getGpuBuffer=function(){return this._gpuBuffer},i.initialize=function(t){if("buffer"in t){this._isBufferView=!0;var e=t.buffer;this._usage=e.usage,this._memUsage=e.memUsage,this._size=this._stride=t.range,this._count=1,this._flags=e.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:e.getGpuBuffer().indirects,glTarget:e.getGpuBuffer().glTarget,glBuffer:e.getGpuBuffer().glBuffer,glOffset:t.offset}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:new Y$t,glTarget:0,glBuffer:null,glOffset:0},x$t(X$t.instance,this._gpuBuffer),X$t.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(w$t(X$t.instance,this._gpuBuffer),X$t.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)st(16379);else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(T$t(X$t.instance,this._gpuBuffer),X$t.instance.memoryStatus.bufferSize-=e,X$t.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?st(16380):(i=void 0!==e?e:64&this._usage?0:t.byteLength,C$t(X$t.instance,this._gpuBuffer,t,0,i))},e}(H_),J$t=function(t){function e(){var e;return(e=t.call(this)||this)._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUDescriptorSets=[],e._curGPUInputAssembler=null,e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new D_,e._isStateInvalid=!1,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=X$t.instance.bindingMappings.blockOffsets.length,i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.width:o},set width(t){o=t},get height(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.height:h},set height(t){h=t}},M$t(X$t.instance,this._gpuFramebuffer),this._gpuFramebuffer.gpuColorViews.forEach((function(t){return i._gpuColorViews.push(t.gpuTexture.glTexture)})),this._gpuDepthStencilView=null===(e=this._gpuFramebuffer.gpuDepthStencilView)||void 0===e?void 0:e.gpuTexture.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){this._gpuFramebuffer&&(P$t(X$t.instance,this._gpuFramebuffer),this._gpuFramebuffer=null,this._gpuColorViews.length=0,this._gpuDepthStencilView=null)},n(e,[{key:"needRebuild",get:function(){var t=this.getGpuFramebuffer();if(t){for(var e,i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=F_(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(I$t(X$t.instance,this._gpuTexture),X$t.instance.memoryStatus.textureSize-=n,X$t.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new jd;e.format=t.format,e.usage=M_[t.format].hasDepth?32:16,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(up),c0t="webglcontextlost";function f0t(t){t.activeTexture(33984),t.pixelStorei(3333,1),t.pixelStorei(3317,1),t.pixelStorei(37440,!1),t.bindFramebuffer(36160,null),t.enable(3089),t.enable(2884),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.enable(2929),t.depthMask(!0),t.depthFunc(513),t.stencilFuncSeparate(1028,519,1,65535),t.stencilOpSeparate(1028,7680,7680,7680),t.stencilMaskSeparate(1028,65535),t.stencilFuncSeparate(1029,519,1,65535),t.stencilOpSeparate(1029,7680,7680,7680),t.stencilMaskSeparate(1029,65535),t.disable(2960),t.disable(32926),t.disable(3042),t.blendEquationSeparate(32774,32774),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}function d0t(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n{r=A,f=e}));var n=Object.assign({},e),a="";"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),i&&(a=i),a=0!==a.indexOf("blob:")?a.substr(0,a.replace(/[?#].*/,"").lastIndexOf("/")+1):"",e.print||console.log.bind(console);var t,o=e.printErr||console.error.bind(console);Object.assign(e,n),n=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(t=e.wasmBinary),e.noExitRuntime;var c,b={Memory:function(A){this.buffer=new ArrayBuffer(65536*A.initial)},Module:function(){},Instance:function(A,r){this.exports=function(A){for(var r,f=new Uint8Array(123),e=25;e>=0;--e)f[48+e]=52+e,f[65+e]=e,f[97+e]=26+e;function i(A,r,e){for(var i,n,a=0,t=r,o=e.length,c=r+(3*o>>2)-("="==e[o-2])-("="==e[o-1]);a>4,t>2),t>2]=w[r>>2],w[e+64>>2]=w[r+64>>2],w[e+116>>2]=w[r+4>>2],w[e+68>>2]=w[r+68>>2],w[e+120>>2]=w[r+8>>2],w[e+72>>2]=w[r+72>>2],w[e+128>>2]=w[r+16>>2],w[e+80>>2]=w[r+80>>2],w[e+132>>2]=w[r+20>>2],w[e+84>>2]=w[r+84>>2],w[e+136>>2]=w[r+24>>2],w[e+88>>2]=w[r+88>>2],w[e+144>>2]=w[r+32>>2],w[e+96>>2]=w[r+96>>2],w[e+148>>2]=w[r+36>>2],w[e+100>>2]=w[r+100>>2],w[e+152>>2]=w[r+40>>2],w[e+104>>2]=w[r+104>>2],i=o[A+4>>2],u=w[i+44>>2],b=w[i+40>>2],d=w[i+36>>2],t=m(Zn[o[o[i>>2]+48>>2]](i)),c=m(Zn[o[o[i>>2]+48>>2]](i)),l=m(Zn[o[o[i>>2]+48>>2]](i)),o[e+36>>2]=0,b=m(b+c),w[e+28>>2]=b+b,b=m(d+t),w[e+24>>2]=b+b,u=m(u+l),w[e+32>>2]=u+u,A=o[A+8>>2],u=w[A+44>>2],b=w[A+40>>2],d=w[A+36>>2],t=m(Zn[o[o[A>>2]+48>>2]](A)),c=m(Zn[o[o[A>>2]+48>>2]](A)),l=m(Zn[o[o[A>>2]+48>>2]](A)),o[e+20>>2]=0,b=m(b+c),w[e+12>>2]=b+b,b=m(d+t),w[e+8>>2]=b+b,u=m(u+l),w[e+16>>2]=u+u,a=f,S=n=S-368|0,T=w[36+(A=e+112|0)>>2],L=w[A+4>>2],y=w[A+20>>2],E=w[A+40>>2],nA=w[A+8>>2],U=w[A+24>>2],d=w[8+(M=r+48|0)>>2],t=w[8+(f=r+112|0)>>2],B=w[M>>2],Z=w[f>>2],H=w[M+4>>2],X=w[f+4>>2],u=w[A+32>>2],dA=w[A>>2],b=w[A+16>>2],c=m(w[e+24>>2]*m(.5)),w[n+356>>2]=c,l=m(w[e+28>>2]*m(.5)),w[n+360>>2]=l,k=m(w[e+32>>2]*m(.5)),w[n+364>>2]=k,F=m(w[e+8>>2]*m(.5)),w[n+344>>2]=F,V=m(w[e+12>>2]*m(.5)),w[n+348>>2]=V,h=m(w[e+16>>2]*m(.5)),w[n+352>>2]=h,d=m(t-d),t=m(Z-B),B=m(X-H),Z=m(m(u*d)+m(m(dA*t)+m(b*B))),q=w[40+(r=e- -64|0)>>2],_=w[r+8>>2],j=w[r+24>>2],H=m(m(u*q)+m(m(dA*_)+m(b*j))),tA=m(Q(H)),$=w[r+36>>2],I=w[r+4>>2],AA=w[r+20>>2],X=m(m(u*$)+m(m(dA*I)+m(b*AA))),oA=m(Q(X)),rA=w[r+32>>2],fA=w[r>>2],eA=w[r+16>>2],D=m(m(u*rA)+m(m(dA*fA)+m(b*eA))),wA=m(Q(D));A:if(!((b=m(m(Q(Z))-m(m(h*tA)+m(m(V*oA)+m(m(F*wA)+c)))))>m(0)||(R=m(m(T*q)+m(m(L*_)+m(y*j))),cA=m(Q(R)),z=m(m(T*$)+m(m(L*I)+m(y*AA))),P=m(Q(z)),O=m(m(T*rA)+m(m(L*fA)+m(y*eA))),bA=m(Q(O)),u=m(-34028234663852886e22),b>m(-34028234663852886e22)&&(s=Zm(0)||(y=m(m(E*q)+m(m(nA*_)+m(U*j))),uA=m(Q(y)),x=m(m(E*$)+m(m(nA*I)+m(U*AA))),lA=m(Q(x)),g=m(m(E*rA)+m(m(nA*fA)+m(U*eA))),iA=m(Q(g)),um(0)||(um(0)||(um(0)||(um(0)||(um(1.1920928955078125e-7)||(U=m(lA+m(9999999747378752e-21)),q=m(P+m(9999999747378752e-21)),_=m(wA+m(9999999747378752e-21)),P=m(-T),B=m(0),bA=m(O*O),lA=m(m(g*g)+m(0)),(j=m(N(m(bA+lA))))>m(1.1920928955078125e-7)?(t=m(0),b=m(b/j),d=m(0),m(b*m(1.0499999523162842))>u&&(s=$m(1.1920928955078125e-7)||(j=m(uA+m(9999999747378752e-21)),$=m(cA+m(9999999747378752e-21)),cA=m(z*z),uA=m(m(x*x)+m(0)),(I=m(N(m(cA+uA))))>m(1.1920928955078125e-7)&&(b=m(b/I),m(b*m(1.0499999523162842))>u&&(s=iAm(1.1920928955078125e-7)||(iA=m(R*R),tA=m(m(y*y)+m(0)),(I=m(N(m(iA+tA))))>m(1.1920928955078125e-7)&&(b=m(b/I),m(b*m(1.0499999523162842))>u&&(s=Pm(1.1920928955078125e-7)||(I=m(-E),oA=m(D*D),(E=m(N(m(oA+lA))))>m(1.1920928955078125e-7)&&(b=m(b/E),m(b*m(1.0499999523162842))>u&&(s=Pm(1.1920928955078125e-7)||(P=m(X*X),(g=m(N(m(P+uA))))>m(1.1920928955078125e-7)&&(b=m(b/g),m(b*m(1.0499999523162842))>u&&(s=Em(1.1920928955078125e-7)||(E=m(H*H),(x=m(N(m(E+tA))))>m(1.1920928955078125e-7)&&(b=m(b/x),m(b*m(1.0499999523162842))>u&&(s=gm(1.1920928955078125e-7)||(y=m(-Z),(Z=m(N(m(m(bA+oA)+m(0)))))>m(1.1920928955078125e-7)&&(b=m(b/Z),m(b*m(1.0499999523162842))>u&&(s=xm(1.1920928955078125e-7)||((h=m(N(m(m(cA+P)+m(0)))))>m(1.1920928955078125e-7)&&(b=m(b/h),m(b*m(1.0499999523162842))>u&&(s=Zm(1.1920928955078125e-7))))))))))))))))){r:{f:{if((h=m(N(m(m(iA+E)+m(0)))))>m(1.1920928955078125e-7)&&(b=m(b/h),m(b*m(1.0499999523162842))>u))s=Z>2]=h,Z=m(m(w[A+24>>2]*t)+m(m(w[A+16>>2]*B)+m(d*w[A+20>>2]))),w[e+52>>2]=Z,u=m(m(w[A+40>>2]*t)+m(m(w[A+32>>2]*B)+m(d*w[A+36>>2])));break r}h=w[p>>2],w[e+48>>2]=h,Z=w[p+16>>2],w[e+52>>2]=Z,b=u,u=w[p+32>>2]}if(w[e+56>>2]=u,s&&(w[e+56>>2]=-u,w[e+52>>2]=-Z,w[e+48>>2]=-h),w[e+44>>2]=-b,C>>>0>=7)o[n+120>>2]=o[M+8>>2],i=o[M+4>>2],o[n+112>>2]=o[M>>2],o[n+116>>2]=i,u=w[e+56>>2],B=w[A+40>>2],d=w[e+48>>2],h=w[A+8>>2],t=w[e+52>>2],Z=w[A+24>>2],k=m(m(u*B)+m(m(d*h)+m(t*Z)))>m(0)?k:m(-k),E=m(k*B),B=w[A+36>>2],H=w[A+4>>2],X=w[A+20>>2],l=m(m(u*B)+m(m(d*H)+m(t*X)))>m(0)?l:m(-l),g=m(l*B),B=w[A+32>>2],D=w[A>>2],R=w[A+16>>2],c=m(m(u*B)+m(m(d*D)+m(t*R)))>m(0)?c:m(-c),w[n+120>>2]=E+m(g+m(m(c*B)+w[n+120>>2])),w[n+112>>2]=m(k*h)+m(m(l*H)+m(m(c*D)+w[n+112>>2])),w[n+116>>2]=m(k*Z)+m(m(l*X)+m(m(c*R)+w[n+116>>2])),o[n+216>>2]=o[f+8>>2],i=o[f+4>>2],o[n+208>>2]=o[f>>2],o[n+212>>2]=i,c=w[n+352>>2],l=w[r+40>>2],k=w[r+8>>2],B=w[r+24>>2],c=m(m(u*l)+m(m(d*k)+m(t*B)))>m(0)?m(-c):c,D=m(c*l),R=m(-V),E=V,V=w[r+36>>2],h=w[r+4>>2],Z=w[r+20>>2],l=m(m(u*V)+m(m(d*h)+m(t*Z)))>m(0)?R:E,g=m(-F),E=F,F=w[r+32>>2],R=d,d=w[r>>2],X=t,t=w[r+16>>2],u=m(m(u*F)+m(m(R*d)+m(X*t)))>m(0)?g:E,F=m(D+m(m(l*V)+m(m(u*F)+w[n+216>>2]))),w[n+216>>2]=F,k=m(m(c*k)+m(m(l*h)+m(m(u*d)+w[n+208>>2]))),w[n+208>>2]=k,t=m(m(c*B)+m(m(l*Z)+m(m(u*t)+w[n+212>>2]))),w[n+212>>2]=t,A=(((f=C-7&255)>>>0)/3<<2)+A|0,w[n+288>>2]=w[A>>2],w[n+292>>2]=w[A+16>>2],w[n+296>>2]=w[A+32>>2],c=w[(A=r+((f>>>0)%3<<2)|0)>>2],w[n+80>>2]=c,l=w[A+16>>2],w[n+84>>2]=l,V=w[A+32>>2],w[n+88>>2]=V,A=n+208|0,r=n- -64|0,d=m(0),B=w[n+296>>2],h=w[n+88>>2],Z=w[n+288>>2],H=w[n+80>>2],X=w[n+292>>2],D=w[n+84>>2],u=m(m(B*h)+m(m(Z*H)+m(X*D))),(R=m(m(1)-m(u*u)))<=m(9999999747378752e-20)?u=m(0):(R=m(m(1)/R),d=m(w[A+8>>2]-w[n+120>>2]),E=m(B*d),B=m(w[A>>2]-w[n+112>>2]),g=m(Z*B),Z=m(w[A+4>>2]-w[n+116>>2]),X=m(E+m(g+m(X*Z))),B=m(m(h*d)+m(m(H*B)+m(D*Z))),d=m(R*m(m(u*X)-B)),u=m(R*m(X-m(u*B)))),w[n+328>>2]=u,w[r>>2]=d,u=w[n+64>>2],w[n+216>>2]=m(V*u)+F,w[n+212>>2]=m(l*u)+t,w[n+208>>2]=m(c*u)+k,u=w[e+48>>2],d=w[e+52>>2],t=w[e+56>>2],o[n+44>>2]=0,w[n+40>>2]=-t,w[n+36>>2]=-d,w[n+32>>2]=-u,Zn[o[o[a>>2]+16>>2]](a,n+32|0,A,b),o[e+40>>2]=C;else{u=w[e+48>>2],C>>>0<=3?(d=w[e+56>>2],p=n+356|0,i=f,f=r,v=n+344|0,b=w[e+52>>2]):(u=m(-u),d=m(-w[e+56>>2]),p=n+344|0,i=M,M=f,f=A,A=r,v=n+356|0,b=m(-w[e+52>>2])),c=m(m(w[f+32>>2]*d)+m(m(w[f>>2]*u)+m(b*w[f+16>>2]))),w[n+328>>2]=c,l=m(m(w[f+36>>2]*d)+m(m(w[f+4>>2]*u)+m(b*w[f+20>>2]))),w[n+332>>2]=l,t=m(m(w[f+40>>2]*d)+m(m(w[f+8>>2]*u)+m(b*w[f+24>>2]))),w[n+336>>2]=t,t=m(Q(t)),(l=m(Q(l)))>(c=m(Q(c)))?(r=(s=t>2],t=w[r+(n+328|0)>>2]>2])+m(w[i+8>>2]-w[M+8>>2])),V=m(m(t*w[r+16>>2])+m(w[i+4>>2]-w[M+4>>2])),B=m(m(t*w[r>>2])+m(w[i>>2]-w[M>>2])),vA=s?2:1,r=1,i=2;r:{f:{e:switch(0|(hA=(C>>>0<4?-1:-4)+C|0)){case 0:break r;case 1:break e;default:break f}r=0;break r}i=1,r=0}t=w[32+(r=(s=r<<2)+A|0)>>2],c=w[r>>2],l=w[r+16>>2],k=w[32+(A=(r=i<<2)+A|0)>>2],h=w[A>>2],Z=w[A+16>>2],H=m(m(F*k)+m(m(B*h)+m(V*Z))),D=w[32+(sA=(A=K<<2)+f|0)>>2],R=w[sA>>2],z=w[sA+16>>2],X=m(m(k*D)+m(m(h*R)+m(Z*z))),O=w[A+v>>2],T=m(X*O),y=m(H+T),x=w[32+(aA=(A=vA<<2)+f|0)>>2],g=w[aA>>2],E=w[aA+16>>2],h=m(m(k*x)+m(m(h*g)+m(Z*E))),L=w[A+v>>2],k=m(h*L),w[n+316>>2]=y-k,Z=m(m(F*t)+m(m(B*c)+m(V*l))),D=m(m(t*D)+m(m(c*R)+m(l*z))),z=m(O*D),O=m(Z+z),R=m(m(t*x)+m(m(c*g)+m(l*E))),t=m(L*R),w[n+312>>2]=O-t,w[n+308>>2]=y+k,w[n+304>>2]=O+t,c=m(H-T),w[n+300>>2]=c+k,l=m(Z-z),w[n+296>>2]=l+t,w[n+292>>2]=c-k,w[n+288>>2]=l-t,w[n+280>>2]=w[s+p>>2],w[n+284>>2]=w[r+p>>2],i=n+208|0,s=0,S=W=S+-64|0,t=w[n+280>>2],k=w[n+288>>2],t>(c=m(-k))?(w[i>>2]=k,w[i+4>>2]=w[n+292>>2],t=w[n+280>>2],k=w[n+288>>2],c=m(-k),s=1,r=i+8|0):r=i,A=t>c,c=w[n+296>>2],(0|A)!=((l=m(-c))>2],w[r+4>>2]=m(m(m(w[n+300>>2]-l)/m(c-k))*m(m(-t)-k))+l,w[r>>2]=-w[n+280>>2],s=s+1|0,t=w[n+280>>2],c=w[n+296>>2],l=m(-c),r=r+8|0),t>l&&(w[r>>2]=c,w[r+4>>2]=w[n+300>>2],s=s+1|0,t=w[n+280>>2],c=w[n+296>>2],l=m(-c),r=r+8|0),A=t>l,l=w[n+304>>2],(0|A)!=((k=m(-l))>2],w[r+4>>2]=m(m(m(w[n+308>>2]-k)/m(l-c))*m(m(-t)-c))+k,w[r>>2]=-w[n+280>>2],s=s+1|0,t=w[n+280>>2],l=w[n+304>>2],k=m(-l),r=r+8|0),t>k&&(w[r>>2]=l,w[r+4>>2]=w[n+308>>2],s=s+1|0,t=w[n+280>>2],l=w[n+304>>2],k=m(-l),r=r+8|0),A=t>k,c=w[n+312>>2],(0|A)!=((k=m(-c))>2],w[r+4>>2]=m(m(m(w[n+316>>2]-k)/m(c-l))*m(m(-t)-l))+k,w[r>>2]=-w[n+280>>2],s=s+1|0,t=w[n+280>>2],c=w[n+312>>2],k=m(-c),r=r+8|0),t>k&&(w[r>>2]=c,w[r+4>>2]=w[n+316>>2],s=s+1|0,t=w[n+280>>2],c=w[n+312>>2],k=m(-c),r=r+8|0);r:{f:{if(l=w[n+288>>2],(m(-l)k|0)){if(!s){r=0;break f}}else if(k=w[n+316>>2],w[r+4>>2]=m(m(m(w[n+292>>2]-k)/m(l-c))*m(m(-t)-c))+k,w[r>>2]=-w[n+280>>2],r=8,8&(s=s+1|0))break r;if((t=w[n+280>>2])>(c=w[i>>2])?(w[W>>2]=c,w[W+4>>2]=w[i+4>>2],t=w[n+280>>2],c=w[i>>2],r=1,A=8|W):(r=0,A=W),v=i+8|0,((l=w[i+((Y=s>>>0>1)<<3)>>2])c|0)&&(k=w[i+4>>2],w[A+4>>2]=m(m(m(w[(Y?v:i)+4>>2]-k)/m(l-c))*m(t-c))+k,w[A>>2]=w[n+280>>2],r=r+1|0,A=A+8|0),!((0|s)<2)){if((t=w[v>>2])<(c=w[n+280>>2])&&(w[A>>2]=t,w[A+4>>2]=w[i+12>>2],r=r+1|0,c=w[n+280>>2],t=w[v>>2],A=A+8|0),v=i+16|0,(t>>0<4294967294)<<4)>>2])>2],w[A+4>>2]=m(m(m(w[(Y?v:i)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<3)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+20>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if(v=i+24|0,(t>2])>2],w[A+4>>2]=m(m(m(w[(Y?i:v)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<4)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+28>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if(v=i+32|0,(t>>0<4294967294)<<5)>>2])>2],w[A+4>>2]=m(m(m(w[(Y?v:i)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<5)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+36>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if(v=i+40|0,(t>2])>2],w[A+4>>2]=m(m(m(w[(Y?i:v)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<6)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+44>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if(v=i+48|0,(t>>0<4294967294)?48:0)>>2])>2],w[A+4>>2]=m(m(m(w[(Y?v:i)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<7)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+52>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if(v=i+56|0,(t>2])>2],w[A+4>>2]=m(m(m(w[(Y?i:v)+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0))break f;A=A+8|0}if(!((0|s)<8)){if((t=w[v>>2])<(c=w[n+280>>2])){if(w[A>>2]=t,w[A+4>>2]=w[i+60>>2],8&(r=r+1|0))break f;c=w[n+280>>2],t=w[v>>2],A=A+8|0}if((t>>0<4294967294)<<6)|0)>>2])>2],w[A+4>>2]=m(m(m(w[s+4>>2]-k)/m(l-t))*m(c-t))+k,w[A>>2]=w[n+280>>2],8&(r=r+1|0)))break f}}}}}}}if((0|r)<=0)r=0;else{for(kA=4|W,v=0,A=W,s=i;;){if(t=w[n+284>>2],l=w[A+4>>2],t>(c=m(-l))){if(w[s>>2]=w[A>>2],w[s+4>>2]=w[A+4>>2],8&(v=v+1|0)){r=v;break r}t=w[n+284>>2],l=w[A+4>>2],c=m(-l),s=s+8|0}if(Y=A+8|0,k=w[((BA=r>>>0>1)?A+12:kA)>>2],(m(-k)c|0)){if(c=w[A>>2],w[s>>2]=m(m(m(w[(BA?Y:W)>>2]-c)/m(k-l))*m(m(-t)-l))+c,w[s+4>>2]=-w[n+284>>2],8&(v=v+1|0)){r=v;break r}s=s+8|0}if(BA=(0|r)>1,r=r-1|0,A=Y,!BA)break}if(r=0,!((0|v)<=0))for(s=W,A=i;;){if((t=w[n+284>>2])>(c=w[A+4>>2])){if(w[s>>2]=w[A>>2],w[s+4>>2]=w[A+4>>2],8&(r=r+1|0))break f;t=w[n+284>>2],c=w[A+4>>2],s=s+8|0}if(Y=A+8|0,((l=w[(kA=v>>>0>1?Y:i)+4>>2])c|0)){if(k=w[A>>2],w[s>>2]=m(m(m(w[kA>>2]-k)/m(l-c))*m(t-c))+k,w[s+4>>2]=w[n+284>>2],8&(r=r+1|0))break f;s=s+8|0}if(kA=(0|v)>1,v=v-1|0,A=Y,!kA)break}}}pr(i,W,r<<3)}if(S=W- -64|0,!((0|r)<=0)){for(i=r,t=m(m(1)/m(m(D*h)-m(X*R))),l=m(t*m(-X)),k=m(t*m(-R)),h=m(h*t),X=m(D*t),D=w[(hA<<2)+p>>2],R=w[32+(A=(vA<<2)+f|0)>>2],z=w[32+(r=(K<<2)+f|0)>>2],O=w[A+16>>2],T=w[r+16>>2],y=w[aA>>2],x=w[sA>>2],A=0,r=0;f=(n+112|0)+G(A,12)|0,g=w[(s=(n+208|0)+(r<<3)|0)>>2],c=m(g-Z),E=w[s+4>>2],L=m(E-H),t=m(m(l*c)+m(X*L)),c=m(m(h*c)+m(k*L)),L=m(m(t*y)+m(m(c*x)+B)),w[f>>2]=L,nA=m(m(t*O)+m(m(c*T)+V)),w[f+4>>2]=nA,t=m(m(t*R)+m(m(c*z)+F)),w[f+8>>2]=t,t=m(D-m(m(d*t)+m(m(u*L)+m(b*nA)))),w[(n+80|0)+(A<<2)>>2]=t,t>=m(0)&&(w[4+(f=(n+208|0)+(A<<3)|0)>>2]=E,w[f>>2]=g,A=A+1|0),(0|i)!=(0|(r=r+1|0)););if(!((0|A)<=0)){r:if((K=(0|(r=(0|A)>=4?4:A))<=1?1:r)>>>0>=A>>>0){if(C>>>0>=4){for(r=0;f=(n+112|0)+G(r,12)|0,b=w[e+48>>2],u=w[(n+80|0)+(r<<2)>>2],w[n+32>>2]=m(w[f>>2]+w[M>>2])-m(b*u),d=w[e+52>>2],w[n+36>>2]=m(w[f+4>>2]+w[M+4>>2])-m(u*d),t=w[e+56>>2],w[n+40>>2]=m(w[f+8>>2]+w[M+8>>2])-m(u*t),o[n+76>>2]=0,w[n+72>>2]=-t,w[n+68>>2]=-d,w[n+64>>2]=-b,Zn[o[o[a>>2]+16>>2]](a,n- -64|0,n+32|0,m(-u)),(0|(r=r+1|0))!=(0|A););break r}for(r=0;f=(n+112|0)+G(r,12)|0,w[n+32>>2]=w[f>>2]+w[M>>2],w[n+36>>2]=w[f+4>>2]+w[M+4>>2],w[n+40>>2]=w[f+8>>2]+w[M+8>>2],u=w[e+48>>2],b=w[e+52>>2],d=w[e+56>>2],o[n+76>>2]=0,w[n+72>>2]=-d,w[n+68>>2]=-b,w[n+64>>2]=-u,Zn[o[o[a>>2]+16>>2]](a,n- -64|0,n+32|0,m(-w[(n+80|0)+(r<<2)>>2])),(0|(r=r+1|0))!=(0|A););}else{if(f=0,!(A>>>0<2)){if(W=3&(r=A-1|0),i=0,d=w[n+80>>2],A-2>>>0<3)r=1;else for(sA=-4&r,r=1;u=w[(s=n+80|0)+((aA=r+3|0)<<2)>>2],p=(b=w[s+(r<<2)>>2])>d,v=(t=w[s+((vA=r+1|0)<<2)>>2])>(b=p?b:d),d=(Y=(b=(s=(d=w[s+((hA=r+2|0)<<2)>>2])>(b=v?t:b))?d:b)>2])>d)?u:d,f=s?r:f,r=r+1|0,(0|W)!=(0|(i=i+1|0)););}W=n+208|0,p=n+32|0,i=0,b=m(0),t=m(0),c=m(0),S=s=S+-64|0;f:{e:{i:{n:{switch((r=A)-1|0){case 1:break i;case 0:break n}if((0|r)>=2)for(v=r-2|0;d=w[(A=W+(i<<3)|0)>>2],l=w[A+12>>2],k=w[A+4>>2],F=w[A+8>>2],u=m(m(d*l)-m(k*F)),b=m(b+u),t=m(m(u*m(l+k))+t),c=m(m(u*m(d+F))+c),A=(0|i)!=(0|v),i=i+1|0,A;);if(l=m(0xde0b6b000000000),V=b,b=w[(A=W+(r<<3)|0)-8>>2],d=w[W+4>>2],k=w[A-4>>2],F=w[W>>2],u=m(m(b*d)-m(k*F)),V=m(V+u),m(Q(V))>m(1.1920928955078125e-7)&&(l=m(m(1)/m(V*m(3)))),i=0,(0|r)<=0)break f;t=m(m(m(u*m(d+k))+t)*l),u=m(m(m(u*m(b+F))+c)*l);break e}t=w[W+4>>2],u=w[W>>2];break e}t=m(m(w[W+4>>2]+w[W+12>>2])*m(.5)),u=m(m(w[W>>2]+w[W+8>>2])*m(.5))}for(;ZA=(s+32|0)+(i<<2)|0,GA=zr(m(w[4+(A=W+(i<<3)|0)>>2]-t),m(w[A>>2]-u)),w[ZA>>2]=GA,(0|r)!=(0|(i=i+1|0)););if(J=0,v=0,r-1>>>0>=7)for(W=-8&r,A=0;o[(i=v<<2)+s>>2]=1,o[s+(4|i)>>2]=1,o[s+(8|i)>>2]=1,o[s+(12|i)>>2]=1,o[s+(16|i)>>2]=1,o[s+(20|i)>>2]=1,o[s+(24|i)>>2]=1,o[s+(28|i)>>2]=1,v=v+8|0,(0|W)!=(0|(A=A+8|0)););if(A=7&r)for(;i=1,o[s+(v<<2)>>2]=1,v=v+1|0,(0|A)!=(0|(J=J+1|0)););else i=1}if(o[(A=f<<2)+s>>2]=0,o[p>>2]=f,!((0|K)<2))if(J=p+4|0,i)for(d=m(m(6.2831854820251465)/m(0|K)),t=w[A+(s+32|0)>>2],p=1;;){for(o[J>>2]=f,c=(u=m(m(m(0|p)*d)+t))>m(3.1415927410125732)?m(u+m(-6.2831854820251465)):u,b=m(1e9),A=f,i=0;o[(W=i<<2)+s>>2]&&(u=(u=m(Q(m(w[W+(s+32|0)>>2]-c))))>m(3.1415927410125732)?m(m(6.2831854820251465)-u):u)>2]=i,A=i,b=u),(0|r)!=(0|(i=i+1|0)););if(o[s+(A<<2)>>2]=0,J=J+4|0,(0|K)==(0|(p=p+1|0)))break}else{if(A=7&(r=K-1|0),K-2>>>0>=7)for(r&=-8,i=0;o[J+28>>2]=f,o[J+24>>2]=f,o[J+20>>2]=f,o[J+16>>2]=f,o[J+12>>2]=f,o[J+8>>2]=f,o[J+4>>2]=f,o[J>>2]=f,J=J+32|0,(0|r)!=(0|(i=i+8|0)););if(A)for(i=0;o[J>>2]=f,J=J+4|0,(0|A)!=(0|(i=i+1|0)););}for(S=s- -64|0,f=C>>>0>3,A=0;i=o[(n+32|0)+(A<<2)>>2],r=(n+112|0)+G(i,12)|0,c=m(w[r>>2]+w[M>>2]),w[n+64>>2]=c,l=m(w[r+4>>2]+w[M+4>>2]),w[n+68>>2]=l,k=m(w[r+8>>2]+w[M+8>>2]),w[n+72>>2]=k,r=(n+80|0)+(i<<2)|0,f?(b=w[e+48>>2],d=w[e+52>>2],t=w[e+56>>2],o[n+28>>2]=0,w[n+24>>2]=-t,w[n+20>>2]=-d,w[n+16>>2]=-b,u=w[r>>2],o[n+12>>2]=0,w[n+8>>2]=k-m(t*u),w[n+4>>2]=l-m(d*u),w[n>>2]=c-m(b*u),Zn[o[o[a>>2]+16>>2]](a,n+16|0,n,m(-u))):(u=w[e+48>>2],b=w[e+52>>2],d=w[e+56>>2],o[n+28>>2]=0,w[n+24>>2]=-d,w[n+20>>2]=-b,w[n+16>>2]=-u,Zn[o[o[a>>2]+16>>2]](a,n+16|0,n- -64|0,m(-w[r>>2]))),(0|K)!=(0|(A=A+1|0)););}o[e+40>>2]=C}}}}S=n+368|0,S=e+160|0}function K(A,r,f){var e,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=m(0),h=0,B=0,Z=0,E=m(0),W=0,N=m(0),p=m(0),F=0,R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=0,C=0,J=0,x=0,y=0,M=0;S=e=S-144|0;A:if((0|f)<=0)!(r=o[A+12>>2])||!r|!v[A+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+12>>2]=0,a[A+16|0]=1,o[A+4>>2]=0,o[A+8>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,!(r=o[A+52>>2])||!r|!v[A+56|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+52>>2]=0,a[A+56|0]=1,o[A+44>>2]=0,o[A+48>>2]=0;else{if(a[e+112|0]=1,o[e+88>>2]=0,o[e+92>>2]=256,o[e+72>>2]=0,o[e+76>>2]=256,o[e+56>>2]=0,o[e+60>>2]=256,o[e+108>>2]=0,o[e+100>>2]=0,o[e+104>>2]=0,o[e+80>>2]=0,o[e+84>>2]=0,o[e+64>>2]=0,o[e+68>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,n=e+16|0,S=b=S-48|0,R=m(-1.0000000150474662e30),Y=m(1.0000000150474662e30),l=f,(0|f)>0)for(f=r,d=m(1.0000000150474662e30),E=m(1.0000000150474662e30),N=m(-1.0000000150474662e30),p=m(-1.0000000150474662e30);R=R<(V=w[f+8>>2])?V:R,N=N<(g=w[f+4>>2])?g:N,p=p<(X=w[f>>2])?X:p,Y=Y>V?V:Y,d=d>g?g:d,E=E>X?X:E,f=f+16|0,(0|l)!=(0|(s=s+1|0)););else p=m(-1.0000000150474662e30),N=m(-1.0000000150474662e30),E=m(1.0000000150474662e30),d=m(1.0000000150474662e30);if(o[n+12>>2]=0,o[n+28>>2]=0,w[n+24>>2]=m(R+Y)*m(.5),w[n+20>>2]=m(N+d)*m(.5),w[n+16>>2]=m(p+E)*m(.5),i=(E=m(p-E))<(d=m(N-d)),f=(N=m(R-Y))>(i?d:E)?2:i,o[n+112>>2]=f,i=(0|f)==(0|(i=N>(i?E:d)?!i:2))?f+(f>>>0>1?-2:1)|0:i,o[n+104>>2]=i,i=f+i|0,o[n+108>>2]=3-i,N=m(N*m(9788566967472434e-20)),N=(f=(0|f)==((4-i|0)%3|0))?N:m(-N),w[n+8>>2]=N,d=m(d*m(9788566967472434e-20)),d=f?d:m(-d),w[n+4>>2]=d,E=m(E*m(9788566967472434e-20)),E=f?E:m(-E),w[n>>2]=E,a[b+44|0]=1,o[b+36>>2]=0,o[b+40>>2]=0,(0|l)>0){if(o[8488]=o[8488]+1,y=b,M=0|Zn[o[8290]](l<<4,16),o[y+40>>2]=M,a[b+44|0]=1,o[b+36>>2]=l,o[b+32>>2]=l,!((0|l)<=0)){for(N=N!=m(0)?m(m(1)/N):N,p=d!=m(0)?m(m(1)/d):d,E=E!=m(0)?m(m(1)/E):E,k=(f=b+8|0)+(o[n+104>>2]<<2)|0,c=f+(o[n+112>>2]<<2)|0,W=f+(o[n+108>>2]<<2)|0,R=w[n+24>>2],Y=w[n+20>>2],V=w[n+16>>2],u=o[b+40>>2],s=0;d=w[r>>2],g=w[r+4>>2],X=w[r+8>>2],o[b+20>>2]=0,w[b+16>>2]=N*m(X-R),w[b+12>>2]=p*m(g-Y),w[b+8>>2]=E*m(d-V),f=u+(s<<4)|0,d=w[W>>2],i=m(Q(d))>2]=i,d=w[c>>2],i=m(Q(d))>2]=i,d=w[k>>2],o[f+12>>2]=s,i=m(Q(d))>2]=i,r=r+16|0,(0|l)!=(0|(s=s+1|0)););(0|l)<2||Dr(b+28|0,b+8|0,0,l-1|0)}}else o[b+32>>2]=l;if(o[n+44>>2]=l,o[n+40>>2]=0,o[n+36>>2]=o[n+32>>2],!((0|l)<=(0|(r=o[n+84>>2])))){if((0|l)>o[n+88>>2]){if(l?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](l<<2,16),c=o[n+84>>2]):(s=0,c=r),!((0|c)<=0)){if(k=0,f=0,c>>>0>=4)for(u=-4&c,i=0;o[(W=f<<2)+s>>2]=o[W+o[n+92>>2]>>2],o[(h=4|W)+s>>2]=o[h+o[n+92>>2]>>2],o[(h=8|W)+s>>2]=o[h+o[n+92>>2]>>2],o[(W|=12)+s>>2]=o[W+o[n+92>>2]>>2],f=f+4|0,(0|u)!=(0|(i=i+4|0)););if(i=3&c)for(;o[(c=f<<2)+s>>2]=o[c+o[n+92>>2]>>2],f=f+1|0,(0|i)!=(0|(k=k+1|0)););}!(f=o[n+92>>2])||!f|!v[n+96|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[n+92>>2]=s,a[n+96|0]=1,o[n+88>>2]=l}if(i=l+~r|0,k=l-r&3)for(f=0;o[o[n+92>>2]+(r<<2)>>2]=0,r=r+1|0,(0|k)!=(0|(f=f+1|0)););if(!(i>>>0<3))for(;o[(f=r<<2)+o[n+92>>2]>>2]=0,o[4+(f+o[n+92>>2]|0)>>2]=0,o[8+(f+o[n+92>>2]|0)>>2]=0,o[12+(f+o[n+92>>2]|0)>>2]=0,(0|l)!=(0|(r=r+4|0)););}if(o[n+84>>2]=l,(0|l)>0)for(u=0;;){if(!((i=o[n+40>>2])||((r=o[n+36>>2])?(o[n+36>>2]=o[r+8>>2],i=o[r>>2]):(o[8488]=o[8488]+1,r=0|Zn[o[8290]](12,16),f=o[n+44>>2],o[r+8>>2]=0,o[r+4>>2]=f,o[8488]=o[8488]+1,i=0|Zn[o[8290]](G(f,112),16),o[r>>2]=i,o[r+8>>2]=o[n+32>>2],o[n+32>>2]=r),(0|(W=o[r+4>>2]))<=0))){if(h=0,k=0,f=i,W>>>0>=4)for(B=-4&W,s=0,r=i,c=0;f=r+448|0,k=s+4|0,o[r+336>>2]=(0|W)>(0|k)?f:0,o[r+224>>2]=(0|W)>(3|s)?r+336|0:0,o[r+112>>2]=(0|W)>(2|s)?r+224|0:0,o[r>>2]=(0|W)>(1|s)?r+112|0:0,s=k,r=f,(0|B)!=(0|(c=c+4|0)););if(r=3&W)for(;s=f,f=f+112|0,k=k+1|0,o[s>>2]=(0|W)>(0|k)?f:0,(0|r)!=(0|(h=h+1|0)););}if(o[n+40>>2]=o[i>>2],o[i+16>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=0,o[i+4>>2]=0,o[i+104>>2]=-1,r=o[b+40>>2]+(u<<4)|0,f=o[r+4>>2],o[i+88>>2]=o[r>>2],o[i+92>>2]=f,f=o[r+12>>2],o[i+96>>2]=o[r+8>>2],o[i+100>>2]=f,o[o[n+92>>2]+(u<<2)>>2]=i,(0|l)==(0|(u=u+1|0)))break}if(!(r=o[b+40>>2])||!r|!v[b+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[b+40>>2]=0,a[b+44|0]=1,o[b+32>>2]=0,o[b+36>>2]=0,o[n+116>>2]=0,o[n+120>>2]=0,o[n+60>>2]=G(l,6),o[n+56>>2]=0,o[n+100>>2]=-3,o[n+52>>2]=o[n+48>>2],o[b+16>>2]=0,o[b+20>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,_(n,0,l,b+8|0),o[n+124>>2]=o[b+8>>2],!(r=o[b+40>>2])||!r|!v[b+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),S=b+48|0,(o[A+4>>2]&o[A+8>>2])<0&&(!(r=o[A+12>>2])||!r|!v[A+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+16|0]=1,o[A+8>>2]=0,o[A+12>>2]=0),o[A+4>>2]=0,!((0|(r=o[A+24>>2]))>=0)){if(o[A+28>>2]<0&&(!(f=o[A+32>>2])||!f|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),a[A+36|0]=1,o[A+28>>2]=0,o[A+32>>2]=0),f=r,k=0-r&3)for(;i=o[A+32>>2]+G(f,12)|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,f=f+1|0,(0|k)!=(0|(t=t+1|0)););if(!(r>>>0>4294967292))for(;i=(r=G(f,12))+o[A+32>>2]|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,i=r+o[A+32>>2]|0,o[i+20>>2]=0,o[i+12>>2]=0,o[i+16>>2]=0,i=r+o[A+32>>2]|0,o[i+32>>2]=0,o[i+24>>2]=0,o[i+28>>2]=0,r=r+o[A+32>>2]|0,o[r+44>>2]=0,o[r+36>>2]=0,o[r+40>>2]=0,f=f+4|0;);}if(o[A+24>>2]=0,(0|(f=o[A+44>>2]))<0&&(r=o[A+52>>2],o[A+48>>2]<0&&(!r||!r|!v[A+56|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+56|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,r=0),Af((i=r)+(r=f<<2)|0,0,0-r|0)),o[A+44>>2]=0,r=o[e+140>>2],!(o[r+104>>2]>=0)){for(o[r+104>>2]=0,o[8488]=o[8488]+1,l=0|Zn[o[8290]](4,16),o[l>>2]=r,f=0,k=1,n=1;;){W=f,S=i=S-16|0;r:{f:{e:{i:{if(h=o[(f<<2)+l>>2],o[(r=h)+100>>2]>=0)w[i+(o[e+124>>2]<<2)>>2]=o[r+88>>2];else if(d=yf(r+24|0),E=yf(f=r+72|0),t=o[r+100>>2],w[i+(o[e+124>>2]<<2)>>2]=d/E,(0|t)<0)break i;w[i+(o[e+128>>2]<<2)>>2]=o[r+92>>2];break e}if(d=yf(r+40|0),E=yf(f),f=o[r+100>>2],w[i+(o[e+128>>2]<<2)>>2]=d/E,(0|f)<0)break f}d=m(o[r+96>>2]);break r}d=m(yf(r+56|0)/yf(r+72|0))}if(w[i+(o[e+120>>2]<<2)>>2]=d,d=w[e+36>>2],E=w[e+40>>2],N=w[e+32>>2],p=w[e+16>>2],R=w[e+20>>2],Y=w[e+24>>2],V=w[i>>2],g=w[i+4>>2],X=w[i+8>>2],o[e+12>>2]=0,w[e+8>>2]=E+m(X*Y),w[e+4>>2]=d+m(g*R),w[e>>2]=N+m(V*p),S=i+16|0,(0|(t=o[A+4>>2]))==o[A+8>>2]&&!((0|(s=t?t<<1:1))<=(0|t))){if(s?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](s<<4,16),t=o[A+4>>2]):i=0,!((0|t)<=0)){if(f=0,1!=(0|t))for(B=-2&t,r=0;u=(b=f<<4)+i|0,c=b+o[A+12>>2]|0,Z=o[c+4>>2],o[u>>2]=o[c>>2],o[u+4>>2]=Z,Z=o[c+12>>2],o[u+8>>2]=o[c+8>>2],o[u+12>>2]=Z,b=(c=16|b)+i|0,c=c+o[A+12>>2]|0,u=o[c+4>>2],o[b>>2]=o[c>>2],o[b+4>>2]=u,u=o[c+12>>2],o[b+8>>2]=o[c+8>>2],o[b+12>>2]=u,f=f+2|0,(0|B)!=(0|(r=r+2|0)););1&t&&(r=(f<<=4)+i|0,f=f+o[A+12>>2]|0,t=o[f+4>>2],o[r>>2]=o[f>>2],o[r+4>>2]=t,t=o[f+12>>2],o[r+8>>2]=o[f+8>>2],o[r+12>>2]=t)}!(r=o[A+12>>2])||!r|!v[A+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+12>>2]=i,a[A+16|0]=1,o[A+8>>2]=s,t=o[A+4>>2]}if(f=o[e+4>>2],r=o[A+12>>2]+(t<<4)|0,o[r>>2]=o[e>>2],o[r+4>>2]=f,f=o[e+12>>2],o[r+8>>2]=o[e+8>>2],o[r+12>>2]=f,o[A+4>>2]=o[A+4>>2]+1,r=-1,s=-1,f=J=o[h+8>>2]){for(;;){if(o[f+20>>2]<0){if(t=b=o[A+24>>2],(0|b)==o[A+28>>2]&&!((0|(h=t?b<<1:1))<=(0|t))){if(h?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](G(h,12),16),i=o[A+24>>2]):(u=0,i=b),!((0|i)<=0)){if(t=0,1!=(0|i))for(D=-2&i,c=0;B=(Z=G(t,12))+o[A+32>>2]|0,F=o[B+4>>2],o[(Z=u+Z|0)>>2]=o[B>>2],o[Z+4>>2]=F,o[Z+8>>2]=o[B+8>>2],B=(Z=G(1|t,12))+o[A+32>>2]|0,F=o[B+4>>2],o[(Z=u+Z|0)>>2]=o[B>>2],o[Z+4>>2]=F,o[Z+8>>2]=o[B+8>>2],t=t+2|0,(0|D)!=(0|(c=c+2|0)););1&i&&(i=(t=G(t,12))+o[A+32>>2]|0,c=o[i+4>>2],o[(t=t+u|0)>>2]=o[i>>2],o[t+4>>2]=c,o[t+8>>2]=o[i+8>>2])}!(i=o[A+32>>2])||!i|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+32>>2]=u,a[A+36|0]=1,o[A+28>>2]=h,t=o[A+24>>2]}if(i=o[A+32>>2]+G(t,12)|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,c=o[A+24>>2]+1|0,o[A+24>>2]=c,o[A+28>>2]==(0|c)&&!((0|(i=c?c<<1:1))<=(0|c))){if(i?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](G(i,12),16),c=o[A+24>>2]):u=0,!((0|c)<=0)){if(Z=1&c,t=0,1!=(0|c))for(D=-2&c,c=0;h=(B=G(t,12))+o[A+32>>2]|0,F=o[h+4>>2],o[(B=u+B|0)>>2]=o[h>>2],o[B+4>>2]=F,o[B+8>>2]=o[h+8>>2],h=(B=G(1|t,12))+o[A+32>>2]|0,F=o[h+4>>2],o[(B=u+B|0)>>2]=o[h>>2],o[B+4>>2]=F,o[B+8>>2]=o[h+8>>2],t=t+2|0,(0|D)!=(0|(c=c+2|0)););Z&&(t=(c=G(t,12))+o[A+32>>2]|0,h=o[t+4>>2],o[(c=c+u|0)>>2]=o[t>>2],o[c+4>>2]=h,o[c+8>>2]=o[t+8>>2])}!(t=o[A+32>>2])||!t|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](t)),o[A+32>>2]=u,a[A+36|0]=1,o[A+28>>2]=i,c=o[A+24>>2]}if(i=o[A+32>>2]+G(c,12)|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,o[A+24>>2]=o[A+24>>2]+1,h=o[A+32>>2],o[f+20>>2]=b,F=b+1|0,o[o[f+8>>2]+20>>2]=F,B=G(b,12)+h|0,o[B+16>>2]=-1,o[B+4>>2]=1,Z=o[f+12>>2],(0|(i=o[Z+104>>2]))>=0)t=k,k=i;else{o[Z+104>>2]=k;r:if((0|n)!=(0|k)||(0|(c=n?n<<1:1))<=(0|n))i=l,c=n;else{c?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](c<<2,16)):i=0;f:if((0|n)>0){if(D=0,t=0,n>>>0>=4)for(x=-4&n,b=0;o[(u=t<<2)+i>>2]=o[u+l>>2],o[(C=4|u)+i>>2]=o[l+C>>2],o[(C=8|u)+i>>2]=o[l+C>>2],o[(u|=12)+i>>2]=o[u+l>>2],t=t+4|0,(0|x)!=(0|(b=b+4|0)););if(!(n&=3))break f;for(;o[(b=t<<2)+i>>2]=o[b+l>>2],t=t+1|0,(0|n)!=(0|(D=D+1|0)););}else if(!l)break r;l&&(o[8489]=o[8489]+1,Zn[o[8291]](l))}o[(k<<2)+i>>2]=Z,t=k+1|0,l=i,n=c}o[B+8>>2]=k,o[8+(G(F,12)+h|0)>>2]=W,k=t}if(i=t=o[f+20>>2],(0|r)>=0&&(o[o[A+32>>2]+G(t,12)>>2]=r-t,i=s),r=t,s=i,(0|J)==(0|(f=o[f>>2])))break}o[o[A+32>>2]+G(s,12)>>2]=r-s}if(!((0|k)>(0|(f=W+1|0))))break}for(b=0;;){if(t=h=o[o[(b<<2)+l>>2]+8>>2])for(;;){if((0|(f=o[t+20>>2]))>=0){if((0|(u=o[A+44>>2]))==o[A+48>>2]&&!((0|(n=u?u<<1:1))<=(0|u))){n?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](n<<2,16),u=o[A+44>>2]):i=0,r=o[A+52>>2];r:{f:if((0|u)>0){if(c=0,f=0,u>>>0>=4)for(B=-4&u,s=0;o[(k=f<<2)+i>>2]=o[r+k>>2],o[(Z=4|k)+i>>2]=o[r+Z>>2],o[(Z=8|k)+i>>2]=o[r+Z>>2],o[(k|=12)+i>>2]=o[r+k>>2],f=f+4|0,(0|B)!=(0|(s=s+4|0)););if(!(k=3&u))break f;for(;o[(s=f<<2)+i>>2]=o[r+s>>2],f=f+1|0,(0|k)!=(0|(c=c+1|0)););}else if(!r)break r;r&&v[A+56|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),u=o[A+44>>2]}o[A+52>>2]=i,a[A+56|0]=1,o[A+48>>2]=n,f=o[t+20>>2]}for(o[o[A+52>>2]+(u<<2)>>2]=f,o[A+44>>2]=o[A+44>>2]+1,f=t;o[f+20>>2]=-1,(0|t)!=(0|(f=o[o[f+8>>2]+4>>2])););}if((0|h)==(0|(t=o[t>>2])))break}if(r=(0|b)==(0|W),b=b+1|0,r)break}l&&l&&(o[8489]=o[8489]+1,Zn[o[8291]](l))}for(!(A=o[e+108>>2])||!A|!v[e+112|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[e+108>>2]=0,a[e+112|0]=1,o[e+100>>2]=0,o[e+104>>2]=0;A=o[e+80>>2];)o[e+80>>2]=o[A+8>>2],(r=o[A>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A));for(;A=o[e+64>>2];)o[e+64>>2]=o[A+8>>2],(r=o[A>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A));for(;;){if(!(A=o[e+48>>2]))break A;o[e+48>>2]=o[A+8>>2],(r=o[A>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}}S=e+144|0}function q(A,r,f){var e,i=0,n=0,c=m(0),b=0,u=0,l=0,s=0,k=m(0),d=0,B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),N=0,p=m(0),F=0,R=m(0),Y=m(0),V=0,g=0,X=0,D=m(0),C=0,J=0,x=m(0),y=0,M=0,H=0,I=m(0),T=m(0);if(S=e=S-32|0,X=o[A+56>>2],1!=(f-r|0)){G=f,b=f-(n=r)|0;A:{r:{if((0|n)>=(0|f))x=m(0|b);else{if(v[A+60|0])for(p=w[A+12>>2],Z=w[A+8>>2],Q=w[A+44>>2],k=w[A+40>>2],i=o[A+116>>2],B=w[A+4>>2],c=w[A+36>>2],f=r;Y=m(Y+m(m(m(m(m(h[6+(u=i+(f<<4)|0)>>1])/c)+B)+m(m(m(h[u>>1])/c)+B))*m(.5))),E=m(E+m(m(m(m(m(h[u+10>>1])/Q)+p)+m(m(m(h[u+4>>1])/Q)+p))*m(.5))),W=m(W+m(m(m(m(m(h[u+8>>1])/k)+Z)+m(m(m(h[u+2>>1])/k)+Z))*m(.5))),(0|G)!=(0|(f=f+1|0)););else for(i=o[A+76>>2],f=r;Y=m(Y+m(m(w[16+(u=i+(f<<6)|0)>>2]+w[u>>2])*m(.5))),E=m(E+m(m(w[u+24>>2]+w[u+8>>2])*m(.5))),W=m(W+m(m(w[u+20>>2]+w[u+4>>2])*m(.5))),(0|G)!=(0|(f=f+1|0)););if(x=m(0|b),(0|n)<(0|G))break r}E=m(0),W=m(0);break A}if(c=m(m(1)/x),I=m(c*E),T=m(c*W),Y=m(c*Y),W=m(0),v[A+60|0])for(D=w[A+12>>2],p=w[A+8>>2],Z=w[A+44>>2],Q=w[A+40>>2],f=o[A+116>>2],k=w[A+4>>2],B=w[A+36>>2],E=m(0);c=m(m(m(m(m(m(h[6+(i=f+(n<<4)|0)>>1])/B)+k)+m(m(m(h[i>>1])/B)+k))*m(.5))-Y),R=m(R+m(c*c)),c=m(m(m(m(m(m(h[i+10>>1])/Z)+D)+m(m(m(h[i+4>>1])/Z)+D))*m(.5))-I),W=m(W+m(c*c)),c=m(m(m(m(m(m(h[i+8>>1])/Q)+p)+m(m(m(h[i+2>>1])/Q)+p))*m(.5))-T),E=m(E+m(c*c)),(0|G)!=(0|(n=n+1|0)););else for(f=o[A+76>>2],E=m(0);c=m(m(m(w[16+(i=f+(n<<6)|0)>>2]+w[i>>2])*m(.5))-Y),R=m(R+m(c*c)),c=m(m(m(w[i+24>>2]+w[i+8>>2])*m(.5))-I),W=m(W+m(c*c)),c=m(m(m(w[i+20>>2]+w[i+4>>2])*m(.5))-T),E=m(E+m(c*c)),(0|G)!=(0|(n=n+1|0)););}if(k=m(m(1)/m(x+m(-1))),f=(B=m(k*R))<(c=m(k*E)),b=m(k*W)>(f?c:B)?2:f,E=m(0),W=m(0),R=m(0),o[28+(l=S-96|0)>>2]=0,F=G-r|0,!(i=(0|r)>=(0|G)))if(v[A+60|0])for(p=w[A+12>>2],Z=w[A+8>>2],Q=w[A+44>>2],k=w[A+40>>2],n=o[A+116>>2],B=w[A+4>>2],c=w[A+36>>2],f=r;R=m(m(m(m(m(m(h[6+(u=n+(f<<4)|0)>>1])/c)+B)+m(m(m(h[u>>1])/c)+B))*m(.5))+R),E=m(m(m(m(m(m(h[u+10>>1])/Q)+p)+m(m(m(h[u+4>>1])/Q)+p))*m(.5))+E),W=m(m(m(m(m(m(h[u+8>>1])/k)+Z)+m(m(m(h[u+2>>1])/k)+Z))*m(.5))+W),(0|G)!=(0|(f=f+1|0)););else for(n=o[A+76>>2],f=r;R=m(m(m(w[16+(u=n+(f<<6)|0)>>2]+w[u>>2])*m(.5))+R),E=m(m(m(w[u+24>>2]+w[u+8>>2])*m(.5))+E),W=m(m(m(w[u+20>>2]+w[u+4>>2])*m(.5))+W),(0|G)!=(0|(f=f+1|0)););if(c=m(m(1)/m(0|F)),w[l+24>>2]=c*E,w[l+20>>2]=c*W,w[l+16>>2]=c*R,n=r,!i)for(D=w[(f=b<<2)+(l+16|0)>>2],d=f+l|0,f=r;(i=v[A+60|0])?(b=o[A+116>>2]+(f<<4)|0,p=w[A+44>>2],Z=w[A+12>>2],E=m(m(m(h[b+4>>1])/p)+Z),Q=w[A+40>>2],k=w[A+8>>2],W=m(m(m(h[b+2>>1])/Q)+k),B=w[A+36>>2],c=w[A+4>>2],R=m(m(m(h[b>>1])/B)+c),Y=m(m(m(h[b+10>>1])/p)+Z),x=m(m(m(h[b+8>>1])/Q)+k),c=m(m(m(h[b+6>>1])/B)+c)):(b=o[A+76>>2]+(f<<6)|0,E=w[b+8>>2],W=w[b+4>>2],R=w[b>>2],Y=w[b+24>>2],x=w[b+20>>2],c=w[b+16>>2]),o[l+12>>2]=0,w[l+8>>2]=m(Y+E)*m(.5),w[l+4>>2]=m(x+W)*m(.5),w[l>>2]=m(c+R)*m(.5),D>2]&&(i?(b=o[A+116>>2],i=o[12+(u=N=b+(f<<4)|0)>>2],o[l+40>>2]=o[u+8>>2],o[l+44>>2]=i,i=o[u+4>>2],o[l+32>>2]=o[u>>2],o[l+36>>2]=i,i=o[4+(u=(u=b)+(b=n<<4)|0)>>2],o[N>>2]=o[u>>2],o[N+4>>2]=i,i=o[u+12>>2],o[N+8>>2]=o[u+8>>2],o[N+12>>2]=i,i=o[l+36>>2],b=b+o[A+116>>2]|0,o[b>>2]=o[l+32>>2],o[b+4>>2]=i,i=o[l+44>>2],o[b+8>>2]=o[l+40>>2],o[b+12>>2]=i):(u=o[A+76>>2],i=o[60+(s=u+(f<<6)|0)>>2],o[l+88>>2]=o[s+56>>2],o[l+92>>2]=i,i=o[s+52>>2],o[l+80>>2]=o[s+48>>2],o[l+84>>2]=i,i=o[s+44>>2],o[l+72>>2]=o[s+40>>2],o[l+76>>2]=i,i=o[s+36>>2],o[(b=N=l- -64|0)>>2]=o[s+32>>2],o[b+4>>2]=i,i=o[s+28>>2],o[l+56>>2]=o[s+24>>2],o[l+60>>2]=i,i=o[s+20>>2],o[l+48>>2]=o[s+16>>2],o[l+52>>2]=i,i=o[s+12>>2],o[l+40>>2]=o[s+8>>2],o[l+44>>2]=i,i=o[s+4>>2],o[l+32>>2]=o[s>>2],o[l+36>>2]=i,i=o[4+(u=(b=n<<6)+u|0)>>2],o[s>>2]=o[u>>2],o[s+4>>2]=i,i=o[u+12>>2],o[s+8>>2]=o[u+8>>2],o[s+12>>2]=i,i=o[u+20>>2],o[s+16>>2]=o[u+16>>2],o[s+20>>2]=i,i=o[u+28>>2],o[s+24>>2]=o[u+24>>2],o[s+28>>2]=i,i=o[u+36>>2],o[s+32>>2]=o[u+32>>2],o[s+36>>2]=i,i=o[u+44>>2],o[s+40>>2]=o[u+40>>2],o[s+44>>2]=i,i=o[u+52>>2],o[s+48>>2]=o[u+48>>2],o[s+52>>2]=i,i=o[u+60>>2],o[s+56>>2]=o[u+56>>2],o[s+60>>2]=i,i=o[l+36>>2],b=b+o[A+76>>2]|0,o[b>>2]=o[l+32>>2],o[b+4>>2]=i,i=o[l+44>>2],o[b+8>>2]=o[l+40>>2],o[b+12>>2]=i,i=o[l+52>>2],o[b+16>>2]=o[l+48>>2],o[b+20>>2]=i,i=o[l+60>>2],o[b+24>>2]=o[l+56>>2],o[b+28>>2]=i,i=o[N+4>>2],o[b+32>>2]=o[N>>2],o[b+36>>2]=i,i=o[l+76>>2],o[b+40>>2]=o[l+72>>2],o[b+44>>2]=i,i=o[l+84>>2],o[b+48>>2]=o[l+80>>2],o[b+52>>2]=i,i=o[l+92>>2],o[b+56>>2]=o[l+88>>2],o[b+60>>2]=i),n=n+1|0),(0|G)!=(0|(f=f+1|0)););if(b=f=(F>>1)+r|0,s=(r+(f=(0|F)/3|0)|0)>=(0|n)||(G+~f|0)<=(0|n)?b:n,y=o[A+56>>2],v[A+60|0]?(p=w[A+40>>2],Z=w[A+8>>2],Q=w[A+24>>2],k=w[A+44>>2],B=w[A+12>>2],c=w[A+28>>2],f=o[A+136>>2]+(y<<4)|0,n=(D=m(m(w[A+20>>2]-w[A+4>>2])*w[A+36>>2]))=m(0)?~~D>>>0:0,t[f>>1]=65534&n,n=(c=m(m(c-B)*k))=m(0)?~~c>>>0:0,t[f+4>>1]=65534&n,n=(c=m(m(Q-Z)*p))=m(0)?~~c>>>0:0,t[f+2>>1]=65534&n):(f=o[A+24>>2],n=o[A+96>>2]+(y<<6)|0,o[n>>2]=o[A+20>>2],o[n+4>>2]=f,f=o[A+32>>2],o[n+8>>2]=o[A+28>>2],o[n+12>>2]=f),f=o[A+56>>2],v[A+60|0]?(k=w[A+40>>2],Z=w[A+8>>2],B=w[A+44>>2],Q=w[A+12>>2],f=o[A+136>>2]+(f<<4)|0,c=w[A+4>>2],n=(c=m(m(m(c-c)*w[A+36>>2])+m(1)))=m(0)?~~c>>>0:0,t[f+6>>1]=1|n,n=(c=m(m(m(Q-Q)*B)+m(1)))=m(0)?~~c>>>0:0,t[f+10>>1]=1|n,n=(c=m(m(m(Z-Z)*k)+m(1)))=m(0)?~~c>>>0:0,t[f+8>>1]=1|n):(n=o[A+96>>2]+(f<<6)|0,f=o[A+8>>2],o[n+16>>2]=o[A+4>>2],o[n+20>>2]=f,f=o[A+16>>2],o[n+24>>2]=o[A+12>>2],o[n+28>>2]=f),(0|r)<(0|G))for(f=r;;){v[A+60|0]?(u=o[A+116>>2]+(f<<4)|0,b=h[u+4>>1],i=h[u+2>>1],n=h[u>>1],p=w[A+44>>2],Z=w[A+40>>2],Q=w[A+36>>2],o[e+28>>2]=0,k=w[A+4>>2],w[e+16>>2]=m(m(n>>>0)/Q)+k,B=w[A+8>>2],w[e+20>>2]=m(m(i>>>0)/Z)+B,c=w[A+12>>2],w[e+24>>2]=m(m(b>>>0)/p)+c,b=h[u+6>>1],i=h[u+8>>1],n=h[u+10>>1],o[e+12>>2]=0,w[e+8>>2]=c+m(m(n>>>0)/p),w[e+4>>2]=B+m(m(i>>>0)/Z),w[e>>2]=k+m(m(b>>>0)/Q)):(i=o[A+76>>2]+(f<<6)|0,n=o[i+12>>2],o[e+24>>2]=o[i+8>>2],o[e+28>>2]=n,n=o[i+4>>2],o[e+16>>2]=o[i>>2],o[e+20>>2]=n,n=o[i+28>>2],o[e+8>>2]=o[i+24>>2],o[e+12>>2]=n,n=o[i+20>>2],o[e>>2]=o[i+16>>2],o[e+4>>2]=n),V=o[A+56>>2];A:if(v[A+60|0]){if(Q=w[A+12>>2],k=w[A+44>>2],d=(c=m(m(w[e+24>>2]-Q)*k))=m(0)?~~c>>>0:0,B=w[A+8>>2],c=w[A+40>>2],u=(Z=m(m(w[e+20>>2]-B)*c))=m(0)?~~Z>>>0:0,b=(k=m(m(k*m(w[e+8>>2]-Q))+m(1)))=m(0)?~~k>>>0:0,i=(c=m(m(c*m(w[e+4>>2]-B))+m(1)))=m(0)?~~c>>>0:0,B=w[A+4>>2],c=w[A+36>>2],F=65534&(n=(k=m(m(w[e+16>>2]-B)*c))=m(0)?~~k>>>0:0),l=o[A+136>>2],N=F>>>0>=h[(g=l+(V<<4)|0)>>1],n=(c=m(m(c*m(w[e>>2]-B))+m(1)))=m(0)?~~c>>>0:0,N||(t[g>>1]=F),(n|=1)>>>0>h[6+(N=l+(V<<4)|0)>>1]&&(t[N+6>>1]=n),(n=65534&u)>>>0>1]&&(t[g+2>>1]=n),(n=1|i)>>>0>h[8+(u=l+(V<<4)|0)>>1]&&(t[u+8>>1]=n),(n=65534&d)>>>0>1]&&(t[g+4>>1]=n),(n=1|b)>>>0<=h[10+(i=l+(V<<4)|0)>>1])break A;t[i+10>>1]=n}else c=w[e+16>>2],n=o[A+96>>2],c>2]&&(w[i>>2]=c),(c=w[e+20>>2])>2]&&(w[i+4>>2]=c),(c=w[e+24>>2])>2]&&(w[i+8>>2]=c),(c=w[e+28>>2])>2]&&(w[i+12>>2]=c),(c=w[e>>2])>w[16+(n=n+(V<<6)|0)>>2]&&(w[n+16>>2]=c),(c=w[e+4>>2])>w[n+20>>2]&&(w[n+20>>2]=c),(c=w[e+8>>2])>w[n+24>>2]&&(w[n+24>>2]=c),(c=w[e+12>>2])>w[n+28>>2]&&(w[n+28>>2]=c);if((0|G)==(0|(f=f+1|0)))break}if(M=o[A+56>>2]+1|0,o[A+56>>2]=M,q(A,r,s),V=o[A+56>>2],q(A,s,G),!(!(f=v[A+60|0])|(0|(g=o[A+56>>2]-X|0))<129)){if(G=0,X=o[A+136>>2],N=(0|(r=o[12+(l=X+(V<<4)|0)>>2]))>=0?1:0-r|0,(u=(0|(r=o[12+(s=X+(M<<4)|0)>>2]))>=0?1:0-r|0)>>>0<=128){if((0|(f=n=o[A+152>>2]))==o[A+156>>2]&&!((0|(F=f?n<<1:1))<=(0|f))){if(F?(o[8488]=o[8488]+1,H=0|Zn[o[8290]](F<<5,16),r=o[A+152>>2]):r=n,!((0|r)<=0)){if(1!=(0|r))for(b=-2&r;i=(d=C<<5)+H|0,J=o[A+160>>2]+d|0,f=o[J+4>>2],o[i>>2]=o[J>>2],o[i+4>>2]=f,f=o[J+28>>2],o[i+24>>2]=o[J+24>>2],o[i+28>>2]=f,f=o[J+20>>2],o[i+16>>2]=o[J+16>>2],o[i+20>>2]=f,f=o[J+12>>2],o[i+8>>2]=o[J+8>>2],o[i+12>>2]=f,i=(f=32|d)+H|0,d=f+o[A+160>>2]|0,f=o[d+4>>2],o[i>>2]=o[d>>2],o[i+4>>2]=f,f=o[d+12>>2],o[i+8>>2]=o[d+8>>2],o[i+12>>2]=f,f=o[d+20>>2],o[i+16>>2]=o[d+16>>2],o[i+20>>2]=f,f=o[d+28>>2],o[i+24>>2]=o[d+24>>2],o[i+28>>2]=f,C=C+2|0,(0|b)!=(0|(G=G+2|0)););1&r&&(f=(r=C<<5)+H|0,i=r+o[A+160>>2]|0,r=o[i+4>>2],o[f>>2]=o[i>>2],o[f+4>>2]=r,r=o[i+28>>2],o[f+24>>2]=o[i+24>>2],o[f+28>>2]=r,r=o[i+20>>2],o[f+16>>2]=o[i+16>>2],o[f+20>>2]=r,r=o[i+12>>2],o[f+8>>2]=o[i+8>>2],o[f+12>>2]=r)}!(r=o[A+160>>2])||!r|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+160>>2]=H,a[A+164|0]=1,o[A+156>>2]=F,f=o[A+152>>2]}o[A+152>>2]=f+1,f=o[A+160>>2]+(n<<5)|0,t[f>>1]=h[s>>1],t[f+2>>1]=h[s+2>>1],t[f+4>>1]=h[s+4>>1],r=X+(M<<4)|0,t[f+6>>1]=h[r+6>>1],t[f+8>>1]=h[r+8>>1],r=h[r+10>>1],o[f+16>>2]=u,o[f+12>>2]=M,t[f+10>>1]=r}if((0|N)<=128){if((0|(f=n=o[A+152>>2]))==o[A+156>>2]&&!((0|(F=f?n<<1:1))<=(0|f))){if(F?(o[8488]=o[8488]+1,r=0|Zn[o[8290]](F<<5,16),f=o[A+152>>2]):(r=0,f=n),!((0|f)<=0)){if(C=0,1!=(0|f))for(u=-2&f,G=0;b=(d=C<<5)+r|0,s=d+o[A+160>>2]|0,i=o[s+4>>2],o[b>>2]=o[s>>2],o[b+4>>2]=i,i=o[s+28>>2],o[b+24>>2]=o[s+24>>2],o[b+28>>2]=i,i=o[s+20>>2],o[b+16>>2]=o[s+16>>2],o[b+20>>2]=i,i=o[s+12>>2],o[b+8>>2]=o[s+8>>2],o[b+12>>2]=i,b=(i=32|d)+r|0,d=i+o[A+160>>2]|0,i=o[d+4>>2],o[b>>2]=o[d>>2],o[b+4>>2]=i,i=o[d+12>>2],o[b+8>>2]=o[d+8>>2],o[b+12>>2]=i,i=o[d+20>>2],o[b+16>>2]=o[d+16>>2],o[b+20>>2]=i,i=o[d+28>>2],o[b+24>>2]=o[d+24>>2],o[b+28>>2]=i,C=C+2|0,(0|u)!=(0|(G=G+2|0)););1&f&&(i=(f=C<<5)+r|0,b=f+o[A+160>>2]|0,f=o[b+4>>2],o[i>>2]=o[b>>2],o[i+4>>2]=f,f=o[b+28>>2],o[i+24>>2]=o[b+24>>2],o[i+28>>2]=f,f=o[b+20>>2],o[i+16>>2]=o[b+16>>2],o[i+20>>2]=f,f=o[b+12>>2],o[i+8>>2]=o[b+8>>2],o[i+12>>2]=f)}!(f=o[A+160>>2])||!f|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+160>>2]=r,a[A+164|0]=1,o[A+156>>2]=F,f=o[A+152>>2]}o[A+152>>2]=f+1,f=o[A+160>>2]+(n<<5)|0,t[f>>1]=h[l>>1],t[f+2>>1]=h[l+2>>1],t[f+4>>1]=h[l+4>>1],r=X+(V<<4)|0,t[f+6>>1]=h[r+6>>1],t[f+8>>1]=h[r+8>>1],r=h[r+10>>1],o[f+16>>2]=N,o[f+12>>2]=V,t[f+10>>1]=r}o[A+168>>2]=o[A+152>>2],f=v[A+60|0]}255&f?o[12+(o[A+136>>2]+(y<<4)|0)>>2]=0-g:o[32+(o[A+96>>2]+(y<<6)|0)>>2]=g}else v[A+60|0]?(r=o[A+116>>2]+(r<<4)|0,n=o[r+4>>2],f=o[A+136>>2]+(X<<4)|0,o[f>>2]=o[r>>2],o[f+4>>2]=n):(r=o[A+76>>2]+(r<<6)|0,n=o[r+4>>2],f=o[A+96>>2]+(X<<6)|0,o[f>>2]=o[r>>2],o[f+4>>2]=n,n=o[r+60>>2],o[f+56>>2]=o[r+56>>2],o[f+60>>2]=n,n=o[r+52>>2],o[f+48>>2]=o[r+48>>2],o[f+52>>2]=n,n=o[r+44>>2],o[f+40>>2]=o[r+40>>2],o[f+44>>2]=n,n=o[r+36>>2],o[f+32>>2]=o[r+32>>2],o[f+36>>2]=n,n=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=n,n=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=n),n=o[r+12>>2],o[f+8>>2]=o[r+8>>2],o[f+12>>2]=n,o[A+56>>2]=o[A+56>>2]+1;S=e+32|0}function _(A,r,f,e){var i,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,v=0,h=0,B=0,w=0,Z=0,m=0,Q=0,E=0,W=0,N=0,p=0,F=0,R=0,Y=0,V=0,g=0,X=0,D=0,C=0,J=0,x=0;S=i=S-16|0;A:{r:{f:{e:{i:switch(0|(a=f-r|0)){case 1:break f;case 2:break e;case 0:break i;default:break r}o[e>>2]=0,o[e+4>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0;break A}r=(f=o[o[A+92>>2]+(r<<2)>>2])+112|0;e:{if((l=(0|(t=o[f+88>>2]))!=(0|(u=o[f+200>>2])))|(0|(a=o[f+204>>2]))!=(0|(n=o[f+92>>2])))o[f+4>>2]=r,o[f>>2]=r,o[f+116>>2]=f,o[f+112>>2]=f,u=(b=(Z=(0|n)<(0|a))&(0|t)==(0|u))|(t=(0|t)<(0|u)),o[e+4>>2]=u?r:f,o[e>>2]=u?f:r,n=(a=Z|t&l&(0|n)==(0|a))?r:f,a=a?f:r;else{if(o[f+96>>2]==o[f+208>>2])break e;n=o[f+96>>2]>o[f+208>>2],o[(a=(n?112:0)+f|0)>>2]=a,o[(a=n?r:f)+4>>2]=a,o[e+4>>2]=a,o[e>>2]=a,r=n?f:r,f=n=a}o[e+12>>2]=n,o[e+8>>2]=a,A=ir(A,f,r),o[A+4>>2]=A,o[A>>2]=A,o[f+8>>2]=A,A=o[A+8>>2],o[A+4>>2]=A,o[A>>2]=A,o[r+8>>2]=A;break A}o[f+8>>2]=0,o[f+4>>2]=f,o[f>>2]=f,o[e+12>>2]=f,o[e+8>>2]=f,o[e+4>>2]=f,o[e>>2]=f;break A}A=o[o[A+92>>2]+(r<<2)>>2],o[A+8>>2]=0,o[A+4>>2]=A,o[A>>2]=A,o[e+12>>2]=A,o[e+8>>2]=A,o[e+4>>2]=A,o[e>>2]=A;break A}a=n=((0|a)/2|0)+r|0;r:if(!((0|n)>=(0|f))){for(u=o[A+92>>2],a=o[(u+(n<<2)|0)-4>>2],l=o[a+88>>2],Z=o[a+96>>2],b=o[a+92>>2],a=n;;){if(t=o[u+(a<<2)>>2],(0|l)!=o[t+88>>2]|(0|b)!=o[t+92>>2]|(0|Z)!=o[t+96>>2])break r;if(!((0|(a=a+1|0))<(0|f)))break}a=f}_(A,r,n,e),o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=0,o[i+4>>2]=0,_(A,a,f,i),v=A,f=0,S=c=S-128|0;r:if(o[i+4>>2])if(o[e+4>>2]){o[v+100>>2]=o[v+100>>2]-1,o[c+124>>2]=0,o[c+120>>2]=0,l=0,b=e,A=o[e+12>>2],u=o[i+8>>2];f:{e:{if(!(o[A+88>>2]!=o[u+88>>2]|o[A+92>>2]!=o[u+92>>2])){if((0|(e=o[u+4>>2]))==(0|u)){if(o[c+124>>2]=A,A=0,!(r=o[u+8>>2]))break e;o[c+120>>2]=o[r+12>>2],A=0;break f}A=o[u>>2],o[e>>2]=A,o[A+4>>2]=e,o[i>>2]==(0|u)&&(t=i,r=A,(0|(a=o[A+88>>2]))<(0|(n=o[e+88>>2]))||(0|n)==(0|a)&&(r=A,o[A+92>>2]>2])||(r=e),o[t>>2]=r),o[i+4>>2]==(0|u)&&(r=o[A+88>>2],a=o[e+88>>2],o[i+4>>2]=(0|r)>(0|a)|(0|r)==(0|a)&o[A+92>>2]>o[e+92>>2]?A:e)}for(k=o[i>>2],E=o[b>>2],A=R=o[b+4>>2],e=p=o[i+4>>2],u=0,Z=1;;){s=o[A+88>>2];i:{if((0|(a=G(o[e+88>>2]-s|0,Z)))>0)for(;;){for(r=e,t=o[e+92>>2],n=a;s=t-(a=o[A+92>>2])|0,!((0|(e=o[(m?A:A+4)>>2]))==(0|A)||(0|(h=o[e+92>>2]-a|0))>0||(d=o[e+88>>2],a=G(d-o[A+88>>2]|0,Z),(0|G(n,h))>(0|G(a,s))|(0|a)>=0&&a));)n=G(o[r+88>>2]-d|0,Z),A=e;if((0|(e=o[(m?r:r+4)>>2]))==(0|r))break i;if(h=o[e+88>>2],(0|(a=G(h-o[A+88>>2]|0,Z)))<=0)break i;if((0|(d=o[e+92>>2]-t|0))>=0)break i;if(t=G(h-o[r+88>>2]|0,Z)){if((0|t)>=0)break i;if(!((0|G(n,d))<(0|G(t,s))))break i}}n:{if((0|a)<0)a:for(;;){for(s=o[e+92>>2],r=o[(m?e+4:e)>>2];;){if(t=a,n=A,h=s-(d=o[A+92>>2])|0,(0|r)!=(0|e)&&!((0|(a=o[r+92>>2]-s|0))<0||(B=o[r+88>>2],A=G(B-o[e+88>>2]|0,Z),(0|G(a,t))>(0|G(A,h))|(0|A)>=0&&A))){a=G(B-o[n+88>>2]|0,Z),e=r,A=n;continue a}if((0|n)==(0|(A=o[(m?n+4:n)>>2])))break n;if(B=o[A+88>>2],(0|(a=G(o[e+88>>2]-B|0,Z)))>=0)break n;if((0|(F=o[A+92>>2]-d|0))<=0)break n;if(d=G(B-o[n+88>>2]|0,Z)){if((0|d)>=0)break n;if(!((0|G(t,F))<(0|G(d,h))))break}}break n}n=o[A+92>>2],a=A;a:{if(!m)for(;;){if(t=a,(0|(a=o[a+4>>2]))==(0|A)|(0|s)!=o[a+88>>2])break a;if(!((0|(r=n))>=(0|(n=o[a+92>>2]))))break a}for(;;){if(t=a,(0|(a=o[a>>2]))==(0|A)|(0|s)!=o[a+88>>2])break a;if(!((0|(r=n))>=(0|(n=o[a+92>>2]))))break}}a=o[e+92>>2],n=e,A=e;a:{if(!m)for(;;){if(r=n,(0|(n=o[n>>2]))==(0|e)|(0|s)!=o[n+88>>2])break a;if(!((0|(A=a))<=(0|(a=o[n+92>>2]))))break a}for(;;){if(r=A,(0|e)==(0|(A=o[A+4>>2]))|(0|s)!=o[A+88>>2])break a;if(!((0|(n=a))<=(0|(a=o[A+92>>2]))))break}}A=t;break i}r=e,A=n}if(m||(Z=-1,u=r,l=A,A=E,r=k),e=r,2==(0|(m=m+1|0)))break}o[A+4>>2]=e,o[e>>2]=A,o[l>>2]=u,o[u+4>>2]=l,o[k+88>>2]>2]&&(o[b>>2]=k),o[p+88>>2]>=o[R+88>>2]&&(o[b+4>>2]=p),o[b+12>>2]=o[i+12>>2],o[c+124>>2]=l,A=1}o[c+120>>2]=u}if(E=o[c+120>>2],A){if(p=o[c+124>>2],b=o[p+96>>2],d=o[E+96>>2],h=o[p+92>>2],u=o[E+92>>2],e=o[p+8>>2],B=o[p+88>>2],R=o[E+88>>2],o[c+80>>2]=0,l=ee(A=d-b|0,t=A>>31,r=u-h|0,k=r>>31),F=L,n=ee(a=0-(n=R-B|0)|0,s=a>>31,n,n>>31),m=L,Z=n-(V=ee(r,k,r,k))|0,V=m-(L+(n>>>0>>0)|0)|0,m=0-(A=ee(a,s,A,t))|0,g=0-(L+!!(0|A)|0)|0,e){for(A=e;;){w=o[A+12>>2],t=n=(Q=o[w+92>>2])-h|0,W=ee(n,N=n>>31,a,s),Y=L;f:if(!((0|W)!=(0-(D=ee(r,k,n=(J=o[w+88>>2])-B|0,x=n>>31))|0)|(0-(L+!!(0|D)|0)|0)!=(0|Y)||(t=ee(l,F,t,N),N=L,W=ee(m,g,n,x),n=L+N|0,n=(t=W+t|0)>>>0>>0?n+1|0:n,D=t,W=ee(Z,V,t=(N=o[w+96>>2])-b|0,t>>31),t=L+n|0,!(w=D+W|0)&(0|(t=w>>>0>>0?t+1|0:t))<=0|(0|t)<0))){e:if(f){if(n=o[f+4>>2],o[f>>2]==(0|A)){if((0|A)!=(0|n))break f;if(n=o[f+12>>2],t=o[o[A+8>>2]+12>>2],W=o[t+96>>2],w=o[n+96>>2]-W|0,Y=o[t+92>>2],N=N-W|0,Q=ee(Q=G(w,Y-Q|0)+G(N,o[n+92>>2]-Y|0)|0,Q>>31,r,k),W=L,t=o[t+88>>2],w=ee(n=G(N,t-o[n+88>>2]|0)+G(w,J-t|0)|0,n>>31,a,s),t=L+W|0,!(n=w+Q|0)&(0|(t=n>>>0>>0?t+1|0:t))<=0|(0|t)<0)break e;break f}if((0|A)!=(0|n))break f}f=A}if((0|e)==(0|(A=o[A>>2])))break}o[c+80>>2]=f}if(n=o[E+8>>2],e=0,o[c+56>>2]=0,n){for(A=n;;){h=o[A+12>>2],b=t=(B=o[h+92>>2])-u|0,Q=ee(t,w=t>>31,a,s),N=L;f:if(!((0|Q)!=(0-(J=ee(r,k,t=(W=o[h+88>>2])-R|0,Y=t>>31))|0)|(0-(L+!!(0|J)|0)|0)!=(0|N)||(b=ee(l,F,b,w),w=L,Q=ee(m,g,t,Y),t=L+w|0,t=(b=Q+b|0)>>>0>>0?t+1|0:t,D=b,h=ee(Z,V,b=(w=o[h+96>>2])-d|0,b>>31),t=L+t|0,!(b=D+h|0)&(0|(t=b>>>0>>0?t+1|0:t))<=0|(0|t)<0))){if(e){if(o[e>>2]!=(0|A))break f;if(o[e+4>>2]==(0|A)&&(t=o[e+12>>2],b=o[o[A+8>>2]+12>>2],Q=o[b+96>>2],h=o[t+96>>2]-Q|0,N=o[b+92>>2],w=w-Q|0,B=ee(B=G(h,N-B|0)+G(w,o[t+92>>2]-N|0)|0,B>>31,r,k),Q=L,b=o[b+88>>2],h=ee(t=G(w,b-o[t+88>>2]|0)+G(h,W-b|0)|0,t>>31,a,s),t=L+Q|0,!(b=h+B|0)&(0|(t=b>>>0>>0?t+1|0:t))<=0|(0|t)<0))break f}e=A}if((0|n)==(0|(A=o[A>>2])))break}o[c+56>>2]=e}f|e&&(oA(v,p,E,c+80|0,c+56|0),(A=o[c+80>>2])&&(p=o[A+12>>2],o[c+124>>2]=p),(A=o[c+56>>2])&&(E=o[A+12>>2],o[c+120>>2]=E,d=o[E+96>>2],u=o[E+92>>2],R=o[E+88>>2])),A=d+1|0}else R=o[E+88>>2]+1|0,u=o[E+92>>2],p=o[c+124>>2],A=o[E+96>>2];for(h=A,A=p,a=E,b=0,t=0,Z=0,l=1,f=0,r=0,m=0;;){if(d=o[a+96>>2],e=o[A+96>>2],n=o[A+92>>2],s=o[a+92>>2],k=o[A+88>>2],B=o[a+88>>2],o[c+116>>2]=-1,s=s-n|0,o[c+108>>2]=s,d=d-e|0,o[c+112>>2]=d,B=B-k|0,o[c+104>>2]=B,g=u-n|0,n=h-e|0,F=(e=G(g,d)-G(n,s)|0)>>31,o[c+80>>2]=e,o[c+84>>2]=F,k=R-k|0,V=(n=G(n,B)-G(k,d)|0)>>31,o[c+88>>2]=n,o[c+92>>2]=V,g=(k=G(s,k)-G(B,g)|0)>>31,o[c+96>>2]=k,o[c+100>>2]=g,w=ee(n,V,B,Q=B>>31),N=L,Y=ee(e,F,s,W=s>>31),o[c+72>>2]=w-Y,o[c+76>>2]=N-(L+(w>>>0>>0)|0),e=ee(e,D=F,d,F=d>>31),w=L,B=ee(k,g,B,Q),o[c+64>>2]=e-B,o[c+68>>2]=w-(L+(e>>>0>>0)|0),e=ee(s,W,k,g),k=L,n=ee(n,V,d,F),o[c+56>>2]=e-n,o[c+60>>2]=k-(L+(e>>>0>>0)|0),o[c+48>>2]=0,o[c+40>>2]=0,o[c+44>>2]=0,o[c+32>>2]=0,o[c+36>>2]=0,s=SA(v,0,A,e=c+104|0,n=c+80|0,k=c+56|0,c+32|0),o[c+24>>2]=0,o[c+16>>2]=0,o[c+20>>2]=0,o[c+8>>2]=0,o[c+12>>2]=0,!((k=SA(v,1,a,e,n,k,c+8|0))|s)){r=ir(v,A,a),o[r+4>>2]=r,o[r>>2]=r,o[A+8>>2]=r,A=o[r+8>>2],o[A+4>>2]=A,o[A>>2]=A,o[a+8>>2]=A;break r}d=s?-1:1,!s|!k||(d=Er(c+32|0,c+8|0));f:{e:{i:if(!(1&l)){if((0|d)>=0){if(o[c+16>>2]|o[c+20>>2]|o[c+24>>2]>=0)break i;l=b,a=t,n=f,e=r;break e}if(!(o[c+40>>2]|o[c+44>>2]|o[c+48>>2]>=0)){o[c+4>>2]=s,n=f,e=r;break f}}e=n=ir(v,A,a),f&&(o[f+4>>2]=n,e=r),o[n>>2]=f,a=l=o[n+8>>2],b&&(o[b>>2]=l,a=t),o[l+4>>2]=b}if(o[c+4>>2]=s,o[c>>2]=k,f=k,d||(oA(v,o[c+124>>2],o[c+120>>2],c+4|0,c),f=o[c>>2]),!f|(0|d)<0)b=l,t=a;else{e:{i:{if(X){if((0|k)!=(0|(A=o[X>>2])))for(;b=o[A+8>>2],r=0,u=0,(0|(t=o[A>>2]))!=(0|A)&&(o[t+4>>2]=o[A+4>>2],o[o[A+4>>2]>>2]=t,u=t),o[o[b+12>>2]+8>>2]=u,(0|(u=o[b>>2]))!=(0|b)&&(o[u+4>>2]=o[b+4>>2],o[o[b+4>>2]>>2]=u,r=u),o[o[A+12>>2]+8>>2]=r,o[A+16>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,o[A>>2]=o[v+56>>2],o[v+56>>2]=A,o[b+16>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,o[b>>2]=0,o[b+4>>2]=0,o[b>>2]=o[v+56>>2],o[v+56>>2]=b,o[v+116>>2]=o[v+116>>2]-1,(0|k)!=(0|(A=t)););if(l)break i;break e}if(!l){Z=k;break e}X=o[k+4>>2],Z=a}o[X>>2]=a,o[a+4>>2]=X,o[l>>2]=k,o[k+4>>2]=l,f=o[c>>2],a=0}t=a,A=o[c+120>>2],h=o[A+96>>2],u=o[A+92>>2],R=o[A+88>>2],o[c+120>>2]=o[f+12>>2],X=o[f+8>>2],b=0}}if((0|d)<=0&&(d=o[c+4>>2])){f:{if(C){if((0|s)!=(0|(A=o[C+4>>2])))for(;l=o[A+8>>2],u=o[A+4>>2],r=0,f=0,(0|(a=o[A>>2]))!=(0|A)&&(o[a+4>>2]=u,o[o[A+4>>2]>>2]=a,f=a),o[o[l+12>>2]+8>>2]=f,(0|(f=o[l>>2]))!=(0|l)&&(o[f+4>>2]=o[l+4>>2],o[o[l+4>>2]>>2]=f,r=f),o[o[A+12>>2]+8>>2]=r,o[A+16>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,o[A>>2]=o[v+56>>2],o[v+56>>2]=A,o[l+16>>2]=0,o[l+8>>2]=0,o[l+12>>2]=0,o[l>>2]=0,o[l+4>>2]=0,o[l>>2]=o[v+56>>2],o[v+56>>2]=l,o[v+116>>2]=o[v+116>>2]-1,(0|s)!=(0|(A=u)););if(!n)break f;o[e>>2]=C,A=C+4|0}else{if(!n){m=s;break f}A=o[s>>2],o[e>>2]=A,m=e,A=A+4|0}o[A>>2]=e,o[s>>2]=n,o[n+4>>2]=s,e=0,d=o[c+4>>2]}A=o[c+124>>2],h=o[A+96>>2],u=o[A+92>>2],R=o[A+88>>2],A=o[d+12>>2],o[c+124>>2]=A,C=o[d+8>>2],n=0}else A=o[c+124>>2];if(!((0|A)!=(0|p)|(0|E)!=(0|(a=o[c+120>>2])))){if(C){if((0|m)!=(0|(A=o[C+4>>2])))for(;l=o[A+8>>2],a=o[A+4>>2],r=0,(0|(f=o[A>>2]))!=(0|A)&&(o[f+4>>2]=a,o[o[A+4>>2]>>2]=f,r=f),o[o[l+12>>2]+8>>2]=r,(0|l)!=(0|(u=o[l>>2]))?(o[u+4>>2]=o[l+4>>2],o[o[l+4>>2]>>2]=u):u=0,o[o[A+12>>2]+8>>2]=u,o[A+16>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,o[A>>2]=o[v+56>>2],o[v+56>>2]=A,o[l+16>>2]=0,o[l+8>>2]=0,o[l+12>>2]=0,o[l>>2]=0,o[l+4>>2]=0,o[l>>2]=o[v+56>>2],o[v+56>>2]=l,o[v+116>>2]=o[v+116>>2]-1,(0|m)!=(0|(A=a)););n&&(o[e>>2]=C,o[C+4>>2]=e,o[m>>2]=n,o[n+4>>2]=m)}else o[e>>2]=n,o[n+4>>2]=e,o[o[c+124>>2]+8>>2]=n;if(!X){o[b>>2]=t,o[t+4>>2]=b,o[o[c+120>>2]+8>>2]=b;break r}if((0|Z)!=(0|(A=o[X>>2])))for(;f=o[A+8>>2],u=0,(0|(r=o[A>>2]))!=(0|A)&&(o[r+4>>2]=o[A+4>>2],o[o[A+4>>2]>>2]=r,u=r),o[o[f+12>>2]+8>>2]=u,(0|f)!=(0|(u=o[f>>2]))?(o[u+4>>2]=o[f+4>>2],o[o[f+4>>2]>>2]=u):u=0,o[o[A+12>>2]+8>>2]=u,o[A+16>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,o[A>>2]=o[v+56>>2],o[v+56>>2]=A,o[f+16>>2]=0,o[f+8>>2]=0,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,o[f>>2]=o[v+56>>2],o[v+56>>2]=f,o[v+116>>2]=o[v+116>>2]-1,(0|Z)!=(0|(A=r)););if(!b)break r;o[X>>2]=t,o[t+4>>2]=X,o[b>>2]=Z,o[Z+4>>2]=b;break}l=0,f=n,r=e}}else A=o[i+4>>2],o[e>>2]=o[i>>2],o[e+4>>2]=A,A=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=A;S=c+128|0}S=i+16|0}function AA(A){var r,f=0,e=0,i=0,n=m(0),t=m(0),c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=0,E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=0,V=0,g=0,X=m(0),D=m(0),C=0,J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=0,L=0,$=0,K=0,q=m(0),_=m(0),AA=0;S=r=S-16|0;A:if(v[A+356|0]){a[A+356|0]=0,a[A+352|0]=0,o[A+344>>2]=0,o[A+348>>2]=0,o[A+336>>2]=0,o[A+340>>2]=0,i=-16&v[A+332|0],a[A+332|0]=i,f=A+316|0;r:{f:switch(o[A>>2]-1|0){case 0:e=o[A+168>>2],o[A+260>>2]=o[A+164>>2],o[A+264>>2]=e,e=o[A+88>>2],o[A+244>>2]=o[A+84>>2],o[A+248>>2]=e,e=o[A+176>>2],o[A+268>>2]=o[A+172>>2],o[A+272>>2]=e,e=o[A+96>>2],o[A+252>>2]=o[A+92>>2],o[A+256>>2]=e,a[A+352|0]=0,o[A+288>>2]=0,w[A+280>>2]=w[A+248>>2]-w[A+264>>2],w[A+276>>2]=w[A+244>>2]-w[A+260>>2],w[A+284>>2]=w[A+252>>2]-w[A+268>>2],o[A+344>>2]=0,o[A+348>>2]=0,o[A+336>>2]=1065353216,o[A+340>>2]=0,e=1;break r;case 1:c=1,l=w[A+8>>2],n=m(w[A+24>>2]-l),u=w[A+12>>2],b=m(w[A+28>>2]-u),k=m(b*m(m(0)-u)),s=w[A+4>>2],u=m(w[A+20>>2]-s),e=1,(f=(l=m(k+m(m(u*m(m(0)-s))+m(m(m(0)-l)*n))))>m(0))&&((t=m(m(b*b)+m(m(u*u)+m(n*n))))>l?(t=m(l/t),e=3):(t=m(1),e=2)),o[A+344>>2]=0,o[A+348>>2]=0,w[A+340>>2]=t,l=m(m(1)-t),w[A+336>>2]=l,a[A+332|0]=i|e,o[A+256>>2]=0,n=w[A+92>>2],s=m(n+m(t*m(w[A+108>>2]-n))),w[A+252>>2]=s,n=w[A+88>>2],d=m(n+m(t*m(w[A+104>>2]-n))),w[A+248>>2]=d,n=w[A+84>>2],h=m(n+m(t*m(w[A+100>>2]-n))),w[A+244>>2]=h,k=w[A+180>>2],Z=w[A+184>>2],n=w[A+168>>2],G=w[A+188>>2],b=w[A+172>>2],u=w[A+164>>2],o[A+288>>2]=0,b=m(b+m(t*m(G-b))),w[A+284>>2]=s-b,n=m(n+m(t*m(Z-n))),w[A+280>>2]=d-n,u=m(u+m(t*m(k-u))),w[A+276>>2]=h-u,o[A+272>>2]=0,w[A+268>>2]=b,w[A+264>>2]=n,w[A+260>>2]=u,f||(o[A>>2]=1,c=0),1&e||(o[A>>2]=c,f=o[16+(e=(c<<4)+A|0)>>2],o[A+12>>2]=o[e+12>>2],o[A+16>>2]=f,f=o[e+8>>2],o[A+4>>2]=o[e+4>>2],o[A+8>>2]=f,f=o[e+96>>2],o[A+92>>2]=o[e+92>>2],o[A+96>>2]=f,f=o[e+88>>2],o[A+84>>2]=o[e+84>>2],o[A+88>>2]=f,f=o[e+176>>2],o[A+172>>2]=o[e+172>>2],o[A+176>>2]=f,f=o[e+168>>2],o[A+164>>2]=o[e+164>>2],o[A+168>>2]=f),e=l>=m(0)&t>=m(0);break r;case 2:o[r+8>>2]=0,o[r+12>>2]=0,o[r>>2]=0,o[r+4>>2]=0,$A(r,A+4|0,A+20|0,A+36|0,f),o[A+256>>2]=0,t=w[A+336>>2],n=w[A+340>>2],b=w[A+344>>2],u=m(m(m(t*w[A+92>>2])+m(n*w[A+108>>2]))+m(b*w[A+124>>2])),w[A+252>>2]=u,l=m(m(m(t*w[A+88>>2])+m(n*w[A+104>>2]))+m(b*w[A+120>>2])),w[A+248>>2]=l,s=m(m(m(t*w[A+84>>2])+m(n*w[A+100>>2]))+m(b*w[A+116>>2])),w[A+244>>2]=s,d=w[A+180>>2],h=w[A+196>>2],k=w[A+168>>2],Z=w[A+184>>2],G=w[A+200>>2],W=w[A+172>>2],N=w[A+188>>2],p=w[A+204>>2],F=w[A+164>>2],o[A+288>>2]=0,B=u,u=m(m(m(t*W)+m(n*N))+m(b*p)),w[A+284>>2]=B-u,B=l,l=m(m(m(t*k)+m(n*Z))+m(b*G)),w[A+280>>2]=B-l,k=s,s=m(m(m(t*F)+m(n*d))+m(b*h)),w[A+276>>2]=k-s,o[A+272>>2]=0,w[A+268>>2]=u,w[A+264>>2]=l,w[A+260>>2]=s;e:{i:{n:{a:{t:{o:if((0|(f=o[A>>2]))>=4){if(8&(c=v[A+332|0])){e=f;break o}e=f-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+60>>2]=o[f+12>>2],o[A+64>>2]=i,i=o[f+8>>2],o[A+52>>2]=o[f+4>>2],o[A+56>>2]=i,i=o[f+88>>2],o[A+132>>2]=o[f+84>>2],o[A+136>>2]=i,i=o[f+96>>2],o[A+140>>2]=o[f+92>>2],o[A+144>>2]=i,i=o[f+176>>2],o[A+220>>2]=o[f+172>>2],o[A+224>>2]=i,i=o[f+168>>2],o[A+212>>2]=o[f+164>>2],o[A+216>>2]=i}else{if(e=3,3!=(0|f))break t;c=v[A+332|0]}if(4&c)break a;e=e-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+44>>2]=o[f+12>>2],o[A+48>>2]=i,i=o[f+8>>2],o[A+36>>2]=o[f+4>>2],o[A+40>>2]=i,i=o[f+96>>2],o[A+124>>2]=o[f+92>>2],o[A+128>>2]=i,i=o[f+88>>2],o[A+116>>2]=o[f+84>>2],o[A+120>>2]=i,i=o[f+176>>2],o[A+204>>2]=o[f+172>>2],o[A+208>>2]=i,i=o[f+168>>2],o[A+196>>2]=o[f+164>>2],o[A+200>>2]=i;break a}if(e=2,(0|f)<2)break n;c=v[A+332|0]}if(2&c)break i;e=e-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+28>>2]=o[f+12>>2],o[A+32>>2]=i,i=o[f+8>>2],o[A+20>>2]=o[f+4>>2],o[A+24>>2]=i,i=o[f+96>>2],o[A+108>>2]=o[f+92>>2],o[A+112>>2]=i,i=o[f+88>>2],o[A+100>>2]=o[f+84>>2],o[A+104>>2]=i,i=o[f+176>>2],o[A+188>>2]=o[f+172>>2],o[A+192>>2]=i,i=o[f+168>>2],o[A+180>>2]=o[f+164>>2],o[A+184>>2]=i;break i}if(e=1,1!=(0|f))break e;c=v[A+332|0]}1&c||(e=e-1|0,o[A>>2]=e,f=o[16+(e=(e<<4)+A|0)>>2],o[A+12>>2]=o[e+12>>2],o[A+16>>2]=f,f=o[e+8>>2],o[A+4>>2]=o[e+4>>2],o[A+8>>2]=f,f=o[e+96>>2],o[A+92>>2]=o[e+92>>2],o[A+96>>2]=f,f=o[e+88>>2],o[A+84>>2]=o[e+84>>2],o[A+88>>2]=f,f=o[e+176>>2],o[A+172>>2]=o[e+172>>2],o[A+176>>2]=f,f=o[e+168>>2],o[A+164>>2]=o[e+164>>2],o[A+168>>2]=f)}if(e=0,!(b>=m(0))|!(t>=m(0))|!(n>=m(0)))break r;e=w[A+348>>2]>=m(0);break r;case 3:break f;default:break r}if(o[r+8>>2]=0,o[r+12>>2]=0,o[r>>2]=0,o[r+4>>2]=0,S=c=S-48|0,a[c+24|0]=0,i=o[r+12>>2],o[f+8>>2]=o[r+8>>2],o[f+12>>2]=i,i=o[r+4>>2],o[f>>2]=o[r>>2],o[f+4>>2]=i,Q=v[f+16|0],a[f+16|0]=15|Q,T=w[r+8>>2],t=w[8+(i=A+4|0)>>2],U=m(T-t),B=w[8+(Y=A+36|0)>>2],n=m(B-t),E=w[(V=A+52|0)>>2],b=w[i>>2],u=m(E-b),l=w[4+(g=A+20|0)>>2],s=w[i+4>>2],d=m(l-s),h=w[g>>2],k=m(h-b),J=w[V+4>>2],Z=m(J-s),X=m(m(u*d)-m(k*Z)),x=w[Y>>2],G=m(x-b),W=w[g+8>>2],N=m(W-t),P=w[V+8>>2],p=m(P-t),D=m(m(Z*N)-m(d*p)),y=w[Y+4>>2],F=m(y-s),M=m(m(p*k)-m(N*u)),R=m(m(n*X)+m(m(G*D)+m(F*M))),H=m(U*X),X=w[r>>2],j=m(X-b),I=m(j*D),D=w[r+4>>2],z=m(D-s),O=m(R*R)>2],n=m(b-T),t=m(n*n),u=w[c+8>>2],n=m(u-X),s=m(n*n),l=w[c+12>>2],n=m(l-D),n=m(t+m(s+m(n*n))),t=m(34028234663852886e22),n>2]=w[c+20>>2],w[f+8>>2]=b,w[f+4>>2]=l,w[f>>2]=u,a[f+16|0]=7&v[c+24|0]|-16&Q,t=w[c+36>>2],Q=o[c+32>>2],C=o[c+28>>2],o[f+32>>2]=0,w[f+28>>2]=t,o[f+20>>2]=C,o[f+24>>2]=Q,t=n)),L&&($A(r,i,Y,V,c+8|0),b=w[c+16>>2],n=m(b-w[r+8>>2]),s=m(n*n),u=w[c+8>>2],n=m(u-w[r>>2]),k=m(n*n),l=w[c+12>>2],n=m(l-w[r+4>>2]),(n=m(s+m(k+m(n*n))))>2]=w[c+20>>2],w[f+8>>2]=b,w[f+4>>2]=l,w[f>>2]=u,Q=v[c+24|0],a[f+16|0]=240&v[f+16|0]|1&Q|Q<<1&12,Q=o[c+36>>2],C=o[c+32>>2],t=w[c+28>>2],o[f+24>>2]=0,o[f+28>>2]=C,o[f+32>>2]=Q,w[f+20>>2]=t,t=n)),O&&($A(r,i,V,g,c+8|0),b=w[c+16>>2],n=m(b-w[r+8>>2]),s=m(n*n),u=w[c+8>>2],n=m(u-w[r>>2]),k=m(n*n),l=w[c+12>>2],n=m(l-w[r+4>>2]),(n=m(s+m(k+m(n*n))))>2]=w[c+20>>2],w[f+8>>2]=b,w[f+4>>2]=l,w[f>>2]=u,i=v[c+24|0],a[f+16|0]=240&v[f+16|0]|1&i|i>>>1&2|i<<2&8,t=w[c+36>>2],b=w[c+28>>2],w[f+32>>2]=w[c+32>>2],o[f+28>>2]=0,w[f+24>>2]=t,w[f+20>>2]=b,t=n)),AA=1,$&&($A(r,g,V,Y,c+8|0),l=t,t=w[c+16>>2],n=m(t-w[r+8>>2]),s=m(n*n),n=w[c+8>>2],b=m(n-w[r>>2]),k=m(b*b),b=w[c+12>>2],u=m(b-w[r+4>>2]),l>m(s+m(k+m(u*u)))&&(w[f+12>>2]=w[c+20>>2],w[f+8>>2]=t,w[f+4>>2]=b,w[f>>2]=n,i=v[c+24|0],a[f+16|0]=240&v[f+16|0]|4&i|i<<1&2|i<<2&8,t=w[c+36>>2],n=w[c+28>>2],w[f+32>>2]=w[c+32>>2],w[f+28>>2]=t,w[f+24>>2]=n,o[f+20>>2]=0))),S=c+48|0,AA){o[A+256>>2]=0,n=w[A+336>>2],b=w[A+340>>2],u=w[A+344>>2],t=w[A+348>>2],l=m(m(m(m(n*w[A+92>>2])+m(b*w[A+108>>2]))+m(u*w[A+124>>2]))+m(t*w[A+140>>2])),w[A+252>>2]=l,s=m(m(m(m(n*w[A+88>>2])+m(b*w[A+104>>2]))+m(u*w[A+120>>2]))+m(t*w[A+136>>2])),w[A+248>>2]=s,d=m(m(m(m(n*w[A+84>>2])+m(b*w[A+100>>2]))+m(u*w[A+116>>2]))+m(t*w[A+132>>2])),w[A+244>>2]=d,o[A+288>>2]=0,o[A+272>>2]=0,h=m(m(m(m(n*w[A+164>>2])+m(b*w[A+180>>2]))+m(u*w[A+196>>2]))+m(t*w[A+212>>2])),w[A+260>>2]=h,k=m(m(m(m(n*w[A+168>>2])+m(b*w[A+184>>2]))+m(u*w[A+200>>2]))+m(t*w[A+216>>2])),w[A+264>>2]=k,n=m(m(m(m(n*w[A+172>>2])+m(b*w[A+188>>2]))+m(u*w[A+204>>2]))+m(t*w[A+220>>2])),w[A+268>>2]=n,w[A+276>>2]=d-h,w[A+280>>2]=s-k,w[A+284>>2]=l-n;f:{e:{i:{n:{a:{t:if((0|(f=o[A>>2]))>=4){if(8&(c=v[A+332|0])){e=f;break t}e=f-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+60>>2]=o[f+12>>2],o[A+64>>2]=i,i=o[f+8>>2],o[A+52>>2]=o[f+4>>2],o[A+56>>2]=i,i=o[f+96>>2],o[A+140>>2]=o[f+92>>2],o[A+144>>2]=i,i=o[f+88>>2],o[A+132>>2]=o[f+84>>2],o[A+136>>2]=i,i=o[f+176>>2],o[A+220>>2]=o[f+172>>2],o[A+224>>2]=i,i=o[f+168>>2],o[A+212>>2]=o[f+164>>2],o[A+216>>2]=i}else{if(e=3,3!=(0|f))break a;c=v[A+332|0]}if(4&c)break n;e=e-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+44>>2]=o[f+12>>2],o[A+48>>2]=i,i=o[f+8>>2],o[A+36>>2]=o[f+4>>2],o[A+40>>2]=i,i=o[f+96>>2],o[A+124>>2]=o[f+92>>2],o[A+128>>2]=i,i=o[f+88>>2],o[A+116>>2]=o[f+84>>2],o[A+120>>2]=i,i=o[f+176>>2],o[A+204>>2]=o[f+172>>2],o[A+208>>2]=i,i=o[f+168>>2],o[A+196>>2]=o[f+164>>2],o[A+200>>2]=i;break n}if(e=2,(0|f)<2)break i;c=v[A+332|0]}if(2&c)break e;e=e-1|0,o[A>>2]=e,i=o[16+(f=(e<<4)+A|0)>>2],o[A+28>>2]=o[f+12>>2],o[A+32>>2]=i,i=o[f+8>>2],o[A+20>>2]=o[f+4>>2],o[A+24>>2]=i,i=o[f+96>>2],o[A+108>>2]=o[f+92>>2],o[A+112>>2]=i,i=o[f+88>>2],o[A+100>>2]=o[f+84>>2],o[A+104>>2]=i,i=o[f+176>>2],o[A+188>>2]=o[f+172>>2],o[A+192>>2]=i,i=o[f+168>>2],o[A+180>>2]=o[f+164>>2],o[A+184>>2]=i;break e}if(e=1,1!=(0|f))break f;c=v[A+332|0]}1&c||(e=e-1|0,o[A>>2]=e,f=o[16+(e=(e<<4)+A|0)>>2],o[A+12>>2]=o[e+12>>2],o[A+16>>2]=f,f=o[e+8>>2],o[A+4>>2]=o[e+4>>2],o[A+8>>2]=f,f=o[e+96>>2],o[A+92>>2]=o[e+92>>2],o[A+96>>2]=f,f=o[e+88>>2],o[A+84>>2]=o[e+84>>2],o[A+88>>2]=f,f=o[e+176>>2],o[A+172>>2]=o[e+172>>2],o[A+176>>2]=f,f=o[e+168>>2],o[A+164>>2]=o[e+164>>2],o[A+168>>2]=f)}e=w[A+336>>2]>=m(0)&w[A+340>>2]>=m(0)&w[A+344>>2]>=m(0)&t>=m(0)}else if(!v[A+352|0]){o[A+276>>2]=0,o[A+280>>2]=0,e=1,a[A+312|0]=1,o[A+284>>2]=0,o[A+288>>2]=0;break A}}a[A+312|0]=e}else e=v[A+312|0];return S=r+16|0,!!(255&e)}function rA(A){var r,f=0,e=0,i=0,n=0,c=0,b=0,u=m(0),l=0,s=0,k=m(0),d=0,Z=0,E=m(0),W=0,p=m(0),F=0,R=0,Y=m(0),V=0,g=0,X=m(0),D=m(0),C=0,J=m(0),x=m(0),y=0,M=m(0),H=0,I=0,T=0,U=m(0),j=0,z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0);S=r=S-96|0,a[r+52|0]=1,o[r+48>>2]=0,a[r+72|0]=1,o[r+40>>2]=0,o[r+44>>2]=0,o[r+68>>2]=0,a[r+92|0]=1,o[r+60>>2]=0,o[r+64>>2]=0,o[r+88>>2]=0,o[r+80>>2]=0,o[r+84>>2]=0,o[r+28>>2]=0,a[r+32|0]=1,o[r+20>>2]=0,o[r+24>>2]=0,o[A+72>>2]=0,o[A+76>>2]=0,o[A+64>>2]=0,o[A+68>>2]=0;A:{r:{if((0|(l=o[A+28>>2]))>0){for(;;){if(H=G(y,36),(0|(I=o[4+(H+o[A+36>>2]|0)>>2]))>0){for(T=0;;){f=o[12+(o[A+36>>2]+H|0)>>2],n=o[f+(T<<2)>>2],f=o[f+(((j=(0|I)==(0|(T=T+1|0)))?0:T)<<2)>>2],t[r+14>>1]=f,t[r+12>>1]=n,(0|(e=n<<16>>16))<(0|(i=f<<16>>16))&&(t[r+14>>1]=n,t[r+12>>1]=f,e=f,i=n),g=i<<16>>16,l=0;f:if(!((f=(Z=e<<16>>16)+(i<<16)&o[r+64>>2]-1)>>>0>=B[r+20>>2])&&-1!=(0|(f=o[o[r+28>>2]+(f<<2)>>2]))){for(b=o[r+48>>2],n=o[r+88>>2];;){if(!(h[(f=(s=f<<2)+n|0)>>1]==(65535&e)&h[f+2>>1]==(65535&i))){if(-1!=(0|(f=o[b+s>>2])))continue;break f}break}l=s+o[r+68>>2]|0}n=(f=o[A+16>>2])+(g<<4)|0,f=f+(Z<<4)|0,U=u=m(w[n+8>>2]-w[f+8>>2]),p=m(w[n>>2]-w[f>>2]),E=m(w[n+4>>2]-w[f+4>>2]),u=m(m(1)/m(N(m(m(u*u)+m(m(p*p)+m(E*E)))))),X=m(U*u),D=m(E*u),k=m(p*u);f:{if((0|(e=o[A+48>>2]))>0)for(n=o[A+56>>2],f=0;;){if(p=w[8+(i=n+(f<<4)|0)>>2],u=w[i>>2],E=w[i+4>>2],!(+m(Q(m(u-k)))>1e-6|+m(Q(m(E-D)))>1e-6|+m(Q(m(p-X)))>1e-6)|!(+m(Q(m(k+u)))>1e-6|+m(Q(m(D+E)))>1e-6|+m(Q(m(X+p)))>1e-6))break f;if((0|(f=f+1|0))==(0|e))break}if(o[A+52>>2]==(0|e)&&!((0|(F=e?e<<1:1))<=(0|e))){if(F?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](F<<4,16),e=o[A+48>>2]):i=0,!((0|e)<=0)){if(g=1&e,f=0,1!=(0|e))for(Z=-2&e,e=0;b=(s=f<<4)+i|0,W=s+o[A+56>>2]|0,n=o[W+4>>2],o[b>>2]=o[W>>2],o[b+4>>2]=n,n=o[W+12>>2],o[b+8>>2]=o[W+8>>2],o[b+12>>2]=n,b=(n=16|s)+i|0,s=n+o[A+56>>2]|0,n=o[s+4>>2],o[b>>2]=o[s>>2],o[b+4>>2]=n,n=o[s+12>>2],o[b+8>>2]=o[s+8>>2],o[b+12>>2]=n,f=f+2|0,(0|Z)!=(0|(e=e+2|0)););g&&(e=(f<<=4)+i|0,n=f+o[A+56>>2]|0,f=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=f,f=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=f)}!(f=o[A+56>>2])||!f|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+56>>2]=i,a[A+60|0]=1,o[A+52>>2]=F,e=o[A+48>>2]}f=o[A+56>>2]+(e<<4)|0,o[f+12>>2]=0,w[f+8>>2]=X,w[f+4>>2]=D,w[f>>2]=k,o[A+48>>2]=o[A+48>>2]+1}f:{if(l){if(t[l+2>>1]=y,j)break f;continue}t[r+8>>1]=y,t[r+10>>1]=65535;e:{i:{if(!((C=(i=t[r+12>>1])+((s=h[r+14>>1])<<16)&(n=o[48+(c=r+16|0)>>2])-1)>>>0>=B[c+4>>2])&&-1!=(0|(f=o[o[c+12>>2]+(C<<2)>>2])))for(g=o[c+32>>2],Z=o[c+72>>2],b=65535&i;;){if((0|b)==h[(i=(e=f<<2)+Z|0)>>1]&(0|s)==h[i+2>>1])break i;if(-1==(0|(f=o[e+g>>2])))break}if((0|n)==(0|(f=g=o[c+44>>2]))&&!((0|(f=n))>=(0|(W=f?f<<1:1)))){if(W?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](W<<2,16),i=o[c+44>>2]):(d=0,i=n),!((0|i)<=0)){if(F=0,f=0,i>>>0>=4)for(Z=-4&i,l=0;b=(s=f<<2)+d|0,e=s+o[c+52>>2]|0,e=h[e>>1]|h[e+2>>1]<<16,t[b>>1]=e,t[b+2>>1]=e>>>16,b=(e=4|s)+d|0,e=e+o[c+52>>2]|0,e=h[e>>1]|h[e+2>>1]<<16,t[b>>1]=e,t[b+2>>1]=e>>>16,b=(e=8|s)+d|0,e=e+o[c+52>>2]|0,e=h[e>>1]|h[e+2>>1]<<16,t[b>>1]=e,t[b+2>>1]=e>>>16,b=(e=12|s)+d|0,e=e+o[c+52>>2]|0,e=h[e>>1]|h[e+2>>1]<<16,t[b>>1]=e,t[b+2>>1]=e>>>16,f=f+4|0,(0|Z)!=(0|(l=l+4|0)););if(b=3&i)for(;e=(i=f<<2)+d|0,i=i+o[c+52>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,f=f+1|0,(0|b)!=(0|(F=F+1|0)););}!(f=o[c+52>>2])||!f|!v[c+56|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[c+52>>2]=d,a[c+56|0]=1,o[c+48>>2]=W,f=o[c+44>>2]}if(i=o[c+52>>2]+(f<<2)|0,f=h[r+8>>1]|h[r+10>>1]<<16,t[i>>1]=f,t[i+2>>1]=f>>>16,o[c+44>>2]=o[c+44>>2]+1,(0|(W=o[c- -64>>2]))==o[c+68>>2]&&!((0|(Z=W?W<<1:1))<=(0|W))){if(Z?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](Z<<2,16),W=o[c+64>>2]):d=0,!((0|W)<=0)){if(F=0,f=0,W>>>0>=4)for(b=-4&W,l=0;e=(s=f<<2)+d|0,i=s+o[c+72>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,e=(i=4|s)+d|0,i=i+o[c+72>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,e=(i=8|s)+d|0,i=i+o[c+72>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,e=(i=12|s)+d|0,i=i+o[c+72>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,f=f+4|0,(0|b)!=(0|(l=l+4|0)););if(b=3&W)for(;e=(i=f<<2)+d|0,i=i+o[c+72>>2]|0,i=h[i>>1]|h[i+2>>1]<<16,t[e>>1]=i,t[e+2>>1]=i>>>16,f=f+1|0,(0|b)!=(0|(F=F+1|0)););}!(f=o[c+72>>2])||!f|!v[c+76|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[c+72>>2]=d,a[c+76|0]=1,o[c+68>>2]=Z,W=o[c+64>>2]}if(i=o[c+72>>2]+(W<<2)|0,f=h[r+12>>1]|h[r+14>>1]<<16,t[i>>1]=f,t[i+2>>1]=f>>>16,o[c+64>>2]=o[c+64>>2]+1,(0|n)>2]){if(l=0,d=0,W=0,C=0,!((0|(i=o[c+4>>2]))>=(0|(V=o[c+48>>2])))){if((0|V)<=o[c+8>>2])l=o[c+12>>2];else{V?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](V<<2,16),f=o[c+4>>2]):f=i,Z=o[c+12>>2];n:{a:if((0|f)>0){if(f>>>0>=4)for(e=-4&f;o[(b=d<<2)+l>>2]=o[b+Z>>2],o[(n=4|b)+l>>2]=o[n+Z>>2],o[(n=8|b)+l>>2]=o[n+Z>>2],o[(n=12|b)+l>>2]=o[n+Z>>2],d=d+4|0,(0|e)!=(0|(W=W+4|0)););if(!(n=3&f))break a;for(;o[(f=d<<2)+l>>2]=o[f+Z>>2],d=d+1|0,(0|n)!=(0|(C=C+1|0)););}else if(!Z)break n;Z&&v[c+16|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](Z))}o[c+12>>2]=l,a[c+16|0]=1,o[c+8>>2]=V}if(Af((f=i<<2)+l|0,0,(s=V<<2)-f|0),o[c+4>>2]=V,(0|(n=o[c+24>>2]))<(0|V)){n:if((0|V)<=o[c+28>>2])l=o[c+32>>2];else{V?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](s,16),f=o[c+24>>2]):(l=0,f=n),F=o[c+32>>2];a:if((0|f)>0){if(C=0,d=0,f>>>0>=4)for(b=-4&f,W=0;o[(Z=d<<2)+l>>2]=o[Z+F>>2],o[(e=4|Z)+l>>2]=o[e+F>>2],o[(e=8|Z)+l>>2]=o[e+F>>2],o[(e=12|Z)+l>>2]=o[e+F>>2],d=d+4|0,(0|b)!=(0|(W=W+4|0)););if(!(e=3&f))break a;for(;o[(f=d<<2)+l>>2]=o[f+F>>2],d=d+1|0,(0|e)!=(0|(C=C+1|0)););}else if(!F){o[c+32>>2]=l,o[c+28>>2]=V,a[c+36|0]=1;break n}F&&v[c+36|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](F)),o[c+32>>2]=l,a[c+36|0]=1,o[c+28>>2]=V}Af((f=n<<2)+l|0,0,s-f|0)}if(o[c+24>>2]=V,(0|V)>0&&(Af(o[c+12>>2],255,s),Af(o[c+32>>2],255,s)),!((0|i)<=0))for(Z=o[c+32>>2],b=o[c+72>>2],e=o[c+12>>2],d=0;f=e+(((h[2+(f=(n=d<<2)+b|0)>>1]<<16)+t[f>>1]&o[c+48>>2]-1)<<2)|0,o[n+Z>>2]=o[f>>2],o[f>>2]=d,(0|i)!=(0|(d=d+1|0)););}C=t[r+12>>1]+(h[r+14>>1]<<16)&o[c+48>>2]-1}f=o[c+12>>2]+(C<<2)|0,o[o[c+32>>2]+(g<<2)>>2]=o[f>>2],o[f>>2]=g;break e}n=o[c+52>>2]+(f<<2)|0,f=h[r+8>>1]|h[r+10>>1]<<16,t[n>>1]=f,t[n+2>>1]=f>>>16}if(!j)continue}break}l=o[A+28>>2]}if(!((0|(y=y+1|0))<(0|l)))break}if(y=0,i=(0|l)>0)break r}u=w[A+72>>2],J=w[A+68>>2],x=w[A+64>>2];break A}for(H=o[A+16>>2],b=o[A+36>>2],x=w[A+64>>2],J=w[A+68>>2],u=w[A+72>>2];;){if(f=b+G(y,36)|0,(0|(s=o[f+4>>2]))>=3)for(g=o[f+12>>2],I=H+(o[g>>2]<<4)|0,e=s-2|0,f=1;Z=H+(o[g+(f<<2)>>2]<<4)|0,L=w[Z+8>>2],R=H+(o[g+((0|(n=f+1|0))%(0|s)<<2)>>2]<<4)|0,$=w[R+8>>2],z=w[I>>2],K=w[Z>>2],q=m(z-K),P=w[I+4>>2],_=w[R+4>>2],Y=m(P-_),X=w[R>>2],D=m(z-X),k=w[Z+4>>2],E=m(P-k),AA=m(m(q*Y)-m(D*E)),O=w[I+8>>2],p=m(O-$),U=m(E*p),E=m(O-L),Y=m(U-m(Y*E)),U=u,u=m(m(E*D)-m(p*q)),E=m(m(N(m(m(AA*AA)+m(m(Y*Y)+m(u*u)))))*m(.5)),u=m(U+m(m(m(m(O+L)+$)*m(.3333333432674408))*E)),w[A+72>>2]=u,J=m(J+m(m(m(_+m(P+k))*m(.3333333432674408))*E)),w[A+68>>2]=J,x=m(x+m(m(m(X+m(z+K))*m(.3333333432674408))*E)),w[A+64>>2]=x,M=m(M+E),R=(0|f)==(0|e),f=n,!R;);if((0|(y=y+1|0))==(0|l))break}R=i}if(o[A+96>>2]=2139095039,E=m(m(1)/M),X=m(E*u),w[A+72>>2]=X,D=m(E*J),w[A+68>>2]=D,k=m(E*x),w[A+64>>2]=k,p=m(34028234663852886e22),E=m(34028234663852886e22),R)for(n=o[A+36>>2],f=0;R=n+G(f,36)|0,(u=m(Q(m(w[R+32>>2]+m(m(X*w[R+28>>2])+m(m(k*w[R+20>>2])+m(D*w[R+24>>2])))))))>2]=u,E=u),(0|l)!=(0|(f=f+1|0)););if((0|(R=o[A+8>>2]))<=0)Y=m(-34028234663852886e22),u=m(34028234663852886e22),J=m(-34028234663852886e22),x=m(-34028234663852886e22),M=m(34028234663852886e22);else for(n=o[A+16>>2],x=m(-34028234663852886e22),f=0,M=m(34028234663852886e22),J=m(-34028234663852886e22),Y=m(-34028234663852886e22),u=m(34028234663852886e22);x=(k=w[8+(i=n+(f<<4)|0)>>2])>x?k:x,u=u>k?k:u,J=(k=w[i+4>>2])>J?k:J,p=k>2])>Y?k:Y,M=k>2]=0,k=m(x-u),w[A+124>>2]=k,X=m(J-p),w[A+120>>2]=X,D=m(Y-M),w[A+116>>2]=D,o[A+112>>2]=0,w[A+108>>2]=u+x,w[A+104>>2]=p+J,w[A+100>>2]=Y+M,u=w[(n=(R=k>((n=X>D)?X:D)?2:n)<<2)+(A+116|0)>>2],k=m(E/m(1.7320507764816284)),w[A+84>>2]=k,w[A+88>>2]=k,w[A+80>>2]=k,n=(i=A+80|0)+n|0,u=m(u*m(.5)),w[n>>2]=u,p=m(m(u-k)*m(.0009765625));A:{r:{for(;;){if(br(A))break r;if(u=m(u-p),w[n>>2]=u,1024==(0|(f=f+1|0)))break}w[A+84>>2]=k,w[A+88>>2]=k,w[A+80>>2]=k;break A}if(u=w[(n=i+((1<<(f=1<>2],Y=w[(f=i+(f<<2)|0)>>2],E=m(m(E-k)*m(.0009765625)),w[f>>2]=E+Y,p=m(E+w[n>>2]),w[n>>2]=p,br(A))for(e=0;;){if(u=p,1024==(0|(e=e+1|0)))break A;if(Y=w[f>>2],w[f>>2]=E+Y,p=m(E+w[n>>2]),w[n>>2]=p,!br(A))break}w[f>>2]=Y,w[n>>2]=u}!(A=o[r+88>>2])||!A|!v[r+92|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[r+88>>2]=0,a[r+92|0]=1,o[r+80>>2]=0,o[r+84>>2]=0,!(A=o[r+68>>2])||!A|!v[r+72|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[r+68>>2]=0,a[r+72|0]=1,o[r+60>>2]=0,o[r+64>>2]=0,!(A=o[r+48>>2])||!A|!v[r+52|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[r+48>>2]=0,a[r+52|0]=1,o[r+40>>2]=0,o[r+44>>2]=0,!(A=o[r+28>>2])||!A|!v[r+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),S=r+96|0}function fA(A,r,f){var e,i,n,t,c,b,u,l,s,k,d,v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=0,I=0,T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=0,K=m(0);T=w[r+52>>2],U=w[r+56>>2],F=w[A+96>>2],R=w[A+100>>2],Y=w[A+104>>2],v=w[r+20>>2],h=w[r+24>>2],V=w[A- -64>>2],g=w[A+80>>2],D=w[A+52>>2],C=w[A+68>>2],J=w[A+84>>2],x=w[A+56>>2],B=w[r+36>>2],y=w[A+72>>2],G=w[r+40>>2],M=w[A+88>>2],j=w[r+48>>2],Z=w[r+8>>2],Q=w[r>>2],p=w[r+4>>2],W=w[r+16>>2],X=w[A+48>>2],E=w[r+32>>2],o[A+1296>>2]=0,o[A+1280>>2]=0,o[A+1264>>2]=0,o[A+1248>>2]=0,w[(r=A+1276|0)>>2]=m(M*G)+m(m(x*E)+m(y*B)),w[(I=A+1272|0)>>2]=m(J*G)+m(m(D*E)+m(C*B)),w[(e=A+1268|0)>>2]=m(g*G)+m(m(X*E)+m(V*B)),w[(i=A+1260|0)>>2]=m(M*h)+m(m(x*W)+m(y*v)),w[(n=A+1256|0)>>2]=m(J*h)+m(m(D*W)+m(C*v)),w[(t=A+1252|0)>>2]=m(g*h)+m(m(X*W)+m(V*v)),w[(c=A+1244|0)>>2]=m(M*Z)+m(m(x*Q)+m(p*y)),w[(b=A+1240|0)>>2]=m(J*Z)+m(m(D*Q)+m(p*C)),w[A+1236>>2]=m(g*Z)+m(m(X*Q)+m(V*p)),w[(u=A+1292|0)>>2]=U+m(m(Y*G)+m(m(F*E)+m(B*R))),w[(l=A+1288|0)>>2]=T+m(m(Y*h)+m(m(F*W)+m(v*R))),w[(s=A+1284|0)>>2]=j+m(m(Y*Z)+m(m(F*Q)+m(p*R))),T=w[f+52>>2],U=w[f+56>>2],F=w[A+160>>2],R=w[A+164>>2],Y=w[A+168>>2],v=w[f+20>>2],h=w[f+24>>2],V=w[A+128>>2],g=w[A+144>>2],D=w[A+116>>2],C=w[A+132>>2],J=w[A+148>>2],x=w[A+120>>2],y=w[A+136>>2],B=w[f+36>>2],M=w[A+152>>2],G=w[f+40>>2],j=w[f+48>>2],Z=w[f+8>>2],Q=w[f>>2],p=w[f+4>>2],W=w[f+16>>2],X=w[A+112>>2],E=w[f+32>>2],o[A+1360>>2]=0,o[A+1344>>2]=0,o[A+1328>>2]=0,o[A+1312>>2]=0,w[A+1340>>2]=m(M*G)+m(m(x*E)+m(y*B)),w[A+1336>>2]=m(J*G)+m(m(D*E)+m(C*B)),w[A+1332>>2]=m(g*G)+m(m(X*E)+m(V*B)),w[A+1324>>2]=m(M*h)+m(m(x*W)+m(y*v)),w[A+1320>>2]=m(J*h)+m(m(D*W)+m(C*v)),w[A+1316>>2]=m(g*h)+m(m(X*W)+m(V*v)),w[A+1308>>2]=m(M*Z)+m(m(x*Q)+m(p*y)),w[A+1304>>2]=m(J*Z)+m(m(D*Q)+m(p*C)),w[A+1300>>2]=m(g*Z)+m(m(X*Q)+m(V*p)),w[(f=A+1356|0)>>2]=U+m(m(Y*G)+m(m(F*E)+m(B*R))),w[(k=A+1352|0)>>2]=T+m(m(Y*h)+m(m(F*W)+m(v*R))),w[(d=A+1348|0)>>2]=j+m(m(Y*Z)+m(m(F*Q)+m(p*R))),o[A+1440>>2]=0,B=w[c>>2],Q=w[t>>2],p=w[I>>2],W=w[e>>2],E=w[n>>2],h=m(m(Q*p)-m(W*E)),G=w[A+1236>>2],F=w[r>>2],R=w[i>>2],D=m(m(E*F)-m(p*R)),Z=w[b>>2],C=m(m(R*W)-m(F*Q)),v=m(m(1)/m(m(B*h)+m(m(G*D)+m(Z*C)))),Y=m(w[f>>2]-w[u>>2]),V=m(w[d>>2]-w[s>>2]),g=m(w[k>>2]-w[l>>2]),h=m(m(m(m(m(G*E)-m(Q*Z))*v)*Y)+m(m(m(h*v)*V)+m(g*m(m(m(Z*W)-m(p*G))*v)))),w[A+1436>>2]=h,G=m(m(m(m(m(B*Q)-m(R*G))*v)*Y)+m(m(m(C*v)*V)+m(g*m(m(m(G*F)-m(W*B))*v)))),w[A+1432>>2]=G,v=m(m(m(m(m(Z*R)-m(E*B))*v)*Y)+m(m(m(D*v)*V)+m(g*m(m(m(B*p)-m(F*Z))*v)))),w[A+1428>>2]=v,w[A+940>>2]=v,r=A+924|0,B=m(0),f=A+908|0;A:{if((Z=w[A+680>>2])>(Q=w[A+696>>2]))I=f;else{if(w[f>>2]=v-Z,H=3,Z==Q)break A;B=m(v-Q),H=4,I=r}w[I>>2]=B}w[A+944>>2]=G,o[A+956>>2]=H;A:{if((v=w[A+684>>2])>(B=w[A+700>>2]))H=0,v=m(0),I=f;else{if(w[A+912>>2]=G-v,H=3,v==B)break A;v=m(G-B),H=4,I=r}w[I+4>>2]=v,h=w[A+1436>>2]}w[A+948>>2]=h,o[A+960>>2]=H;A:{if((v=w[A+688>>2])>(B=w[A+704>>2]))H=0,v=m(0);else{if(w[A+916>>2]=h-v,H=3,v==B)break A;f=r,H=4,v=m(h-B)}w[f+8>>2]=v}o[A+964>>2]=H,S=f=S-48|0,Y=w[A+1332>>2],V=w[A+1316>>2],g=w[A+1336>>2],D=w[A+1304>>2],C=w[A+1320>>2],J=w[A+1340>>2],x=w[A+1308>>2],y=w[A+1324>>2],G=w[A+1244>>2],Q=w[A+1256>>2],p=w[A+1272>>2],Z=w[A+1240>>2],B=w[A+1268>>2],W=w[A+1260>>2],E=w[A+1252>>2],F=w[A+1276>>2],M=w[A+1300>>2],h=w[A+1236>>2],o[f+44>>2]=0,o[f+28>>2]=0,R=m(m(E*p)-m(B*Q)),L=m(m(Q*F)-m(p*W)),z=m(m(W*B)-m(F*E)),v=m(m(1)/m(m(G*R)+m(m(h*L)+m(Z*z)))),X=m(m(m(h*Q)-m(E*Z))*v),T=m(R*v),U=m(m(m(Z*B)-m(p*h))*v),R=m(m(J*X)+m(m(x*T)+m(y*U))),w[f+40>>2]=R,j=m(m(g*X)+m(m(D*T)+m(U*C))),w[f+36>>2]=j,P=m(m(m(G*E)-m(W*h))*v),z=m(z*v),O=m(m(m(h*F)-m(B*G))*v),h=m(m(J*P)+m(m(x*z)+m(y*O))),w[f+24>>2]=h,E=m(m(g*P)+m(m(D*z)+m(O*C))),w[f+20>>2]=E,o[f+12>>2]=0,B=m(m(Y*X)+m(m(M*T)+m(V*U))),w[f+32>>2]=B,X=m(m(Y*P)+m(m(M*z)+m(V*O))),w[f+16>>2]=X,Q=m(m(m(Z*W)-m(Q*G))*v),W=m(L*v),G=m(m(m(G*p)-m(F*Z))*v),Z=m(m(J*Q)+m(m(x*W)+m(y*G))),w[f+8>>2]=Z,v=m(m(g*Q)+m(m(D*W)+m(G*C))),w[f+4>>2]=v,G=m(m(Y*Q)+m(m(M*W)+m(V*G))),w[f>>2]=G;A:{r:{f:{e:{i:{n:{a:{t:switch(0|(r=o[A+1232>>2])){case 5:break f;case 4:break e;case 3:break i;case 2:break n;case 1:break a;case 0:break t;default:break A}r=A+1372|0;t:{if(Bm(-1)){$=A,K=zr(m(-j),R),w[$+1364>>2]=K,$=A+1368|0,K=sf((v=Bm(1)?m(1):v),w[$>>2]=K,v=zr(m(-X),G);break t}o[A+1368>>2]=-1077342245,$=A,K=m(-zr(v,E)),w[$+1364>>2]=K}else o[A+1368>>2]=1070141403,$=A,K=zr(v,E),w[$+1364>>2]=K;v=m(0)}w[r>>2]=v;break r}r=A+1364|0;a:if((v=w[f+16>>2])m(-1)){$=r,K=zr(w[f+24>>2],w[f+20>>2]),w[$>>2]=K,$=r,K=zr(w[f+32>>2],w[f>>2]),w[$+4>>2]=K,$=r,K=sf((v=(v=w[f+16>>2])>m(1)?m(-1):m(-v))>m(1)?m(1):v),w[$+8>>2]=K;break a}v=w[f+40>>2],h=w[f+8>>2],o[r+4>>2]=0,$=r,K=m(-zr(m(-h),v)),w[$>>2]=K,w[r+8>>2]=1.5707963705062866}else v=w[f+40>>2],h=w[f+8>>2],o[r+4>>2]=0,$=r,K=zr(m(-h),v),w[$>>2]=K,w[r+8>>2]=-1.5707963705062866;break r}r=A+1364|0;n:{if((v=w[f+36>>2])m(-1)){$=r,K=sf((v=v>m(1)?m(-1):m(-v))>m(1)?m(1):v),w[$>>2]=K,$=r,K=zr(w[f+32>>2],w[f+40>>2]),w[$+4>>2]=K,$=r,K=zr(w[f+4>>2],w[f+20>>2]),w[$+8>>2]=K;break n}o[r>>2]=1070141403,$=r,K=m(-zr(m(-w[f+16>>2]),w[f>>2])),w[$+4>>2]=K}else o[r>>2]=-1077342245,$=r,K=zr(m(-w[f+16>>2]),w[f>>2]),w[$+4>>2]=K;w[r+8>>2]=0}break r}r=A+1372|0;i:if(vm(-1)){$=A,K=zr(m(-j),E),w[$+1364>>2]=K,$=A+1368|0,K=zr(m(-Z),G),w[$>>2]=K,v=sf((v=vm(1)?m(1):v);break i}o[A+1364>>2]=0,$=A+1368|0,K=m(-zr(h,R)),w[$>>2]=K,v=m(-1.5707963705062866)}else o[A+1364>>2]=0,$=A+1368|0,K=zr(h,R),w[$>>2]=K,v=m(1.5707963705062866);w[r>>2]=v;break r}r=A+1372|0;e:if(hm(-1)){$=A,K=sf((v=hm(1)?m(1):v),w[$+1364>>2]=K,$=A+1368|0,K=zr(m(-Z),R),w[$>>2]=K,v=zr(m(-X),E);break e}o[A+1364>>2]=-1077342245,o[A+1368>>2]=0,v=m(-zr(B,G))}else o[A+1364>>2]=1070141403,o[A+1368>>2]=0,v=zr(B,G);w[r>>2]=v;break r}r=A+1364|0;f:if((v=w[f+8>>2])m(-1)){$=r,K=zr(w[f+24>>2],w[f+40>>2]),w[$>>2]=K,$=r,K=sf((v=(v=w[f+8>>2])>m(1)?m(-1):m(-v))>m(1)?m(1):v),w[$+4>>2]=K,$=r,K=zr(w[f+4>>2],w[f>>2]),w[$+8>>2]=K;break f}o[r>>2]=0,o[r+4>>2]=1070141403,$=r,K=m(-zr(w[f+16>>2],w[f+32>>2])),w[$+8>>2]=K}else o[r>>2]=0,o[r+4>>2]=-1077342245,$=r,K=zr(m(-w[f+16>>2]),m(-w[f+32>>2])),w[$+8>>2]=K}r=o[A+1232>>2]}A:{r:{switch(0|r){default:p=w[A+1420>>2],h=w[A+1416>>2],B=w[A+1412>>2],W=w[A+1404>>2],G=w[A+1400>>2],E=w[A+1396>>2],Z=w[A+1388>>2],Q=w[A+1384>>2],v=w[A+1380>>2];break A;case 0:o[A+1408>>2]=0,o[A+1424>>2]=0,o[A+1392>>2]=0,v=w[A+1300>>2],F=w[A+1276>>2],B=w[A+1332>>2],Q=w[A+1244>>2],G=m(m(v*F)-m(B*Q)),R=w[A+1260>>2],Z=w[A+1316>>2],E=m(m(R*B)-m(Z*F)),p=m(m(v*G)-m(E*Z)),W=m(m(Q*Z)-m(v*R)),h=m(m(B*E)-m(W*v)),B=m(m(Z*W)-m(G*B)),Z=m(m(E*R)-m(Q*G)),Q=m(m(W*Q)-m(F*E)),v=m(m(G*F)-m(R*W));break A;case 1:o[A+1424>>2]=0,o[A+1408>>2]=0,o[A+1392>>2]=0,v=w[A+1316>>2],F=w[A+1272>>2],R=w[A+1256>>2],Z=w[A+1332>>2],B=m(m(v*F)-m(R*Z)),Q=w[A+1240>>2],G=w[A+1300>>2],h=m(m(Z*Q)-m(F*G)),W=m(m(B*v)-m(G*h)),p=m(m(G*R)-m(Q*v)),G=m(m(p*G)-m(Z*B)),E=m(m(h*Z)-m(v*p)),Z=m(m(Q*h)-m(B*R)),Q=m(m(F*B)-m(p*Q)),v=m(m(R*p)-m(h*F));break A;case 2:o[A+1424>>2]=0,o[A+1408>>2]=0,o[A+1392>>2]=0,h=w[A+1304>>2],W=w[A+1260>>2],F=w[A+1244>>2],B=w[A+1320>>2],Z=m(m(h*W)-m(F*B)),w[A+1388>>2]=Z,R=w[A+1336>>2],p=w[A+1276>>2],Q=m(m(F*R)-m(h*p)),w[A+1384>>2]=Q,v=m(m(B*p)-m(W*R)),w[A+1380>>2]=v,G=m(m(p*v)-m(Z*F)),w[A+1400>>2]=G,E=m(m(W*Z)-m(Q*p)),w[A+1396>>2]=E,p=m(m(v*B)-m(h*Q)),h=m(m(Z*h)-m(R*v)),B=m(m(Q*R)-m(B*Z)),W=m(m(F*Q)-m(v*W));break A;case 3:o[A+1424>>2]=0,o[A+1408>>2]=0,o[A+1392>>2]=0,v=w[A+1236>>2],F=w[A+1320>>2],Q=w[A+1304>>2],Z=w[A+1252>>2],p=m(m(v*F)-m(Q*Z)),w[A+1420>>2]=p,E=w[A+1268>>2],R=w[A+1336>>2],h=m(m(Q*E)-m(v*R)),w[A+1416>>2]=h,B=m(m(Z*R)-m(F*E)),w[A+1412>>2]=B,W=m(m(B*Z)-m(v*h)),w[A+1404>>2]=W,G=m(m(p*v)-m(E*B)),w[A+1400>>2]=G,E=m(m(h*E)-m(Z*p)),w[A+1396>>2]=E,Z=m(m(Q*h)-m(B*F)),w[A+1388>>2]=Z,Q=m(m(R*B)-m(p*Q)),w[A+1384>>2]=Q,v=m(m(F*p)-m(h*R));break r;case 4:o[A+1424>>2]=0,o[A+1408>>2]=0,o[A+1392>>2]=0,h=w[A+1240>>2],E=w[A+1324>>2],G=w[A+1308>>2],B=w[A+1256>>2],Z=m(m(h*E)-m(G*B)),w[A+1388>>2]=Z,W=w[A+1272>>2],F=w[A+1340>>2],Q=m(m(G*W)-m(h*F)),w[A+1384>>2]=Q,v=m(m(B*F)-m(E*W)),w[A+1380>>2]=v,p=m(m(v*B)-m(h*Q)),w[A+1420>>2]=p,h=m(m(Z*h)-m(W*v)),w[A+1416>>2]=h,B=m(m(Q*W)-m(B*Z)),w[A+1412>>2]=B,W=m(m(G*Q)-m(v*E)),w[A+1404>>2]=W,G=m(m(F*v)-m(Z*G)),w[A+1400>>2]=G,E=m(m(E*Z)-m(Q*F)),w[A+1396>>2]=E;break A;case 5:}o[A+1408>>2]=0,o[A+1424>>2]=0,o[A+1392>>2]=0,v=w[A+1308>>2],B=w[A+1252>>2],h=w[A+1236>>2],F=w[A+1324>>2],W=m(m(v*B)-m(h*F)),w[A+1404>>2]=W,R=w[A+1340>>2],Z=w[A+1268>>2],G=m(m(h*R)-m(v*Z)),w[A+1400>>2]=G,E=m(m(F*Z)-m(B*R)),w[A+1396>>2]=E,p=m(m(h*G)-m(E*B)),w[A+1420>>2]=p,h=m(m(Z*E)-m(W*h)),w[A+1416>>2]=h,B=m(m(B*W)-m(G*Z)),w[A+1412>>2]=B,Z=m(m(E*F)-m(v*G)),w[A+1388>>2]=Z,Q=m(m(W*v)-m(R*E)),w[A+1384>>2]=Q,v=m(m(G*R)-m(F*W))}w[A+1380>>2]=v}F=p,p=m(m(1)/m(N(m(m(p*p)+m(m(B*B)+m(h*h)))))),w[A+1420>>2]=F*p,w[A+1416>>2]=h*p,w[A+1412>>2]=B*p,h=m(m(1)/m(N(m(m(W*W)+m(m(E*E)+m(G*G)))))),w[A+1404>>2]=W*h,w[A+1400>>2]=G*h,w[A+1396>>2]=E*h,h=m(m(1)/m(N(m(m(Z*Z)+m(m(v*v)+m(Q*Q)))))),w[A+1388>>2]=Z*h,w[A+1384>>2]=Q*h,w[A+1380>>2]=v*h,S=f+48|0,h=w[o[A+28>>2]+404>>2],v=w[o[A+32>>2]+404>>2],a[A+1452|0]=hm(0)?m(p/v):m(.5),w[A+1444>>2]=v,w[A+1448>>2]=m(1)-v}function eA(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=m(0),a=m(0),t=0,c=m(0),b=m(0),u=m(0),l=0,s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=0,E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=0,x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=m(0),nA=m(0),aA=m(0),tA=m(0);S=i=S-272|0,o[A+56>>2]=0,o[i+264>>2]=0,o[i+268>>2]=0,o[i+256>>2]=0,o[i+260>>2]=0,t=o[r+12>>2],o[i+168>>2]=o[r+8>>2],o[i+172>>2]=t,t=o[r+4>>2],o[i+160>>2]=o[r>>2],o[i+164>>2]=t,t=o[r+28>>2],o[i+184>>2]=o[r+24>>2],o[i+188>>2]=t,t=o[r+20>>2],o[i+176>>2]=o[r+16>>2],o[i+180>>2]=t,t=o[r+44>>2],o[i+200>>2]=o[r+40>>2],o[i+204>>2]=t,t=o[r+36>>2],o[i+192>>2]=o[r+32>>2],o[i+196>>2]=t,t=o[r+60>>2],o[i+216>>2]=o[r+56>>2],o[i+220>>2]=t,t=o[r+52>>2],o[i+208>>2]=o[r+48>>2],o[i+212>>2]=t,t=o[r+76>>2],o[i+104>>2]=o[r+72>>2],o[i+108>>2]=t,t=o[r+68>>2],o[i+96>>2]=o[r+64>>2],o[i+100>>2]=t,t=o[r+92>>2],o[i+120>>2]=o[r+88>>2],o[i+124>>2]=t,t=o[r+84>>2],o[i+112>>2]=o[r+80>>2],o[i+116>>2]=t,t=o[r+108>>2],o[i+136>>2]=o[r+104>>2],o[i+140>>2]=t,t=o[r+100>>2],o[i+128>>2]=o[r+96>>2],o[i+132>>2]=t,t=o[r+124>>2],o[i+152>>2]=o[r+120>>2],o[i+156>>2]=t,t=o[r+116>>2],o[i+144>>2]=o[r+112>>2],o[i+148>>2]=t,n=w[i+212>>2],c=w[i+148>>2],X=m(m(n+c)*m(.5)),w[i+212>>2]=n-X,n=w[i+216>>2],a=w[i+152>>2],D=m(m(n+a)*m(.5)),w[i+216>>2]=n-D,w[i+148>>2]=c-X,w[i+152>>2]=a-D,n=w[i+208>>2],c=w[i+144>>2],C=m(m(n+c)*m(.5)),w[i+208>>2]=n-C,w[i+144>>2]=c-C,l=o[o[A+28>>2]+4>>2]-17>>>0<=1?o[o[A+32>>2]+4>>2]-17>>>0<2:l,n=w[A+44>>2],c=w[A+48>>2],o[8534]=o[8534]+1,o[A+68>>2]=0,o[A+12>>2]=0,o[A+16>>2]=0,o[A+4>>2]=0,o[A+8>>2]=1065353216,o[A+60>>2]=-1,o[A+64>>2]=0,t=v[A+52|0],re(o[A+24>>2]),h=t?m(0):n,B=t?m(0):c,G=m(h+B),t=A+4|0,c=m(0xde0b6b000000000);A:{r:{f:{for(;;){if(s=w[r+32>>2],Z=w[r>>2],d=w[r+16>>2],k=w[r+36>>2],E=w[r+4>>2],p=w[r+20>>2],F=w[r+40>>2],n=w[A+12>>2],u=w[r+8>>2],b=w[A+4>>2],R=w[r+24>>2],a=w[A+8>>2],o[i+252>>2]=0,W=u,u=m(-b),w[i+248>>2]=m(m(W*u)-m(R*a))-m(F*n),w[i+244>>2]=m(m(E*u)-m(p*a))-m(k*n),w[i+240>>2]=m(m(Z*u)-m(d*a))-m(s*n),u=w[r+96>>2],s=w[r+64>>2],Z=w[r+80>>2],d=w[r+100>>2],k=w[r+68>>2],E=w[r+84>>2],p=w[r+104>>2],F=w[r+72>>2],R=w[r+88>>2],o[i+236>>2]=0,w[i+232>>2]=m(p*n)+m(m(F*b)+m(a*R)),w[i+228>>2]=m(d*n)+m(m(k*b)+m(a*E)),w[i+224>>2]=m(u*n)+m(m(s*b)+m(a*Z)),NA(i+80|0,o[A+28>>2],i+240|0),NA(i- -64|0,o[A+32>>2],i+224|0),o[i+60>>2]=0,n=w[i+88>>2],a=w[i+80>>2],u=w[i+84>>2],b=m(m(m(n*w[i+200>>2])+m(m(a*w[i+192>>2])+m(u*w[i+196>>2])))+w[i+216>>2]),w[i+56>>2]=b,Z=m(m(m(n*w[i+184>>2])+m(m(a*w[i+176>>2])+m(u*w[i+180>>2])))+w[i+212>>2]),w[i+52>>2]=Z,d=m(m(m(n*w[i+168>>2])+m(m(a*w[i+160>>2])+m(u*w[i+164>>2])))+w[i+208>>2]),w[i+48>>2]=d,o[i+44>>2]=0,n=w[i+72>>2],a=w[i+64>>2],s=w[i+68>>2],u=m(m(m(n*w[i+136>>2])+m(m(a*w[i+128>>2])+m(s*w[i+132>>2])))+w[i+152>>2]),w[i+40>>2]=u,k=m(m(m(n*w[i+120>>2])+m(m(a*w[i+112>>2])+m(s*w[i+116>>2])))+w[i+148>>2]),w[i+36>>2]=k,n=m(m(m(n*w[i+104>>2])+m(m(a*w[i+96>>2])+m(s*w[i+100>>2])))+w[i+144>>2]),w[i+32>>2]=n,l&&(o[i+40>>2]=0,o[i+56>>2]=0,u=m(0),b=m(0)),o[i+28>>2]=0,a=m(b-u),w[i+24>>2]=a,n=m(d-n),w[i+16>>2]=n,b=m(Z-k),w[i+20>>2]=b,!(!((n=m(m(w[A+12>>2]*a)+m(m(w[A+4>>2]*n)+m(b*w[A+8>>2]))))>m(0))|!(m(n*n)>m(c*w[r+128>>2])))){o[A+68>>2]=10;break f}if(wf(o[A+24>>2],i+16|0)){o[A+68>>2]=1;break f}if((n=m(c-n))<=m(c*m(9.999999974752427e-7))){o[A+68>>2]=n<=m(0)?2:11;break f}if(Wf(o[A+24>>2],i+16|0,i+48|0,i+32|0),De(o[A+24>>2],i))if(n=w[i+8>>2],a=m(n*n),n=w[i>>2],u=m(n*n),n=w[i+4>>2],(n=m(a+m(u+m(n*n))))>2],o[t>>2]=o[i>>2],o[t+4>>2]=l,l=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=l,l=6;else{if(!(m(c-n)<=m(c*m(1.1920928955078125e-7)))){if(Q=o[i+4>>2],o[t>>2]=o[i>>2],o[t+4>>2]=Q,Q=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=Q,Q=o[A+64>>2],o[A+64>>2]=Q+1,(0|Q)>1e3)break r;if(4==o[o[A+24>>2]>>2]){o[A+68>>2]=13;break r}c=n;continue}l=12,c=n}else l=3;break}o[A+68>>2]=l}if(fe(o[A+24>>2],i+240|0,i+224|0),l=o[t+12>>2],o[i+264>>2]=o[t+8>>2],o[i+268>>2]=l,l=o[t+4>>2],o[i+256>>2]=o[t>>2],o[i+260>>2]=l,n=w[A+12>>2],a=w[A+4>>2],b=w[A+8>>2],(u=m(m(n*n)+m(m(a*a)+m(b*b))))>2]=5),u>m(14210854715202004e-30)){u=m(m(1)/m(N(u))),w[i+256>>2]=u*w[i+256>>2],w[i+260>>2]=u*w[i+260>>2],w[i+264>>2]=u*w[i+264>>2],s=m(N(c)),c=m(h/s),w[i+240>>2]=w[i+240>>2]-m(c*a),w[i+244>>2]=w[i+244>>2]-m(c*b),w[i+248>>2]=w[i+248>>2]-m(c*n),c=m(B/s),w[i+224>>2]=m(c*a)+w[i+224>>2],w[i+228>>2]=m(c*b)+w[i+228>>2],w[i+232>>2]=m(c*n)+w[i+232>>2],l=1,o[A+60>>2]=1,n=m(m(m(1)/u)-G);break A}o[A+60>>2]=2}l=0,n=m(0)}J=1,Q=o[A+20>>2],!o[A+68>>2]|!o[A+72>>2]|!Q||(J=!(w[8296]>m(G+n)));A:{r:{if(!(!Q|l&J)){if(o[8533]=o[8533]+1,o[t+8>>2]=0,o[t+12>>2]=0,o[t>>2]=0,o[t+4>>2]=0,0|Zn[o[o[Q>>2]+8>>2]](Q,o[A+24>>2],o[A+28>>2],o[A+32>>2],i+160|0,i+96|0,t,i+80|0,i- -64|0,e)){if(u=m(0),a=w[i+72>>2],G=w[i+88>>2],h=m(a-G),s=w[i+64>>2],Z=w[i+80>>2],c=m(s-Z),d=w[i+68>>2],k=w[i+84>>2],B=m(d-k),(b=m(m(h*h)+m(m(c*c)+m(B*B))))<=m(14210854715202004e-30)&&(u=w[A+16>>2],h=w[A+12>>2],c=w[A+4>>2],B=w[A+8>>2],b=m(m(h*h)+m(m(c*c)+m(B*B)))),b>m(14210854715202004e-30)){if(o[A+60>>2]=3,a=m(G-a),W=m(a*a),a=m(Z-s),s=m(a*a),a=m(k-d),!(!((a=m(-m(N(m(W+m(s+m(a*a)))))))>2],o[i+248>>2]=o[i+88>>2],o[i+252>>2]=e,e=o[i+76>>2],o[i+232>>2]=o[i+72>>2],o[i+236>>2]=e,e=o[i+84>>2],o[i+240>>2]=o[i+80>>2],o[i+244>>2]=e,e=o[i+68>>2],o[i+224>>2]=o[i+64>>2],o[i+228>>2]=e,w[i+268>>2]=u,n=m(m(1)/m(N(b))),w[i+264>>2]=h*n,w[i+260>>2]=B*n,w[i+256>>2]=c*n,n=a;break r}o[A+60>>2]=8;break r}if(o[A+60>>2]=9,l)break r;break A}if(a=w[A+12>>2],b=w[A+4>>2],u=w[A+8>>2],m(m(a*a)+m(m(b*b)+m(u*u)))>m(0)){if(c=m(w[i+88>>2]-w[i+72>>2]),d=m(c*c),c=m(w[i+80>>2]-w[i+64>>2]),W=m(c*c),c=m(w[i+84>>2]-w[i+68>>2]),!(!((c=m(m(N(m(d+m(W+m(c*c)))))-G))>2],o[i+248>>2]=o[i+88>>2],o[i+252>>2]=e,e=o[i+76>>2],o[i+232>>2]=o[i+72>>2],o[i+236>>2]=e,w[i+248>>2]=w[i+248>>2]-m(h*a),w[i+232>>2]=m(B*a)+w[i+232>>2],e=o[i+68>>2],o[i+224>>2]=o[i+64>>2],o[i+228>>2]=e,e=o[i+84>>2],o[i+240>>2]=o[i+80>>2],o[i+244>>2]=e,w[i+224>>2]=m(B*b)+w[i+224>>2],w[i+228>>2]=m(B*u)+w[i+228>>2],w[i+240>>2]=w[i+240>>2]-m(h*b),w[i+244>>2]=w[i+244>>2]-m(h*u),e=o[t+12>>2],o[i+264>>2]=o[t+8>>2],o[i+268>>2]=e,e=o[t+4>>2],o[i+256>>2]=o[t>>2],o[i+260>>2]=e,a=w[i+264>>2],b=w[i+256>>2],u=w[i+260>>2],n=m(m(1)/m(N(m(m(a*a)+m(m(b*b)+m(u*u)))))),w[i+264>>2]=a*n,w[i+260>>2]=u*n,w[i+256>>2]=b*n,o[A+60>>2]=6,n=c;break r}o[A+60>>2]=5;break r}}if(!l)break A}n>2]>m(n*n)&&(e=o[i+260>>2],o[t>>2]=o[i+256>>2],o[t+4>>2]=e,e=o[i+268>>2],o[t+8>>2]=o[i+264>>2],o[t+12>>2]=e,w[A+56>>2]=n,u=w[r+32>>2],h=w[r>>2],B=w[r+16>>2],G=w[r+36>>2],s=w[r+4>>2],Z=w[r+20>>2],c=w[r+40>>2],a=w[r+8>>2],d=w[r+24>>2],o[i+92>>2]=0,W=c,c=w[i+264>>2],b=w[i+256>>2],k=m(a*b),a=w[i+260>>2],w[i+88>>2]=m(W*c)+m(k+m(d*a)),w[i+84>>2]=m(G*c)+m(m(s*b)+m(a*Z)),w[i+80>>2]=m(u*c)+m(m(h*b)+m(B*a)),u=w[r+96>>2],h=w[r+64>>2],B=w[r+80>>2],G=w[r+100>>2],s=w[r+68>>2],Z=w[r+84>>2],d=w[r+104>>2],k=w[r+72>>2],E=w[r+88>>2],o[i+76>>2]=0,b=m(-b),w[i+72>>2]=m(m(k*b)-m(E*a))-m(d*c),w[i+68>>2]=m(m(s*b)-m(Z*a))-m(G*c),w[i+64>>2]=m(m(h*b)-m(B*a))-m(u*c),t=i+80|0,NA(e=i+48|0,o[A+28>>2],t),Q=i- -64|0,NA(l=i+32|0,o[A+32>>2],Q),c=w[i+264>>2],x=w[i+216>>2],y=w[i+200>>2],M=w[i+192>>2],H=w[i+196>>2],I=w[i+152>>2],T=w[i+136>>2],U=w[i+128>>2],j=w[i+132>>2],z=w[i+208>>2],P=w[i+168>>2],O=w[i+160>>2],L=w[i+164>>2],$=w[i+144>>2],K=w[i+104>>2],q=w[i+96>>2],_=w[i+100>>2],AA=w[i+212>>2],rA=w[i+184>>2],u=w[i+56>>2],fA=w[i+176>>2],h=w[i+48>>2],eA=w[i+180>>2],B=w[i+52>>2],iA=w[i+148>>2],nA=w[i+120>>2],G=w[i+40>>2],aA=w[i+112>>2],s=w[i+32>>2],tA=w[i+116>>2],Z=w[i+36>>2],b=w[i+256>>2],a=w[i+260>>2],k=w[r+32>>2],E=w[r>>2],p=w[r+16>>2],F=w[r+36>>2],R=w[r+4>>2],Y=w[r+20>>2],V=w[r+40>>2],d=w[r+8>>2],g=w[r+24>>2],o[i+92>>2]=0,W=d,d=m(-b),w[i+88>>2]=m(m(W*d)-m(g*a))-m(V*c),w[i+84>>2]=m(m(R*d)-m(Y*a))-m(F*c),w[i+80>>2]=m(m(E*d)-m(p*a))-m(k*c),k=w[r+96>>2],E=w[r+64>>2],p=w[r+80>>2],F=w[r+100>>2],R=w[r+68>>2],Y=w[r+84>>2],V=w[r+104>>2],g=w[r+72>>2],W=w[r+88>>2],o[i+76>>2]=0,w[i+72>>2]=m(V*c)+m(m(g*b)+m(a*W)),w[i+68>>2]=m(F*c)+m(m(R*b)+m(a*Y)),w[i+64>>2]=m(k*c)+m(m(E*b)+m(a*p)),NA(e,o[A+28>>2],t),NA(l,o[A+32>>2],Q),Y=w[i+264>>2],b=w[i+56>>2],k=w[i+48>>2],E=w[i+52>>2],p=w[i+40>>2],F=w[i+32>>2],R=w[i+36>>2],W=m(Y*m(m(m(m(b*w[i+200>>2])+m(m(k*w[i+192>>2])+m(E*w[i+196>>2])))+w[i+216>>2])-m(m(m(p*w[i+136>>2])+m(m(F*w[i+128>>2])+m(R*w[i+132>>2])))+w[i+152>>2]))),V=w[i+256>>2],g=m(V*m(m(m(m(b*w[i+168>>2])+m(m(k*w[i+160>>2])+m(E*w[i+164>>2])))+w[i+208>>2])-m(m(m(p*w[i+104>>2])+m(m(F*w[i+96>>2])+m(R*w[i+100>>2])))+w[i+144>>2]))),k=m(m(m(m(b*w[i+184>>2])+m(m(k*w[i+176>>2])+m(E*w[i+180>>2])))+w[i+212>>2])-m(m(m(p*w[i+120>>2])+m(m(F*w[i+112>>2])+m(R*w[i+116>>2])))+w[i+148>>2])),b=w[i+260>>2],m(W+m(g+m(k*b)))>2]=10,w[i+264>>2]=-Y,w[i+260>>2]=-b,w[i+256>>2]=-V),o[i+92>>2]=0,w[i+88>>2]=D+w[i+232>>2],w[i+84>>2]=X+w[i+228>>2],w[i+80>>2]=C+w[i+224>>2],Zn[o[o[f>>2]+16>>2]](f,i+256|0,i+80|0,n))}S=i+272|0}function iA(A){var r,f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0;S=r=S-16|0;A:{r:{f:{e:{i:{n:{a:{t:{o:{c:{b:{u:{l:{s:{if((A|=0)>>>0<=244){if(3&(f=(t=o[8984])>>>(e=(c=A>>>0<11?16:A+11&-8)>>>3|0)|0)){f=35976+(A=(e=e+(1&~f)|0)<<3)|0,i=o[A+35984>>2],(0|f)!=(0|(A=o[i+8>>2]))?(o[A+12>>2]=f,o[f+8>>2]=A):(s=35936,k=Le(e)&t,o[s>>2]=k),A=i+8|0,f=e<<3,o[i+4>>2]=3|f,o[4+(f=f+i|0)>>2]=1|o[f+4>>2];break A}if((l=o[8986])>>>0>=c>>>0)break s;if(f){f=35976+(A=(i=si(0-(A=(0-(A=2<>2],(0|f)!=(0|(A=o[n+8>>2]))?(o[A+12>>2]=f,o[f+8>>2]=A):(t=Le(i)&t,o[8984]=t),o[n+4>>2]=3|c,i=(A=i<<3)-c|0,o[4+(e=n+c|0)>>2]=1|i,o[A+n>>2]=i,l&&(f=35976+(-8&l)|0,a=o[8989],(A=1<<(l>>>3))&t?A=o[f+8>>2]:(o[8984]=A|t,A=f),o[f+8>>2]=a,o[A+12>>2]=a,o[a+12>>2]=f,o[a+8>>2]=A),A=n+8|0,o[8989]=e,o[8986]=i;break A}if(!(u=o[8985]))break s;for(e=o[36240+(si(0-u&u)<<2)>>2],a=(-8&o[e+4>>2])-c|0,f=e;(A=o[f+16>>2])||(A=o[f+20>>2]);)a=(i=(f=(-8&o[A+4>>2])-c|0)>>>0>>0)?f:a,e=i?A:e,f=A;if(b=o[e+24>>2],(0|(i=o[e+12>>2]))!=(0|e)){A=o[e+8>>2],o[A+12>>2]=i,o[i+8>>2]=A;break r}if(!(A=o[(f=e+20|0)>>2])){if(!(A=o[e+16>>2]))break l;f=e+16|0}for(;n=f,i=A,(A=o[(f=A+20|0)>>2])||(f=i+16|0,A=o[i+16>>2]););o[n>>2]=0;break r}if(c=-1,!(A>>>0>4294967231)&&(c=-8&(A=A+11|0),u=o[8985])){a=0-c|0,t=0,c>>>0<256||(t=31,c>>>0>16777215||(t=62+((c>>>38-(A=E(A>>>8|0))&1)-(A<<1)|0)|0));k:{d:{if(f=o[36240+(t<<2)>>2])for(A=0,e=c<<(31!=(0|t)?25-(t>>>1|0):0);;){if(!((n=(-8&o[f+4>>2])-c|0)>>>0>=a>>>0||(i=f,a=n,n))){a=0,A=f;break d}if(n=o[f+20>>2],f=o[16+((e>>>29&4)+f|0)>>2],A=n?(0|n)==(0|f)?A:n:A,e<<=1,!f)break}else A=0;if(!(A|i)){if(i=0,!(A=(0-(A=2<>2]}if(!A)break k}for(;a=(e=(f=(-8&o[A+4>>2])-c|0)>>>0>>0)?f:a,i=e?A:i,A=(f=o[A+16>>2])||o[A+20>>2];);}if(!(!i|o[8986]-c>>>0<=a>>>0)){if(t=o[i+24>>2],(0|i)!=(0|(e=o[i+12>>2]))){A=o[i+8>>2],o[A+12>>2]=e,o[e+8>>2]=A;break f}if(!(A=o[(f=i+20|0)>>2])){if(!(A=o[i+16>>2]))break u;f=i+16|0}for(;n=f,e=A,(A=o[(f=A+20|0)>>2])||(f=e+16|0,A=o[e+16>>2]););o[n>>2]=0;break f}}}if((A=o[8986])>>>0>=c>>>0){i=o[8989],(f=A-c|0)>>>0>=16?(o[4+(e=i+c|0)>>2]=1|f,o[A+i>>2]=f,o[i+4>>2]=3|c):(o[i+4>>2]=3|A,o[4+(A=A+i|0)>>2]=1|o[A+4>>2],e=0,f=0),o[8986]=f,o[8989]=e,A=i+8|0;break A}if((b=o[8987])>>>0>c>>>0){f=b-c|0,o[8987]=f,A=(e=o[8990])+c|0,o[8990]=A,o[A+4>>2]=1|f,o[e+4>>2]=3|c,A=e+8|0;break A}if(A=0,u=c+47|0,o[9102]?e=o[9104]:(o[9105]=-1,o[9106]=-1,o[9103]=4096,o[9104]=4096,o[9102]=r+12&-16^1431655768,o[9107]=0,o[9095]=0,e=4096),(f=(n=u+e|0)&(a=0-e|0))>>>0<=c>>>0)break A;if((i=o[9094])&&i>>>0<(t=(e=o[9092])+f|0)>>>0|e>>>0>=t>>>0)break A;s:{if(!(4&v[36380])){k:{d:{v:{h:{if(i=o[8990])for(A=36384;;){if((e=o[A>>2])>>>0<=i>>>0&i>>>0>2]>>>0)break h;if(!(A=o[A+8>>2]))break}if(-1==(0|(e=we(0))))break k;if(t=f,(A=(i=o[9103])-1|0)&e&&(t=(f-e|0)+(A+e&0-i)|0),t>>>0<=c>>>0)break k;if((i=o[9094])&&i>>>0<(a=(A=o[9092])+t|0)>>>0|A>>>0>=a>>>0)break k;if((0|e)!=(0|(A=we(t))))break v;break s}if((0|(e=we(t=a&n-b)))==(o[A>>2]+o[A+4>>2]|0))break d;A=e}if(-1==(0|A))break k;if(c+48>>>0<=t>>>0){e=A;break s}if(-1==(0|we(e=(e=o[9104])+(u-t|0)&0-e)))break k;t=e+t|0,e=A;break s}if(-1!=(0|e))break s}o[9095]=4|o[9095]}if(-1==(0|(e=we(f)))|-1==(0|(A=we(0)))|A>>>0<=e>>>0)break o;if((t=A-e|0)>>>0<=c+40>>>0)break o}A=o[9092]+t|0,o[9092]=A,A>>>0>B[9093]&&(o[9093]=A);s:{if(n=o[8990]){for(A=36384;;){if(((i=o[A>>2])+(f=o[A+4>>2])|0)==(0|e))break s;if(!(A=o[A+8>>2]))break}break b}for((A=o[8988])>>>0<=e>>>0&&A||(o[8988]=e),A=0,o[9097]=t,o[9096]=e,o[8992]=-1,o[8993]=o[9102],o[9099]=0;f=35976+(i=A<<3)|0,o[i+35984>>2]=f,o[i+35988>>2]=f,32!=(0|(A=A+1|0)););f=(i=t-40|0)-(A=e+8&7?-8-e&7:0)|0,o[8987]=f,A=A+e|0,o[8990]=A,o[A+4>>2]=1|f,o[4+(e+i|0)>>2]=40,o[8991]=o[9106];break c}if(8&o[A+12>>2]|e>>>0<=n>>>0|i>>>0>n>>>0)break b;o[A+4>>2]=f+t,e=(A=n+8&7?-8-n&7:0)+n|0,o[8990]=e,A=(f=o[8987]+t|0)-A|0,o[8987]=A,o[e+4>>2]=1|A,o[4+(f+n|0)>>2]=40,o[8991]=o[9106];break c}i=0;break r}e=0;break f}B[8988]>e>>>0&&(o[8988]=e),f=e+t|0,A=36384;b:{u:{l:{for(;;){if((0|f)!=o[A>>2]){if(A=o[A+8>>2])continue;break l}break}if(!(8&v[A+12|0]))break u}for(A=36384;;){if((f=o[A>>2])>>>0<=n>>>0&&(a=f+o[A+4>>2]|0)>>>0>n>>>0)break b;A=o[A+8>>2]}}if(o[A>>2]=e,o[A+4>>2]=o[A+4>>2]+t,o[4+(u=(e+8&7?-8-e&7:0)+e|0)>>2]=3|c,A=(t=f+(f+8&7?-8-f&7:0)|0)-(b=c+u|0)|0,(0|n)==(0|t)){o[8990]=b,A=o[8987]+A|0,o[8987]=A,o[b+4>>2]=1|A;break e}if(o[8989]==(0|t)){o[8989]=b,A=o[8986]+A|0,o[8986]=A,o[b+4>>2]=1|A,o[A+b>>2]=A;break e}if(1!=(3&(a=o[t+4>>2])))break i;if(n=-8&a,a>>>0<=255){if((0|(e=o[t+12>>2]))==(0|(f=o[t+8>>2]))){s=35936,k=o[8984]&Le(a>>>3|0),o[s>>2]=k;break n}o[f+12>>2]=e,o[e+8>>2]=f;break n}if(c=o[t+24>>2],(0|t)!=(0|(e=o[t+12>>2]))){f=o[t+8>>2],o[f+12>>2]=e,o[e+8>>2]=f;break a}if(!(a=o[(f=t+20|0)>>2])){if(!(a=o[t+16>>2]))break t;f=t+16|0}for(;i=f,(a=o[(f=(e=a)+20|0)>>2])||(f=e+16|0,a=o[e+16>>2]););o[i>>2]=0;break a}for(f=(i=t-40|0)-(A=e+8&7?-8-e&7:0)|0,o[8987]=f,A=A+e|0,o[8990]=A,o[A+4>>2]=1|f,o[4+(e+i|0)>>2]=40,o[8991]=o[9106],o[(i=(A=(a+(a-39&7?39-a&7:0)|0)-47|0)>>>0>>0?n:A)+4>>2]=27,A=o[9099],o[i+16>>2]=o[9098],o[i+20>>2]=A,A=o[9097],o[i+8>>2]=o[9096],o[i+12>>2]=A,o[9098]=i+8,o[9097]=t,o[9096]=e,o[9099]=0,A=i+24|0;o[A+4>>2]=7,f=A+8|0,A=A+4|0,f>>>0>>0;);if((0|i)!=(0|n))if(o[i+4>>2]=-2&o[i+4>>2],a=i-n|0,o[n+4>>2]=1|a,o[i>>2]=a,a>>>0<=255)f=35976+(-8&a)|0,(e=o[8984])&(A=1<<(a>>>3))?A=o[f+8>>2]:(o[8984]=A|e,A=f),o[f+8>>2]=n,o[A+12>>2]=n,o[n+12>>2]=f,o[n+8>>2]=A;else{A=31,a>>>0<=16777215&&(A=62+((a>>>38-(A=E(a>>>8|0))&1)-(A<<1)|0)|0),o[n+28>>2]=A,o[n+16>>2]=0,o[n+20>>2]=0,f=36240+(A<<2)|0;b:{if((i=o[8985])&(e=1<>>1|0):0),i=o[f>>2];;){if((0|a)==(-8&o[(f=i)+4>>2]))break b;if(e=A>>>29|0,A<<=1,!(i=o[16+(e=(4&e)+f|0)>>2]))break}o[e+16>>2]=n}else o[8985]=e|i,o[f>>2]=n;o[n+24>>2]=f,o[n+12>>2]=n,o[n+8>>2]=n;break c}A=o[f+8>>2],o[A+12>>2]=n,o[f+8>>2]=n,o[n+24>>2]=0,o[n+12>>2]=f,o[n+8>>2]=A}}if(!((A=o[8987])>>>0<=c>>>0)){f=A-c|0,o[8987]=f,A=(e=o[8990])+c|0,o[8990]=A,o[A+4>>2]=1|f,o[e+4>>2]=3|c,A=e+8|0;break A}}o[8983]=48,A=0;break A}e=0}if(c){i=o[t+28>>2];a:{if(o[(f=36240+(i<<2)|0)>>2]==(0|t)){if(o[f>>2]=e,e)break a;s=35940,k=o[8985]&Le(i),o[s>>2]=k;break n}if(o[c+(o[c+16>>2]==(0|t)?16:20)>>2]=e,!e)break n}o[e+24>>2]=c,(f=o[t+16>>2])&&(o[e+16>>2]=f,o[f+24>>2]=e),(f=o[t+20>>2])&&(o[e+20>>2]=f,o[f+24>>2]=e)}}A=A+n|0,a=o[4+(t=n+t|0)>>2]}if(o[t+4>>2]=-2&a,o[b+4>>2]=1|A,o[A+b>>2]=A,A>>>0<=255)f=35976+(-8&A)|0,(e=o[8984])&(A=1<<(A>>>3))?A=o[f+8>>2]:(o[8984]=A|e,A=f),o[f+8>>2]=b,o[A+12>>2]=b,o[b+12>>2]=f,o[b+8>>2]=A;else{a=31,A>>>0<=16777215&&(a=62+((A>>>38-(f=E(A>>>8|0))&1)-(f<<1)|0)|0),o[b+28>>2]=a,o[b+16>>2]=0,o[b+20>>2]=0,f=36240+(a<<2)|0;i:{if((i=o[8985])&(e=1<>>1|0):0),e=o[f>>2];;){if(f=e,(-8&o[e+4>>2])==(0|A))break i;if(e=a>>>29|0,a<<=1,!(e=o[16+(i=(4&e)+f|0)>>2]))break}o[i+16>>2]=b}else o[8985]=e|i,o[f>>2]=b;o[b+24>>2]=f,o[b+12>>2]=b,o[b+8>>2]=b;break e}A=o[f+8>>2],o[A+12>>2]=b,o[f+8>>2]=b,o[b+24>>2]=0,o[b+12>>2]=f,o[b+8>>2]=A}}A=u+8|0;break A}f:if(t){f=o[i+28>>2];e:{if(o[(A=36240+(f<<2)|0)>>2]==(0|i)){if(o[A>>2]=e,e)break e;u=Le(f)&u,o[8985]=u;break f}if(o[t+(o[t+16>>2]==(0|i)?16:20)>>2]=e,!e)break f}o[e+24>>2]=t,(A=o[i+16>>2])&&(o[e+16>>2]=A,o[A+24>>2]=e),(A=o[i+20>>2])&&(o[e+20>>2]=A,o[A+24>>2]=e)}f:if(a>>>0<=15)A=a+c|0,o[i+4>>2]=3|A,o[4+(A=A+i|0)>>2]=1|o[A+4>>2];else if(o[i+4>>2]=3|c,o[4+(n=i+c|0)>>2]=1|a,o[n+a>>2]=a,a>>>0<=255)f=35976+(-8&a)|0,(e=o[8984])&(A=1<<(a>>>3))?A=o[f+8>>2]:(o[8984]=A|e,A=f),o[f+8>>2]=n,o[A+12>>2]=n,o[n+12>>2]=f,o[n+8>>2]=A;else{A=31,a>>>0<=16777215&&(A=62+((a>>>38-(A=E(a>>>8|0))&1)-(A<<1)|0)|0),o[n+28>>2]=A,o[n+16>>2]=0,o[n+20>>2]=0,f=36240+(A<<2)|0;e:{if((e=1<>>1|0):0),c=o[f>>2];;){if((-8&o[(f=c)+4>>2])==(0|a))break e;if(e=A>>>29|0,A<<=1,!(c=o[16+(e=(4&e)+f|0)>>2]))break}o[e+16>>2]=n}else o[8985]=e|u,o[f>>2]=n;o[n+24>>2]=f,o[n+12>>2]=n,o[n+8>>2]=n;break f}A=o[f+8>>2],o[A+12>>2]=n,o[f+8>>2]=n,o[n+24>>2]=0,o[n+12>>2]=f,o[n+8>>2]=A}A=i+8|0;break A}r:if(b){f=o[e+28>>2];f:{if(o[(A=36240+(f<<2)|0)>>2]==(0|e)){if(o[A>>2]=i,i)break f;s=35940,k=Le(f)&u,o[s>>2]=k;break r}if(o[b+(o[b+16>>2]==(0|e)?16:20)>>2]=i,!i)break r}o[i+24>>2]=b,(A=o[e+16>>2])&&(o[i+16>>2]=A,o[A+24>>2]=i),(A=o[e+20>>2])&&(o[i+20>>2]=A,o[A+24>>2]=i)}a>>>0<=15?(A=a+c|0,o[e+4>>2]=3|A,o[4+(A=A+e|0)>>2]=1|o[A+4>>2]):(o[e+4>>2]=3|c,o[4+(i=e+c|0)>>2]=1|a,o[i+a>>2]=a,l&&(f=35976+(-8&l)|0,n=o[8989],(A=1<<(l>>>3))&t?A=o[f+8>>2]:(o[8984]=A|t,A=f),o[f+8>>2]=n,o[A+12>>2]=n,o[n+12>>2]=f,o[n+8>>2]=A),o[8989]=i,o[8986]=a),A=e+8|0}return S=r+16|0,0|A}function nA(A,r,f,e,i,n){var t,c,b,u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=0,Z=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=0,T=m(0),U=m(0),j=m(0);S=t=S-672|0,c=o[e+12>>2],b=o[e+4>>2];A:if((0|(I=o[b+4>>2]))<=19)w[t+644>>2]=n,o[t+640>>2]=0,o[t+472>>2]=13280,w[t+636>>2]=w[i+4>>2],a[t+444|0]=0,o[t+420>>2]=953267991,o[t+36>>2]=22800,o[20+(B=t+648|0)>>2]=0,o[B+16>>2]=b,o[B+12>>2]=A,o[B+8>>2]=t+36,o[B+4>>2]=t+112,o[B>>2]=22576,0|Zn[o[o[B>>2]+8>>2]](B,r,f,c,c,t+472|0)&&(l=w[t+612>>2],s=w[t+604>>2],h=w[t+608>>2],(u=m(m(l*l)+m(m(s*s)+m(h*h))))>m(9999999747378752e-20)&&(n=w[t+636>>2])>2]&&(u=m(m(1)/m(N(u))),w[t+612>>2]=l*u,w[t+608>>2]=h*u,w[t+604>>2]=s*u,o[t+60>>2]=b,o[t+68>>2]=o[e+8>>2],o[t+72>>2]=t+52,A=o[t+616>>2],o[t+84>>2]=o[t+612>>2],o[t+88>>2]=A,f=o[t+604>>2],r=o[t+608>>2],A=o[t+632>>2],o[t+100>>2]=o[t+628>>2],o[t+104>>2]=A,o[t+76>>2]=f,o[t+80>>2]=r,A=o[t+624>>2],o[t+92>>2]=o[t+620>>2],o[t+96>>2]=A,w[t+108>>2]=n,m(Zn[o[o[i>>2]+12>>2]](i,t+68|0,1))));else if((B=I-21|0)>>>0<=8){switch(0|B){case 0:E=w[c+20>>2],W=w[c+36>>2],Z=w[c+52>>2],p=w[c+24>>2],Q=w[c+56>>2],F=w[c+40>>2],D=w[c+32>>2],C=w[c>>2],J=w[c+16>>2],x=w[c+4>>2],y=w[c+8>>2],u=w[c+48>>2],d=w[r+52>>2],k=w[r+56>>2],l=w[r+48>>2],o[t+80>>2]=0,u=m(-u),s=m(m(m(y*u)-m(p*Z))-m(F*Q)),w[t+76>>2]=s+m(m(k*F)+m(m(l*y)+m(p*d))),h=m(m(m(x*u)-m(E*Z))-m(W*Q)),w[t+72>>2]=h+m(m(k*W)+m(m(l*x)+m(E*d))),u=m(m(m(C*u)-m(J*Z))-m(D*Q)),w[t+68>>2]=u+m(m(k*D)+m(m(l*C)+m(J*d))),d=w[f+52>>2],k=w[f+56>>2],l=w[f+48>>2],o[t+660>>2]=0,w[t+656>>2]=s+m(m(k*F)+m(m(l*y)+m(p*d))),w[t+652>>2]=h+m(m(k*W)+m(m(l*x)+m(E*d))),w[t+648>>2]=u+m(m(k*D)+m(m(l*C)+m(J*d))),M=w[f+20>>2],Z=w[f+36>>2],Q=w[f+24>>2],d=w[f+40>>2],k=w[f+32>>2],l=w[f>>2],s=w[f+16>>2],h=w[f+4>>2],u=w[f+8>>2],o[t+516>>2]=0,o[t+520>>2]=0,o[t+500>>2]=0,o[t+524>>2]=0,o[t+528>>2]=0,o[t+532>>2]=0,w[t+512>>2]=m(d*F)+m(m(u*y)+m(p*Q)),w[t+508>>2]=m(Z*F)+m(m(h*y)+m(p*M)),w[t+496>>2]=m(d*W)+m(m(u*x)+m(E*Q)),w[t+492>>2]=m(Z*W)+m(m(h*x)+m(E*M)),o[t+484>>2]=0,w[t+504>>2]=m(k*F)+m(m(l*y)+m(p*s)),w[t+488>>2]=m(k*W)+m(m(l*x)+m(E*s)),w[t+480>>2]=m(d*D)+m(m(u*C)+m(J*Q)),w[t+476>>2]=m(Z*D)+m(m(h*C)+m(J*M)),w[t+472>>2]=m(k*D)+m(m(l*C)+m(J*s)),e=o[e+8>>2],r=mr(t+112|0,A,r,f,c,m(Zn[o[o[b>>2]+48>>2]](b))),o[r+220>>2]=b,o[r+216>>2]=e,o[r+212>>2]=i,o[r>>2]=13880,u=w[i+4>>2],w[r+208>>2]=n,w[r+200>>2]=u,i=t+52|0,e=t+36|0,Zn[o[o[A>>2]+8>>2]](A,t+472|0,i,e),S=I=S-16|0,A=o[b+56>>2],o[I+12>>2]=r,o[I+8>>2]=A,o[I+4>>2]=18948,f=I+4|0,r=t+68|0,A=t+648|0,B=o[b+60>>2],v[B+60|0]?MA(B,f,r,A,i,e,o[B+56>>2]):KA(B,f,r,A,i,e),S=I+16|0;break A;case 7:w[t+284>>2]=n,o[t+280>>2]=0,o[t+112>>2]=13280,w[t+276>>2]=w[i+4>>2],o[20+(B=t+68|0)>>2]=b,o[B+16>>2]=0,o[B+12>>2]=A,o[B+4>>2]=0,o[B+8>>2]=0,o[B>>2]=22576,0|Zn[o[o[B>>2]+8>>2]](B,r,f,c,c,t+112|0)&&(l=w[t+252>>2],s=w[t+244>>2],h=w[t+248>>2],(u=m(m(l*l)+m(m(s*s)+m(h*h))))>m(9999999747378752e-20)&&(n=w[t+276>>2])>2]&&(u=m(m(1)/m(N(u))),w[t+252>>2]=l*u,w[t+248>>2]=h*u,w[t+244>>2]=s*u,o[t+656>>2]=b,o[t+472>>2]=o[e+8>>2],o[t+476>>2]=t+648,A=o[t+256>>2],o[t+488>>2]=o[t+252>>2],o[t+492>>2]=A,f=o[t+244>>2],r=o[t+248>>2],A=o[t+272>>2],o[t+504>>2]=o[t+268>>2],o[t+508>>2]=A,o[t+480>>2]=f,o[t+484>>2]=r,A=o[t+264>>2],o[t+496>>2]=o[t+260>>2],o[t+500>>2]=A,w[t+512>>2]=n,m(Zn[o[o[i>>2]+12>>2]](i,t+472|0,1))));break A}E=w[r+52>>2],W=w[r+56>>2],p=w[c+52>>2],F=w[c+56>>2],D=w[f+52>>2],C=w[f+56>>2],T=w[c+20>>2],U=w[c+36>>2],j=w[c+24>>2],H=w[c+40>>2],J=w[r+48>>2],h=w[c+48>>2],x=w[f+48>>2],R=w[c+32>>2],Y=w[c>>2],V=w[c+16>>2],g=w[c+4>>2],X=w[c+8>>2],y=w[f+20>>2],M=w[f+36>>2],Z=w[f+24>>2],Q=w[f+40>>2],d=w[f+32>>2],k=w[f>>2],l=w[f+16>>2],s=w[f+4>>2],u=w[f+8>>2],o[t+516>>2]=0,o[t+520>>2]=0,o[t+500>>2]=0,o[t+524>>2]=0,o[t+528>>2]=0,o[t+532>>2]=0,w[t+512>>2]=m(Q*H)+m(m(u*X)+m(j*Z)),w[t+508>>2]=m(M*H)+m(m(s*X)+m(j*y)),w[t+496>>2]=m(Q*U)+m(m(u*g)+m(T*Z)),w[t+492>>2]=m(M*U)+m(m(s*g)+m(T*y)),o[t+484>>2]=0,w[t+504>>2]=m(d*H)+m(m(k*X)+m(j*l)),w[t+488>>2]=m(d*U)+m(m(k*g)+m(T*l)),w[t+480>>2]=m(Q*R)+m(m(u*Y)+m(V*Z)),w[t+476>>2]=m(M*R)+m(m(s*Y)+m(V*y)),w[t+472>>2]=m(d*R)+m(m(k*Y)+m(V*l)),e=o[e+8>>2],r=mr(t+112|0,A,r,f,c,m(Zn[o[o[b>>2]+48>>2]](b))),o[r+220>>2]=b,o[r+216>>2]=e,o[r+212>>2]=i,o[r>>2]=14092,u=w[i+4>>2],w[r+208>>2]=n,w[r+200>>2]=u,Zn[o[o[A>>2]+8>>2]](A,t+472|0,t+68|0,t+648|0),o[t+64>>2]=0,n=m(-h),s=m(m(m(X*n)-m(j*p))-m(H*F)),u=m(m(m(g*n)-m(T*p))-m(U*F)),k=m(u+m(m(C*U)+m(m(x*g)+m(T*D)))),n=m(m(m(Y*n)-m(V*p))-m(R*F)),h=Z=m(n+m(m(W*R)+m(m(J*Y)+m(V*E)))),(l=m(n+m(m(C*R)+m(m(x*Y)+m(V*D)))))>2]=l,h=l),k<(u=d=m(u+m(m(W*U)+m(m(J*g)+m(T*E)))))&&(w[t+56>>2]=k,u=k),n=Q=m(s+m(m(W*H)+m(m(J*X)+m(j*E)))),(s=m(s+m(m(C*H)+m(m(x*X)+m(j*D)))))>2]=s,n=s),o[t+48>>2]=0,w[t+52>>2]=w[t+68>>2]+h,w[t+56>>2]=w[t+72>>2]+u,w[t+60>>2]=w[t+76>>2]+n,w[t+36>>2]=w[t+648>>2]+(l>Z?l:Z),w[t+40>>2]=w[t+652>>2]+(k>d?k:d),w[t+44>>2]=w[t+656>>2]+(s>Q?s:Q),Zn[o[o[b>>2]+64>>2]](b,r,t+52|0,t+36|0)}else if(31==(0|I)){Zn[o[8294]](7860),F=w[c+52>>2],D=w[c+56>>2],C=w[r+52>>2],J=w[r+56>>2],H=w[c+20>>2],R=w[c+36>>2],x=w[r+20>>2],y=w[r+36>>2],M=w[r+24>>2],Y=w[c+24>>2],Z=w[r+40>>2],V=w[c+40>>2],g=w[c+32>>2],X=w[c>>2],E=w[c+16>>2],Q=w[r+32>>2],d=w[r>>2],k=w[r+16>>2],u=w[c+48>>2],l=w[r+48>>2],W=w[c+4>>2],s=w[r+4>>2],h=w[r+8>>2],p=w[c+8>>2],o[t+172>>2]=0,o[t+156>>2]=0,o[t+140>>2]=0,w[t+152>>2]=m(Z*V)+m(m(h*p)+m(Y*M)),w[t+148>>2]=m(y*V)+m(m(s*p)+m(Y*x)),w[t+136>>2]=m(Z*R)+m(m(h*W)+m(H*M)),w[t+132>>2]=m(y*R)+m(m(s*W)+m(H*x)),u=m(-u),w[t+168>>2]=m(m(m(p*u)-m(Y*F))-m(V*D))+m(m(J*V)+m(m(l*p)+m(Y*C))),w[t+164>>2]=m(m(m(W*u)-m(H*F))-m(R*D))+m(m(J*R)+m(m(l*W)+m(H*C))),o[t+124>>2]=0,w[t+144>>2]=m(Q*V)+m(m(d*p)+m(Y*k)),w[t+128>>2]=m(Q*R)+m(m(d*W)+m(H*k)),w[t+120>>2]=m(Z*g)+m(m(h*X)+m(E*M)),w[t+116>>2]=m(y*g)+m(m(s*X)+m(E*x)),w[t+112>>2]=m(Q*g)+m(m(d*X)+m(E*k)),w[t+160>>2]=m(m(m(X*u)-m(E*F))-m(g*D))+m(m(J*g)+m(m(l*X)+m(E*C))),B=t+112|0,Zn[o[o[A>>2]+8>>2]](A,B,t+52|0,t+36|0),F=w[c+52>>2],D=w[c+56>>2],C=w[f+52>>2],J=w[f+56>>2],H=w[c+20>>2],R=w[c+36>>2],x=w[f+20>>2],y=w[f+36>>2],M=w[f+24>>2],Y=w[c+24>>2],Z=w[f+40>>2],V=w[c+40>>2],g=w[c+32>>2],X=w[c>>2],E=w[c+16>>2],Q=w[f+32>>2],d=w[f>>2],k=w[f+16>>2],u=w[c+48>>2],l=w[f+48>>2],W=w[c+4>>2],s=w[f+4>>2],h=w[f+8>>2],p=w[c+8>>2],o[t+172>>2]=0,o[t+156>>2]=0,o[t+140>>2]=0,w[t+152>>2]=m(Z*V)+m(m(h*p)+m(Y*M)),w[t+148>>2]=m(y*V)+m(m(s*p)+m(Y*x)),w[t+136>>2]=m(Z*R)+m(m(h*W)+m(H*M)),w[t+132>>2]=m(y*R)+m(m(s*W)+m(H*x)),u=m(-u),w[t+168>>2]=m(m(m(p*u)-m(Y*F))-m(V*D))+m(m(J*V)+m(m(l*p)+m(Y*C))),w[t+164>>2]=m(m(m(W*u)-m(H*F))-m(R*D))+m(m(J*R)+m(m(l*W)+m(H*C))),o[t+124>>2]=0,w[t+144>>2]=m(Q*V)+m(m(d*p)+m(Y*k)),w[t+128>>2]=m(Q*R)+m(m(d*W)+m(H*k)),w[t+120>>2]=m(Z*g)+m(m(h*X)+m(E*M)),w[t+116>>2]=m(y*g)+m(m(s*X)+m(E*x)),w[t+112>>2]=m(Q*g)+m(m(d*X)+m(E*k)),w[t+160>>2]=m(m(m(X*u)-m(E*F))-m(g*D))+m(m(J*g)+m(m(l*X)+m(E*C))),Zn[o[o[A>>2]+8>>2]](A,B,t+16|0,t),(u=w[t+16>>2])>2]&&(w[t+52>>2]=u),(u=w[t+20>>2])>2]&&(w[t+56>>2]=u),(u=w[t+24>>2])>2]&&(w[t+60>>2]=u),(u=w[t+28>>2])>2]&&(w[t+64>>2]=u),(u=w[t>>2])>w[t+36>>2]&&(w[t+36>>2]=u),(u=w[t+4>>2])>w[t+40>>2]&&(w[t+40>>2]=u),(u=w[t+8>>2])>w[t+44>>2]&&(w[t+44>>2]=u),(u=w[t+12>>2])>w[t+48>>2]&&(w[t+48>>2]=u),o[t+504>>2]=i,o[t+500>>2]=c,w[t+492>>2]=n,o[t+488>>2]=f,o[t+484>>2]=r,o[t+480>>2]=A,o[t+476>>2]=e,o[t+472>>2]=14308,o[t+496>>2]=b;r:if(r=o[b+72>>2])A=o[t+64>>2],o[t+120>>2]=o[t+60>>2],o[t+124>>2]=A,A=o[t+48>>2],o[t+136>>2]=o[t+44>>2],o[t+140>>2]=A,A=o[t+40>>2],o[t+128>>2]=o[t+36>>2],o[t+132>>2]=A,A=o[t+56>>2],o[t+112>>2]=o[t+52>>2],o[t+116>>2]=A,ar(o[r>>2],t+112|0,t+472|0);else{if(o[b+24>>2]<=0)break r;for(f=0;A=o[b+32>>2]+G(f,80)|0,e=o[A+64>>2],D=w[A+48>>2],C=w[A+52>>2],J=w[A+56>>2],x=w[A>>2],y=w[A+16>>2],M=w[A+32>>2],Z=w[A+4>>2],Q=w[A+20>>2],d=w[A+36>>2],k=w[A+8>>2],l=w[A+24>>2],s=w[A+40>>2],A=o[t+500>>2],h=w[A+52>>2],u=w[A+56>>2],R=w[A+20>>2],Y=w[A+24>>2],V=w[A+36>>2],g=w[A+40>>2],n=w[A+48>>2],X=w[A+8>>2],E=w[A>>2],W=w[A+4>>2],p=w[A+16>>2],F=w[A+32>>2],o[t+172>>2]=0,o[t+156>>2]=0,o[t+140>>2]=0,o[t+124>>2]=0,w[t+152>>2]=m(s*g)+m(m(k*F)+m(l*V)),w[t+148>>2]=m(d*g)+m(m(Z*F)+m(Q*V)),w[t+144>>2]=m(M*g)+m(m(x*F)+m(y*V)),w[t+136>>2]=m(s*Y)+m(m(k*p)+m(l*R)),w[t+132>>2]=m(d*Y)+m(m(Z*p)+m(Q*R)),w[t+128>>2]=m(M*Y)+m(m(x*p)+m(y*R)),w[t+120>>2]=m(s*X)+m(m(k*E)+m(l*W)),w[t+116>>2]=m(d*X)+m(m(Z*E)+m(Q*W)),w[t+112>>2]=m(M*X)+m(m(x*E)+m(y*W)),w[t+168>>2]=u+m(m(J*g)+m(m(D*F)+m(C*V))),w[t+164>>2]=h+m(m(J*Y)+m(m(D*p)+m(C*R))),w[t+160>>2]=n+m(m(J*X)+m(m(D*E)+m(C*W))),o[t+80>>2]=-1,o[t+84>>2]=0,o[t+72>>2]=1065353216,o[t+76>>2]=1,o[t+96>>2]=f,A=o[t+504>>2],o[t+92>>2]=A,o[t+88>>2]=e,o[t+68>>2]=14524,w[t+72>>2]=w[A+4>>2],r=o[t+476>>2],A=o[r+8>>2],o[t+668>>2]=f,o[t+664>>2]=-1,o[t+656>>2]=A,o[t+652>>2]=e,o[t+648>>2]=r,o[t+660>>2]=t+112,nA(o[t+480>>2],o[t+484>>2],o[t+488>>2],t+648|0,t+68|0,w[t+492>>2]),(0|(f=f+1|0))>2];);}Zn[o[8295]]()}S=t+672|0}function aA(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,t,c,b=0,u=0,l=0,s=0,k=m(0),d=0,h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=0,N=0,p=m(0),F=m(0),R=m(0),Y=0,V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0);if(S=n=S-176|0,l=v[A+68|0],t=o[(c=l?f:r)+4>>2],o[t+76>>2]!=o[A+80>>2]){if((0|(s=o[A+52>>2]))>0)for(;(u=o[(N=b<<2)+o[A+60>>2]>>2])&&(Zn[o[o[u>>2]>>2]](u),u=o[A+4>>2],Zn[o[o[u>>2]+60>>2]](u,o[N+o[A+60>>2]>>2])),(0|s)!=(0|(b=b+1|0)););dr(A,r,f),o[A+80>>2]=o[t+76>>2]}if(u=o[A+52>>2]){if(s=o[t+72>>2],b=o[A+60>>2],N=o[A+4>>2],o[n+172>>2]=o[A+72>>2],o[n+168>>2]=b,o[n+164>>2]=i,o[n+160>>2]=e,o[n+156>>2]=N,N=l?r:f,o[n+152>>2]=N,o[n+148>>2]=c,o[n+144>>2]=16388,(0|(r=o[A+32>>2]))<0){if(o[A+36>>2]<0&&(!(f=o[A+40>>2])||!f|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),a[A+44|0]=1,o[A+36>>2]=0,o[A+40>>2]=0),u=0,b=r,f=0-r&3)for(;o[o[A+40>>2]+(b<<2)>>2]=0,b=b+1|0,(0|f)!=(0|(u=u+1|0)););if(r>>>0<=4294967292)for(;o[(r=b<<2)+o[A+40>>2]>>2]=0,o[4+(r+o[A+40>>2]|0)>>2]=0,o[8+(r+o[A+40>>2]|0)>>2]=0,o[12+(r+o[A+40>>2]|0)>>2]=0,b=b+4|0;);u=o[A+52>>2]}if(o[A+32>>2]=0,(0|u)>0)for(l=A+28|0,r=0;;){if(f=o[o[A+60>>2]+(r<<2)>>2]){if(Zn[o[o[f>>2]+16>>2]](f,l),b=0,(0|(f=o[A+32>>2]))>0)for(;e=o[o[A+40>>2]+(b<<2)>>2],o[e+844>>2]&&(o[i+4>>2]=e,f=(0|(u=o[e+836>>2]))==(0|(W=o[o[i+8>>2]+8>>2])),d=e,e=o[o[i+12>>2]+8>>2],OA(d,(f?u:e)+4|0,(f?e:W)+4|0),o[i+4>>2]=0,f=o[A+32>>2]),(0|(b=b+1|0))<(0|f););if(!((0|f)>=0)){if(o[A+36>>2]<0&&(!(e=o[A+40>>2])||!e|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),a[A+44|0]=1,o[A+36>>2]=0,o[A+40>>2]=0),u=0,b=f,e=0-f&3)for(;o[o[A+40>>2]+(b<<2)>>2]=0,b=b+1|0,(0|e)!=(0|(u=u+1|0)););if(!(f>>>0>4294967292))for(;o[(f=b<<2)+o[A+40>>2]>>2]=0,o[4+(f+o[A+40>>2]|0)>>2]=0,o[8+(f+o[A+40>>2]|0)>>2]=0,o[12+(f+o[A+40>>2]|0)>>2]=0,b=b+4|0;);}o[A+32>>2]=0,u=o[A+52>>2]}if(!((0|u)>(0|(r=r+1|0))))break}A:if(s){if(r=o[c+12>>2],V=w[r+52>>2],g=w[r+56>>2],f=o[N+12>>2],X=w[f+52>>2],D=w[f+56>>2],k=w[r+20>>2],h=w[r+36>>2],C=w[f+20>>2],J=w[f+36>>2],x=w[f+24>>2],B=w[r+24>>2],y=w[f+40>>2],Z=w[r+40>>2],M=w[f+32>>2],Q=w[r+32>>2],H=w[f>>2],E=w[r>>2],I=w[f+16>>2],p=w[r+16>>2],T=w[r+48>>2],U=w[f+48>>2],F=w[r+4>>2],j=w[f+4>>2],z=w[f+8>>2],R=w[r+8>>2],o[n+108>>2]=0,o[n+92>>2]=0,o[n+76>>2]=0,w[n+88>>2]=m(y*Z)+m(m(z*R)+m(B*x)),w[n+84>>2]=m(J*Z)+m(m(j*R)+m(B*C)),w[n+72>>2]=m(y*h)+m(m(z*F)+m(k*x)),w[n+68>>2]=m(J*h)+m(m(j*F)+m(k*C)),T=m(-T),w[n+104>>2]=m(m(m(R*T)-m(B*V))-m(Z*g))+m(m(D*Z)+m(m(U*R)+m(B*X))),w[n+100>>2]=m(m(m(F*T)-m(k*V))-m(h*g))+m(m(D*h)+m(m(U*F)+m(k*X))),o[n+60>>2]=0,w[n+48>>2]=m(M*Q)+m(m(H*E)+m(p*I)),w[n+80>>2]=m(M*Z)+m(m(H*R)+m(B*I)),w[n+64>>2]=m(M*h)+m(m(H*F)+m(k*I)),w[n+56>>2]=m(y*Q)+m(m(z*E)+m(p*x)),w[n+52>>2]=m(J*Q)+m(m(j*E)+m(p*C)),w[n+96>>2]=m(m(m(E*T)-m(p*V))-m(Q*g))+m(m(D*Q)+m(m(U*E)+m(p*X))),r=o[N+4>>2],Zn[o[o[r>>2]+8>>2]](r,n+48|0,n+128|0,n+112|0),k=w[i+32>>2],w[n+136>>2]=w[n+136>>2]-k,w[n+120>>2]=k+w[n+120>>2],w[n+128>>2]=w[n+128>>2]-k,w[n+132>>2]=w[n+132>>2]-k,w[n+112>>2]=k+w[n+112>>2],w[n+116>>2]=k+w[n+116>>2],r=o[n+140>>2],o[n+24>>2]=o[n+136>>2],o[n+28>>2]=r,r=o[n+124>>2],o[n+40>>2]=o[n+120>>2],o[n+44>>2]=r,r=o[n+116>>2],o[n+32>>2]=o[n+112>>2],o[n+36>>2]=r,r=o[n+132>>2],o[n+16>>2]=o[n+128>>2],o[n+20>>2]=r,f=0,l=0,u=o[s>>2]){if(e=o[A+16>>2],k=w[n+40>>2],h=w[n+36>>2],B=w[n+32>>2],Z=w[n+24>>2],Q=w[n+20>>2],E=w[n+16>>2],!((0|(i=o[A+12>>2]))>=0)){if((0|e)<0&&(!(r=o[A+20>>2])||!r|!v[A+24|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+24|0]=1,o[A+16>>2]=0,o[A+20>>2]=0,e=0),b=0-(r=i)&3)for(;o[o[A+20>>2]+(r<<2)>>2]=0,r=r+1|0,(0|b)!=(0|(f=f+1|0)););if(!(i>>>0>4294967292))for(;o[(f=r<<2)+o[A+20>>2]>>2]=0,o[4+(f+o[A+20>>2]|0)>>2]=0,o[8+(f+o[A+20>>2]|0)>>2]=0,o[12+(f+o[A+20>>2]|0)>>2]=0,r=r+4|0;);}if(i=0,o[A+12>>2]=0,(0|e)<=63){if(o[8488]=o[8488]+1,f=0|Zn[o[8290]](256,16),!((0|(i=o[A+12>>2]))<=0)){if(e=0,r=0,i>>>0>=4)for(s=-4&i;o[(b=r<<2)+f>>2]=o[b+o[A+20>>2]>>2],o[(W=4|b)+f>>2]=o[W+o[A+20>>2]>>2],o[(W=8|b)+f>>2]=o[W+o[A+20>>2]>>2],o[(b|=12)+f>>2]=o[b+o[A+20>>2]>>2],r=r+4|0,(0|s)!=(0|(l=l+4|0)););if(b=3&i)for(;o[(s=r<<2)+f>>2]=o[s+o[A+20>>2]>>2],r=r+1|0,(0|b)!=(0|(e=e+1|0)););}!(r=o[A+20>>2])|!v[A+24|0]||(r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),i=o[A+12>>2]),o[A+20>>2]=f,a[A+24|0]=1,o[A+16>>2]=64,e=64}if(W=n+144|0,(0|e)==(0|i))if((0|(s=e<<1))<=(0|e))i=e;else{r=0;r:{if(e){if(o[8488]=o[8488]+1,f=0|Zn[o[8290]](e<<3,16),(0|(i=o[A+12>>2]))<=0)break r}else f=0,i=e;if(i-1>>>0>=3)for(l=-4&i,e=0;o[(b=r<<2)+f>>2]=o[b+o[A+20>>2]>>2],o[(Y=4|b)+f>>2]=o[Y+o[A+20>>2]>>2],o[(Y=8|b)+f>>2]=o[Y+o[A+20>>2]>>2],o[(b|=12)+f>>2]=o[b+o[A+20>>2]>>2],r=r+4|0,(0|l)!=(0|(e=e+4|0)););if(b=3&i)for(e=0;o[(l=r<<2)+f>>2]=o[l+o[A+20>>2]>>2],r=r+1|0,(0|b)!=(0|(e=e+1|0)););}!(r=o[A+20>>2])|!v[A+24|0]||(r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),i=o[A+12>>2]),o[A+20>>2]=f,a[A+24|0]=1,o[A+16>>2]=s}for(o[o[A+20>>2]+(i<<2)>>2]=u,r=i+1|0;;){if(e=o[A+20>>2],s=o[e+((f=r-1|0)<<2)>>2],o[A+12>>2]=f,B>=w[s>>2])if(E<=w[s+16>>2])if(h>=w[s+4>>2])if(Q<=w[s+20>>2])if(k>=w[s+8>>2])if(Z<=w[s+24>>2])if(o[s+40>>2]){if((0|(b=o[A+16>>2]))==(0|f))if((0|(b=f?f<<1:1))<(0|r))b=f;else{if(b?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](b<<2,16),f=o[A+12>>2]):e=0,!((0|f)<=0)){if(u=0,r=0,f>>>0>=4)for(Y=-4&f,i=0;o[(l=r<<2)+e>>2]=o[l+o[A+20>>2]>>2],o[(d=4|l)+e>>2]=o[d+o[A+20>>2]>>2],o[(d=8|l)+e>>2]=o[d+o[A+20>>2]>>2],o[(l|=12)+e>>2]=o[l+o[A+20>>2]>>2],r=r+4|0,(0|Y)!=(0|(i=i+4|0)););if(i=3&f)for(;o[(l=r<<2)+e>>2]=o[l+o[A+20>>2]>>2],r=r+1|0,(0|i)!=(0|(u=u+1|0)););}!(r=o[A+20>>2])|!v[A+24|0]||(r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),f=o[A+12>>2]),o[A+20>>2]=e,a[A+24|0]=1,o[A+16>>2]=b}if(o[(f<<2)+e>>2]=o[s+36>>2],u=f+1|0,o[A+12>>2]=u,(0|b)==(0|u))if((0|(i=b?b<<1:1))<=(0|b))u=b;else{if(i?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](i<<2,16),b=o[A+12>>2]):f=0,u=b,!((0|b)<=0)){if(l=0,r=0,u>>>0>=4)for(Y=-4&u,b=0;o[(e=r<<2)+f>>2]=o[e+o[A+20>>2]>>2],o[(d=4|e)+f>>2]=o[d+o[A+20>>2]>>2],o[(d=8|e)+f>>2]=o[d+o[A+20>>2]>>2],o[(e|=12)+f>>2]=o[e+o[A+20>>2]>>2],r=r+4|0,(0|Y)!=(0|(b=b+4|0)););if(e=3&u)for(;o[(b=r<<2)+f>>2]=o[b+o[A+20>>2]>>2],r=r+1|0,(0|e)!=(0|(l=l+1|0)););}!(r=o[A+20>>2])|!v[A+24|0]||(r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),u=o[A+12>>2]),o[A+20>>2]=f,a[A+24|0]=1,o[A+16>>2]=i}o[o[A+20>>2]+(u<<2)>>2]=o[s+40>>2],r=u+1|0,o[A+12>>2]=r}else Zn[o[o[W>>2]+12>>2]](W,s),r=o[A+12>>2];else r=f;else r=f;else r=f;else r=f;else r=f;else r=f;if(!((0|r)>0))break}}}else{if((0|u)<=0)break A;for(b=0;zA(n+144|0,o[64+(o[t+32>>2]+G(b,80)|0)>>2],b),(0|u)!=(0|(b=b+1|0)););}if(s=o[A+52>>2],!((0|(r=o[A+32>>2]))>=0)){if(o[A+36>>2]<0&&(!(f=o[A+40>>2])||!f|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),a[A+44|0]=1,o[A+36>>2]=0,o[A+40>>2]=0),u=0,b=r,f=0-r&3)for(;o[o[A+40>>2]+(b<<2)>>2]=0,b=b+1|0,(0|f)!=(0|(u=u+1|0)););if(!(r>>>0>4294967292))for(;o[(r=b<<2)+o[A+40>>2]>>2]=0,o[4+(r+o[A+40>>2]|0)>>2]=0,o[8+(r+o[A+40>>2]|0)>>2]=0,o[12+(r+o[A+40>>2]|0)>>2]=0,b=b+4|0;);}if(o[A+32>>2]=0,!((0|s)<=0))for(i=0;o[(e=i<<2)+o[A+60>>2]>>2]&&(r=o[t+32>>2]+G(i,80)|0,b=o[r+64>>2],f=o[c+12>>2],j=w[f+52>>2],z=w[f+56>>2],V=w[r+48>>2],g=w[r+52>>2],X=w[r+56>>2],D=w[r+4>>2],C=w[r+20>>2],J=w[r+36>>2],x=w[r+8>>2],y=w[r+24>>2],M=w[r+40>>2],k=w[f+20>>2],h=w[f+24>>2],H=w[r>>2],I=w[r+16>>2],B=w[f+36>>2],U=w[r+32>>2],Z=w[f+40>>2],T=w[f+48>>2],Q=w[f+8>>2],E=w[f>>2],p=w[f+4>>2],F=w[f+16>>2],R=w[f+32>>2],u=0,o[n+108>>2]=0,o[n+92>>2]=0,o[n+76>>2]=0,o[n+60>>2]=0,w[n+80>>2]=m(U*Z)+m(m(H*R)+m(B*I)),w[n+64>>2]=m(U*h)+m(m(H*F)+m(k*I)),w[n+48>>2]=m(U*Q)+m(m(H*E)+m(p*I)),w[n+88>>2]=m(M*Z)+m(m(x*R)+m(B*y)),w[n+84>>2]=m(J*Z)+m(m(D*R)+m(B*C)),w[n+72>>2]=m(M*h)+m(m(x*F)+m(k*y)),w[n+68>>2]=m(J*h)+m(m(D*F)+m(k*C)),w[n+56>>2]=m(M*Q)+m(m(x*E)+m(p*y)),w[n+52>>2]=m(J*Q)+m(m(D*E)+m(p*C)),w[n+104>>2]=z+m(m(X*Z)+m(m(V*R)+m(B*g))),w[n+100>>2]=j+m(m(X*h)+m(m(V*F)+m(k*g))),w[n+96>>2]=T+m(m(X*Q)+m(m(V*E)+m(p*g))),Zn[o[o[b>>2]+8>>2]](b,n+48|0,n+16|0,n+128|0),r=o[N+4>>2],Zn[o[o[r>>2]+8>>2]](r,o[N+12>>2],n+112|0,n),r=0,w[n+16>>2]>w[n>>2]||(r=0,w[n+128>>2]>2]||(r=1)),!(w[n+20>>2]>w[n+4>>2])&!(w[n+132>>2]>2])&(w[n+136>>2]>2]|w[n+24>>2]>w[n+8>>2]?u:r)||(r=o[e+o[A+60>>2]>>2],Zn[o[o[r>>2]>>2]](r),r=o[A+4>>2],Zn[o[o[r>>2]+60>>2]](r,o[e+o[A+60>>2]>>2]),o[e+o[A+60>>2]>>2]=0)),(0|s)!=(0|(i=i+1|0)););}S=n+176|0}function tA(){var A=0;C(31268,31280,31296,0,11128,7,11131,0,11131,0,2234,11133,6),A=xe(8),o[A>>2]=100,o[A+4>>2]=1,X(31260,4404,2,31312,11152,8,0|A,0,0),A=xe(8),o[A>>2]=104,o[A+4>>2]=1,X(31260,4415,2,31312,11152,8,0|A,0,0),A=xe(8),o[A>>2]=108,o[A+4>>2]=1,X(31268,7586,5,31344,11156,9,0|A,0,0),C(31404,31416,31432,31268,11128,13,11128,12,11128,11,5292,11133,10),A=xe(4),o[A>>2]=14,X(31404,5645,2,31448,11152,15,0|A,0,0),D(31268,2650,2,31456,11323,17,16,0),D(31268,7880,3,31744,11390,19,18,0),C(31772,31784,31800,0,11128,21,11131,0,11131,0,2346,11133,20),A=xe(8),o[A>>2]=16,o[A+4>>2]=1,X(31772,2251,4,31824,11498,22,0|A,0,0),C(31872,31884,31900,31772,11128,26,11128,25,11128,24,5304,11133,23),A=xe(4),o[A>>2]=27,X(31872,5645,2,31916,11152,28,0|A,0,0),D(31772,2650,2,31924,11323,30,29,0),D(31772,7880,3,31744,11390,19,31,0),C(32e3,32012,32028,0,11128,33,11131,0,11131,0,7180,11133,32),A=xe(8),o[A>>2]=16,o[A+4>>2]=1,X(32e3,4677,3,32044,11714,34,0|A,0,0),C(32088,32100,32116,32e3,11128,38,11128,37,11128,36,5331,11133,35),A=xe(4),o[A>>2]=39,X(32088,5645,2,32132,11152,40,0|A,0,0),D(32e3,2650,2,32140,11323,42,41,0),D(32e3,7880,3,31744,11390,19,43,0),p(8386,2,32212,11323,45,44,0),p(7676,2,32220,11152,47,46,0),p(10270,2,32228,11836,49,48,0),p(10259,3,32236,11840,51,50,0),p(7108,3,32248,11714,53,52,0),p(2225,4,32272,11845,55,54,0),p(1593,2,32228,11836,49,56,0),p(1469,2,32228,11836,49,57,0),p(1031,2,32228,11836,49,58,0),p(3127,5,32288,11851,60,59,0),p(1725,5,32320,11858,62,61,0),p(1586,2,32228,11836,49,63,0),p(1462,2,32228,11836,49,64,0),p(1024,2,32228,11836,49,65,0),p(2244,2,32228,11836,49,66,0),p(3103,6,32352,11865,68,67,0),p(1854,1,32376,11128,70,69,0),p(1090,2,32220,11152,47,71,0),p(5877,3,32248,11714,53,72,0),p(6138,2,32212,11323,45,73,0),p(5899,3,32380,11390,75,74,0),p(6158,3,32380,11390,75,76,0),p(6281,3,32248,11714,53,77,0),p(6189,3,32248,11714,53,78,0),p(5364,4,32400,11498,80,79,0),p(6959,2,32212,11323,45,81,0),p(3482,3,32380,11390,75,82,0),p(3495,3,32380,11390,75,83,0),p(1433,1,32376,11128,70,84,0),p(7005,2,32228,11836,49,85,0),p(6974,3,32236,11840,51,86,0),p(8342,3,32236,11840,51,87,0),p(1614,5,32416,11873,89,88,0),p(4426,4,32400,11498,80,90,0),p(2694,7,32448,11880,92,91,0),p(4798,3,32476,11714,94,93,0),p(1345,3,32476,11714,94,95,0),p(7309,3,32236,11840,51,96,0),p(3136,4,32496,11889,98,97,0),p(1159,3,32236,11840,51,99,0),p(1654,5,32416,11873,89,100,0),p(9474,3,32248,11714,53,101,0),p(9346,3,32248,11714,53,102,0),p(1634,5,32416,11873,89,103,0),p(4452,4,32400,11498,80,104,0),p(1672,6,32512,11895,106,105,0),p(4478,4,32400,11498,80,107,0),p(2719,5,32544,11903,109,108,0),p(6754,4,32576,11498,111,110,0),p(3753,4,32592,11910,113,112,0),p(6837,4,32592,11910,113,114,0),p(7795,4,32592,11910,113,115,0),p(2444,4,32592,11910,113,116,0),p(4826,4,32576,11498,111,117,0),p(7749,4,32592,11910,113,118,0),p(1112,4,32592,11910,113,119,0),p(5511,4,32576,11498,111,120,0),p(3167,4,32592,11910,113,121,0),p(7834,2,32608,11323,123,122,0),p(6928,3,32248,11714,53,124,0),p(9239,4,32624,11916,126,125,0),p(8559,5,32640,11156,128,127,0),p(6113,3,32236,11840,51,129,0),p(6497,3,32248,11714,53,130,0),p(5262,3,32248,11714,53,131,0),p(8541,1,32376,11128,70,132,0),p(4143,2,32212,11323,45,133,0),p(1919,2,32212,11323,45,134,0),p(3662,3,32248,11714,53,135,0),p(2043,2,32660,11922,137,136,0),p(3615,3,32236,11840,51,138,0),p(1949,2,32212,11323,45,139,0),p(5424,5,32672,11926,141,140,0),p(2094,3,32692,11933,143,142,0),p(5449,5,32672,11926,141,144,0),p(2059,3,32692,11933,143,145,0),p(3555,3,32236,11840,51,146,0),p(2869,3,32236,11840,51,147,0),p(1561,3,32248,11714,53,148,0),p(2073,3,32704,11938,150,149,0),p(6405,2,32212,11323,45,151,0),p(2660,3,32236,11840,51,152,0),p(1967,7,32720,11943,154,153,0),p(1883,1,32376,11128,70,155,0),p(7644,6,32752,11952,157,156,0),p(2018,4,32784,11960,159,158,0),p(6601,2,32212,11323,45,160,0),p(6564,6,32800,11966,162,161,0),p(2012,5,32832,11974,164,163,0),p(1984,2,32212,11323,45,165,0),p(1932,1,32376,11128,70,166,0),p(1480,3,32248,11714,53,167,0),p(2111,1,32376,11128,70,168,0),p(4372,2,32212,11323,45,169,0),p(7553,4,32400,11498,80,170,0),p(7494,3,32380,11390,75,171,0),p(7522,3,32248,11714,53,172,0),p(6311,5,32864,11156,174,173,0),p(1705,1,32376,11128,70,175,0),p(7409,2,32212,11323,45,176,0),p(7375,3,32248,11714,53,177,0),p(8259,3,32248,11714,53,178,0),p(6901,2,32212,11323,45,179,0),p(7192,2,32212,11323,45,180,0),p(7249,3,32248,11714,53,181,0),p(7121,3,32476,11714,94,182,0),p(7061,2,32608,11323,123,183,0),p(3400,2,32608,11323,123,184,0),p(3369,2,32608,11323,123,185,0),p(3434,2,32608,11323,123,186,0),p(6247,2,32212,11323,45,187,0),p(4304,3,32248,11714,53,188,0),p(4338,2,32212,11323,45,189,0),p(8221,3,32236,11840,51,190,0),p(3575,3,32236,11840,51,191,0),p(1503,3,32248,11714,53,192,0),p(1532,2,32212,11323,45,193,0),p(6469,6,32352,11865,68,194,0),p(6524,4,32576,11498,111,195,0),p(1600,3,32884,11981,197,196,0),p(4285,2,32212,11323,45,198,0),p(4210,3,32248,11714,53,199,0),p(1044,3,32248,11714,53,200,0),p(6816,4,32496,11889,98,201,0),p(3835,3,32236,11840,51,202,0),p(4043,4,32624,11916,126,203,0),p(4894,3,32248,11714,53,204,0),p(4867,3,32248,11714,53,205,0),p(1250,3,32248,11714,53,206,0),p(1278,2,32212,11323,45,207,0),p(1192,3,32248,11714,53,208,0),p(1221,2,32212,11323,45,209,0),p(7146,2,32220,11152,47,210,0),p(4517,2,32220,11152,47,211,0),p(6877,2,32608,11323,123,212,0),p(4581,4,32496,11889,98,213,0),p(8305,2,32228,11836,49,214,0),p(7167,2,32212,11323,45,215,0),p(7086,3,32248,11714,53,216,0),p(7728,4,32400,11498,80,217,0),p(7286,4,32400,11498,80,218,0),p(6219,3,32248,11714,53,219,0),p(8394,1,32376,11128,70,220,0),p(1830,1,32376,11128,70,221,0),p(4650,2,32212,11323,45,222,0),p(6367,3,32380,11390,75,223,0),p(10414,2,32212,11323,45,224,0),p(10335,2,32212,11323,45,225,0),p(10387,2,32212,11323,45,226,0),p(10308,2,32212,11323,45,227,0),p(10359,2,32212,11323,45,228,0),p(10280,2,32212,11323,45,229,0),p(3694,2,32212,11323,45,230,0),p(2409,3,32380,11390,75,231,0),p(9498,2,32212,11323,45,232,0),p(9370,2,32212,11323,45,233,0),p(9530,2,32212,11323,45,234,0),p(9402,2,32212,11323,45,235,0),p(9439,2,32212,11323,45,236,0),p(9402,2,32212,11323,45,235,0),p(1900,1,32376,11128,70,237,0),p(1734,1,32376,11128,70,238,0),p(3335,5,32896,11156,240,239,0),p(3298,3,32248,11714,53,241,0),p(2265,5,32640,11156,128,242,0),p(2288,7,32928,11986,244,243,0),p(5232,3,32248,11714,53,245,0),p(7887,2,32220,11152,47,246,0),p(2131,4,32960,11960,248,247,0),p(5473,3,32476,11714,94,249,0),p(1065,3,32248,11714,53,250,0),p(5970,5,32976,11995,252,251,0),p(1406,5,32896,11156,240,253,0),p(1376,3,32248,11714,53,254,0),p(2524,4,32576,11498,111,255,0),p(2493,3,32248,11714,53,256,0),p(5853,3,32248,11714,53,257,0),p(5826,3,32248,11714,53,258,0),p(7682,3,32248,11714,53,259,0),p(7705,2,32212,11323,45,260,0),p(5148,5,32288,11851,60,261,0),p(5115,5,32288,11851,60,262,0),p(4985,5,32288,11851,60,263,0),p(5027,5,32288,11851,60,264,0),p(5072,5,32288,11851,60,265,0),p(5179,5,32288,11851,60,266,0),p(4920,5,32288,11851,60,267,0),p(4951,5,32288,11851,60,268,0),p(2791,2,32608,11323,123,269,0),p(2810,2,32608,11323,123,270,0),p(8459,1,32376,11128,70,271,0),p(4259,3,32248,11714,53,272,0),p(3024,6,33008,11952,274,273,0),p(7955,2,32212,11323,45,275,0),p(8106,2,32212,11323,45,276,0),p(3853,2,32212,11323,45,277,0),p(5699,2,32228,11836,49,278,0),p(8431,1,32376,11128,70,279,0),p(4229,3,32248,11714,53,280,0),p(2997,6,33008,11952,274,281,0),p(7917,2,32212,11323,45,282,0),p(8067,2,32212,11323,45,283,0),p(4711,2,32212,11323,45,284,0),p(8514,1,32376,11128,70,285,0),p(3077,6,33008,11952,274,286,0),p(8030,2,32212,11323,45,287,0),p(8183,2,32212,11323,45,288,0),p(3892,2,32212,11323,45,289,0),p(5784,2,32228,11836,49,290,0),p(8483,1,32376,11128,70,291,0),p(3047,6,33008,11952,274,292,0),p(7989,2,32212,11323,45,293,0),p(8141,2,32212,11323,45,294,0),p(4753,2,32212,11323,45,295,0),p(5738,2,32228,11836,49,296,0),p(1868,1,32376,11128,70,297,0),p(3112,6,32352,11865,68,298,0),p(3222,2,32212,11323,45,299,0),p(7443,2,32212,11323,45,300,0),p(4066,2,32212,11323,45,301,0),p(6437,2,32212,11323,45,302,0),p(5202,2,32212,11323,45,303,0),p(6638,2,32228,11836,49,304,0),p(7344,2,32212,11323,45,305,0),p(3257,2,32212,11323,45,306,0),p(7036,5,33040,12002,308,307,0),p(5613,2,32212,11323,45,309,0),p(2926,3,32236,11840,51,310,0),p(2963,3,32236,11840,51,311,0),p(2757,3,32236,11840,51,312,0),p(6028,3,32476,11714,94,313,0),p(1306,3,32476,11714,94,314,0),p(2190,9,33072,12009,316,315,0),p(1799,4,32960,11960,248,317,0),p(3518,3,32236,11840,51,318,0),p(2832,3,32236,11840,51,319,0),p(2159,10,33120,12020,321,320,0),p(1772,4,32960,11960,248,322,0),p(2889,3,32236,11840,51,323,0),p(2565,3,32236,11840,51,324,0),p(2606,3,32236,11840,51,325,0)}function oA(A,r,f,e,i){var n,a,t,c,b,u,l,s,k,d,v,h,B,w,Z,m,Q,E=0,W=0,N=0,p=0,F=0,R=0,Y=0,V=0,g=0,X=0,D=0,C=0,J=0,x=0,y=0,M=0,H=0,I=0,T=0,U=0,j=0,z=0,P=0,O=0,$=0;if(S=n=S-48|0,I=o[i>>2],D=r,(m=o[e>>2])&&(D=o[m+12>>2]),U=o[D+96>>2],R=f,x=o[r+96>>2],u=o[f+96>>2]-x|0,p=o[(m||I)+12>>2],J=o[r+92>>2],F=o[p+92>>2]-J|0,h=o[f+92>>2]-J|0,y=o[p+96>>2]-x|0,Y=ee(k=G(u,F)-G(h,y)|0,B=k>>31,u,C=u>>31),N=L,H=o[r+88>>2],p=o[p+88>>2]-H|0,Q=o[f+88>>2]-H|0,r=Y-(F=ee(d=G(p,h)-G(F,Q)|0,w=d>>31,g=Q,V=g>>31))|0,T=o[D+92>>2],l=r,W=ee(r,a=N-(L+(F>>>0>Y>>>0)|0)|0,f=T,f>>31),E=L,M=ee(d,w,f=h,Y=f>>31),N=L,r=M-(p=ee(v=G(g,y)-G(p,u)|0,Z=v>>31,u,C))|0,D=o[D+88>>2],s=r,r=ee(r,t=N-(L+(p>>>0>M>>>0)|0)|0,F=D,F>>31),E=L+E|0,E=r>>>0>(p=r+W|0)>>>0?E+1|0:E,F=ee(g,V,v,Z),g=L,f=ee(f,Y,k,B),f=ee(c=F-f|0,b=g-(L+(f>>>0>F>>>0)|0)|0,U,U>>31),E=L+E|0,g=(r=f+p|0)>>>0>>0?E+1|0:E,f=ee(k,B,H,H>>31),F=L,N=f,f=ee(d,w,x,x>>31),W=L+F|0,W=f>>>0>(p=N+f|0)>>>0?W+1|0:W,F=ee(v,Z,J,J>>31),N=L+W|0,J=f=F+p|0,x=f>>>0>>0?N+1|0:N,R=I?o[I+12>>2]:R,H=o[R+96>>2],M=o[R+92>>2],y=o[R+88>>2],f=I,m&&(f=I,o[m+12>>2])){f=o[o[m+8>>2]+4>>2],W=o[f+12>>2],N=ee(p=o[W+92>>2],Y=p>>31,v,Z),E=L,V=N,N=ee(F=o[W+88>>2],C=F>>31,k,B),E=L+E|0,E=N>>>0>(V=V+N|0)>>>0?E+1|0:E,R=V,V=ee(N=o[W+96>>2],j=N>>31,d,w),W=L+E|0;A:if(!((R=R+V|0)>>>0>>0&(0|x)>=(0|(W=R>>>0>>0?W+1|0:W))|(0|W)<(0|x))){for(R=f+12|0,X=o[A+100>>2];;){if((0|X)==o[f+20>>2])break A;if(Y=ee(p,Y,l,a),p=L,F=ee(F,C,s,t),E=L+p|0,E=F>>>0>(Y=F+Y|0)>>>0?E+1|0:E,p=ee(N,j,c,b),E=L+E|0,p=E=p>>>0>(F=p+Y|0)>>>0?E+1|0:E,(0|g)>=(0|E)&r>>>0>=F>>>0|(0|E)<(0|g))break A;if(o[e>>2]=f,r=o[R>>2],U=o[r+96>>2],T=o[r+92>>2],D=o[r+88>>2],!r)break;if(R=(f=o[o[f+8>>2]+4>>2])+12|0,r=F,g=p,V=o[f+12>>2],N=ee(p=o[(F=V)+92>>2],Y=p>>31,v,Z),E=L,z=(W=N)+(N=ee(F=o[F+88>>2],C=F>>31,k,B))|0,W=L+E|0,W=N>>>0>z>>>0?W+1|0:W,E=ee(N=o[V+96>>2],j=N>>31,d,w),W=L+W|0,(V=E+z|0)>>>0>>0&(0|x)>=(0|(W=E>>>0>V>>>0?W+1|0:W))|(0|W)<(0|x))break A}r=F,g=p}f=o[i>>2]}F=ee(l,a,M,M>>31),p=L,N=F,F=ee(s,t,y,y>>31),E=L+p|0,E=(N=N+F|0)>>>0>>0?E+1|0:E,F=ee(c,b,H,H>>31),W=L+E|0,Y=(p=F+N|0)>>>0>>0?W+1|0:W;A:if(f){if(o[f+12>>2]&&(R=o[o[f+8>>2]>>2],V=o[R+12>>2],E=ee(F=o[(N=V)+92>>2],C=F>>31,v,Z),W=L,X=E,E=ee(N=o[N+88>>2],j=N>>31,k,B),W=L+W|0,W=E>>>0>(X=X+E|0)>>>0?W+1|0:W,E=ee(V=o[V+96>>2],P=V>>31,d,w),W=L+W|0,!((X=E+X|0)>>>0>>0&(0|x)>=(0|(W=E>>>0>X>>>0?W+1|0:W))|(0|W)<(0|x)))){for(O=R+12|0,z=o[A+100>>2];;){if((0|z)==o[(E=R)+20>>2])break A;if(F=ee(F,C,l,a),W=L,R=F,F=ee(N,j,s,t),N=L+W|0,N=F>>>0>(R=R+F|0)>>>0?N+1|0:N,V=ee(c,b,V,P),W=L+N|0,N=W=(F=V+R|0)>>>0>>0?W+1|0:W,(0|Y)>=(0|W)&p>>>0>=F>>>0|(0|W)<(0|Y))break A;if(o[i>>2]=E,f=o[O>>2],H=o[f+96>>2],M=o[f+92>>2],y=o[f+88>>2],!f)break;if(O=(R=o[o[E+8>>2]>>2])+12|0,f=E,p=F,Y=N,V=o[R+12>>2],E=ee(F=o[(N=V)+92>>2],C=F>>31,v,Z),W=L,X=E,E=ee(N=o[N+88>>2],j=N>>31,k,B),W=L+W|0,W=E>>>0>(X=X+E|0)>>>0?W+1|0:W,$=(E=X)+(X=ee(V=o[V+96>>2],P=V>>31,d,w))|0,E=L+W|0,J>>>0>$>>>0&(0|x)>=(0|(E=X>>>0>$>>>0?E+1|0:E))|(0|E)<(0|x))break A}f=E,p=F,Y=N}}else f=0;g=Y-((r>>>0>p>>>0)+g|0)|0;A:{if(!!(r=p-r|0)&(0|g)>=0|(0|g)>0)for(x=o[A+100>>2];;){for(f=o[e>>2];;){r:if(C=(F=(G(M-T|0,h)+G(y-D|0,Q)|0)+G(H-U|0,u)|0)>>31,!(!f|!o[f+12>>2]||(J=o[o[f>>2]+8>>2],(0|x)>=o[J+20>>2]))){p=o[J+12>>2],A=(R=o[p+92>>2])-T|0,N=(I=o[p+88>>2])-D|0,Y=(V=o[p+96>>2])-U|0,X=(G(A,h)+G(N,Q)|0)+G(Y,u)|0,A=ee(l,a,A,A>>31),p=L,E=A,A=ee(s,t,N,N>>31),W=L+p|0,W=A>>>0>(N=E+A|0)>>>0?W+1|0:W,p=ee(c,b,Y,Y>>31),E=L+W|0;f:{if(!((E=(A=p+N|0)>>>0

>>0?E+1|0:E)|A)){if((0|X)<0)break f;break r}if((0|E)>0|(0|E)>=0)break r;if(o[n+32>>2]=0-A,o[n+36>>2]=0-(!!(0|A)+E|0),N=(0|X)>0,o[n+40>>2]=N?-1:X>>>31|0,p=(0|X)<0,o[n+24>>2]=N?X:p?0-X|0:0,A=X>>31,o[n+28>>2]=N?A:p?0-(!!(0|X)+A|0)|0:0,(0|F)>0?(o[n+16>>2]=1,Y=C,N=-1,A=F):(0|F)<0?(o[n+16>>2]=-1,Y=0-(!!(0|F)+C|0)|0,N=1,A=0-F|0):(o[n+16>>2]=0,Y=0,N=0,A=0),o[n>>2]=A,o[n+4>>2]=Y,!!(A=r)&(0|(p=g))>=0|(0|p)>0||(p=0,A=0,(0|g)>0|(0|g)>=0||(o[n+16>>2]=N,p=0-(!!(0|r)+g|0)|0,A=0-r|0)),o[n+8>>2]=A,o[n+12>>2]=p,(0|Er(n+24|0,n))<0)break r}f=(0|f)!=(0|m)?J:0,o[e>>2]=f,A=ee(l,a,A=M-R|0,A>>31),r=L,F=A,A=ee(s,t,A=y-I|0,A>>31),N=L+r|0,N=A>>>0>(g=F+A|0)>>>0?N+1|0:N,A=ee(c,b,A=H-V|0,A>>31),E=L+N|0,g=A>>>0>(r=A+g|0)>>>0?E+1|0:E,D=I,T=R,U=V;continue}break}if(!(A=o[i>>2])|!o[A+12>>2])break A;if(X=o[o[A+8>>2]>>2],(0|x)>=o[X+20>>2])break A;if(p=o[X+12>>2],A=ee(E=(J=o[p+92>>2])-M|0,M=E>>31,v,Z),f=L,N=A,A=ee(Y=(R=o[p+88>>2])-y|0,I=Y>>31,k,B),W=L+f|0,W=A>>>0>(y=N+A|0)>>>0?W+1|0:W,(0|y)!=(0-(f=ee(d,w,p=(N=o[p+96>>2])-H|0,V=p>>31))|0)|(0-(L+!!(0|f)|0)|0)!=(0|W))break A;if(A=ee(l,a,A=J-T|0,A>>31),f=L,R=(W=A)+(A=ee(s,t,A=R-D|0,A>>31))|0,W=L+f|0,W=A>>>0>R>>>0?W+1|0:W,A=ee(c,b,A=N-U|0,A>>31),N=L+W|0,!(f=A+R|0)&(0|(A=N=A>>>0>f>>>0?N+1|0:N))<=0|(0|A)<0)break A;R=(G(E,h)+G(Y,Q)|0)+G(p,u)|0,N=ee(E,M,l,a),E=L,Y=(W=N)+(N=ee(s,t,Y,I))|0,W=L+E|0,W=N>>>0>Y>>>0?W+1|0:W,N=ee(c,b,p,V),E=L+W|0;r:{if(!((E=N>>>0>(p=N+Y|0)>>>0?E+1|0:E)|p)){if((0|R)<0)break r;break A}if((0|E)>0|(0|E)>=0)break A;if(o[n+32>>2]=0-p,o[n+36>>2]=0-(!!(0|p)+E|0),Y=(0|R)>0,o[n+40>>2]=Y?-1:R>>>31|0,N=(0|R)<0,o[n+24>>2]=Y?R:N?0-R|0:0,p=R>>31,o[n+28>>2]=Y?p:N?0-(!!(0|R)+p|0)|0:0,(0|F)>0?(o[n+16>>2]=1,p=-1):(0|F)<0?(o[n+16>>2]=-1,F=0-(p=F)|0,C=0-(!!(0|p)+C|0)|0,p=1):(o[n+16>>2]=0,F=0,C=0,p=0),o[n>>2]=F,o[n+4>>2]=C,!!(F=r)&(0|(N=g))>=0|(0|N)>0||(N=0,F=0,(0|g)>0|(0|g)>=0||(o[n+16>>2]=p,N=0-(!!(0|r)+g|0)|0,F=0-r|0)),o[n+8>>2]=F,o[n+12>>2]=N,(0|Er(n+24|0,n))<=0)break A}o[i>>2]=X,r=o[X+12>>2],H=o[r+96>>2],M=o[r+92>>2],y=o[r+88>>2],r=f,g=A}if(!((0|g)>0|(0|g)>=0))for(X=o[A+100>>2];;){C=(F=(G(M-T|0,h)+G(y-D|0,Q)|0)+G(H-U|0,u)|0)>>31;r:if(!(!f|!o[f+12>>2]||(J=o[o[f+4>>2]+8>>2],(0|X)>=o[J+20>>2]))){p=o[J+12>>2],A=(Y=o[p+92>>2])-M|0,W=(N=o[p+88>>2])-y|0,V=(p=o[p+96>>2])-H|0,R=(G(A,h)+G(W,Q)|0)+G(V,u)|0,A=ee(l,a,A,A>>31),E=L,x=A,A=ee(s,t,W,W>>31),E=L+E|0,E=A>>>0>(W=x+A|0)>>>0?E+1|0:E,A=(V=ee(c,b,V,V>>31))+W|0,W=L+E|0;f:{if(!((W=A>>>0>>0?W+1|0:W)|A)){if((0|R)>0)break f;break r}if((0|W)>0|(0|W)>=0)break r;if(o[n+32>>2]=0-A,o[n+36>>2]=0-(!!(0|A)+W|0),W=(0|R)>0,o[n+40>>2]=W?-1:R>>>31|0,E=(0|R)<0,o[n+24>>2]=W?R:E?0-R|0:0,A=R>>31,o[n+28>>2]=W?A:E?0-(!!(0|R)+A|0)|0:0,(0|F)>0?(o[n+16>>2]=1,R=-1,E=C,A=F):(0|F)<0?(o[n+16>>2]=-1,R=1,E=0-(!!(0|F)+C|0)|0,A=0-F|0):(R=0,o[n+16>>2]=0,E=0,A=0),o[n>>2]=A,o[n+4>>2]=E,!!(A=r)&(0|(E=g))>=0|(0|E)>0||(E=0,A=0,(0|g)>0|(0|g)>=0||(o[n+16>>2]=R,E=0-(!!(0|r)+g|0)|0,A=0-r|0)),o[n+8>>2]=A,o[n+12>>2]=E,(0|Er(n+24|0,n))>0)break r}f=(0|f)!=(0|I)?J:0,o[i>>2]=f,A=ee(l,a,A=Y-T|0,A>>31),r=L,F=A,A=ee(s,t,A=N-D|0,A>>31),E=L+r|0,E=A>>>0>(g=F+A|0)>>>0?E+1|0:E,A=ee(c,b,A=p-U|0,A>>31),W=L+E|0,g=A>>>0>(r=A+g|0)>>>0?W+1|0:W,y=N,M=Y,H=p;continue}if(!(A=o[e>>2])|!o[A+12>>2])break A;if(z=o[o[A+8>>2]+4>>2],(0|X)>=o[z+20>>2])break A;if(N=o[z+12>>2],A=ee(Y=(J=o[N+92>>2])-T|0,T=Y>>31,v,Z),f=L,x=(E=A)+(A=ee(p=(R=o[N+88>>2])-D|0,W=p>>31,k,B))|0,E=L+f|0,E=A>>>0>x>>>0?E+1|0:E,(0|x)!=(0-(N=ee(d,w,f=(D=o[N+96>>2])-U|0,V=f>>31))|0)|(0-(L+!!(0|N)|0)|0)!=(0|E))break A;if(A=ee(l,a,A=M-J|0,A>>31),N=L,E=A,A=ee(s,t,A=y-R|0,A>>31),N=L+N|0,N=A>>>0>(E=E+A|0)>>>0?N+1|0:N,A=(D=ee(c,b,A=H-D|0,A>>31))+E|0,E=L+N|0,(0|(E=A>>>0>>0?E+1|0:E))>0|(0|E)>=0)break A;D=(G(Y,h)+G(p,Q)|0)+G(f,u)|0,Y=ee(Y,T,l,a),N=L,p=ee(s,t,p,W),W=L+N|0,W=p>>>0>(Y=p+Y|0)>>>0?W+1|0:W,p=ee(c,b,f,V),W=L+W|0;r:{if(!((W=(f=p+Y|0)>>>0

>>0?W+1|0:W)|f)){if((0|D)>0)break r;break A}if((0|W)>0|(0|W)>=0)break A;if(o[n+32>>2]=0-f,o[n+36>>2]=0-(!!(0|f)+W|0),N=(0|D)>0,o[n+40>>2]=N?-1:D>>>31|0,p=(0|D)<0,o[n+24>>2]=N?D:p?0-D|0:0,f=D>>31,o[n+28>>2]=N?f:p?0-(!!(0|D)+f|0)|0:0,(0|F)>0?(o[n+16>>2]=1,p=-1):(0|F)<0?(o[n+16>>2]=-1,f=F,F=0-F|0,C=0-(!!(0|f)+C|0)|0,p=1):(o[n+16>>2]=0,F=0,C=0,p=0),o[n>>2]=F,o[n+4>>2]=C,!!(f=r)&(0|(F=g))>=0|(0|F)>0||(F=0,f=0,(0|g)>0|(0|g)>=0||(o[n+16>>2]=p,F=0-(!!(0|r)+g|0)|0,f=0-r|0)),o[n+8>>2]=f,o[n+12>>2]=F,(0|Er(n+24|0,n))>=0)break A}o[e>>2]=z,r=o[z+12>>2],U=o[r+96>>2],T=o[r+92>>2],f=o[i>>2],D=o[r+88>>2],r=A,g=E}}S=n+48|0}function cA(A,r,f,e){var i,n=0,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=0,d=m(0),h=m(0),B=0,Z=m(0),Q=0,E=m(0),W=0,p=m(0),F=0,R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=0,I=0,T=m(0),U=m(0),j=m(0),z=0,P=m(0),O=m(0),L=m(0),$=0,K=0,q=m(0),_=0,AA=0,rA=0,fA=0,eA=0,iA=0,nA=0;S=i=S-704|0,W=ae(i+620|0),o[(n=W)+20>>2]=1065353216,o[n+24>>2]=1065353216,o[n+4>>2]=8,o[n>>2]=21520,o[n+32>>2]=0,o[n+36>>2]=0,o[n+28>>2]=1065353216,o[n+40>>2]=0,o[n+44>>2]=0,o[n+48>>2]=0,o[n+52>>2]=0,o[n+56>>2]=0,n=o[f+12>>2],Q=o[f+4>>2];A:if((0|(F=o[Q+4>>2]))<=19)o[i+612>>2]=0,o[i+616>>2]=0,o[i+444>>2]=13280,w[i+608>>2]=w[e+4>>2],a[i+416|0]=0,o[i+392>>2]=953267991,o[12+(F=i+680|0)>>2]=Q,o[F+8>>2]=W,B=i+84|0,o[F+4>>2]=B,o[F>>2]=23372,o[12+(k=i+68|0)>>2]=Q,o[k+8>>2]=W,o[k+4>>2]=B,o[k>>2]=22724,Q=8&o[e+16>>2]?k:F,0|Zn[o[o[Q>>2]+8>>2]](Q,A,r,n,n,i+444|0)&&(t=w[i+584>>2],c=w[i+576>>2],b=w[i+580>>2],(u=m(m(t*t)+m(m(c*c)+m(b*b))))>m(9999999747378752e-20)&&(l=w[i+608>>2])>2]&&(d=t,t=m(m(1)/m(N(u))),w[i+584>>2]=d*t,w[i+580>>2]=b*t,w[i+576>>2]=c*t,A=o[f+8>>2],o[i+44>>2]=0,o[i+40>>2]=A,A=o[i+588>>2],o[i+56>>2]=o[i+584>>2],o[i+60>>2]=A,A=o[i+580>>2],o[i+48>>2]=o[i+576>>2],o[i+52>>2]=A,w[i+64>>2]=l,m(Zn[o[o[e>>2]+12>>2]](e,i+40|0,1))));else if(F-21>>>0<=8){if(Z=w[n+20>>2],b=w[n+36>>2],p=w[n+24>>2],E=w[n+52>>2],u=w[n+56>>2],l=w[n+40>>2],s=w[n+32>>2],R=w[n+16>>2],d=w[n>>2],Y=w[n+4>>2],h=w[n+48>>2],X=w[n+8>>2],c=w[A+52>>2],V=w[A+56>>2],t=w[A+48>>2],o[i+456>>2]=0,E=m(-E),J=m(p*E),g=m(m(J-m(X*h))-m(l*u)),x=m(V*l),y=m(p*c),w[i+452>>2]=g+m(x+m(m(t*X)+y)),M=m(Z*E),D=m(m(M-m(Y*h))-m(b*u)),T=m(V*b),U=m(Z*c),w[i+448>>2]=D+m(T+m(m(t*Y)+U)),j=m(R*E),P=m(m(j-m(d*h))-m(s*u)),O=m(V*s),L=m(R*c),w[i+444>>2]=P+m(O+m(m(t*d)+L)),V=w[r+52>>2],E=w[r+56>>2],c=w[r+48>>2],o[i+52>>2]=0,C=g,g=m(E*l),q=m(c*X),X=m(p*V),w[i+48>>2]=C+m(g+m(q+X)),C=D,D=m(E*b),p=m(c*Y),Y=m(Z*V),w[i+44>>2]=C+m(D+m(p+Y)),E=m(E*s),C=m(c*d),d=m(R*V),w[i+40>>2]=P+m(E+m(C+d)),21==(0|F)){r=o[f+8>>2],A=Sf(i+84|0,F=i+444|0,k=i+40|0,o[e+16>>2]),o[A+52>>2]=Q,o[A+48>>2]=r,o[A+44>>2]=e,o[A>>2]=13348,f=o[n+12>>2],o[(r=A- -64|0)>>2]=o[n+8>>2],o[r+4>>2]=f,r=o[n+4>>2],o[A+56>>2]=o[n>>2],o[A+60>>2]=r,r=o[n+28>>2],o[A+80>>2]=o[n+24>>2],o[A+84>>2]=r,r=o[n+20>>2],o[A+72>>2]=o[n+16>>2],o[A+76>>2]=r,r=o[n+44>>2],o[A+96>>2]=o[n+40>>2],o[A+100>>2]=r,r=o[n+36>>2],o[A+88>>2]=o[n+32>>2],o[A+92>>2]=r,r=o[n+60>>2],o[A+112>>2]=o[n+56>>2],o[A+116>>2]=r,r=o[n+52>>2],o[A+104>>2]=o[n+48>>2],o[A+108>>2]=r,w[A+40>>2]=w[e+4>>2],S=r=S-16|0,f=o[Q+56>>2],o[r+12>>2]=A,o[r+8>>2]=f,o[r+4>>2]=18780,f=o[Q+60>>2],e=r+4|0,S=A=S-32|0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+16>>2]=0,o[A+20>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,v[f+60|0]?MA(f,e,F,k,A+16|0,A,o[f+56>>2]):KA(f,e,F,k,A+16|0,A),S=A+32|0,S=r+16|0;break A}Z=w[n>>2],p=w[n+4>>2],u=m(-u),C=m(l*u),l=w[n+8>>2],h=m(-h),R=m(C+m(m(l*h)+J)),w[i+688>>2]=m(x+m(m(t*l)+y))+R,o[i+692>>2]=0,b=m(m(b*u)+m(m(p*h)+M)),w[i+684>>2]=m(T+m(m(t*p)+U))+b,C=m(O+m(m(t*Z)+L)),t=m(m(s*u)+m(m(Z*h)+j)),w[i+680>>2]=C+t,o[i+80>>2]=0,w[i+76>>2]=m(g+m(m(c*l)+X))+R,w[i+72>>2]=m(D+m(m(c*p)+Y))+b,w[i+68>>2]=m(E+m(m(c*Z)+d))+t,r=o[f+8>>2],A=Sf(i+84|0,i+680|0,i+68|0,o[e+16>>2]),o[A+52>>2]=Q,o[A+48>>2]=r,o[A+44>>2]=e,o[A>>2]=13348,f=o[n+12>>2],o[(r=A- -64|0)>>2]=o[n+8>>2],o[r+4>>2]=f,r=o[n+4>>2],o[A+56>>2]=o[n>>2],o[A+60>>2]=r,r=o[n+28>>2],o[A+80>>2]=o[n+24>>2],o[A+84>>2]=r,r=o[n+20>>2],o[A+72>>2]=o[n+16>>2],o[A+76>>2]=r,r=o[n+44>>2],o[A+96>>2]=o[n+40>>2],o[A+100>>2]=r,r=o[n+36>>2],o[A+88>>2]=o[n+32>>2],o[A+92>>2]=r,r=o[n+60>>2],o[A+112>>2]=o[n+56>>2],o[A+116>>2]=r,r=o[n+52>>2],o[A+104>>2]=o[n+48>>2],o[A+108>>2]=r,w[A+40>>2]=w[e+4>>2],r=o[i+692>>2],o[i+32>>2]=o[i+688>>2],o[i+36>>2]=r,r=o[i+684>>2],o[i+24>>2]=o[i+680>>2],o[i+28>>2]=r,(t=w[i+68>>2])>2]&&(w[i+24>>2]=t),(c=w[i+72>>2])>2]&&(w[i+28>>2]=c),(b=w[i+76>>2])>2]&&(w[i+32>>2]=b),(u=w[i+80>>2])>2]&&(w[i+36>>2]=u),r=o[i+692>>2],o[i+16>>2]=o[i+688>>2],o[i+20>>2]=r,r=o[i+684>>2],o[i+8>>2]=o[i+680>>2],o[i+12>>2]=r,t>w[i+8>>2]&&(w[i+8>>2]=t),c>w[i+12>>2]&&(w[i+12>>2]=c),b>w[i+16>>2]&&(w[i+16>>2]=b),u>w[i+20>>2]&&(w[i+20>>2]=u),Zn[o[o[Q>>2]+64>>2]](Q,A,i+24|0,i+8|0)}else if(31==(0|F))if(W=o[Q+72>>2],f=o[f+8>>2],o[i+64>>2]=e,o[i+60>>2]=r,o[i+56>>2]=A,o[i+52>>2]=n,o[i+48>>2]=Q,o[i+44>>2]=f,o[i+40>>2]=13532,W){if(t=w[n+20>>2],c=w[n+36>>2],b=w[n+24>>2],u=w[n+52>>2],Y=w[A+52>>2],l=w[n+40>>2],s=w[n+56>>2],R=w[A+56>>2],X=w[n>>2],h=w[n+16>>2],Z=w[n+32>>2],V=w[n+4>>2],d=w[n+8>>2],p=w[n+48>>2],E=w[A+48>>2],o[i+96>>2]=0,R=m(R-s),g=d,d=m(E-p),Y=m(Y-u),w[i+92>>2]=m(l*R)+m(m(g*d)+m(b*Y)),w[i+88>>2]=m(c*R)+m(m(V*d)+m(Y*t)),w[i+84>>2]=m(Z*R)+m(m(X*d)+m(Y*h)),R=w[r+52>>2],d=w[r+56>>2],Y=w[n>>2],X=w[n+4>>2],V=w[n+8>>2],E=w[r+48>>2],o[i+456>>2]=0,g=l,l=m(d-s),s=m(E-p),d=b,b=m(R-u),w[i+452>>2]=m(g*l)+m(m(V*s)+m(d*b)),w[i+448>>2]=m(c*l)+m(m(X*s)+m(t*b)),w[i+444>>2]=m(Z*l)+m(m(Y*s)+m(h*b)),$=i+40|0,F=0,S=k=S-544|0,A=o[W>>2]){for(t=w[i+92>>2],c=w[i+452>>2],b=w[i+84>>2],u=w[i+444>>2],l=w[i+88>>2],s=w[i+448>>2],o[k+32>>2]=A,t=m(c-t),c=m(u-b),b=m(s-l),u=m(m(1)/m(N(m(m(t*t)+m(m(c*c)+m(b*b)))))),l=m(t*u),d=m(l*t),t=m(c*u),g=m(t*c),c=m(b*u),p=m(d+m(g+m(b*c))),_=k+((A=(b=l==m(0)?m(0xde0b6b000000000):m(m(1)/l))>2],B=o[W+4>>2],o[k>>2]=o[W>>2],o[k+4>>2]=B,B=o[W+12>>2],o[k+8>>2]=o[W+8>>2],o[k+12>>2]=B,B=o[W+28>>2],o[k+24>>2]=o[W+24>>2],o[k+28>>2]=B,B=o[W+20>>2],o[k+16>>2]=o[W+16>>2],o[k+20>>2]=B,h=w[i+84>>2],u=m(t*m(w[eA>>2]-h)),s=w[i+88>>2],!(u>(l=m(c*m(w[fA>>2]-s)))||(s=m(c*m(w[AA>>2]-s)))>(h=m(t*m(w[iA>>2]-h)))||(u=u>2],u>(s=m(b*m(w[rA>>2]-Z)))||(Z=m(b*m(w[_>>2]-Z)))>(l=l(us?s:l)>m(0)))))if(o[W+40>>2]){if((0|A)>(0|f)){if((0|(A=e<<1))>(0|e)){if((0|A)>(0|n)){if(e){if(o[8488]=o[8488]+1,f=0|Zn[o[8290]](e<<3,16),!((0|e)<=0)){if(z=0,n=0,e>>>0>=4)for(nA=-4&e,H=0;o[(B=n<<2)+f>>2]=o[r+B>>2],o[(I=4|B)+f>>2]=o[r+I>>2],o[(I=8|B)+f>>2]=o[r+I>>2],o[(B|=12)+f>>2]=o[r+B>>2],n=n+4|0,(0|nA)!=(0|(H=H+4|0)););if(B=3&e)for(;o[(H=n<<2)+f>>2]=o[r+H>>2],n=n+1|0,(0|B)!=(0|(z=z+1|0)););}}else f=0;n=F,F=1,r&&n&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),n=A,r=f}Af((f=e<<2)+r|0,0,f)}e=A,f=A-2|0}o[r+K>>2]=o[W+36>>2],o[(Q<<2)+r>>2]=o[W+40>>2],A=Q+1|0}else Zn[o[o[$>>2]+12>>2]]($,W);if(Q=A,!A)break}F&&r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}S=k+544|0}else if(!((0|(e=o[Q+24>>2]))<=0))for(f=0;A=o[o[i+48>>2]+32>>2]+G(f,80)|0,r=o[A+64>>2],R=w[A+56>>2],d=w[A+48>>2],Y=w[A+52>>2],X=w[A+32>>2],V=w[A>>2],E=w[A+16>>2],J=w[A+36>>2],g=w[A+4>>2],x=w[A+20>>2],y=w[A+40>>2],M=w[A+8>>2],D=w[A+24>>2],A=o[i+52>>2],T=w[A+52>>2],U=w[A+56>>2],t=w[A+24>>2],c=w[A+20>>2],b=w[A+40>>2],u=w[A+36>>2],j=w[A+48>>2],l=w[A+8>>2],s=w[A>>2],h=w[A+4>>2],Z=w[A+16>>2],p=w[A+32>>2],o[i+144>>2]=0,o[i+128>>2]=0,o[i+112>>2]=0,o[i+96>>2]=0,w[i+124>>2]=m(y*b)+m(m(M*p)+m(D*u)),w[i+120>>2]=m(J*b)+m(m(g*p)+m(x*u)),w[i+116>>2]=m(X*b)+m(m(V*p)+m(E*u)),w[i+108>>2]=m(y*t)+m(m(M*Z)+m(D*c)),w[i+104>>2]=m(J*t)+m(m(g*Z)+m(x*c)),w[i+100>>2]=m(X*t)+m(m(V*Z)+m(E*c)),w[i+92>>2]=m(y*l)+m(m(M*s)+m(h*D)),w[i+88>>2]=m(J*l)+m(m(g*s)+m(h*x)),w[i+84>>2]=m(X*l)+m(m(V*s)+m(E*h)),w[i+140>>2]=U+m(m(R*b)+m(m(d*p)+m(u*Y))),w[i+136>>2]=T+m(m(R*t)+m(m(d*Z)+m(c*Y))),w[i+132>>2]=j+m(m(R*l)+m(m(d*s)+m(h*Y))),o[i+700>>2]=f,o[i+696>>2]=-1,o[i+688>>2]=o[i+44>>2],o[i+684>>2]=r,o[i+680>>2]=0,o[i+692>>2]=i+84,o[i+460>>2]=0,o[i+448>>2]=1065353216,o[i+452>>2]=0,o[i+472>>2]=f,o[i+464>>2]=r,o[i+444>>2]=13708,A=o[i+64>>2],o[i+468>>2]=A,w[i+448>>2]=w[A+4>>2],o[i+460>>2]=o[A+16>>2],cA(o[i+56>>2],o[i+60>>2],i+680|0,i+444|0),(0|e)!=(0|(f=f+1|0)););S=i+704|0}function bA(A,r,f){var e,i,n=m(0),a=0,t=m(0),c=m(0),b=m(0),u=m(0),l=0,s=0,k=0,d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=0,p=0,F=0,R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=0,j=m(0),z=m(0),P=m(0),O=m(0),L=0,$=0,K=0,q=m(0),_=m(0),AA=0,rA=0;for(S=e=S-96|0,o[A+376>>2]=0,o[A+364>>2]=4,o[A+368>>2]=0,l=A+316|0,o[A+360>>2]=l,o[A+356>>2]=A+284,o[A+352>>2]=A+252,o[A+348>>2]=A+220,a=o[r+4>>2],o[A>>2]=o[r>>2],o[A+4>>2]=a,a=o[r+20>>2],o[A+16>>2]=o[r+16>>2],o[A+20>>2]=a,a=o[r+12>>2],o[A+8>>2]=o[r+8>>2],o[A+12>>2]=a,a=o[r+36>>2],o[A+32>>2]=o[r+32>>2],o[A+36>>2]=a,a=o[r+28>>2],o[A+24>>2]=o[r+24>>2],o[A+28>>2]=a,a=o[r+52>>2],o[A+48>>2]=o[r+48>>2],o[A+52>>2]=a,a=o[r+44>>2],o[A+40>>2]=o[r+40>>2],o[A+44>>2]=a,a=o[4+(s=r- -64|0)>>2],o[(F=A- -64|0)>>2]=o[s>>2],o[F+4>>2]=a,a=o[r+60>>2],o[A+56>>2]=o[r+56>>2],o[A+60>>2]=a,a=o[r+84>>2],o[A+80>>2]=o[r+80>>2],o[A+84>>2]=a,a=o[r+76>>2],o[A+72>>2]=o[r+72>>2],o[A+76>>2]=a,a=o[r+100>>2],o[A+96>>2]=o[r+96>>2],o[A+100>>2]=a,a=o[r+92>>2],o[A+88>>2]=o[r+88>>2],o[A+92>>2]=a,a=o[r+108>>2],o[A+104>>2]=o[r+104>>2],o[A+108>>2]=a,a=o[r+116>>2],o[A+112>>2]=o[r+112>>2],o[A+116>>2]=a,a=o[r+124>>2],r=o[r+120>>2],o[A+144>>2]=0,o[A+180>>2]=0,o[A+120>>2]=r,o[A+124>>2]=a,r=o[f+4>>2],o[A+128>>2]=o[f>>2],o[A+132>>2]=r,r=o[f+12>>2],o[A+136>>2]=o[f+8>>2],o[A+140>>2]=r,o[A+364>>2]=3,o[A+164>>2]=0,o[A+328>>2]=0,o[A+180>>2]=1,o[A+148>>2]=l,c=w[A+136>>2],b=w[A+128>>2],n=w[A+132>>2],r=(t=m(m(c*c)+m(m(b*b)+m(n*n))))>m(0),c=m(r?-c:0),b=m(r?-b:1),n=m(r?-n:0),u=m(m(1)/m(N(m(m(c*c)+m(m(b*b)+m(n*n)))))),w[A+324>>2]=c*u,w[A+320>>2]=n*u,w[l>>2]=b*u,Yr(e+16|0,A,l),r=o[e+28>>2],o[A+340>>2]=o[e+24>>2],o[A+344>>2]=r,r=o[e+20>>2],o[A+332>>2]=o[e+16>>2],o[A+336>>2]=r,o[A+164>>2]=1065353216,f=o[A+148>>2],r=o[f+20>>2],o[A+128>>2]=o[f+16>>2],o[A+132>>2]=r,r=o[f+28>>2],o[A+136>>2]=o[f+24>>2],o[A+140>>2]=r,r=o[f+28>>2],o[e+72>>2]=o[f+24>>2],o[e+76>>2]=r,r=o[f+20>>2],o[e+64>>2]=o[f+16>>2],o[e+68>>2]=r,r=o[f+28>>2],o[e+56>>2]=o[f+24>>2],o[e+60>>2]=r,r=o[f+20>>2],o[e+48>>2]=o[f+16>>2],o[e+52>>2]=r,r=o[f+28>>2],o[e+40>>2]=o[f+24>>2],o[e+44>>2]=r,r=o[f+20>>2],o[e+32>>2]=o[f+16>>2],o[e+36>>2]=r,r=o[f+28>>2],o[e+24>>2]=o[f+24>>2],o[e+28>>2]=r,r=o[f+20>>2],o[e+16>>2]=o[f+16>>2],o[e+20>>2]=r,n=w[A+136>>2],d=w[A+132>>2],u=w[A+128>>2],W=o[A+368>>2],i=A+148|0;;){A:{r:{f:if((v=m(N(m(m(n*n)+m(m(u*u)+m(d*d))))))>2]=1;else if(a=G(W,36),f=o[180+(F=a+A|0)>>2],o[164+((s=f<<2)+F|0)>>2]=0,r=o[A+364>>2]-1|0,o[A+364>>2]=r,p=a+i|0,a=o[348+((r<<2)+A|0)>>2],o[s+p>>2]=a,o[F+180>>2]=f+1,o[a+12>>2]=0,b=m(m(1)/v),w[a+8>>2]=b*m(-n),w[a+4>>2]=b*m(-d),w[a>>2]=b*m(-u),Yr(e+80|0,A,a),r=o[e+92>>2],o[a+24>>2]=o[e+88>>2],o[a+28>>2]=r,r=o[e+84>>2],o[a+16>>2]=o[e+80>>2],o[a+20>>2]=r,a=o[F+180>>2],s=o[((a<<2)+p|0)-4>>2],u=w[s+24>>2],n=m(u-w[e+24>>2]),Q=m(n*n),c=w[s+16>>2],n=m(c-w[e+16>>2]),h=m(n*n),b=w[s+20>>2],n=m(b-w[e+20>>2]),m(Q+m(h+m(n*n)))>2]),Q=m(n*n),n=m(c-w[e+32>>2]),h=m(n*n),n=m(b-w[e+36>>2]),m(Q+m(h+m(n*n)))>2]),Q=m(n*n),n=m(c-w[e+48>>2]),h=m(n*n),n=m(b-w[e+52>>2]),m(Q+m(h+m(n*n)))>2]),Q=m(n*n),n=m(c-w[e+64>>2]),h=m(n*n),n=m(b-w[e+68>>2]),m(Q+m(h+m(n*n)))>2],f=G(W,36)+A|0,r=o[f+180>>2]-1|0,o[f+180>>2]=r,f=o[148+(f+(r<<2)|0)>>2],r=o[A+364>>2],o[A+364>>2]=r+1,o[348+((r<<2)+A|0)>>2]=f;else{if(r=o[s+28>>2],o[8+(f=(e+16|0)+((K=K+1&3)<<4)|0)>>2]=o[s+24>>2],o[f+12>>2]=r,r=o[s+20>>2],o[f>>2]=o[s+16>>2],o[f+4>>2]=r,j=(n=m(m(m(w[A+136>>2]*u)+m(m(w[A+128>>2]*c)+m(w[A+132>>2]*b)))/v))>j?n:j,m(m(v*m(-9999999747378752e-20))+m(v-j))<=m(0)){W=o[A+368>>2],f=G(W,36)+A|0,r=o[f+180>>2]-1|0,o[f+180>>2]=r,f=o[148+(f+(r<<2)|0)>>2],r=o[A+364>>2],o[A+364>>2]=r+1,o[348+((r<<2)+A|0)>>2]=f;break f}o[e+12>>2]=0;e:{i:{n:switch(a-2|0){case 0:if(f=o[p+4>>2],c=w[f+24>>2],r=o[p>>2],R=w[r+24>>2],d=m(c-R),b=w[f+16>>2],B=w[r+16>>2],v=m(b-B),t=w[f+20>>2],Z=w[r+20>>2],u=m(t-Z),!((n=m(m(d*d)+m(m(v*v)+m(u*u))))>m(0)))break e;if((E=m(m(-m(m(R*d)+m(m(B*v)+m(Z*u))))/n))>=m(1)){o[e+12>>2]=2,o[e+80>>2]=0,o[e+84>>2]=1065353216,t=m(m(c*c)+m(m(b*b)+m(t*t)));break i}if(E<=m(0)){o[e+12>>2]=1,o[e+80>>2]=1065353216,o[e+84>>2]=0,t=m(m(R*R)+m(m(B*B)+m(Z*Z)));break i}o[e+12>>2]=3,w[e+84>>2]=E,w[e+80>>2]=m(1)-E,n=m(R+m(d*E)),h=m(n*n),n=m(B+m(v*E)),t=m(n*n),n=m(Z+m(u*E)),t=m(h+m(t+m(n*n)));break i;case 1:t=xA(o[p>>2]+16|0,o[p+4>>2]+16|0,o[p+8>>2]+16|0,e+80|0,e+12|0);break i;case 2:break n;default:break i}S=k=S-32|0,n=m(-1),s=o[p+4>>2]+16|0,Q=w[s+4>>2],l=o[p+12>>2]+16|0,D=w[l+4>>2],C=m(Q-D),a=o[p>>2]+16|0,h=w[a+8>>2],J=w[l+8>>2],x=m(h-J),q=m(C*m(-x)),f=o[p+8>>2]+16|0,b=w[f>>2],y=w[l>>2],V=m(b-y),z=w[a>>2],M=m(z-y),_=m(M*C),E=w[f+8>>2],g=m(E-J),c=w[s>>2],H=m(c-y),P=w[a+4>>2],I=m(P-D),R=m(H*m(-I)),O=w[s+8>>2],T=m(O-J),B=m(T*m(-M)),t=w[f+4>>2],X=m(t-D),Z=m(I*T),d=m(x*H),(Y=m(m(q*V)+m(m(_*g)+m(m(R*g)+m(m(B*X)+m(m(Z*V)+m(d*X)))))))>m(0)|Y>2]=0,o[k+16>>2]=0,o[k+20>>2]=0,o[k+12>>2]=0,m(Y*m(m(J*m(_+R))+m(m(y*m(Z+q))+m(D*m(d+B)))))>m(0)&&(n=xA(a,s,l,k+16|0,k+12|0),r=o[k+12>>2],o[e+12>>2]=3&r|r<<1&8,w[e+80>>2]=w[k+16>>2],t=w[k+20>>2],o[e+88>>2]=0,w[e+84>>2]=t,w[e+92>>2]=w[k+24>>2]),m(Y*m(m(w[l+8>>2]*m(m(H*X)-m(V*C)))+m(m(w[l>>2]*m(m(C*g)-m(X*T)))+m(w[l+4>>2]*m(m(T*V)-m(g*H))))))>m(0)&&(t=xA(s,f,l,k+16|0,k+12|0),n>2]=o[k+12>>2]<<1&14,w[e+84>>2]=w[k+16>>2],n=w[k+20>>2],o[e+80>>2]=0,w[e+88>>2]=n,w[e+92>>2]=w[k+24>>2],n=t)),m(Y*m(m(w[l+8>>2]*m(m(V*I)-m(M*X)))+m(m(w[l>>2]*m(m(X*x)-m(I*g)))+m(w[l+4>>2]*m(m(g*M)-m(x*V))))))>m(0)&&(t=xA(f,a,l,k+16|0,k+12|0),n>2],o[e+12>>2]=r>>>1&1|r<<1&8|r<<2&4,w[e+88>>2]=w[k+16>>2],n=w[k+20>>2],o[e+84>>2]=0,w[e+80>>2]=n,w[e+92>>2]=w[k+24>>2],n=t)),n>2]=15,B=w[f>>2],Z=w[s+4>>2],d=w[l+8>>2],v=w[f+4>>2],u=w[s+8>>2],c=w[l>>2],b=w[f+8>>2],t=w[s>>2],n=w[l+4>>2],E=m(m(m(m(m(B*Z)*d)+m(m(m(m(m(v*u)*c)+m(m(b*t)*n))-m(m(u*B)*n))-m(m(t*v)*d)))-m(m(Z*b)*c))/Y),w[e+80>>2]=E,B=w[a>>2],Z=w[f+4>>2],d=w[l+8>>2],v=w[a+4>>2],u=w[f+8>>2],c=w[l>>2],b=w[a+8>>2],t=w[f>>2],n=w[l+4>>2],R=m(m(m(m(m(B*Z)*d)+m(m(m(m(m(v*u)*c)+m(m(b*t)*n))-m(m(u*B)*n))-m(m(t*v)*d)))-m(m(Z*b)*c))/Y),w[e+84>>2]=R,B=w[s>>2],Z=w[a+4>>2],d=w[l+8>>2],v=w[s+4>>2],u=w[a+8>>2],c=w[l>>2],b=w[s+8>>2],t=w[a>>2],n=w[l+4>>2],n=m(m(m(m(m(B*Z)*d)+m(m(m(m(m(v*u)*c)+m(m(b*t)*n))-m(m(u*B)*n))-m(m(t*v)*d)))-m(m(Z*b)*c))/Y),w[e+88>>2]=n,w[e+92>>2]=m(1)-m(m(E+R)+n),n=m(0)))),S=k+32|0,t=n}if(t>=m(0)){if(r=G(W=1-W|0,36),o[180+(L=r+A|0)>>2]=0,o[A+136>>2]=0,o[A+140>>2]=0,o[A+128>>2]=0,o[A+132>>2]=0,o[A+368>>2]=W,!(k=o[F+180>>2])){n=m(0),$=o[e+12>>2],d=m(0),u=m(0);break r}for(l=r+i|0,f=o[A+364>>2],n=m(0),U=0,$=o[e+12>>2],d=m(0),u=m(0),r=0;AA=o[(s=(F=r<<2)+p|0)>>2],$>>>r&1?(o[(a=U<<2)+l>>2]=AA,c=w[F+(e+80|0)>>2],U=U+1|0,o[L+180>>2]=U,w[164+(a+L|0)>>2]=c,a=o[s>>2],b=w[a+24>>2],n=w[a+20>>2],u=m(m(c*w[a+16>>2])+w[A+128>>2]),w[A+128>>2]=u,d=m(m(c*n)+w[A+132>>2]),w[A+132>>2]=d,n=m(m(c*b)+w[A+136>>2]),w[A+136>>2]=n):(a=f+1|0,o[A+364>>2]=a,o[348+((f<<2)+A|0)>>2]=AA,f=a),(0|k)!=(0|(r=r+1|0)););break r}}W=o[A+368>>2],f=G(W,36)+A|0,r=o[f+180>>2]-1|0,o[f+180>>2]=r,f=o[148+(f+(r<<2)|0)>>2],r=o[A+364>>2],o[A+364>>2]=r+1,o[348+((r<<2)+A|0)>>2]=f}r=o[A+376>>2];break A}if(r=(rA=rA+1|0)>>>0>=128?2:15==(0|$)?1:o[A+376>>2],o[A+376>>2]=r,!r)continue}break}switch(o[A+372>>2]=148+(G(W,36)+A|0),n=m(0),0|r){case 0:n=w[A+136>>2],h=m(n*n),n=w[A+128>>2],t=m(n*n),n=w[A+132>>2],n=m(N(m(h+m(t+m(n*n)))));case 1:w[A+144>>2]=n}return S=e+96|0,r}function uA(A,r,f,e,i,n,t,c){var b,u=0,l=0,s=0,k=0,d=0,h=m(0),B=0,Z=0,Q=0,E=m(0),W=m(0),N=m(0),p=0,F=m(0),R=0,Y=0,V=0,g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=0,I=0,T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=0,L=0,$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0);if(S=b=S-32|0,(o[i+4>>2]&o[i+8>>2])<0&&(!(l=o[i+12>>2])||!l|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](l)),a[i+16|0]=1,o[i+8>>2]=0,o[i+12>>2]=0),l=0,o[i+4>>2]=0,(0|(R=o[e+4>>2]))>o[i+8>>2]){if(R&&(o[8488]=o[8488]+1,l=0|Zn[o[8290]](R<<4,16),!((0|(k=o[i+4>>2]))<=0))){if(1!=(0|k))for(d=-2&k;Q=(Y=u<<4)+l|0,p=Y+o[i+12>>2]|0,I=o[p+4>>2],o[Q>>2]=o[p>>2],o[Q+4>>2]=I,I=o[p+12>>2],o[Q+8>>2]=o[p+8>>2],o[Q+12>>2]=I,Y=(p=16|Y)+l|0,p=p+o[i+12>>2]|0,Q=o[p+4>>2],o[Y>>2]=o[p>>2],o[Y+4>>2]=Q,Q=o[p+12>>2],o[Y+8>>2]=o[p+8>>2],o[Y+12>>2]=Q,u=u+2|0,(0|d)!=(0|(s=s+2|0)););1&k&&(s=(u<<=4)+l|0,u=u+o[i+12>>2]|0,k=o[u+4>>2],o[s>>2]=o[u>>2],o[s+4>>2]=k,k=o[u+12>>2],o[s+8>>2]=o[u+8>>2],o[s+12>>2]=k)}!(u=o[i+12>>2])||!u|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](u)),o[i+12>>2]=l,a[i+16|0]=1,o[i+8>>2]=R}if(!((0|(s=o[r+28>>2]))<=0)){for(F=w[f+40>>2],g=w[f+36>>2],D=w[f+24>>2],C=w[f+20>>2],k=o[r+36>>2],J=w[A+8>>2],x=w[A+4>>2],M=w[A>>2],T=w[f+32>>2],U=w[f+16>>2],j=w[f+8>>2],z=w[f+4>>2],X=w[f>>2],u=0,h=m(34028234663852886e22),l=-1;R=k+G(u,36)|0,N=w[R+28>>2],W=w[R+20>>2],E=w[R+24>>2],h=(R=(N=m(m(m(m(F*N)+m(m(T*W)+m(E*g)))*J)+m(m(m(m(j*N)+m(m(X*W)+m(E*z)))*M)+m(m(m(D*N)+m(m(U*W)+m(E*C)))*x))))>2]+G(l,36)|0,(0|(L=o[p+4>>2]))<=0)l=e;else for(R=0;;){if(l=i,I=(0|L)==(0|(R=(i=R)+1|0)),k=o[r+16>>2],s=o[p+12>>2],u=k+(o[s+((I?0:R)<<2)>>2]<<4)|0,X=w[u+8>>2],y=w[u>>2],P=w[u+4>>2],i=k+(o[s+(i<<2)>>2]<<4)|0,h=w[i+8>>2],N=w[i>>2],W=w[i+4>>2],rA=w[f+56>>2],fA=w[f+48>>2],eA=w[f+52>>2],D=w[f+40>>2],C=w[f+32>>2],J=w[f+36>>2],E=w[p+28>>2],x=w[f+8>>2],F=w[p+20>>2],M=w[f>>2],g=w[p+24>>2],T=w[f+4>>2],U=w[f+24>>2],j=w[f+16>>2],z=w[f+20>>2],o[b+28>>2]=0,X=m(h-X),y=m(N-y),P=m(W-P),$=m(m(x*X)+m(m(M*y)+m(T*P))),K=m(m(U*E)+m(m(j*F)+m(z*g))),q=m(m(x*E)+m(m(M*F)+m(T*g))),_=m(m(U*X)+m(m(j*y)+m(P*z))),AA=m(m($*K)-m(q*_)),w[b+24>>2]=-AA,X=m(m(D*X)+m(m(C*y)+m(P*J))),E=m(m(D*E)+m(m(C*F)+m(J*g))),y=m(m(X*q)-m(E*$)),w[b+20>>2]=-y,X=m(-m(m(_*E)-m(K*X))),w[b+16>>2]=X,Y=0,i=e,(0|(O=o[e+4>>2]))>=2)for(e=(o[i+12>>2]+(O<<4)|0)-16|0,E=w[e+8>>2],F=w[e>>2],g=w[e+4>>2],x=m(-m(m(m(m(fA+m(m(h*x)+m(m(N*M)+m(W*T))))*X)-m(m(eA+m(m(h*U)+m(m(N*j)+m(W*z))))*y))-m(m(rA+m(m(h*D)+m(m(N*C)+m(W*J))))*AA))),h=m(m(m(w[b+24>>2]*E)+m(m(w[b+16>>2]*F)+m(g*w[b+20>>2])))+x);;){e=o[i+12>>2]+(Y<<4)|0,N=w[e+8>>2],C=w[e>>2],W=w[e+4>>2],D=m(m(m(w[b+24>>2]*N)+m(m(w[b+16>>2]*C)+m(W*w[b+20>>2])))+x),J=w[e+12>>2];A:{r:{f:{if(h>2]))==o[l+8>>2]&&!((0|(Q=e?e<<1:1))<=(0|e))){if(Q?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](Q<<4,16),e=o[l+4>>2]):s=0,!((0|e)<=0)){if(u=0,1!=(0|e))for(H=-2&e,k=0;Z=(B=u<<4)+s|0,d=B+o[l+12>>2]|0,V=o[d+4>>2],o[Z>>2]=o[d>>2],o[Z+4>>2]=V,V=o[d+12>>2],o[Z+8>>2]=o[d+8>>2],o[Z+12>>2]=V,B=(d=16|B)+s|0,d=d+o[l+12>>2]|0,Z=o[d+4>>2],o[B>>2]=o[d>>2],o[B+4>>2]=Z,Z=o[d+12>>2],o[B+8>>2]=o[d+8>>2],o[B+12>>2]=Z,u=u+2|0,(0|H)!=(0|(k=k+2|0)););1&e&&(u=(e=u<<4)+s|0,e=e+o[l+12>>2]|0,k=o[e+4>>2],o[u>>2]=o[e>>2],o[u+4>>2]=k,k=o[e+12>>2],o[u+8>>2]=o[e+8>>2],o[u+12>>2]=k)}!(e=o[l+12>>2])||!e|!v[l+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[l+12>>2]=s,a[l+16|0]=1,o[l+8>>2]=Q,e=o[l+4>>2]}u=o[l+12>>2]+(e<<4)|0;break f}if(h=m(h/m(h-D)),J=m(m(N-E)*h),M=m(m(W-g)*h),F=m(m(m(C-F)*h)+F),(0|(e=o[l+4>>2]))==o[l+8>>2]&&!((0|(Q=e?e<<1:1))<=(0|e))){if(Q?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](Q<<4,16),e=o[l+4>>2]):s=0,!((0|e)<=0)){if(u=0,1!=(0|e))for(H=-2&e,k=0;Z=(B=u<<4)+s|0,d=B+o[l+12>>2]|0,V=o[d+4>>2],o[Z>>2]=o[d>>2],o[Z+4>>2]=V,V=o[d+12>>2],o[Z+8>>2]=o[d+8>>2],o[Z+12>>2]=V,B=(d=16|B)+s|0,d=d+o[l+12>>2]|0,Z=o[d+4>>2],o[B>>2]=o[d>>2],o[B+4>>2]=Z,Z=o[d+12>>2],o[B+8>>2]=o[d+8>>2],o[B+12>>2]=Z,u=u+2|0,(0|H)!=(0|(k=k+2|0)););1&e&&(u=(e=u<<4)+s|0,e=e+o[l+12>>2]|0,k=o[e+4>>2],o[u>>2]=o[e>>2],o[u+4>>2]=k,k=o[e+12>>2],o[u+8>>2]=o[e+8>>2],o[u+12>>2]=k)}!(e=o[l+12>>2])||!e|!v[l+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[l+12>>2]=s,a[l+16|0]=1,o[l+8>>2]=Q,e=o[l+4>>2]}h=m(J+E),u=o[l+12>>2]+(e<<4)|0,w[u>>2]=F,J=m(0),E=m(M+g);break r}if(!(D>2]))==o[l+8>>2]&&!((0|(Q=e?e<<1:1))<=(0|e))){if(Q?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](Q<<4,16),e=o[l+4>>2]):s=0,!((0|e)<=0)){if(u=0,1!=(0|e))for(H=-2&e,k=0;Z=(B=u<<4)+s|0,d=B+o[l+12>>2]|0,V=o[d+4>>2],o[Z>>2]=o[d>>2],o[Z+4>>2]=V,V=o[d+12>>2],o[Z+8>>2]=o[d+8>>2],o[Z+12>>2]=V,B=(d=16|B)+s|0,d=d+o[l+12>>2]|0,Z=o[d+4>>2],o[B>>2]=o[d>>2],o[B+4>>2]=Z,Z=o[d+12>>2],o[B+8>>2]=o[d+8>>2],o[B+12>>2]=Z,u=u+2|0,(0|H)!=(0|(k=k+2|0)););1&e&&(u=(e=u<<4)+s|0,e=e+o[l+12>>2]|0,k=o[e+4>>2],o[u>>2]=o[e>>2],o[u+4>>2]=k,k=o[e+12>>2],o[u+8>>2]=o[e+8>>2],o[u+12>>2]=k)}!(e=o[l+12>>2])||!e|!v[l+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[l+12>>2]=s,a[l+16|0]=1,o[l+8>>2]=Q,e=o[l+4>>2]}if(e=o[l+12>>2]+(e<<4)|0,o[e+12>>2]=0,w[e+8>>2]=E,w[e+4>>2]=g,w[e>>2]=h,e=o[l+4>>2]+1|0,o[l+4>>2]=e,o[l+8>>2]==(0|e)&&!((0|(Q=e?e<<1:1))<=(0|e))){if(Q?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](Q<<4,16),e=o[l+4>>2]):s=0,!((0|e)<=0)){if(u=0,1!=(0|e))for(H=-2&e,k=0;Z=(B=u<<4)+s|0,d=B+o[l+12>>2]|0,V=o[d+4>>2],o[Z>>2]=o[d>>2],o[Z+4>>2]=V,V=o[d+12>>2],o[Z+8>>2]=o[d+8>>2],o[Z+12>>2]=V,B=(d=16|B)+s|0,d=d+o[l+12>>2]|0,Z=o[d+4>>2],o[B>>2]=o[d>>2],o[B+4>>2]=Z,Z=o[d+12>>2],o[B+8>>2]=o[d+8>>2],o[B+12>>2]=Z,u=u+2|0,(0|H)!=(0|(k=k+2|0)););1&e&&(u=(e=u<<4)+s|0,e=e+o[l+12>>2]|0,k=o[e+4>>2],o[u>>2]=o[e>>2],o[u+4>>2]=k,k=o[e+12>>2],o[u+8>>2]=o[e+8>>2],o[u+12>>2]=k)}!(e=o[l+12>>2])||!e|!v[l+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[l+12>>2]=s,a[l+16|0]=1,o[l+8>>2]=Q,e=o[l+4>>2]}u=o[l+12>>2]+(e<<4)|0}w[u>>2]=C,h=N,E=W}w[u+12>>2]=J,w[u+8>>2]=h,w[u+4>>2]=E,o[l+4>>2]=o[l+4>>2]+1}if(h=D,E=N,g=W,F=C,(0|O)==(0|(Y=Y+1|0)))break}if(!((0|(e=o[i+4>>2]))>=0)){if(o[i+8>>2]<0&&(!(u=o[i+12>>2])||!u|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](u)),a[i+16|0]=1,o[i+8>>2]=0,o[i+12>>2]=0),s=0,u=e,Y=0-e&3)for(;Q=o[b+4>>2],k=o[i+12>>2]+(u<<4)|0,o[k>>2]=o[b>>2],o[k+4>>2]=Q,Q=o[b+12>>2],o[k+8>>2]=o[b+8>>2],o[k+12>>2]=Q,u=u+1|0,(0|Y)!=(0|(s=s+1|0)););if(!(e>>>0>4294967292))for(;k=o[b+4>>2],s=(e=u<<4)+o[i+12>>2]|0,o[s>>2]=o[b>>2],o[s+4>>2]=k,k=o[b+12>>2],o[s+8>>2]=o[b+8>>2],o[s+12>>2]=k,k=o[b+12>>2],s=e+o[i+12>>2]|0,o[s+24>>2]=o[b+8>>2],o[s+28>>2]=k,k=o[b+4>>2],o[s+16>>2]=o[b>>2],o[s+20>>2]=k,k=o[b+12>>2],s=e+o[i+12>>2]|0,o[s+40>>2]=o[b+8>>2],o[s+44>>2]=k,k=o[b+4>>2],o[s+32>>2]=o[b>>2],o[s+36>>2]=k,s=o[b+12>>2],e=e+o[i+12>>2]|0,o[e+56>>2]=o[b+8>>2],o[e+60>>2]=s,s=o[b+4>>2],o[e+48>>2]=o[b>>2],o[e+52>>2]=s,u=u+4|0;);}if(o[i+4>>2]=0,e=l,I)break}if(!((0|(s=o[l+4>>2]))<=0))for(h=w[p+28>>2],N=w[p+20>>2],W=w[p+24>>2],E=m(m(w[f+40>>2]*h)+m(m(w[f+32>>2]*N)+m(W*w[f+36>>2]))),F=m(m(w[f+8>>2]*h)+m(m(w[f>>2]*N)+m(W*w[f+4>>2]))),h=m(m(w[f+24>>2]*h)+m(m(w[f+16>>2]*N)+m(W*w[f+20>>2]))),N=m(w[p+32>>2]-m(m(E*w[f+56>>2])+m(m(F*w[f+48>>2])+m(h*w[f+52>>2])))),i=0;r=o[l+12>>2]+(i<<4)|0,(W=n>=(W=m(N+m(m(E*w[r+8>>2])+m(m(F*w[r>>2])+m(h*w[r+4>>2])))))?n:W)<=t&&(f=o[r+12>>2],o[b+24>>2]=o[r+8>>2],o[b+28>>2]=f,f=o[r+4>>2],o[b+16>>2]=o[r>>2],o[b+20>>2]=f,Zn[o[o[c>>2]+16>>2]](c,A,b+16|0,W),s=o[l+4>>2]),(0|s)>(0|(i=i+1|0)););}}S=b+32|0}function lA(A,r,f,e,i){var n,c=m(0),b=0,u=0,l=0,s=0,k=0,d=m(0),B=m(0),Z=m(0),G=m(0),Q=0,E=m(0),W=0,N=0,p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0);if(S=n=S-48|0,a[A+60|0]=f,f){if(c=w[e>>2],d=w[e+4>>2],B=w[e+8>>2],o[A+16>>2]=0,G=m(B+m(-1)),w[A+12>>2]=G,d=m(d+m(-1)),w[A+8>>2]=d,B=m(c+m(-1)),w[A+4>>2]=B,Z=w[i>>2],E=w[i+4>>2],c=w[i+8>>2],a[A+60|0]=1,o[A+48>>2]=0,o[A+32>>2]=0,p=m(c+m(1)),w[A+28>>2]=p,F=m(E+m(1)),w[A+24>>2]=F,E=m(Z+m(1)),w[A+20>>2]=E,R=m(m(65533)/m(p-G)),w[A+44>>2]=R,Z=m(m(65533)/m(F-d)),w[A+40>>2]=Z,Y=m(m(65533)/m(E-B)),w[A+36>>2]=Y,f=(c=m(m(G-G)*R))=m(0)?~~c>>>0:0,V=m((65534&f)>>>0),f=(c=m(m(d-d)*Z))=m(0)?~~c>>>0:0,Z=m(d+m(m((65534&f)>>>0)/Z)),f=(c=m(m(B-B)*Y))=m(0)?~~c>>>0:0,(c=m(m(B+m(m((65534&f)>>>0)/Y))+m(-1)))>2]=c,B=c),(c=m(Z+m(-1)))>2]=c,d=c),(c=m(m(G+m(V/R))+m(-1)))>2]=c,G=c),c=m(p-G),R=m(m(65533)/c),f=(c=m(m(c*R)+m(1)))=m(0)?~~c>>>0:0,V=m((1|f)>>>0),c=m(F-d),Z=m(m(65533)/c),f=(c=m(m(c*Z)+m(1)))=m(0)?~~c>>>0:0,Z=m(d+m(m((1|f)>>>0)/Z)),c=m(E-B),Y=m(m(65533)/c),f=(c=m(m(c*Y)+m(1)))=m(0)?~~c>>>0:0,(c=m(m(B+m(m((1|f)>>>0)/Y))+m(1)))>E&&(w[A+20>>2]=c,E=c),(c=m(Z+m(1)))>F&&(w[A+24>>2]=c,F=c),(c=m(m(G+m(V/R))+m(1)))>p&&(w[A+28>>2]=c,p=c),o[A+48>>2]=0,w[A+44>>2]=m(65533)/m(p-G),w[A+40>>2]=m(65533)/m(F-d),w[A+36>>2]=m(65533)/m(E-B),o[n+32>>2]=A,o[n+28>>2]=A+104,o[n+24>>2]=20680,Zn[o[o[r>>2]+8>>2]](r,n+24|0,A+4|0,A+20|0),!((0|(f=o[A+128>>2]))>=(0|(s=(W=o[A+108>>2])<<1)))){if((0|s)>o[A+132>>2]){if(W?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](W<<5,16),i=o[A+128>>2]):(e=0,i=f),!((0|i)<=0)){if(r=0,1!=(0|i))for(N=-2&i;u=(l=r<<4)+e|0,Q=l+o[A+136>>2]|0,b=o[Q+4>>2],o[u>>2]=o[Q>>2],o[u+4>>2]=b,b=o[Q+12>>2],o[u+8>>2]=o[Q+8>>2],o[u+12>>2]=b,u=(b=16|l)+e|0,l=b+o[A+136>>2]|0,b=o[l+4>>2],o[u>>2]=o[l>>2],o[u+4>>2]=b,b=o[l+12>>2],o[u+8>>2]=o[l+8>>2],o[u+12>>2]=b,r=r+2|0,(0|N)!=(0|(k=k+2|0)););1&i&&(i=(r<<=4)+e|0,b=r+o[A+136>>2]|0,r=o[b+4>>2],o[i>>2]=o[b>>2],o[i+4>>2]=r,r=o[b+12>>2],o[i+8>>2]=o[b+8>>2],o[i+12>>2]=r)}!(r=o[A+136>>2])||!r|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+136>>2]=e,a[A+140|0]=1,o[A+132>>2]=s}if(i=s+~f|0,e=s-f&3)for(r=0;b=o[A+136>>2]+(f<<4)|0,o[b>>2]=0,o[b+4>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,f=f+1|0,(0|e)!=(0|(r=r+1|0)););if(!(i>>>0<3))for(;r=(e=f<<4)+o[A+136>>2]|0,o[r>>2]=0,o[r+4>>2]=0,o[r+8>>2]=0,o[r+12>>2]=0,r=e+o[A+136>>2]|0,o[r+24>>2]=0,o[r+28>>2]=0,o[r+16>>2]=0,o[r+20>>2]=0,r=e+o[A+136>>2]|0,o[r+40>>2]=0,o[r+44>>2]=0,o[r+32>>2]=0,o[r+36>>2]=0,r=e+o[A+136>>2]|0,o[r+56>>2]=0,o[r+60>>2]=0,o[r+48>>2]=0,o[r+52>>2]=0,(0|s)!=(0|(f=f+4|0)););}o[A+128>>2]=s}else{if(o[n+40>>2]=20812,o[n+44>>2]=A- -64,o[n+32>>2]=-581039253,o[n+36>>2]=0,o[n+24>>2]=-581039253,o[n+28>>2]=-581039253,o[n+16>>2]=1566444395,o[n+20>>2]=0,o[n+8>>2]=1566444395,o[n+12>>2]=1566444395,Zn[o[o[r>>2]+8>>2]](r,n+40|0,n+24|0,n+8|0),!((0|(r=o[A+88>>2]))>=(0|(k=(W=o[A+68>>2])<<1)))){if((0|k)>o[A+92>>2]){if(W?(o[8488]=o[8488]+1,Q=0|Zn[o[8290]](W<<7,16),f=o[A+88>>2]):f=r,!((0|f)<=0)){if(e=0,1!=(0|f))for(N=-2&f;u=(l=e<<6)+Q|0,s=l+o[A+96>>2]|0,i=o[s+4>>2],o[u>>2]=o[s>>2],o[u+4>>2]=i,i=o[s+60>>2],o[u+56>>2]=o[s+56>>2],o[u+60>>2]=i,i=o[s+52>>2],o[u+48>>2]=o[s+48>>2],o[u+52>>2]=i,i=o[s+44>>2],o[u+40>>2]=o[s+40>>2],o[u+44>>2]=i,i=o[s+36>>2],o[u+32>>2]=o[s+32>>2],o[u+36>>2]=i,i=o[s+28>>2],o[u+24>>2]=o[s+24>>2],o[u+28>>2]=i,i=o[s+20>>2],o[u+16>>2]=o[s+16>>2],o[u+20>>2]=i,i=o[s+12>>2],o[u+8>>2]=o[s+8>>2],o[u+12>>2]=i,u=(i=64|l)+Q|0,l=i+o[A+96>>2]|0,i=o[l+4>>2],o[u>>2]=o[l>>2],o[u+4>>2]=i,i=o[l+12>>2],o[u+8>>2]=o[l+8>>2],o[u+12>>2]=i,i=o[l+20>>2],o[u+16>>2]=o[l+16>>2],o[u+20>>2]=i,i=o[l+28>>2],o[u+24>>2]=o[l+24>>2],o[u+28>>2]=i,i=o[l+36>>2],o[u+32>>2]=o[l+32>>2],o[u+36>>2]=i,i=o[l+44>>2],o[u+40>>2]=o[l+40>>2],o[u+44>>2]=i,i=o[l+52>>2],o[u+48>>2]=o[l+48>>2],o[u+52>>2]=i,i=o[l+60>>2],o[u+56>>2]=o[l+56>>2],o[u+60>>2]=i,e=e+2|0,(0|N)!=(0|(b=b+2|0)););1&f&&(e=(f=e<<6)+Q|0,i=f+o[A+96>>2]|0,f=o[i+4>>2],o[e>>2]=o[i>>2],o[e+4>>2]=f,f=o[i+60>>2],o[e+56>>2]=o[i+56>>2],o[e+60>>2]=f,f=o[i+52>>2],o[e+48>>2]=o[i+48>>2],o[e+52>>2]=f,f=o[i+44>>2],o[e+40>>2]=o[i+40>>2],o[e+44>>2]=f,f=o[i+36>>2],o[e+32>>2]=o[i+32>>2],o[e+36>>2]=f,f=o[i+28>>2],o[e+24>>2]=o[i+24>>2],o[e+28>>2]=f,f=o[i+20>>2],o[e+16>>2]=o[i+16>>2],o[e+20>>2]=f,f=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=f)}!(f=o[A+96>>2])||!f|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+96>>2]=Q,a[A+100|0]=1,o[A+92>>2]=k}if(e=k+~r|0,f=k-r&3)for(i=0;b=o[A+96>>2]+(r<<6)|0,o[b>>2]=0,o[b+4>>2]=0,o[b+56>>2]=0,o[b+60>>2]=0,o[b+48>>2]=0,o[b+52>>2]=0,o[b+40>>2]=0,o[b+44>>2]=0,o[b+32>>2]=0,o[b+36>>2]=0,o[b+24>>2]=0,o[b+28>>2]=0,o[b+16>>2]=0,o[b+20>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,r=r+1|0,(0|f)!=(0|(i=i+1|0)););if(!(e>>>0<3))for(;f=(e=r<<6)+o[A+96>>2]|0,o[f>>2]=0,o[f+4>>2]=0,o[f+56>>2]=0,o[f+60>>2]=0,o[f+48>>2]=0,o[f+52>>2]=0,o[f+40>>2]=0,o[f+44>>2]=0,o[f+32>>2]=0,o[f+36>>2]=0,o[f+24>>2]=0,o[f+28>>2]=0,o[f+16>>2]=0,o[f+20>>2]=0,o[f+8>>2]=0,o[f+12>>2]=0,f=e+o[A+96>>2]|0,o[f+120>>2]=0,o[f+124>>2]=0,o[f+112>>2]=0,o[f+116>>2]=0,o[f+104>>2]=0,o[f+108>>2]=0,o[f+96>>2]=0,o[f+100>>2]=0,o[f+88>>2]=0,o[f+92>>2]=0,o[f+80>>2]=0,o[f+84>>2]=0,o[f+72>>2]=0,o[f+76>>2]=0,o[(f=f- -64|0)>>2]=0,o[f+4>>2]=0,f=e+o[A+96>>2]|0,o[f+184>>2]=0,o[f+188>>2]=0,o[f+176>>2]=0,o[f+180>>2]=0,o[f+168>>2]=0,o[f+172>>2]=0,o[f+160>>2]=0,o[f+164>>2]=0,o[f+152>>2]=0,o[f+156>>2]=0,o[f+144>>2]=0,o[f+148>>2]=0,o[f+136>>2]=0,o[f+140>>2]=0,o[f+128>>2]=0,o[f+132>>2]=0,f=e+o[A+96>>2]|0,o[f+248>>2]=0,o[f+252>>2]=0,o[f+240>>2]=0,o[f+244>>2]=0,o[f+232>>2]=0,o[f+236>>2]=0,o[f+224>>2]=0,o[f+228>>2]=0,o[f+216>>2]=0,o[f+220>>2]=0,o[f+208>>2]=0,o[f+212>>2]=0,o[f+200>>2]=0,o[f+204>>2]=0,o[f+192>>2]=0,o[f+196>>2]=0,(0|k)!=(0|(r=r+4|0)););}o[A+88>>2]=k}if(o[A+56>>2]=0,q(A,0,W),!(o[A+152>>2]|!v[A+60|0])){if(o[A+156>>2])r=1;else{if(o[8488]=o[8488]+1,N=0|Zn[o[8290]](32,16),!((0|(u=o[A+152>>2]))<=0)){if(i=0,1!=(0|u))for(e=-2&u,k=0;f=(b=i<<5)+N|0,l=b+o[A+160>>2]|0,r=o[l+4>>2],o[f>>2]=o[l>>2],o[f+4>>2]=r,r=o[l+28>>2],o[f+24>>2]=o[l+24>>2],o[f+28>>2]=r,r=o[l+20>>2],o[f+16>>2]=o[l+16>>2],o[f+20>>2]=r,r=o[l+12>>2],o[f+8>>2]=o[l+8>>2],o[f+12>>2]=r,f=(r=32|b)+N|0,b=r+o[A+160>>2]|0,r=o[b+4>>2],o[f>>2]=o[b>>2],o[f+4>>2]=r,r=o[b+12>>2],o[f+8>>2]=o[b+8>>2],o[f+12>>2]=r,r=o[b+20>>2],o[f+16>>2]=o[b+16>>2],o[f+20>>2]=r,r=o[b+28>>2],o[f+24>>2]=o[b+24>>2],o[f+28>>2]=r,i=i+2|0,(0|e)!=(0|(k=k+2|0)););1&u&&(f=(r=i<<5)+N|0,e=r+o[A+160>>2]|0,r=o[e+4>>2],o[f>>2]=o[e>>2],o[f+4>>2]=r,r=o[e+28>>2],o[f+24>>2]=o[e+24>>2],o[f+28>>2]=r,r=o[e+20>>2],o[f+16>>2]=o[e+16>>2],o[f+20>>2]=r,r=o[e+12>>2],o[f+8>>2]=o[e+8>>2],o[f+12>>2]=r)}!(r=o[A+160>>2])||!r|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+160>>2]=N,a[A+164|0]=1,o[A+156>>2]=1,r=o[A+152>>2]+1|0}o[A+152>>2]=r,e=o[A+160>>2],f=o[A+136>>2],t[e>>1]=h[f>>1],t[e+2>>1]=h[f+2>>1],t[e+4>>1]=h[f+4>>1],t[e+6>>1]=h[f+6>>1],t[e+8>>1]=h[f+8>>1],r=h[f+10>>1],o[e+12>>2]=0,t[e+10>>1]=r,r=o[f+12>>2],o[e+16>>2]=(0|r)>=0?1:0-r|0}o[A+168>>2]=o[A+152>>2],!(r=o[A+116>>2])||!r|!v[A+120|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+116>>2]=0,a[A+120|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,!(r=o[A+76>>2])||!r|!v[A+80|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+76>>2]=0,a[A+80|0]=1,o[A+68>>2]=0,o[A+72>>2]=0,S=n+48|0}function sA(A,r,f){var e,i=0,n=0,t=0,c=0,b=0,u=0,l=m(0),s=0,k=m(0),d=m(0),h=0,B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0);if(S=e=S-256|0,!((0|(c=o[r+212>>2]))>=0))if(!(2&(c=o[r+252>>2]))||w[404+(c=c<<30>>31&r)>>2]==m(0)&!(2&v[c+204|0])){if(!((0|(c=o[A+188>>2]))>=0)){if(r=o[A+8>>2],o[A+188>>2]=r,Af(e+12|0,0,244),i=r,(0|r)==o[A+12>>2]&&(i=r,!((0|(s=r?r<<1:1))<=(0|r)))){if(s?(o[8488]=o[8488]+1,h=0|Zn[o[8290]](G(s,244),16),i=o[A+8>>2]):i=r,(0|i)>0)for(c=0;t=(n=G(c,244))+h|0,n=n+o[A+16>>2]|0,b=o[n+4>>2],o[t>>2]=o[n>>2],o[t+4>>2]=b,b=o[n+12>>2],o[t+8>>2]=o[n+8>>2],o[t+12>>2]=b,b=o[n+28>>2],o[t+24>>2]=o[n+24>>2],o[t+28>>2]=b,b=o[n+20>>2],o[t+16>>2]=o[n+16>>2],o[t+20>>2]=b,b=o[n+44>>2],o[t+40>>2]=o[n+40>>2],o[t+44>>2]=b,b=o[n+36>>2],o[t+32>>2]=o[n+32>>2],o[t+36>>2]=b,b=o[n+52>>2],o[t+48>>2]=o[n+48>>2],o[t+52>>2]=b,b=o[n+60>>2],o[t+56>>2]=o[n+56>>2],o[t+60>>2]=b,pr(t- -64|0,n- -64|0,180),(0|i)!=(0|(c=c+1|0)););!(c=o[A+16>>2])||!c|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[A+16>>2]=h,a[A+20|0]=1,o[A+12>>2]=s,i=o[A+8>>2]}o[A+8>>2]=i+1,r=(c=G(r,244))+o[A+16>>2]|0,o[r>>2]=0,o[r+4>>2]=0,o[r+8>>2]=0,o[r+12>>2]=0,i=o[e+40>>2],o[r+24>>2]=o[e+36>>2],o[r+28>>2]=i,i=o[e+32>>2],o[r+16>>2]=o[e+28>>2],o[r+20>>2]=i,i=o[e+48>>2],o[r+32>>2]=o[e+44>>2],o[r+36>>2]=i,i=o[e+56>>2],o[r+40>>2]=o[e+52>>2],o[r+44>>2]=i,i=o[e+64>>2],o[r+48>>2]=o[e+60>>2],o[r+52>>2]=i,i=o[e+72>>2],o[r+56>>2]=o[e+68>>2],o[r+60>>2]=i,pr(r- -64|0,e+76|0,180),r=c+o[A+16>>2]|0,o[r+64>>2]=0,o[r+68>>2]=0,o[r+144>>2]=0,o[r+148>>2]=0,o[r+4>>2]=0,o[r+8>>2]=0,o[r>>2]=1065353216,o[r+88>>2]=0,o[r+92>>2]=0,o[r+80>>2]=0,o[r+84>>2]=0,o[r+72>>2]=0,o[r+76>>2]=0,o[r+152>>2]=0,o[r+156>>2]=0,o[r+160>>2]=0,o[r+164>>2]=0,o[r+168>>2]=0,o[r+172>>2]=0,o[r+12>>2]=0,o[r+16>>2]=0,o[r+24>>2]=0,o[r+28>>2]=0,o[r+20>>2]=1065353216,o[r+32>>2]=0,o[r+36>>2]=0,o[r+44>>2]=0,o[r+48>>2]=0,o[r+40>>2]=1065353216,o[r+52>>2]=0,o[r+56>>2]=0,o[r+60>>2]=0,o[r+136>>2]=0,o[r+140>>2]=0,o[r+240>>2]=0,o[r+128>>2]=0,o[r+132>>2]=0,o[r+120>>2]=1065353216,o[r+124>>2]=0,o[r+112>>2]=1065353216,o[r+116>>2]=1065353216,o[r+104>>2]=1065353216,o[r+108>>2]=0,o[r+96>>2]=1065353216,o[r+100>>2]=1065353216,o[r+232>>2]=0,o[r+236>>2]=0,o[r+224>>2]=0,o[r+228>>2]=0,o[r+216>>2]=0,o[r+220>>2]=0,o[r+208>>2]=0,o[r+212>>2]=0,o[r+200>>2]=0,o[r+204>>2]=0,o[r+192>>2]=0,o[r+196>>2]=0,o[r+184>>2]=0,o[r+188>>2]=0,o[r+176>>2]=0,o[r+180>>2]=0,c=o[A+188>>2]}}else{if(c=o[A+8>>2],Af(e+12|0,0,244),n=i=c,o[A+12>>2]==(0|i)&&(n=c,!((0|(s=i?i<<1:1))<=(0|i)))){if(s?(o[8488]=o[8488]+1,b=0|Zn[o[8290]](G(s,244),16),i=o[A+8>>2]):i=c,(0|i)>0)for(;t=(n=G(h,244))+b|0,n=n+o[A+16>>2]|0,u=o[n+4>>2],o[t>>2]=o[n>>2],o[t+4>>2]=u,u=o[n+12>>2],o[t+8>>2]=o[n+8>>2],o[t+12>>2]=u,u=o[n+28>>2],o[t+24>>2]=o[n+24>>2],o[t+28>>2]=u,u=o[n+20>>2],o[t+16>>2]=o[n+16>>2],o[t+20>>2]=u,u=o[n+44>>2],o[t+40>>2]=o[n+40>>2],o[t+44>>2]=u,u=o[n+36>>2],o[t+32>>2]=o[n+32>>2],o[t+36>>2]=u,u=o[n+52>>2],o[t+48>>2]=o[n+48>>2],o[t+52>>2]=u,u=o[n+60>>2],o[t+56>>2]=o[n+56>>2],o[t+60>>2]=u,pr(t- -64|0,n- -64|0,180),(0|i)!=(0|(h=h+1|0)););!(i=o[A+16>>2])||!i|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+16>>2]=b,a[A+20|0]=1,o[A+12>>2]=s,n=o[A+8>>2]}o[A+8>>2]=n+1,i=(n=G(c,244))+o[A+16>>2]|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,t=o[e+40>>2],o[i+24>>2]=o[e+36>>2],o[i+28>>2]=t,t=o[e+32>>2],o[i+16>>2]=o[e+28>>2],o[i+20>>2]=t,t=o[e+48>>2],o[i+32>>2]=o[e+44>>2],o[i+36>>2]=t,t=o[e+56>>2],o[i+40>>2]=o[e+52>>2],o[i+44>>2]=t,t=o[e+64>>2],o[i+48>>2]=o[e+60>>2],o[i+52>>2]=t,t=o[e+72>>2],o[i+56>>2]=o[e+68>>2],o[i+60>>2]=t,pr(i- -64|0,e+76|0,180),i=n+o[A+16>>2]|0,A=r?o[r+252>>2]<<30>>31&r:0,o[i+64>>2]=0,o[i+68>>2]=0,o[i+144>>2]=0,o[i+148>>2]=0,o[i+88>>2]=0,o[i+92>>2]=0,o[i+80>>2]=0,o[i+84>>2]=0,o[i+72>>2]=0,o[i+76>>2]=0,o[i+152>>2]=0,o[i+156>>2]=0,o[i+160>>2]=0,o[i+164>>2]=0,o[i+168>>2]=0,o[i+172>>2]=0,A?(n=o[A+8>>2],o[i>>2]=o[A+4>>2],o[i+4>>2]=n,n=o[A+16>>2],o[i+8>>2]=o[A+12>>2],o[i+12>>2]=n,n=o[A+32>>2],o[i+24>>2]=o[A+28>>2],o[i+28>>2]=n,n=o[A+24>>2],o[i+16>>2]=o[A+20>>2],o[i+20>>2]=n,n=o[A+48>>2],o[i+40>>2]=o[A+44>>2],o[i+44>>2]=n,n=o[A+40>>2],o[i+32>>2]=o[A+36>>2],o[i+36>>2]=n,n=o[A+64>>2],o[i+56>>2]=o[A+60>>2],o[i+60>>2]=n,n=o[A+56>>2],o[i+48>>2]=o[A+52>>2],o[i+52>>2]=n,k=w[A+412>>2],d=w[A+416>>2],B=w[A+408>>2],l=w[A+404>>2],o[i+240>>2]=A,o[i+140>>2]=0,w[i+136>>2]=l*d,w[i+132>>2]=l*k,w[i+128>>2]=l*B,n=o[A+616>>2],o[i+104>>2]=o[A+612>>2],o[i+108>>2]=n,n=o[A+608>>2],o[i+96>>2]=o[A+604>>2],o[i+100>>2]=n,n=o[A+420>>2],o[i+120>>2]=o[A+416>>2],o[i+124>>2]=n,n=o[A+412>>2],o[i+112>>2]=o[A+408>>2],o[i+116>>2]=n,n=o[A+384>>2],o[i+184>>2]=o[A+380>>2],o[i+188>>2]=n,n=o[A+376>>2],o[i+176>>2]=o[A+372>>2],o[i+180>>2]=n,n=o[A+400>>2],o[i+200>>2]=o[A+396>>2],o[i+204>>2]=n,n=o[A+392>>2],o[i+192>>2]=o[A+388>>2],o[i+196>>2]=n,k=w[A+476>>2],d=w[A+480>>2],B=w[A+472>>2],l=w[A+404>>2],o[i+220>>2]=0,w[i+216>>2]=m(l*d)*f,w[i+212>>2]=m(l*k)*f,w[i+208>>2]=m(l*B)*f,B=w[A+332>>2],Z=w[A+348>>2],Q=w[A+364>>2],E=w[A+340>>2],W=w[A+356>>2],N=w[A+324>>2],l=w[A+496>>2],k=w[A+488>>2],d=w[A+492>>2],w[i+228>>2]=m(m(w[A+360>>2]*l)+m(m(w[A+328>>2]*k)+m(d*w[A+344>>2])))*f,w[i+224>>2]=m(m(W*l)+m(m(N*k)+m(E*d)))*f,f=m(m(m(Q*l)+m(m(B*k)+m(d*Z)))*f)):(o[i+4>>2]=0,o[i+8>>2]=0,o[i>>2]=1065353216,o[i+240>>2]=0,o[i+128>>2]=0,o[i+132>>2]=0,o[i+112>>2]=1065353216,o[i+116>>2]=1065353216,o[i+96>>2]=1065353216,o[i+100>>2]=1065353216,o[i+176>>2]=0,o[i+180>>2]=0,o[i+12>>2]=0,o[i+16>>2]=0,o[i+24>>2]=0,o[i+28>>2]=0,o[i+20>>2]=1065353216,o[i+32>>2]=0,o[i+36>>2]=0,o[i+44>>2]=0,o[i+48>>2]=0,o[i+40>>2]=1065353216,o[i+52>>2]=0,o[i+56>>2]=0,o[i+60>>2]=0,o[i+136>>2]=0,o[i+140>>2]=0,o[i+120>>2]=1065353216,o[i+124>>2]=0,o[i+104>>2]=1065353216,o[i+108>>2]=0,o[i+224>>2]=0,o[i+228>>2]=0,o[i+216>>2]=0,o[i+220>>2]=0,o[i+208>>2]=0,o[i+212>>2]=0,o[i+200>>2]=0,o[i+204>>2]=0,o[i+192>>2]=0,o[i+196>>2]=0,o[i+184>>2]=0,o[i+188>>2]=0,f=m(0)),o[i+236>>2]=0,w[i+232>>2]=f,o[r+212>>2]=c}return S=e+256|0,c}function kA(A,r,f,e){var i,n=0,t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0,d=m(0),h=m(0),B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0);S=i=S-144|0,t=w[r+8>>2],b=w[r>>2],c=w[r+4>>2];A:if(!(m(m(t*t)+m(m(b*b)+m(c*c)))>2],u=o[n+64>>2],o[i+136>>2]=o[n+60>>2],o[i+140>>2]=u,u=o[n+56>>2],o[i+128>>2]=o[n+52>>2],o[i+132>>2]=u,u=o[n+64>>2],o[i+120>>2]=o[n+60>>2],o[i+124>>2]=u,u=o[n+56>>2],n=o[n+52>>2],V=m(t+w[i+120>>2]),w[i+120>>2]=V,o[i+112>>2]=n,o[i+116>>2]=u,g=m(b+w[i+112>>2]),w[i+112>>2]=g,X=m(c+w[i+116>>2]),w[i+116>>2]=X;r:{f:if(e){if(n=0,D=w[i+136>>2],t=m(V-D),C=w[i+128>>2],b=m(g-C),J=w[i+132>>2],c=m(X-J),!((s=m(N(m(m(t*t)+m(m(b*b)+m(c*c))))))<=f)){for(;;){if(d=t,t=m(m(1)/s),d=m(d*t),W=m(b*t),p=m(c*t),m(m(d*w[r+8>>2])+m(m(W*w[r>>2])+m(p*w[r+4>>2])))<=m(0))break f;if(w[i+100>>2]=s+w[A+36>>2],l=m(0),b=m(0),S=n=S-224|0,k=o[(v[A+108|0]?104:8)+A>>2],(u=1&a[34028])?(u=!u,c=w[8506],l=w[8505],b=w[8504],t=w[8503]):(o[8505]=0,o[8506]=1065353216,o[8503]=0,o[8504]=0,a[34028]=1,c=m(1),u=0,t=m(0)),F=w[i+100>>2],o[n+204>>2]=0,o[n+188>>2]=0,B=m(m(2)/m(m(c*c)+m(m(l*l)+m(m(t*t)+m(b*b))))),Z=m(l*B),h=m(b*Z),R=m(t*B),E=m(c*R),w[n+196>>2]=h+E,w[n+184>>2]=h-E,h=m(t*R),B=m(b*B),R=m(b*B),w[n+200>>2]=m(1)-m(h+R),Q=h,h=m(l*Z),w[n+180>>2]=m(1)-m(Q+h),o[n+172>>2]=0,E=m(t*Z),Y=m(c*B),w[n+192>>2]=E-Y,B=m(t*B),Z=m(c*Z),w[n+176>>2]=B+Z,w[n+168>>2]=E+Y,w[n+164>>2]=B-Z,w[n+160>>2]=m(1)-m(R+h),G=o[i+140>>2],o[n+216>>2]=o[i+136>>2],o[n+220>>2]=G,G=o[i+132>>2],o[n+208>>2]=o[i+128>>2],o[n+212>>2]=G,u&&(o[8505]=0,o[8506]=1065353216,o[8503]=0,o[8504]=0,a[34028]=1,l=m(0),c=m(1),b=m(0),t=m(0)),B=w[i+136>>2],Y=w[i+120>>2],h=w[i+128>>2],x=w[i+112>>2],R=w[i+132>>2],H=w[i+116>>2],o[n+156>>2]=0,o[n+140>>2]=0,o[n+124>>2]=0,E=m(m(2)/m(m(c*c)+m(m(l*l)+m(m(t*t)+m(b*b))))),Z=m(l*E),Q=m(b*Z),y=m(t*E),M=m(c*y),w[n+132>>2]=Q+M,w[n+120>>2]=Q-M,Q=m(t*y),E=m(b*E),y=m(b*E),w[n+136>>2]=m(1)-m(Q+y),b=Q,Q=m(l*Z),w[n+116>>2]=m(1)-m(b+Q),l=m(Y-B),Y=m(x-h),x=m(H-R),b=m(m(1)/m(N(m(m(l*l)+m(m(Y*Y)+m(x*x)))))),w[n+152>>2]=B+m(F*m(l*b)),w[n+148>>2]=R+m(F*m(x*b)),o[n+108>>2]=0,l=m(t*Z),B=m(c*E),w[n+128>>2]=l-B,t=m(t*E),c=m(c*Z),w[n+112>>2]=t+c,w[n+104>>2]=l+B,w[n+100>>2]=t-c,w[n+96>>2]=m(1)-m(y+Q),w[n+144>>2]=h+m(F*m(Y*b)),u=o[A+4>>2],o[n+20>>2]=0,o[n+8>>2]=1065353216,G=o[i+140>>2],o[n+32>>2]=o[i+136>>2],o[n+36>>2]=G,G=o[i+132>>2],o[n+24>>2]=o[i+128>>2],o[n+28>>2]=G,G=o[i+124>>2],o[n+48>>2]=o[i+120>>2],o[n+52>>2]=G,G=o[i+116>>2],o[n+40>>2]=o[i+112>>2],o[n+44>>2]=G,o[n+92>>2]=u,o[n+88>>2]=0,o[n+4>>2]=25584,u=o[u+188>>2],o[n+12>>2]=o[u+4>>2],o[n+16>>2]=o[u+8>>2],EA(u=o[A+12>>2],k,n+160|0,n+96|0,n+4|0,w[u+56>>2]),(u=o[n+20>>2])&&(t=w[n+8>>2],k=o[n+76>>2],o[i+68>>2]=o[n+72>>2],o[i+72>>2]=k,k=o[n+84>>2],o[i+76>>2]=o[n+80>>2],o[i+80>>2]=k,G=o[4+(k=n- -64|0)>>2],o[i+92>>2]=o[k>>2],o[i+96>>2]=G,k=o[n+60>>2],G=o[n+56>>2],o[i+104>>2]=u,w[i+100>>2]=F*t,o[i+84>>2]=G,o[i+88>>2]=k,o[i+108>>2]=o[n+88>>2]),S=n+224|0,!u){r=o[i+124>>2],o[i+136>>2]=o[i+120>>2],o[i+140>>2]=r,r=o[i+116>>2],o[i+128>>2]=o[i+112>>2],o[i+132>>2]=r,n=0;break f}e:if(n=o[A+20>>2])if(u=o[i+104>>2],2&(k=o[u+252>>2])){if(o[i+64>>2]=u,u=o[i+108>>2],o[i+60>>2]=u,o[i+4>>2]=A,k=o[i+96>>2],o[i+32>>2]=o[i+92>>2],o[i+36>>2]=k,k=o[i+88>>2],o[i+24>>2]=o[i+84>>2],o[i+28>>2]=k,k=o[i+80>>2],o[i+16>>2]=o[i+76>>2],o[i+20>>2]=k,k=o[i+72>>2],o[i+8>>2]=o[i+68>>2],o[i+12>>2]=k,w[i+56>>2]=s,o[i+52>>2]=0,w[i+48>>2]=d,w[i+44>>2]=p,w[i+40>>2]=W,!u)break e;Zn[o[o[n>>2]>>2]](n,i+4|0)}else 4&k&&(u=o[u+256>>2])&&(o[i+60>>2]=u,o[i+4>>2]=A,u=o[i+96>>2],o[i+32>>2]=o[i+92>>2],o[i+36>>2]=u,u=o[i+88>>2],o[i+24>>2]=o[i+84>>2],o[i+28>>2]=u,u=o[i+80>>2],o[i+16>>2]=o[i+76>>2],o[i+20>>2]=u,u=o[i+72>>2],o[i+8>>2]=o[i+68>>2],o[i+12>>2]=u,w[i+56>>2]=s,o[i+52>>2]=0,w[i+48>>2]=d,w[i+44>>2]=p,w[i+40>>2]=W,Zn[o[o[n>>2]+4>>2]](n,i+4|0));if(t=w[i+100>>2],!(!v[A+63|0]|t!=m(0))){qA(A),qA(A),qA(A),qA(A);break r}if((t=m(t-w[A+36>>2]))>m(0)&&(D=m(D+m(d*t)),w[i+136>>2]=D,J=m(J+m(p*t)),w[i+132>>2]=J,C=m(C+m(W*t)),w[i+128>>2]=C),c=w[A+48>>2],l=w[A+40>>2],F=w[A+44>>2],w[A+68>>2]=m(w[i+76>>2]*c)+m(m(w[i+68>>2]*l)+m(w[i+72>>2]*F)),n=o[i+80>>2],o[A+96>>2]=o[i+76>>2],o[A+100>>2]=n,n=o[i+72>>2],o[A+88>>2]=o[i+68>>2],o[A+92>>2]=n,n=o[i+96>>2],o[A+80>>2]=o[i+92>>2],o[A+84>>2]=n,n=o[i+88>>2],o[A+72>>2]=o[i+84>>2],o[A+76>>2]=n,s=w[A+76>>2],t=w[A+72>>2],v[A+61|0]){if(Z=w[A+80>>2],b=m(m(Z*c)+m(m(t*l)+m(F*s))),c=m(Z-m(c*b)),t=m(t-m(l*b)),s=m(s-m(F*b)),(b=m(m(c*c)+m(m(t*t)+m(s*s))))>2]=0,h=c,c=m(m(1)/m(N(b))),b=m(h*c),w[A+80>>2]=b,s=m(s*c),w[A+76>>2]=s,t=m(t*c),w[A+72>>2]=t}else b=w[A+80>>2];if(n=o[i+140>>2],o[i+120>>2]=o[i+136>>2],o[i+124>>2]=n,c=m(V-D),h=m(c*c),c=m(g-C),Q=m(c*c),c=m(X-J),c=m(N(m(h+m(Q+m(c*c))))),l=m(m(d*b)+m(m(W*t)+m(p*s))),h=d=m(d-m(m(b+b)*l)),Q=m(d*d),d=m(W-m(m(t+t)*l)),l=m(p-m(m(s+s)*l)),W=m(m(1)/m(N(m(Q+m(m(d*d)+m(l*l)))))),p=m(h*W),h=b,d=m(d*W),l=m(l*W),b=m(m(p*b)+m(m(d*t)+m(s*l))),V=m(w[i+120>>2]+m(c*m(p-m(h*b)))),w[i+120>>2]=V,n=o[i+132>>2],o[i+112>>2]=o[i+128>>2],o[i+116>>2]=n,g=m(w[i+112>>2]+m(c*m(d-m(t*b)))),w[i+112>>2]=g,X=m(w[i+116>>2]+m(c*m(l-m(s*b)))),w[i+116>>2]=X,!(e=e-1|0))break;if(n=1,t=m(V-D),b=m(g-C),c=m(X-J),(s=m(N(m(m(t*t)+m(m(b*b)+m(c*c))))))<=f)break f}n=1}}else n=0;r=o[i+140>>2],A=o[A+4>>2],o[A+60>>2]=o[i+136>>2],o[A+64>>2]=r,r=o[i+132>>2],o[A+52>>2]=o[i+128>>2],o[A+56>>2]=r;break A}n=1}return S=i+144|0,n}function dA(A){var r,f=0,e=0,i=m(0),n=0,a=0,t=m(0),c=m(0),b=m(0),u=m(0),l=0,s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=0;S=r=S-32|0;A:{r:{f:{e:{i:{n:switch(f=o[A+372>>2],o[f+32>>2]-1|0){case 3:break f;case 2:break e;case 1:break i;case 0:break n;default:break r}if(f=o[A+364>>2],e=o[A+372>>2],a=o[e+32>>2],o[16+(n=(a<<2)+e|0)>>2]=0,f=f-1|0,o[A+364>>2]=f,f=o[348+((f<<2)+A|0)>>2],o[n>>2]=f,o[e+32>>2]=a+1,o[f+8>>2]=0,o[f+12>>2]=0,o[f>>2]=1065353216,o[f+4>>2]=0,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],o[348+((o[A+364>>2]<<2)+A|0)>>2]=f,e=o[A+372>>2],a=o[e+32>>2],o[(n=(a<<2)+e|0)>>2]=f,o[n+16>>2]=0,o[e+32>>2]=a+1,o[f+8>>2]=-2147483648,o[f+12>>2]=0,o[f>>2]=-1082130432,o[f+4>>2]=-2147483648,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,e=o[f+(e<<2)>>2],f=o[A+364>>2],o[A+364>>2]=f+1,o[348+(a=(f<<2)+A|0)>>2]=e,e=o[A+372>>2],n=o[e+32>>2],o[16+(l=(n<<2)+e|0)>>2]=0,o[A+364>>2]=f,f=o[a+348>>2],o[l>>2]=f,o[e+32>>2]=n+1,o[f+8>>2]=0,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=1065353216,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],o[348+((o[A+364>>2]<<2)+A|0)>>2]=f,e=o[A+372>>2],a=o[e+32>>2],o[(n=(a<<2)+e|0)>>2]=f,o[n+16>>2]=0,o[e+32>>2]=a+1,o[f+8>>2]=-2147483648,o[f+12>>2]=0,o[f>>2]=-2147483648,o[f+4>>2]=-1082130432,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,e=o[f+(e<<2)>>2],f=o[A+364>>2],o[A+364>>2]=f+1,o[348+(a=(f<<2)+A|0)>>2]=e,e=o[A+372>>2],n=o[e+32>>2],o[16+(l=(n<<2)+e|0)>>2]=0,o[A+364>>2]=f,f=o[a+348>>2],o[l>>2]=f,o[e+32>>2]=n+1,o[f+8>>2]=1065353216,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],o[348+((o[A+364>>2]<<2)+A|0)>>2]=f,e=o[A+372>>2],a=o[e+32>>2],o[(n=(a<<2)+e|0)>>2]=f,o[n+16>>2]=0,o[e+32>>2]=a+1,o[f+8>>2]=-1082130432,o[f+12>>2]=0,o[f>>2]=-2147483648,o[f+4>>2]=-2147483648,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],e=o[A+364>>2],o[A+364>>2]=e+1,o[348+((e<<2)+A|0)>>2]=f;break r}for(e=o[f+4>>2],f=o[f>>2],u=m(w[e+20>>2]-w[f+20>>2]),s=m(-u),k=m(w[e+24>>2]-w[f+24>>2]),v=m(-k),d=m(w[e+16>>2]-w[f+16>>2]),B=m(-d);;){i:{if(o[r+8>>2]=0,o[r+12>>2]=0,o[r>>2]=0,o[r+4>>2]=0,o[r+(a<<2)>>2]=1065353216,i=w[r+4>>2],b=w[r>>2],t=m(m(d*i)+m(b*s)),h=w[r+8>>2],c=m(m(u*h)+m(i*v)),b=m(m(k*b)+m(h*B)),(i=m(m(t*t)+m(m(c*c)+m(b*b))))>m(0)){if(e=o[A+372>>2],n=o[e+32>>2],o[16+(f=(n<<2)+e|0)>>2]=0,l=o[A+364>>2]-1|0,o[A+364>>2]=l,Z=f,f=o[348+((l<<2)+A|0)>>2],o[Z>>2]=f,o[e+32>>2]=n+1,o[f+12>>2]=0,i=m(m(1)/m(N(i))),w[f+8>>2]=t*i,w[f+4>>2]=b*i,w[f>>2]=c*i,Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,dA(A))break i;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],o[348+((o[A+364>>2]<<2)+A|0)>>2]=f,e=o[A+372>>2],n=o[e+32>>2],o[(l=(n<<2)+e|0)>>2]=f,o[l+16>>2]=0,o[e+32>>2]=n+1,o[f+12>>2]=0,w[f+8>>2]=i*m(-t),w[f+4>>2]=i*m(-b),w[f>>2]=i*m(-c),Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,dA(A))break i;f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],e=o[A+364>>2],o[A+364>>2]=e+1,o[348+((e<<2)+A|0)>>2]=f}if(3!=(0|(a=a+1|0)))continue;break r}break}e=1;break A}if(e=o[f+4>>2],a=o[f>>2],i=w[a+16>>2],b=m(w[e+16>>2]-i),n=o[f+8>>2],t=w[a+20>>2],c=m(w[n+20>>2]-t),i=m(w[n+16>>2]-i),u=m(w[e+20>>2]-t),t=m(m(b*c)-m(i*u)),k=u,u=w[a+24>>2],s=m(w[n+24>>2]-u),u=m(w[e+24>>2]-u),c=m(m(k*s)-m(c*u)),b=m(m(u*i)-m(s*b)),!((i=m(m(t*t)+m(m(c*c)+m(b*b))))>m(0)))break r;if(o[f+28>>2]=0,e=o[A+364>>2]-1|0,o[A+364>>2]=e,e=o[348+((e<<2)+A|0)>>2],o[f+32>>2]=4,o[f+12>>2]=e,o[e+12>>2]=0,i=m(m(1)/m(N(i))),w[e+8>>2]=t*i,w[e+4>>2]=b*i,w[e>>2]=c*i,Yr(r+16|0,A,e),f=o[r+28>>2],o[e+24>>2]=o[r+24>>2],o[e+28>>2]=f,f=o[r+20>>2],o[e+16>>2]=o[r+16>>2],o[e+20>>2]=f,e=1,dA(A))break A;if(f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],o[348+((o[A+364>>2]<<2)+A|0)>>2]=f,e=o[A+372>>2],a=o[e+32>>2],o[(n=(a<<2)+e|0)>>2]=f,o[n+16>>2]=0,o[e+32>>2]=a+1,o[f+12>>2]=0,w[f+8>>2]=i*m(-t),w[f+4>>2]=i*m(-b),w[f>>2]=i*m(-c),Yr(r+16|0,A,f),e=o[r+28>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=e,e=o[r+20>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=e,e=1,dA(A))break A;f=o[A+372>>2],e=o[f+32>>2]-1|0,o[f+32>>2]=e,f=o[f+(e<<2)>>2],e=o[A+364>>2],o[A+364>>2]=e+1,o[348+((e<<2)+A|0)>>2]=f;break r}if(A=o[f>>2],a=o[f+12>>2],i=w[a+16>>2],b=m(w[A+16>>2]-i),n=o[f+4>>2],t=w[a+20>>2],u=m(w[n+20>>2]-t),f=o[f+8>>2],c=w[a+24>>2],s=m(w[f+24>>2]-c),k=m(w[A+20>>2]-t),v=m(w[n+24>>2]-c),d=m(w[f+16>>2]-i),c=m(w[A+24>>2]-c),i=m(w[n+16>>2]-i),t=m(w[f+20>>2]-t),e=1,(i=m(m(m(m(b*u)*s)+m(m(m(m(m(k*v)*d)+m(m(c*i)*t))-m(m(v*b)*t))-m(m(i*k)*s)))-m(m(u*c)*d)))>m(0)|i>2]=o[A+152>>2],mf(r),f=o[A+56>>2],e?(o[r+56>>2]=f<<24|(65280&f)<<8|f>>>8&65280|f>>>24,a[r+4|0]=v[A+7|0],a[r+5|0]=v[A+6|0],a[r+6|0]=v[A+5|0],a[r+7|0]=v[A+4|0],a[r+8|0]=v[A+11|0],a[r+9|0]=v[A+10|0],a[r+10|0]=v[A+9|0],a[r+11|0]=v[A+8|0],a[r+12|0]=v[A+15|0],a[r+13|0]=v[A+14|0],a[r+14|0]=v[A+13|0],a[r+15|0]=v[A+12|0],a[r+16|0]=v[A+19|0],a[r+17|0]=v[A+18|0],a[r+18|0]=v[A+17|0],a[r+19|0]=v[A+16|0],a[r+20|0]=v[A+23|0],a[r+21|0]=v[A+22|0],a[r+22|0]=v[A+21|0],a[r+23|0]=v[A+20|0],a[r+24|0]=v[A+27|0],a[r+25|0]=v[A+26|0],a[r+26|0]=v[A+25|0],a[r+27|0]=v[A+24|0],a[r+28|0]=v[A+31|0],a[r+29|0]=v[A+30|0],a[r+30|0]=v[A+29|0],a[r+31|0]=v[A+28|0],a[r+32|0]=v[A+35|0],a[r+33|0]=v[A+34|0],a[r+34|0]=v[A+33|0],a[r+35|0]=v[A+32|0],a[r+36|0]=v[A+39|0],a[r+37|0]=v[A+38|0],a[r+38|0]=v[A+37|0],a[r+39|0]=v[A+36|0],a[r+40|0]=v[A+43|0],a[r+41|0]=v[A+42|0],a[r+42|0]=v[A+41|0],a[r+43|0]=v[A+40|0],a[r+44|0]=v[A+47|0],a[r+45|0]=v[A+46|0],a[r+46|0]=v[A+45|0],a[r+47|0]=v[A+44|0],a[r+48|0]=v[A+51|0],a[r+49|0]=v[A+50|0],a[r+50|0]=v[A+49|0],a[r+51|0]=v[A+48|0],b=(f=o[A+168>>2])<<24|(65280&f)<<8|f>>>8&65280|f>>>24,f=(f=o[A+144>>2])<<24|(65280&f)<<8|f>>>8&65280|f>>>24):(o[r+56>>2]=f,f=o[A+16>>2],o[r+12>>2]=o[A+12>>2],o[r+16>>2]=f,f=o[A+8>>2],o[r+4>>2]=o[A+4>>2],o[r+8>>2]=f,f=o[A+32>>2],o[r+28>>2]=o[A+28>>2],o[r+32>>2]=f,f=o[A+24>>2],o[r+20>>2]=o[A+20>>2],o[r+24>>2]=f,f=o[A+48>>2],o[r+44>>2]=o[A+44>>2],o[r+48>>2]=f,f=o[A+40>>2],o[r+36>>2]=o[A+36>>2],o[r+40>>2]=f,b=o[A+168>>2],f=o[A+144>>2]),o[r+168>>2]=b,o[r+144>>2]=f,a[r+60|0]=v[A+60|0],l=r+172|0,i=o[A+56>>2],v[A+60|0]){!(f=o[r+136>>2])||!f|!v[r+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[r+136>>2]=l,a[r+140|0]=0;A:if(e){if(!((0|i)<=0))for(u=o[A+136>>2],b=0;n=(f=b<<4)+l|0,f=h[(c=f+u|0)>>1],t[n>>1]=f<<8|f>>>8,f=h[c+2>>1],t[n+2>>1]=f<<8|f>>>8,f=h[c+4>>1],t[n+4>>1]=f<<8|f>>>8,f=h[c+6>>1],t[n+6>>1]=f<<8|f>>>8,f=h[c+8>>1],t[n+8>>1]=f<<8|f>>>8,f=h[c+10>>1],t[n+10>>1]=f<<8|f>>>8,f=o[c+12>>2],o[n+12>>2]=f<<24|(65280&f)<<8|f>>>8&65280|f>>>24,(0|i)!=(0|(b=b+1|0)););}else{if((0|i)<=0)break A;for(u=o[A+136>>2],b=0;c=(f=b<<4)+l|0,f=f+u|0,t[c>>1]=h[f>>1],t[c+2>>1]=h[f+2>>1],t[c+4>>1]=h[f+4>>1],t[c+6>>1]=h[f+6>>1],t[c+8>>1]=h[f+8>>1],t[c+10>>1]=h[f+10>>1],o[c+12>>2]=o[f+12>>2],(0|i)!=(0|(b=b+1|0)););}u=r+128|0,b=i<<4}else{!(f=o[r+96>>2])||!f|!v[r+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[r+96>>2]=l,a[r+100|0]=0,o[r+92>>2]=i,o[(u=r+88|0)>>2]=i;A:if(e){if(f=l,!((0|i)<=0))for(s=o[A+96>>2];n=(c=k<<6)+f|0,f=c+s|0,a[0|n]=v[f+3|0],a[n+1|0]=v[f+2|0],a[n+2|0]=v[f+1|0],a[n+3|0]=v[0|f],a[n+4|0]=v[f+7|0],a[n+5|0]=v[f+6|0],a[n+6|0]=v[f+5|0],a[n+7|0]=v[f+4|0],a[n+8|0]=v[f+11|0],a[n+9|0]=v[f+10|0],a[n+10|0]=v[f+9|0],a[n+11|0]=v[f+8|0],a[n+12|0]=v[f+15|0],a[n+13|0]=v[f+14|0],a[n+14|0]=v[f+13|0],a[n+15|0]=v[f+12|0],n=c+o[r+96>>2]|0,f=c+o[A+96>>2]|0,a[n+16|0]=v[f+19|0],a[n+17|0]=v[f+18|0],a[n+18|0]=v[f+17|0],a[n+19|0]=v[f+16|0],a[n+20|0]=v[f+23|0],a[n+21|0]=v[f+22|0],a[n+22|0]=v[f+21|0],a[n+23|0]=v[f+20|0],a[n+24|0]=v[f+27|0],a[n+25|0]=v[f+26|0],a[n+26|0]=v[f+25|0],a[n+27|0]=v[f+24|0],a[n+28|0]=v[f+31|0],a[n+29|0]=v[f+30|0],a[n+30|0]=v[f+29|0],a[n+31|0]=v[f+28|0],n=c+(f=o[r+96>>2])|0,s=o[A+96>>2],b=o[32+(c=c+s|0)>>2],o[n+32>>2]=b<<24|(65280&b)<<8|b>>>8&65280|b>>>24,b=o[c+36>>2],o[n+36>>2]=b<<24|(65280&b)<<8|b>>>8&65280|b>>>24,c=o[c+40>>2],o[n+40>>2]=c<<24|(65280&c)<<8|c>>>8&65280|c>>>24,(0|i)!=(0|(k=k+1|0)););}else{if(f=l,(0|i)<=0)break A;for(k=o[A+96>>2],b=0;n=(s=b<<6)+f|0,f=o[4+(c=s+k|0)>>2],o[n>>2]=o[c>>2],o[n+4>>2]=f,f=o[c+12>>2],o[n+8>>2]=o[c+8>>2],o[n+12>>2]=f,c=s+o[A+96>>2]|0,f=o[c+20>>2],n=s+o[r+96>>2]|0,o[n+16>>2]=o[c+16>>2],o[n+20>>2]=f,f=o[c+28>>2],o[n+24>>2]=o[c+24>>2],o[n+28>>2]=f,n=s+(f=o[r+96>>2])|0,c=s+(k=o[A+96>>2])|0,o[n+32>>2]=o[c+32>>2],o[n+36>>2]=o[c+36>>2],o[n+40>>2]=o[c+40>>2],(0|i)!=(0|(b=b+1|0)););}b=i<<6,v[r+100|0]&&f&&(o[8489]=o[8489]+1,Zn[o[8291]](f))}o[u>>2]=0,o[u+4>>2]=0,a[u+5|0]=0,a[u+6|0]=0,a[u+7|0]=0,a[u+8|0]=0,a[u+9|0]=0,a[u+10|0]=0,a[u+11|0]=0,a[u+12|0]=0,u=b+l|0,l=o[A+168>>2],!(f=o[r+160>>2])||!f|!v[r+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[r+160>>2]=u,a[r+164|0]=0,o[r+156>>2]=l,o[r+152>>2]=l,l=o[A+168>>2];A:if(e){if(!((0|l)<=0))for(f=o[A+160>>2],e=0;n=(A=e<<5)+u|0,A=h[(c=A+f|0)>>1],t[n>>1]=A<<8|A>>>8,A=h[c+2>>1],t[n+2>>1]=A<<8|A>>>8,A=h[c+4>>1],t[n+4>>1]=A<<8|A>>>8,A=h[c+6>>1],t[n+6>>1]=A<<8|A>>>8,A=h[c+8>>1],t[n+8>>1]=A<<8|A>>>8,A=h[c+10>>1],t[n+10>>1]=A<<8|A>>>8,A=o[c+12>>2],o[n+12>>2]=A<<24|(65280&A)<<8|A>>>8&65280|A>>>24,A=o[c+16>>2],o[n+16>>2]=A<<24|(65280&A)<<8|A>>>8&65280|A>>>24,(0|l)!=(0|(e=e+1|0)););}else{if((0|l)<=0)break A;for(l=o[A+160>>2],e=0;c=(f=e<<5)+u|0,f=f+l|0,t[c>>1]=h[f>>1],t[c+2>>1]=h[f+2>>1],t[c+4>>1]=h[f+4>>1],t[c+6>>1]=h[f+6>>1],t[c+8>>1]=h[f+8>>1],t[c+10>>1]=h[f+10>>1],o[c+12>>2]=o[f+12>>2],f=o[f+16>>2],o[c+28>>2]=0,o[c+20>>2]=0,o[c+24>>2]=0,o[c+16>>2]=f,(0|(e=e+1|0))>2];);}return u&&v[r+164|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](u)),o[r>>2]=0,a[r+157|0]=0,a[r+158|0]=0,a[r+159|0]=0,a[r+160|0]=0,a[r+161|0]=0,a[r+162|0]=0,a[r+163|0]=0,a[r+164|0]=0,o[r+152>>2]=0,o[r+156>>2]=0,1}function hA(A,r){var f,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,w=0,Z=0,m=0,Q=0;if(S=f=S-96|0,a[f+92|0]=1,o[f+60>>2]=0,o[f+64>>2]=0,a[f+52|0]=1,o[f+48>>2]=0,a[f+72|0]=1,o[f+40>>2]=0,o[f+44>>2]=0,o[f+68>>2]=0,o[f+88>>2]=0,o[f+80>>2]=0,o[f+84>>2]=0,o[f+28>>2]=0,a[f+32|0]=1,o[f+20>>2]=0,o[f+24>>2]=0,!((0|(k=o[A+8>>2]))<=0)){for(;;){t=o[o[o[A+16>>2]+(m<<2)>>2]+192>>2],o[f+12>>2]=t,e=G((e=t+~(t<<15)|0)>>>10^e,9),e=~((e^=e>>>6)<<11)+e|0;A:{r:if(!((e=o[f+64>>2]-1&(e>>>16^e))>>>0>=B[f+20>>2])&&-1!=(0|(e=o[o[f+28>>2]+(e<<2)>>2]))){for(i=o[f+48>>2],n=o[f+88>>2];;){if((0|t)!=o[n+(e<<3)>>2]){if(-1!=(0|(e=o[i+(e<<2)>>2])))continue;break r}break}if(o[f+68>>2])break A}o[f+4>>2]=t,t=0;r:{f:{if(k=o[48+(i=f+16|0)>>2],e=o[f+4>>2],n=G((n=~(e<<15)+e|0)>>>10^n,9),!((h=k-1&((n=~((n^=n>>>6)<<11)+n|0)>>>16^n))>>>0>=B[i+4>>2])&&-1!=(0|(n=o[o[i+12>>2]+(h<<2)>>2])))for(u=o[i+32>>2],c=o[i+72>>2];;){if((0|e)==o[c+(n<<3)>>2])break f;if(-1==(0|(n=o[u+(n<<2)>>2])))break}if((0|k)==(0|(e=Q=o[i+44>>2]))&&!((0|(e=k))>=(0|(b=e?e<<1:1)))){if(b?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](b<<2,16),e=o[i+44>>2]):(u=0,e=k),!((0|e)<=0)){if(c=0,n=0,e>>>0>=4)for(d=-4&e;o[(s=n<<2)+u>>2]=o[s+o[i+52>>2]>>2],o[(l=4|s)+u>>2]=o[l+o[i+52>>2]>>2],o[(l=8|s)+u>>2]=o[l+o[i+52>>2]>>2],o[(s|=12)+u>>2]=o[s+o[i+52>>2]>>2],n=n+4|0,(0|d)!=(0|(t=t+4|0)););if(t=3&e)for(;o[(s=n<<2)+u>>2]=o[s+o[i+52>>2]>>2],n=n+1|0,(0|t)!=(0|(c=c+1|0)););}!(t=o[i+52>>2])|!v[i+56|0]||(t&&(o[8489]=o[8489]+1,Zn[o[8291]](t)),e=o[i+44>>2]),o[i+52>>2]=u,a[i+56|0]=1,o[i+48>>2]=b}if(o[o[i+52>>2]+(e<<2)>>2]=o[f+12>>2],o[i+44>>2]=e+1,(0|(e=o[i- -64>>2]))==o[i+68>>2]&&!((0|(s=e?e<<1:1))<=(0|e))){if(s?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](s<<3,16),e=o[i+64>>2]):u=0,!((0|e)<=0)){if(c=0,n=0,e>>>0>=4)for(d=-4&e,t=0;l=(b=n<<3)+u|0,w=b+o[i+72>>2]|0,Z=o[w+4>>2],o[l>>2]=o[w>>2],o[l+4>>2]=Z,w=(l=8|b)+u|0,l=l+o[i+72>>2]|0,Z=o[l+4>>2],o[w>>2]=o[l>>2],o[w+4>>2]=Z,w=(l=16|b)+u|0,l=l+o[i+72>>2]|0,Z=o[l+4>>2],o[w>>2]=o[l>>2],o[w+4>>2]=Z,l=(b|=24)+u|0,b=b+o[i+72>>2]|0,w=o[b+4>>2],o[l>>2]=o[b>>2],o[l+4>>2]=w,n=n+4|0,(0|d)!=(0|(t=t+4|0)););if(e&=3)for(;b=(t=n<<3)+u|0,t=t+o[i+72>>2]|0,d=o[t+4>>2],o[b>>2]=o[t>>2],o[b+4>>2]=d,n=n+1|0,(0|e)!=(0|(c=c+1|0)););}!(e=o[i+72>>2])||!e|!v[i+76|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[i+72>>2]=u,a[i+76|0]=1,o[i+68>>2]=s,e=o[i+64>>2]}if(t=o[f+8>>2],e=o[i+72>>2]+(e<<3)|0,o[e>>2]=o[f+4>>2],o[e+4>>2]=t,o[i+64>>2]=o[i+64>>2]+1,(0|k)>2]){if(n=0,u=0,s=0,h=0,!((0|(k=o[i+4>>2]))>=(0|(c=o[i+48>>2])))){if((0|c)<=o[i+8>>2])n=o[i+12>>2];else{c?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),e=o[i+4>>2]):e=k,t=o[i+12>>2];e:{i:if((0|e)>0){if(e>>>0>=4)for(d=-4&e;o[(b=u<<2)+n>>2]=o[t+b>>2],o[(l=4|b)+n>>2]=o[t+l>>2],o[(l=8|b)+n>>2]=o[t+l>>2],o[(b|=12)+n>>2]=o[t+b>>2],u=u+4|0,(0|d)!=(0|(s=s+4|0)););if(!(e&=3))break i;for(;o[(b=u<<2)+n>>2]=o[t+b>>2],u=u+1|0,(0|e)!=(0|(h=h+1|0)););}else if(!t)break e;t&&v[i+16|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](t))}o[i+12>>2]=n,a[i+16|0]=1,o[i+8>>2]=c}if(Af((e=k<<2)+n|0,0,(d=c<<2)-e|0),o[i+4>>2]=c,(0|(t=o[i+24>>2]))<(0|c)){e:if((0|c)<=o[i+28>>2])n=o[i+32>>2];else{c?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](d,16),e=o[i+24>>2]):(n=0,e=t),b=o[i+32>>2];i:if((0|e)>0){if(h=0,u=0,e>>>0>=4)for(w=-4&e,s=0;o[(l=u<<2)+n>>2]=o[b+l>>2],o[(Z=4|l)+n>>2]=o[b+Z>>2],o[(Z=8|l)+n>>2]=o[b+Z>>2],o[(l|=12)+n>>2]=o[b+l>>2],u=u+4|0,(0|w)!=(0|(s=s+4|0)););if(!(e&=3))break i;for(;o[(s=u<<2)+n>>2]=o[b+s>>2],u=u+1|0,(0|e)!=(0|(h=h+1|0)););}else if(!b){o[i+32>>2]=n,o[i+28>>2]=c,a[i+36|0]=1;break e}b&&v[i+36|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](b)),o[i+32>>2]=n,a[i+36|0]=1,o[i+28>>2]=c}Af((e=t<<2)+n|0,0,d-e|0)}if(o[i+24>>2]=c,(0|c)>0&&(Af(o[i+12>>2],255,d),Af(o[i+32>>2],255,d)),!((0|k)<=0))for(e=o[i+32>>2],t=o[i+72>>2],n=o[i+12>>2],u=0;c=o[t+(u<<3)>>2],c=G((c=~(c<<15)+c|0)>>>10^c,9),c=~((c^=c>>>6)<<11)+c|0,c=n+((o[i+48>>2]-1&(c>>>16^c))<<2)|0,o[e+(u<<2)>>2]=o[c>>2],o[c>>2]=u,(0|k)!=(0|(u=u+1|0)););}e=o[f+4>>2],e=G((e=~(e<<15)+e|0)>>>10^e,9),e=~((e^=e>>>6)<<11)+e|0,h=o[i+48>>2]-1&(e>>>16^e)}e=o[i+12>>2]+(h<<2)|0,o[o[i+32>>2]+(Q<<2)>>2]=o[e>>2],o[e>>2]=Q;break r}o[o[i+52>>2]+(n<<2)>>2]=o[f+12>>2]}e=o[f+12>>2],Zn[o[o[e>>2]+60>>2]](e,r),k=o[A+8>>2]}if(!((0|(m=m+1|0))<(0|k)))break}if(!((0|k)<=0))for(e=0;t=o[o[A+16>>2]+(e<<2)>>2],64!=(0|(i=o[t+252>>2]))&1!=(0|i)||(Zn[o[o[t>>2]+24>>2]](t,r),k=o[A+8>>2]),(0|(e=e+1|0))<(0|k););}!(A=o[f+88>>2])||!A|!v[f+92|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+88>>2]=0,a[f+92|0]=1,o[f+80>>2]=0,o[f+84>>2]=0,!(A=o[f+68>>2])||!A|!v[f+72|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+68>>2]=0,a[f+72|0]=1,o[f+60>>2]=0,o[f+64>>2]=0,!(A=o[f+48>>2])||!A|!v[f+52|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+48>>2]=0,a[f+52|0]=1,o[f+40>>2]=0,o[f+44>>2]=0,!(A=o[f+28>>2])||!A|!v[f+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),S=f+96|0}function BA(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=0,Z=m(0),G=m(0),Q=m(0),E=0,W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=0,x=m(0),y=m(0),M=m(0),H=m(0);S=e=S-144|0,o[e+108>>2]=0,a=w[r+80>>2],t=w[r+96>>2],W=w[r+120>>2],d=w[r+56>>2],D=w[r+112>>2],F=w[r+116>>2],x=w[r+52>>2],u=w[r+68>>2],l=w[r+84>>2],h=w[r+100>>2],c=w[r+20>>2],Z=w[r+36>>2],v=w[r+72>>2],k=w[r+88>>2],G=w[r+24>>2],b=w[r+104>>2],g=w[r+40>>2],s=w[r+64>>2],X=w[r+32>>2],p=w[r>>2],R=w[r+16>>2],y=w[r+48>>2],Y=w[r+4>>2],Q=w[r+8>>2],o[e+104>>2]=0,o[e+88>>2]=0,o[e+72>>2]=0,w[e+84>>2]=m(b*g)+m(m(v*Q)+m(G*k)),w[e+80>>2]=m(b*Z)+m(m(v*Y)+m(c*k)),w[e+68>>2]=m(h*g)+m(m(u*Q)+m(G*l)),w[e- -64>>2]=m(h*Z)+m(m(u*Y)+m(c*l)),W=m(d-W),d=m(y-D),D=m(x-F),w[e+100>>2]=m(b*W)+m(m(v*d)+m(k*D)),w[e+96>>2]=m(h*W)+m(m(u*d)+m(D*l)),o[e+56>>2]=0,w[e+76>>2]=m(b*X)+m(m(v*p)+m(R*k)),w[e+60>>2]=m(h*X)+m(m(u*p)+m(R*l)),w[e+52>>2]=m(t*g)+m(m(s*Q)+m(a*G)),w[e+48>>2]=m(t*Z)+m(m(s*Y)+m(a*c)),w[e+44>>2]=m(t*X)+m(m(s*p)+m(a*R)),w[e+92>>2]=m(t*W)+m(m(s*d)+m(D*a)),l=w[A+12>>2],Z=m(0),G=m(0),g=m(0),S=n=S-32|0,E=o[A+8>>2],a=w[E+64>>2],h=m(w[E+80>>2]-a),b=w[E+68>>2],v=m(w[E+100>>2]-b),k=m(w[E+96>>2]-a),u=m(w[E+84>>2]-b),t=m(m(h*v)-m(k*u)),d=u,u=w[E+72>>2],s=m(w[E+104>>2]-u),c=m(w[E+88>>2]-u),v=m(m(d*s)-m(v*c)),k=m(m(c*k)-m(s*h));A:if((h=m(m(t*t)+m(m(v*v)+m(k*k))))>=m(14210854715202004e-30)&&(B=o[A+4>>2],X=m(w[B+36>>2]*w[B+20>>2]),l=m(X+l),p=w[e+100>>2],c=t,t=m(m(1)/m(N(h))),h=m(c*t),c=m(m(p-u)*h),u=w[e+92>>2],v=m(v*t),k=m(k*t),t=w[e+96>>2],(a=m(c+m(m(m(u-a)*v)+m(k*m(t-b)))))>2],o[n+24>>2]=o[e+100>>2],o[n+28>>2]=B,B=o[e+96>>2],o[n+16>>2]=o[e+92>>2],o[n+20>>2]=B,o[n+12>>2]=0,w[n+8>>2]=h,w[n+4>>2]=k,w[n>>2]=v,R=w[32+(B=E- -64|0)>>2],Y=w[B+40>>2],Q=w[B+24>>2],W=m(Y-Q),d=w[B+16>>2],C=m(R-d),b=w[n+4>>2],s=w[n>>2],D=w[B+36>>2],F=w[B+20>>2],c=m(D-F),x=w[n+24>>2],M=m(m(m(C*b)-m(s*c))*m(x-Q)),V=c,c=w[n+8>>2],y=w[n+16>>2],H=w[n+20>>2],W=m(M+m(m(m(m(V*c)-m(b*W))*m(y-d))+m(m(H-F)*m(m(W*s)-m(c*C))))),V=Q,Q=w[B+8>>2],C=m(V-Q),V=d,d=w[B>>2],M=m(V-d),V=F,F=w[B+4>>2],V=m(V-F),C=m(m(m(m(M*b)-m(s*V))*m(x-Q))+m(m(m(m(V*c)-m(b*C))*m(y-d))+m(m(H-F)*m(m(C*s)-m(c*M))))),d=m(d-R),F=m(F-D),x=m(m(m(d*b)-m(s*F))*m(x-Y)),V=b,b=m(Q-Y),!(!((b=m(x+m(m(m(m(F*c)-m(V*b))*m(y-R))+m(m(H-D)*m(m(b*s)-m(c*d))))))>m(0))|!(C>m(0)))&&(B=1,W>m(0))||(B=C<=m(0)&W<=m(0)&b<=m(0)),B)Z=m(p-m(a*h)),G=m(t-m(a*k)),g=m(u-m(a*v)),R=m(l*l);else{if((0|Zn[o[o[E>>2]+100>>2]](E))<=0)break A;for(R=m(l*l),B=0,E=0;J=o[A+8>>2],Zn[o[o[J>>2]+104>>2]](J,E,n+16|0,n),t=m(0),p=w[n+24>>2],b=m(w[n+8>>2]-p),a=m(w[e+100>>2]-p),Y=w[n+16>>2],s=m(w[n>>2]-Y),l=m(w[e+92>>2]-Y),Q=w[n+20>>2],u=m(w[e+96>>2]-Q),c=m(w[n+4>>2]-Q),(W=m(m(b*a)+m(m(s*l)+m(u*c))))>m(0)&&((t=m(m(b*b)+m(m(s*s)+m(c*c))))>W?(t=m(W/t),a=m(a-m(b*t)),u=m(u-m(c*t)),l=m(l-m(s*t))):(a=m(a-b),u=m(u-c),l=m(l-s),t=m(1))),m(m(a*a)+m(m(l*l)+m(u*u)))>2],E=E+1|0,(0|Zn[o[o[J>>2]+100>>2]](J))>(0|E););if(J=0,!B)break A;p=w[e+100>>2],t=w[e+96>>2],u=w[e+92>>2]}a=m(p-Z),u=m(u-g),t=m(t-G),(l=m(m(a*a)+m(m(u*u)+m(t*t))))m(1.1920928955078125e-7)?(o[e+124>>2]=0,b=a,l=m(N(l)),a=m(m(1)/l),w[e+120>>2]=b*a,w[e+116>>2]=t*a,w[e+112>>2]=u*a,X=m(X-l)):(o[e+124>>2]=0,w[e+120>>2]=h,w[e+116>>2]=k,w[e+112>>2]=v),o[e+140>>2]=0,w[e+136>>2]=Z,w[e+132>>2]=G,w[e+128>>2]=g,w[e+108>>2]=-X,J=1)}S=n+32|0,J&&(i?(l=w[r+72>>2],h=w[r+64>>2],v=w[r+68>>2],k=w[r+88>>2],b=w[r+80>>2],s=w[r+84>>2],c=w[r+104>>2],Z=w[r+96>>2],G=w[r+100>>2],a=w[e+120>>2],t=w[e+112>>2],u=w[e+116>>2],o[e+40>>2]=0,g=m(m(c*a)+m(m(Z*t)+m(u*G))),w[e+36>>2]=-g,X=m(m(k*a)+m(m(b*t)+m(u*s))),w[e+32>>2]=-X,p=m(m(l*a)+m(m(h*t)+m(v*u))),w[e+28>>2]=-p,R=w[r+112>>2],Y=w[r+116>>2],a=w[r+120>>2],o[e+24>>2]=0,t=w[e+136>>2],d=m(c*t),u=w[e+128>>2],c=w[e+132>>2],d=m(a+m(d+m(m(Z*u)+m(G*c)))),a=w[e+108>>2],w[e+20>>2]=d+m(g*a),w[e+16>>2]=m(Y+m(m(t*k)+m(m(u*b)+m(s*c))))+m(X*a),w[e+12>>2]=m(R+m(m(t*l)+m(m(u*h)+m(v*c))))+m(p*a),Zn[o[o[f>>2]+16>>2]](f,e+28|0,e+12|0,a)):(a=w[r+72>>2],t=w[r+64>>2],u=w[r+68>>2],l=w[r+88>>2],h=w[r+80>>2],v=w[r+84>>2],k=w[r+104>>2],b=w[r+96>>2],s=w[r+100>>2],o[e+40>>2]=0,c=w[e+120>>2],Z=w[e+112>>2],G=w[e+116>>2],w[e+36>>2]=m(k*c)+m(m(b*Z)+m(s*G)),w[e+32>>2]=m(l*c)+m(m(h*Z)+m(G*v)),w[e+28>>2]=m(a*c)+m(m(t*Z)+m(u*G)),c=w[r+112>>2],Z=w[r+116>>2],G=w[r+120>>2],o[e+24>>2]=0,d=k,k=w[e+136>>2],Q=b,b=w[e+128>>2],F=s,s=w[e+132>>2],w[e+20>>2]=G+m(m(d*k)+m(m(Q*b)+m(F*s))),w[e+16>>2]=Z+m(m(k*l)+m(m(b*h)+m(v*s))),w[e+12>>2]=c+m(m(k*a)+m(m(b*t)+m(u*s))),Zn[o[o[f>>2]+16>>2]](f,e+28|0,e+12|0,w[e+108>>2]))),S=e+144|0}function wA(A,r){var f=m(0),e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=0,Y=m(0),V=m(0),g=0,X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),S=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=0;A:if(4!=(0|(u=o[A+844>>2])))o[A+844>>2]=u+1;else{g=(u=(f=w[A+84>>2])<(i=w[r+80>>2]))?0:-1,u=(n=w[A+292>>2])<(f=u?f:i),g=(R=(i=w[A+500>>2])<(f=u?n:f))?2:u?1:g,g=(u=w[A+708>>2]<(R?i:f))?3:g;r:{f:{e:{i:{if(v[33192]){if(!g){k=w[A+636>>2],c=w[A+428>>2],t=m(k-c),B=w[A+632>>2],l=w[A+424>>2],e=m(B-l),p=w[A+628>>2],F=w[A+420>>2],s=m(p-F),i=w[r+8>>2],n=w[r+4>>2],b=w[r>>2];break i}if(b=w[r>>2],E=w[A+212>>2],f=m(b-E),B=w[A+632>>2],l=w[A+424>>2],e=m(B-l),p=w[A+628>>2],F=w[A+420>>2],s=m(p-F),n=w[r+4>>2],W=w[A+216>>2],i=m(n-W),t=m(m(f*e)-m(s*i)),d=m(t*t),k=w[A+636>>2],c=w[A+428>>2],t=m(k-c),h=m(i*t),i=w[r+8>>2],N=w[A+220>>2],a=m(i-N),h=m(h-m(e*a)),f=m(m(a*s)-m(t*f)),eA=m(d+m(m(h*h)+m(f*f))),1!=(0|g))break i;b=m(b-w[A+4>>2]),a=m(-b),n=m(n-w[A+8>>2]),h=m(-n),i=m(i-w[A+12>>2]),Z=m(-i),s=m(0);break e}n:{a:{t:{if(g){if(W=w[r>>2],a=w[A+212>>2],I=m(W-a),n=w[A+424>>2],e=w[A+632>>2],Y=m(n-e),i=w[A+420>>2],l=w[A+628>>2],X=m(i-l),N=w[r+4>>2],h=w[A+216>>2],T=m(N-h),f=m(m(I*Y)-m(X*T)),c=m(f*f),b=w[A+428>>2],t=w[A+636>>2],s=m(b-t),E=w[r+8>>2],Z=w[A+220>>2],U=m(E-Z),f=m(m(T*s)-m(Y*U)),k=m(f*f),f=m(m(U*X)-m(s*I)),k=m(c+m(k+m(f*f))),J=m(W-i),D=m(h-e),f=m(a-l),y=m(N-n),c=m(m(J*D)-m(f*y)),B=m(c*c),C=m(Z-t),x=m(E-b),c=m(m(y*C)-m(D*x)),d=m(c*c),c=m(m(x*f)-m(C*J)),k=(c=m(B+m(d+m(c*c))))>2],t=w[A+636>>2],s=m(b-t),n=w[A+424>>2],e=w[A+632>>2],Y=m(n-e),i=w[A+420>>2],l=w[A+628>>2],X=m(i-l),N=w[r+4>>2],M=m(N-e),S=m(-M),W=w[r>>2],V=m(W-l),L=m(-V),E=w[r+8>>2],H=m(E-t),$=m(-H),J=m(W-i),C=m(-J),x=m(E-b),O=m(-x),y=m(N-n),f=m(-y);if(k=w[A+4>>2],p=m(W-k),c=w[A+8>>2],F=m(N-c),a=m(m(p*Y)-m(X*F)),d=m(a*a),B=w[A+12>>2],j=m(E-B),a=m(m(F*s)-m(Y*j)),s=m(m(j*X)-m(s*p)),s=m(d+m(m(a*a)+m(s*s))),d=m(c-e),z=m(k-l),a=m(m(J*d)+m(z*f)),h=m(a*a),P=m(B-t),a=m(m(y*P)+m(d*O)),Z=m(a*a),a=m(m(x*z)+m(P*C)),s=(a=m(h+m(Z+m(a*a))))>2],T=m(N-h),q=m(-T),a=w[A+212>>2],I=m(W-a),_=m(-I),Z=w[A+220>>2],U=m(E-Z),AA=m(-U),rA=m(-F),fA=m(-j),!(!R|u)){l=m(B-Z),d=m(c-h),V=m(k-a),e=m(0);break n}C=m(Z-t),D=m(h-e),f=m(a-l);break a}q=m(-T),_=m(-I),AA=m(-U),k=w[A+4>>2],z=m(k-l),B=w[A+12>>2],P=m(B-t),c=w[A+8>>2],d=m(c-e),p=m(W-k),K=m(-p),F=m(N-c),rA=m(-F),j=m(E-B),fA=m(-j),s=m(0)}if(e=m(m(p*D)+m(f*rA)),t=m(e*e),e=m(m(F*C)+m(D*fA)),f=m(m(j*f)+m(C*K)),f=m(t+m(m(e*e)+m(f*f))),e=m(m(I*d)+m(z*q)),t=m(e*e),e=m(m(T*P)+m(d*AA)),l=m(e*e),e=m(m(U*z)+m(P*_)),f=f>(e=m(t+m(l+m(e*e))))?f:e,d=m(c-h),t=m(V*d),V=m(k-a),e=m(t+m(V*S)),t=m(e*e),l=m(B-Z),e=m(m(M*l)+m(d*$)),Y=m(e*e),e=m(m(H*V)+m(l*L)),e=f>(e=m(t+m(Y+m(e*e))))?f:e,f=m(0),u)break r;D=m(B-b),Y=m(c-n),X=m(k-i),y=m(N-n),f=m(-y),J=m(W-i),C=m(-J),x=m(E-b),O=m(-x)}n=m(h-n),i=m(a-i),t=m(m(p*n)+m(i*rA)),b=m(Z-b),n=m(m(F*b)+m(n*fA)),i=m(m(j*i)+m(b*K)),i=m(m(t*t)+m(m(n*n)+m(i*i))),n=m(m(I*Y)+m(X*q)),t=m(n*n),n=m(m(T*D)+m(Y*AA)),a=m(n*n),n=m(m(U*X)+m(D*_)),i=i>(n=m(t+m(a+m(n*n))))?i:n,f=m(m(J*d)+m(V*f)),n=m(f*f),f=m(m(y*l)+m(d*O)),t=m(f*f),f=m(m(x*V)+m(l*C)),f=(f=m(n+m(t+m(f*f))))>2]),n=m(n-w[A+8>>2]),f=m(m(b*e)-m(s*n)),a=m(f*f),i=m(i-w[A+12>>2]),f=m(m(n*t)-m(e*i)),e=m(f*f),f=m(m(i*s)-m(t*b)),s=m(a+m(e+m(f*f))),N=w[A+220>>2],W=w[A+216>>2],E=w[A+212>>2],a=m(-b),h=m(-n),Z=m(-i),!u&&(e=m(0),R))break f}if(f=m(B-W),e=m(p-E),t=m(m(b*f)+m(e*h)),B=m(t*t),t=m(k-N),f=m(m(n*t)+m(f*Z)),k=m(f*f),f=m(m(i*e)+m(t*a)),e=m(B+m(k+m(f*f))),f=m(0),u)break r}f=m(l-W),t=m(b*f),b=m(F-E),l=m(t+m(b*h)),t=n,n=m(c-N),f=m(m(t*n)+m(f*Z)),t=m(f*f),f=m(m(i*b)+m(n*a)),f=m(m(l*l)+m(t+m(f*f)))}if(R=(u=(i=m(Q(eA)))>m(-0xde0b6b000000000))?0:-1,R=(u=(n=m(Q(s)))>(i=u?i:m(-0xde0b6b000000000)))?1:R,u=(b=m(Q(e)))>(i=u?n:i),u=m(Q(f))>(u?b:i)?3:u?2:R,g=G(u,208)+A|0,!(R=o[g+120>>2]))break A;if(!(iA=o[8785]))break A;Zn[0|iA](R),o[g+120>>2]=0}return pr(4+((R=A)+G(A=(0|u)>0?u:0,208)|0)|0,r,208),A}function ZA(A,r,f,e,i,n){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0;var a,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=0,Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=0,C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=0,nA=m(0),aA=0;S=a=S-96|0,re(o[A+4>>2]),L=w[e+40>>2],$=w[e+36>>2],K=w[e+24>>2],q=w[e+20>>2],J=w[r+20>>2],x=w[r+36>>2],y=w[r+24>>2],F=w[r+52>>2],s=w[f+52>>2],R=w[e+52>>2],l=w[i+52>>2],M=w[r+40>>2],Y=w[r+56>>2],t=w[f+56>>2],V=w[e+56>>2],c=w[i+56>>2],_=w[e+32>>2],AA=w[e+16>>2],rA=w[e+8>>2],fA=w[e+4>>2],eA=w[e>>2],H=w[r>>2],I=w[r+16>>2],T=w[r+32>>2],U=w[r+4>>2],j=w[r+8>>2],g=w[r+48>>2],b=w[f+48>>2],X=w[e+48>>2],v=w[i+48>>2],B=o[A+8>>2],o[a+60>>2]=0,p=m(m(b-g)-m(v-X)),b=m(-p),G=m(m(s-F)-m(l-R)),Q=m(m(t-Y)-m(c-V)),w[a+56>>2]=m(m(j*b)-m(y*G))-m(M*Q),w[a+52>>2]=m(m(U*b)-m(J*G))-m(x*Q),w[a+48>>2]=m(m(H*b)-m(I*G))-m(T*Q),Zn[o[o[B>>2]+64>>2]](a+80|0,B,a+48|0),t=w[r+52>>2],c=w[r+24>>2],v=w[r+20>>2],b=w[r+56>>2],s=w[r+40>>2],l=w[r+36>>2],u=w[r+16>>2],k=w[r+48>>2],Z=w[r+8>>2],d=w[r>>2],h=w[r+4>>2],E=w[r+32>>2],o[a+76>>2]=0,z=b,b=w[a+88>>2],W=m(s*b),s=w[a+80>>2],P=l,l=w[a+84>>2],E=m(z+m(W+m(m(E*s)+m(P*l)))),w[a+72>>2]=E,k=m(k+m(m(b*Z)+m(m(s*d)+m(l*h)))),w[a+64>>2]=k,t=m(t+m(m(b*c)+m(m(s*u)+m(l*v)))),w[a+68>>2]=t,B=o[A+12>>2],b=w[e+20>>2],s=w[e+36>>2],l=w[e+24>>2],c=w[e+40>>2],v=w[e>>2],u=w[e+16>>2],Z=w[e+32>>2],d=w[e+4>>2],h=w[e+8>>2],o[a+28>>2]=0,w[a+24>>2]=m(c*Q)+m(m(h*p)+m(G*l)),w[a+20>>2]=m(s*Q)+m(m(d*p)+m(G*b)),w[a+16>>2]=m(Z*Q)+m(m(v*p)+m(G*u)),Zn[o[o[B>>2]+64>>2]](a+32|0,B,a+16|0),v=w[e+56>>2],u=w[e+40>>2],Z=w[e+36>>2],b=w[e+52>>2],s=w[e+24>>2],l=w[e+20>>2],d=w[e+32>>2],c=w[e+48>>2],h=w[e+8>>2],W=w[e>>2],O=w[e+4>>2],C=w[e+16>>2],o[a+60>>2]=0,o[a+92>>2]=0,z=b,b=w[a+40>>2],nA=m(s*b),s=w[a+32>>2],P=l,l=w[a+36>>2],C=m(z+m(nA+m(m(C*s)+m(P*l)))),w[a+52>>2]=C,t=m(t-C),w[a+84>>2]=t,c=m(c+m(m(b*h)+m(m(s*W)+m(l*O)))),w[a+48>>2]=c,c=m(k-c),w[a+80>>2]=c,b=m(v+m(m(b*u)+m(m(s*d)+m(l*Z)))),w[a+56>>2]=b,u=m(E-b),w[a+88>>2]=u,Z=m(0),b=m(0),s=m(0),l=m(0),v=m(0),k=m(0);A:{r:if(m(m(u*u)+m(m(c*c)+m(t*t)))>m(9999999747378752e-20))for(B=32;;){if(!B)break r;if(D=o[A+8>>2],o[a+12>>2]=0,t=m(-w[a+80>>2]),c=w[a+84>>2],u=w[a+88>>2],w[a+8>>2]=m(m(j*t)-m(y*c))-m(M*u),w[a+4>>2]=m(m(U*t)-m(J*c))-m(x*u),w[a>>2]=m(m(H*t)-m(I*c))-m(T*u),iA=a+16|0,Zn[o[o[D>>2]+64>>2]](iA,D,a),o[a+76>>2]=0,t=w[a+24>>2],c=w[a+16>>2],u=w[a+20>>2],w[a+72>>2]=Y+m(m(t*M)+m(m(c*T)+m(x*u))),w[a+68>>2]=F+m(m(t*y)+m(m(c*I)+m(J*u))),w[a+64>>2]=g+m(m(t*j)+m(m(c*H)+m(U*u))),D=o[A+12>>2],o[a+12>>2]=0,t=w[a+88>>2],c=w[a+80>>2],u=w[a+84>>2],w[a+8>>2]=m(L*t)+m(m(rA*c)+m(K*u)),w[a+4>>2]=m($*t)+m(m(fA*c)+m(q*u)),w[a>>2]=m(_*t)+m(m(eA*c)+m(AA*u)),Zn[o[o[D>>2]+64>>2]](iA,D,a),o[a+60>>2]=0,o[a+44>>2]=0,u=w[a+24>>2],d=w[a+16>>2],h=w[a+20>>2],t=m(R+m(m(u*K)+m(m(d*AA)+m(q*h)))),w[a+52>>2]=t,E=m(w[a+68>>2]-t),w[a+36>>2]=E,t=w[a+84>>2],c=m(X+m(m(u*rA)+m(m(d*eA)+m(fA*h)))),w[a+48>>2]=c,W=m(w[a+64>>2]-c),w[a+32>>2]=W,c=w[a+80>>2],u=m(V+m(m(u*L)+m(m(d*_)+m($*h)))),w[a+56>>2]=u,d=m(w[a+72>>2]-u),w[a+40>>2]=d,k>m(1))break A;if(u=w[a+88>>2],(d=m(m(u*d)+m(m(c*W)+m(t*E))))>m(0)){if((b=m(m(u*Q)+m(m(c*p)+m(G*t))))>=m(-14210854715202004e-30))break A;s=w[r+48>>2],l=w[f+48>>2],v=w[r+52>>2],F=w[f+52>>2],Y=w[r+56>>2],g=w[f+56>>2],X=w[e+48>>2],h=w[i+48>>2],R=w[e+52>>2],W=w[i+52>>2],V=w[e+56>>2],O=w[i+56>>2],o[a+44>>2]=0,w[a+36>>2]=E,k=m(k-m(d/b)),b=m(m(1)-k),V=m(m(V*b)+m(k*O)),R=m(m(b*R)+m(k*W)),X=m(m(b*X)+m(k*h)),Y=m(m(b*Y)+m(k*g)),F=m(m(b*v)+m(k*F)),g=m(m(b*s)+m(k*l)),v=w[a+92>>2],s=t,l=u,b=c}if(wf(o[A+4>>2],a+32|0)||Wf(o[A+4>>2],a+32|0,a- -64|0,a+48|0),!De(o[A+4>>2],a+80|0))break r;if(B=B-1|0,t=w[a+88>>2],c=m(t*t),t=w[a+80>>2],u=m(t*t),t=w[a+84>>2],!(m(c+m(u+m(t*t)))>m(9999999747378752e-20)))break}w[n+164>>2]=k,k=m(0),c=m(0),t=m(0),(u=m(m(l*l)+m(m(b*b)+m(s*s))))>=m(14210854715202004e-30)&&(t=l,l=m(m(1)/m(N(u))),c=m(t*l),k=m(s*l),Z=m(b*l),t=v),w[n+132>>2]=Z,w[n+144>>2]=t,w[n+140>>2]=c,w[n+136>>2]=k,m(-w[n+172>>2])<=m(m(c*Q)+m(m(Z*p)+m(G*k)))||(fe(o[A+4>>2],a+16|0,a),A=o[a+12>>2],o[n+156>>2]=o[a+8>>2],o[n+160>>2]=A,A=o[a+4>>2],o[n+148>>2]=o[a>>2],o[n+152>>2]=A,aA=1)}return S=a+96|0,0|aA}function GA(A,r,f){var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=m(0),s=0,k=0,d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0);A:{r:{if(v[A+165|0]){if(!(!f|(0|(e=o[A+88>>2]))<=0))for(i=o[A+96>>2],d=w[A+168>>2],h=w[r+8>>2],B=w[r+4>>2],Z=w[r>>2],f=0;;){if(l=m(w[8+(n=i+(f<<4)|0)>>2]-h),G=m(l*l),l=m(w[n>>2]-Z),Q=m(l*l),l=m(w[n+4>>2]-B),d>=m(G+m(Q+m(l*l))))break r;if((0|e)==(0|(f=f+1|0)))break}if(f=o[A+32>>2],o[f+12>>2]=o[f+12>>2]+1,o[A+92>>2]==(0|e)&&!((0|(c=e?e<<1:1))<=(0|e))){if(c&&(o[8488]=o[8488]+1,t=0|Zn[o[8290]](c<<4,16),e=o[A+88>>2]),!((0|e)<=0)){if(b=1&e,f=0,1!=(0|e))for(s=-2&e,e=0;n=(u=f<<4)+t|0,k=u+o[A+96>>2]|0,i=o[k+4>>2],o[n>>2]=o[k>>2],o[n+4>>2]=i,i=o[k+12>>2],o[n+8>>2]=o[k+8>>2],o[n+12>>2]=i,n=(i=16|u)+t|0,u=i+o[A+96>>2]|0,i=o[u+4>>2],o[n>>2]=o[u>>2],o[n+4>>2]=i,i=o[u+12>>2],o[n+8>>2]=o[u+8>>2],o[n+12>>2]=i,f=f+2|0,(0|s)!=(0|(e=e+2|0)););b&&(n=(f<<=4)+t|0,i=f+o[A+96>>2]|0,f=o[i+4>>2],o[n>>2]=o[i>>2],o[n+4>>2]=f,f=o[i+12>>2],o[n+8>>2]=o[i+8>>2],o[n+12>>2]=f)}!(f=o[A+96>>2])||!f|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+96>>2]=t,a[A+100|0]=1,o[A+92>>2]=c,e=o[A+88>>2]}return f=o[r+4>>2],i=o[A+96>>2]+(e<<4)|0,o[i>>2]=o[r>>2],o[i+4>>2]=f,f=o[r+12>>2],o[i+8>>2]=o[r+8>>2],o[i+12>>2]=f,r=o[A+88>>2],o[A+88>>2]=r+1,o[o[A+32>>2]+16>>2]=o[A+96>>2],r}if(!(!f|(0|(e=o[A+108>>2]))<=0))for(i=o[A+116>>2],d=w[A+168>>2],h=w[r+8>>2],B=w[r+4>>2],Z=w[r>>2],f=0;;){if(l=m(w[8+(n=i+(f<<2)|0)>>2]-h),G=m(l*l),l=m(w[n>>2]-Z),Q=m(l*l),l=m(w[n+4>>2]-B),d>=m(G+m(Q+m(l*l))))break A;if(!((0|e)>(0|(f=f+3|0))))break}if((0|(i=o[A+112>>2]))==(0|e))if((0|(i=e?e<<1:1))<=(0|e))i=e;else{i&&(o[8488]=o[8488]+1,c=0|Zn[o[8290]](i<<2,16),e=o[A+108>>2]),b=o[A+116>>2];f:{e:{if((0|e)>0){if(f=0,e>>>0>=4)for(t=-4&e;w[(s=f<<2)+c>>2]=w[b+s>>2],w[(n=4|s)+c>>2]=w[n+b>>2],w[(n=8|s)+c>>2]=w[n+b>>2],w[(n=12|s)+c>>2]=w[n+b>>2],f=f+4|0,(0|t)!=(0|(u=u+4|0)););if(t=3&e)for(;w[(n=f<<2)+c>>2]=w[n+b>>2],f=f+1|0,(0|t)!=(0|(k=k+1|0)););if(v[A+120|0])break e;break f}if(!b|!v[A+120|0])break f}b&&(o[8489]=o[8489]+1,Zn[o[8291]](b)),e=o[A+108>>2]}o[A+116>>2]=c,o[A+112>>2]=i,a[A+120|0]=1}if(t=o[A+116>>2],w[t+(e<<2)>>2]=w[r>>2],e=e+1|0,o[A+108>>2]=e,(0|e)==(0|i))if((0|i)>=(0|(n=i?i<<1:1)))n=i,f=t;else{n?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](n<<2,16),t=o[A+116>>2],i=o[A+108>>2]):f=0;f:{e:{if((0|i)>0){if(k=0,c=0,i>>>0>=4)for(s=-4&i,u=0;w[(b=c<<2)+f>>2]=w[t+b>>2],w[(e=4|b)+f>>2]=w[e+t>>2],w[(e=8|b)+f>>2]=w[e+t>>2],w[(e=12|b)+f>>2]=w[e+t>>2],c=c+4|0,(0|s)!=(0|(u=u+4|0)););if(s=3&i)for(;w[(e=c<<2)+f>>2]=w[e+t>>2],c=c+1|0,(0|s)!=(0|(k=k+1|0)););if(v[A+120|0])break e;break f}if(!t|!v[A+120|0])break f}t&&(o[8489]=o[8489]+1,Zn[o[8291]](t)),i=o[A+108>>2]}o[A+116>>2]=f,o[A+112>>2]=n,a[A+120|0]=1}else n=i,f=t,i=e;if(w[(i<<2)+f>>2]=w[r+4>>2],i=i+1|0,o[A+108>>2]=i,(0|i)==(0|n))if((0|(b=n?n<<1:1))<=(0|n))e=f;else{b?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](b<<2,16),f=o[A+116>>2],n=o[A+108>>2]):e=0;f:{e:{if((0|n)>0){if(i=0,c=0,n>>>0>=4)for(s=-4&n,k=0;w[(u=c<<2)+e>>2]=w[f+u>>2],w[(t=4|u)+e>>2]=w[f+t>>2],w[(t=8|u)+e>>2]=w[f+t>>2],w[(t=12|u)+e>>2]=w[f+t>>2],c=c+4|0,(0|s)!=(0|(k=k+4|0)););if(s=3&n)for(;w[(t=c<<2)+e>>2]=w[f+t>>2],c=c+1|0,(0|s)!=(0|(i=i+1|0)););if(v[A+120|0])break e;break f}if(!f|!v[A+120|0])break f}f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),n=o[A+108>>2]}o[A+116>>2]=e,o[A+112>>2]=b,a[A+120|0]=1}else e=f,n=i;w[(n<<2)+e>>2]=w[r+8>>2],r=n+1|0,o[A+108>>2]=r,A=o[A+32>>2],o[A+16>>2]=e,o[A+12>>2]=o[A+12>>2]+1,f=((0|r)/3|0)-1|0}return f}return(f>>>0)/3|0}function mA(A,r,f,e,i,n,t,c,b,u,l,s){var k=0,d=m(0),h=m(0),B=m(0),Z=m(0),Q=0,E=0,W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=0,y=m(0),M=m(0),H=m(0),I=m(0),T=0,U=0,j=m(0),z=m(0),P=m(0),O=m(0),S=m(0),L=0,$=m(0),K=m(0),q=m(0),_=0;if(E=Q=o[A+68>>2],(0|Q)==o[A+72>>2]&&!((0|Q)>=(0|(T=Q?Q<<1:1)))){if(T?(o[8488]=o[8488]+1,U=0|Zn[o[8290]](G(T,152),16),k=o[A+68>>2]):k=Q,!((0|k)<=0)){if(E=0,1!=(0|k))for(_=-2&k;pr((x=G(E,152))+U|0,x+o[A+76>>2]|0,152),pr((x=G(1|E,152))+U|0,x+o[A+76>>2]|0,152),E=E+2|0,(0|(L=L+2|0))!=(0|_););1&k&&pr((k=G(E,152))+U|0,k+o[A+76>>2]|0,152)}!(k=o[A+76>>2])||!k|!v[A+80|0]||(o[8489]=o[8489]+1,Zn[o[8291]](k)),o[A+76>>2]=U,a[A+80|0]=1,o[A+72>>2]=T,E=o[A+68>>2]}o[A+68>>2]=E+1,k=o[A+76>>2]+G(Q,152)|0,o[k+140>>2]=i,Q=o[A+16>>2],A=o[240+(Q+G(e,244)|0)>>2],i=o[240+(Q+G(f,244)|0)>>2],o[k+148>>2]=e,o[k+144>>2]=f,j=w[n+84>>2],o[k+132>>2]=0,w[k+104>>2]=j,o[k+96>>2]=0,o[k+100>>2]=0,i?(E=o[r+4>>2],o[k+16>>2]=o[r>>2],o[k+20>>2]=E,E=o[r+12>>2],o[k+24>>2]=o[r+8>>2],o[k+28>>2]=E,B=w[t+8>>2],d=w[t>>2],h=w[t+4>>2],o[k+12>>2]=0,z=w[k+20>>2],P=w[k+16>>2],y=m(m(d*z)-m(h*P)),w[k+8>>2]=y,O=w[k+24>>2],M=m(m(B*P)-m(d*O)),w[k+4>>2]=M,H=m(m(h*O)-m(z*B)),w[k>>2]=H,B=w[i+332>>2],d=w[i+328>>2],h=w[i+608>>2],Z=w[i+348>>2],R=w[i+340>>2],g=w[i+344>>2],W=w[i+612>>2],F=w[i+364>>2],X=w[i+356>>2],D=w[i+360>>2],C=w[i+604>>2],p=w[i+324>>2],o[k+76>>2]=0,W=m(W*m(m(F*y)+m(m(X*H)+m(M*D)))),w[k+72>>2]=W,Z=m(h*m(m(Z*y)+m(m(R*H)+m(M*g)))),w[k+68>>2]=Z,R=m(C*m(m(B*y)+m(m(p*H)+m(M*d)))),w[k+64>>2]=R):(o[k+64>>2]=0,o[k+68>>2]=0,o[k>>2]=0,o[k+4>>2]=0,o[k+72>>2]=0,o[k+76>>2]=0,o[k+8>>2]=0,o[k+12>>2]=0,o[k+16>>2]=0,o[k+20>>2]=0,o[k+24>>2]=0,o[k+28>>2]=0),A?(B=w[r>>2],d=w[r+4>>2],h=w[r+8>>2],o[k+60>>2]=0,$=m(-h),w[k+56>>2]=$,K=m(-d),w[k+52>>2]=K,q=m(-B),w[k+48>>2]=q,N=w[c+8>>2],Y=w[c+4>>2],V=w[c>>2],o[k+44>>2]=0,I=m(m(B*Y)-m(V*d)),w[k+40>>2]=I,V=m(m(h*V)-m(N*B)),w[k+36>>2]=V,Y=m(m(d*N)-m(Y*h)),w[k+32>>2]=Y,B=w[A+332>>2],h=w[A+328>>2],d=w[A+608>>2],g=w[A+348>>2],F=w[A+340>>2],X=w[A+344>>2],N=w[A+612>>2],D=w[A+364>>2],C=w[A+356>>2],p=w[A+360>>2],S=w[A+604>>2],J=w[A+324>>2],o[k+92>>2]=0,N=m(N*m(m(D*I)+m(m(C*Y)+m(V*p)))),w[k+88>>2]=N,d=m(d*m(m(g*I)+m(m(F*Y)+m(V*X)))),w[k+84>>2]=d,h=m(S*m(m(B*I)+m(m(J*Y)+m(V*h)))),w[k+80>>2]=h):(o[k+80>>2]=0,o[k+84>>2]=0,o[k+32>>2]=0,o[k+36>>2]=0,o[k+88>>2]=0,o[k+92>>2]=0,o[k+40>>2]=0,o[k+44>>2]=0,o[k+48>>2]=0,o[k+52>>2]=0,o[k+56>>2]=0,o[k+60>>2]=0,d=m(0),h=m(0)),g=m(0),S=b,i?(b=w[t+4>>2],F=w[t>>2],p=m(w[r+8>>2]*m(m(R*b)-m(F*Z))),J=Z,Z=w[t+8>>2],J=m(w[i+404>>2]+m(p+m(m(w[r>>2]*m(m(J*Z)-m(b*W)))+m(m(m(W*F)-m(Z*R))*w[r+4>>2]))))):J=m(0),A?(W=w[c>>2],Z=w[c+4>>2],p=m(w[r+8>>2]*m(m(d*W)-m(h*Z))),b=d,d=w[c+8>>2],b=m(w[A+404>>2]+m(p+m(m(w[r>>2]*m(m(N*Z)-m(b*d)))+m(m(m(h*d)-m(N*W))*w[r+4>>2]))))):b=m(0),B=m(S/m(J+b)),w[k+108>>2]=B,F=m(0),W=m(0),Z=m(0),R=m(0),N=m(0),d=m(0),i&&(f=Q+G(f,244)|0,Z=m(w[f+176>>2]+w[f+208>>2]),R=w[f+192>>2],W=m(w[f+180>>2]+w[f+212>>2]),N=w[f+196>>2],F=m(w[f+184>>2]+w[f+216>>2]),d=w[f+200>>2]),h=m(0),X=m(0),D=m(0),C=m(0),p=m(0),A&&(A=Q+G(e,244)|0,g=m(w[A+176>>2]+w[A+208>>2]),D=w[A+200>>2],C=w[A+196>>2],X=m(w[A+184>>2]+w[A+216>>2]),p=w[A+192>>2],h=m(w[A+180>>2]+w[A+212>>2])),b=m(0),b=16&v[n+128|0]?m(B*m(m(w[u+44>>2]*m(-m(m(m(w[n+56>>2]-w[n+40>>2])*w[r+8>>2])+m(m(m(w[n+48>>2]-w[n+32>>2])*w[r>>2])+m(m(w[n+52>>2]-w[n+36>>2])*w[r+4>>2])))))/w[u+12>>2])):b,o[k+128>>2]=0,w[k+124>>2]=j,w[k+116>>2]=s,w[k+120>>2]=-j,w[k+112>>2]=m(B*m(l-m(m(m(m(O*F)+m(m(P*Z)+m(W*z)))+m(m(y*d)+m(m(H*R)+m(N*M))))+m(m(m($*X)+m(m(q*g)+m(h*K)))+m(m(I*D)+m(m(Y*p)+m(C*V)))))))+b}function QA(A,r,f){A|=0,r|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=m(0),k=m(0),d=0,h=m(0),B=m(0),Z=m(0);if(o[A+8>>2]=o[r>>2],(0|(b=o[A+24>>2]))==o[A+28>>2]&&!((0|(c=b?b<<1:1))<=(0|b))){if(c&&(o[8488]=o[8488]+1,e=0|Zn[o[8290]](c<<2,16),b=o[A+24>>2]),!((0|b)<=0)){if(b>>>0>=4)for(d=-4&b;o[(t=n<<2)+e>>2]=o[t+o[A+32>>2]>>2],o[(l=4|t)+e>>2]=o[l+o[A+32>>2]>>2],o[(l=8|t)+e>>2]=o[l+o[A+32>>2]>>2],o[(t|=12)+e>>2]=o[t+o[A+32>>2]>>2],n=n+4|0,(0|d)!=(0|(i=i+4|0)););if(i=3&b)for(;o[(t=n<<2)+e>>2]=o[t+o[A+32>>2]>>2],n=n+1|0,(0|i)!=(0|(u=u+1|0)););}!(n=o[A+32>>2])|!v[A+36|0]||(n&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),b=o[A+24>>2]),o[A+32>>2]=e,a[A+36|0]=1,o[A+28>>2]=c}if(o[o[A+32>>2]+(b<<2)>>2]=o[r>>2],o[A+24>>2]=b+1,f?(h=w[r+16>>2],B=w[r+12>>2],k=w[r+8>>2],s=w[r+20>>2]):(f=o[A+8>>2],s=w[r+16>>2],k=w[r+8>>2],Z=w[r+12>>2],h=m(m(w[f+44>>2]*s)+m(m(w[f+36>>2]*k)+m(Z*w[f+40>>2]))),B=m(m(w[f+28>>2]*s)+m(m(w[f+20>>2]*k)+m(Z*w[f+24>>2]))),k=m(m(w[f+12>>2]*s)+m(m(w[f+4>>2]*k)+m(w[f+8>>2]*Z))),s=m(0)),(0|(e=o[A+76>>2]))==o[A+80>>2]&&!((0|(b=e?e<<1:1))<=(0|e))){if(b?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](b<<4,16),e=o[A+76>>2]):f=0,!((0|e)<=0)){if(n=0,1!=(0|e))for(d=-2&e,u=0;c=(t=n<<4)+f|0,i=t+o[A+84>>2]|0,l=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=l,l=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=l,t=(i=16|t)+f|0,i=i+o[A+84>>2]|0,c=o[i+4>>2],o[t>>2]=o[i>>2],o[t+4>>2]=c,c=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=c,n=n+2|0,(0|d)!=(0|(u=u+2|0)););1&e&&(e=(n<<=4)+f|0,n=n+o[A+84>>2]|0,i=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=i,i=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=i)}!(e=o[A+84>>2])||!e|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+84>>2]=f,a[A+88|0]=1,o[A+80>>2]=b,e=o[A+76>>2]}if(f=o[A+84>>2]+(e<<4)|0,w[f+12>>2]=s,w[f+8>>2]=h,w[f+4>>2]=B,w[f>>2]=k,o[A+76>>2]=o[A+76>>2]+1,s=w[r+24>>2],h=m(m(1)-s),B=m(m(h*w[A+48>>2])+m(s*w[A- -64>>2])),k=m(m(h*w[A+44>>2])+m(s*w[A+60>>2])),s=m(m(h*w[A+40>>2])+m(s*w[A+56>>2])),(0|(e=o[A+96>>2]))==o[A+100>>2]&&!((0|(b=e?e<<1:1))<=(0|e))){if(b?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](b<<4,16),e=o[A+96>>2]):f=0,!((0|e)<=0)){if(n=0,1!=(0|e))for(d=-2&e,u=0;c=(t=n<<4)+f|0,i=t+o[A+104>>2]|0,l=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=l,l=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=l,t=(i=16|t)+f|0,i=i+o[A+104>>2]|0,c=o[i+4>>2],o[t>>2]=o[i>>2],o[t+4>>2]=c,c=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=c,n=n+2|0,(0|d)!=(0|(u=u+2|0)););1&e&&(e=(n<<=4)+f|0,n=n+o[A+104>>2]|0,i=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=i,i=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=i)}!(e=o[A+104>>2])||!e|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+104>>2]=f,a[A+108|0]=1,o[A+100>>2]=b,e=o[A+96>>2]}if(f=o[A+104>>2]+(e<<4)|0,w[f+8>>2]=B,w[f+4>>2]=k,w[f>>2]=s,o[A+96>>2]=o[A+96>>2]+1,(0|(i=o[A+116>>2]))==o[A+120>>2]&&!((0|(t=i?i<<1:1))<=(0|i))){t?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](t<<2,16),i=o[A+116>>2]):e=0,f=o[A+124>>2];A:{r:{if((0|i)>0){if(b=0,n=0,i>>>0>=4)for(d=-4&i,c=0;w[(u=n<<2)+e>>2]=w[f+u>>2],w[(l=4|u)+e>>2]=w[f+l>>2],w[(l=8|u)+e>>2]=w[f+l>>2],w[(u|=12)+e>>2]=w[f+u>>2],n=n+4|0,(0|d)!=(0|(c=c+4|0)););if(u=3&i)for(;w[(c=n<<2)+e>>2]=w[f+c>>2],n=n+1|0,(0|u)!=(0|(b=b+1|0)););if(v[A+128|0])break r;break A}if(!f|!v[A+128|0])break A}f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),i=o[A+116>>2]}o[A+124>>2]=e,o[A+120>>2]=t,a[A+128|0]=1}return w[o[A+124>>2]+(i<<2)>>2]=w[r+24>>2],o[A+116>>2]=i+1,m(w[A+4>>2])}function EA(A,r,f,e,i,n){var a,t,c,b=0,u=m(0),l=0,s=0,k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=0,W=m(0),p=m(0),F=m(0),R=m(0);S=a=S-400|0,Zn[o[8294]](2330),b=o[f+12>>2],o[a+336>>2]=o[f+8>>2],o[a+340>>2]=b,b=o[f+4>>2],o[a+328>>2]=o[f>>2],o[a+332>>2]=b,b=o[f+28>>2],o[a+352>>2]=o[f+24>>2],o[a+356>>2]=b,b=o[f+20>>2],o[a+344>>2]=o[f+16>>2],o[a+348>>2]=b,b=o[f+44>>2],o[a+368>>2]=o[f+40>>2],o[a+372>>2]=b,b=o[f+36>>2],o[a+360>>2]=o[f+32>>2],o[a+364>>2]=b,b=o[f+60>>2],o[a+384>>2]=o[f+56>>2],o[a+388>>2]=b,b=o[f+52>>2],o[a+376>>2]=o[f+48>>2],o[a+380>>2]=b,b=o[e+12>>2],o[a+272>>2]=o[e+8>>2],o[a+276>>2]=b,b=o[e+4>>2],o[a+264>>2]=o[e>>2],o[a+268>>2]=b,b=o[e+28>>2],o[a+288>>2]=o[e+24>>2],o[a+292>>2]=b,b=o[e+20>>2],o[a+280>>2]=o[e+16>>2],o[a+284>>2]=b,b=o[e+44>>2],o[a+304>>2]=o[e+40>>2],o[a+308>>2]=b,b=o[e+36>>2],o[a+296>>2]=o[e+32>>2],o[a+300>>2]=b,b=o[e+60>>2],o[a+320>>2]=o[e+56>>2],o[a+324>>2]=b,b=o[e+52>>2],o[a+312>>2]=o[e+48>>2],o[a+316>>2]=b,jA(s=a+328|0,a+264|0,t=a+4|0,b=a+248|0),o[a+228>>2]=0,u=w[a+248>>2],w[a+224>>2]=u*w[a+12>>2],w[a+220>>2]=u*w[a+8>>2],w[a+216>>2]=u*w[a+4>>2],o[a+208>>2]=0,o[a+212>>2]=0,o[a+200>>2]=0,o[a+204>>2]=0,o[a+60>>2]=0,o[a+64>>2]=0,o[a+52>>2]=0,o[a+56>>2]=0,rf(s,b),o[a+48>>2]=0,o[a+32>>2]=0,d=w[a+260>>2],k=w[a+256>>2],u=w[a+248>>2],v=w[a+252>>2],h=m(m(2)/m(m(d*d)+m(m(k*k)+m(m(u*u)+m(v*v))))),B=m(k*h),Z=m(v*B),G=m(u*h),Q=m(d*G),w[a+40>>2]=Z+Q,w[a+28>>2]=Z-Q,Z=m(u*G),G=v,v=m(v*h),h=m(G*v),w[a+44>>2]=m(1)-m(Z+h),k=m(k*B),w[a+24>>2]=m(1)-m(Z+k),o[a+16>>2]=0,Z=m(u*B),G=m(d*v),w[a+36>>2]=Z-G,u=m(u*v),d=m(d*B),w[a+20>>2]=u+d,w[a+12>>2]=Z+G,w[a+8>>2]=u-d,w[a+4>>2]=m(1)-m(h+k),s=a+232|0,Zn[o[o[r>>2]+8>>2]](r,t,b,s),u=w[a+224>>2],d=w[a+216>>2],v=w[a+220>>2],Z=w[s>>2],G=w[s+4>>2],Q=w[s+8>>2],W=w[b>>2],B=w[a+200>>2],p=w[b+4>>2],h=w[a+204>>2],F=w[b+8>>2],k=w[a+208>>2],R=m(Zn[o[o[r>>2]+16>>2]](r)),o[b+12>>2]=0,l=(k=m(k*m(1)))>m(0),w[b+8>>2]=F+(l?m(-0):k),E=(h=m(h*m(1)))>m(0),w[b+4>>2]=p+(E?m(-0):h),c=(B=m(B*m(1)))>m(0),w[b>>2]=W+(c?m(-0):B),o[s+12>>2]=0,w[s+8>>2]=Q+(l?k:m(-0)),w[s+4>>2]=G+(E?h:m(-0)),w[s>>2]=Z+(c?B:m(-0)),u=m(m(R*m(N(m(m(u*u)+m(m(d*d)+m(v*v))))))*m(1)),w[b>>2]=w[b>>2]-u,w[b+4>>2]=w[b+4>>2]-u,w[b+8>>2]=w[b+8>>2]-u,w[s>>2]=u+w[s>>2],w[s+4>>2]=u+w[s+4>>2],w[s+8>>2]=u+w[s+8>>2],o[a+4>>2]=14912,l=o[f+12>>2],o[a+48>>2]=o[f+8>>2],o[a+52>>2]=l,l=o[f+4>>2],o[a+40>>2]=o[f>>2],o[a+44>>2]=l,E=o[f+28>>2],o[(l=a- -64|0)>>2]=o[f+24>>2],o[l+4>>2]=E,l=o[f+20>>2],o[a+56>>2]=o[f+16>>2],o[a+60>>2]=l,l=o[f+44>>2],o[a+80>>2]=o[f+40>>2],o[a+84>>2]=l,l=o[f+36>>2],o[a+72>>2]=o[f+32>>2],o[a+76>>2]=l,l=o[f+60>>2],o[a+96>>2]=o[f+56>>2],o[a+100>>2]=l,l=o[f+52>>2],o[a+88>>2]=o[f+48>>2],o[a+92>>2]=l,f=o[e+12>>2],o[a+112>>2]=o[e+8>>2],o[a+116>>2]=f,f=o[e+4>>2],o[a+104>>2]=o[e>>2],o[a+108>>2]=f,f=o[e+28>>2],o[a+128>>2]=o[e+24>>2],o[a+132>>2]=f,f=o[e+20>>2],o[a+120>>2]=o[e+16>>2],o[a+124>>2]=f,f=o[e+36>>2],o[a+136>>2]=o[e+32>>2],o[a+140>>2]=f,f=o[e+44>>2],o[a+144>>2]=o[e+40>>2],o[a+148>>2]=f,f=o[e+60>>2],o[a+160>>2]=o[e+56>>2],o[a+164>>2]=f,f=o[e+52>>2],o[a+152>>2]=o[e+48>>2],o[a+156>>2]=f,o[a+188>>2]=i,w[a+192>>2]=n,o[a+196>>2]=r,o[a+184>>2]=A,n=m(w[a+160>>2]-w[a+96>>2]),u=m(w[a+152>>2]-w[a+88>>2]),d=m(w[a+156>>2]-w[a+92>>2]),v=m(m(1)/m(N(m(m(n*n)+m(m(u*u)+m(d*d)))))),B=(k=m(n*v))==m(0)?m(0xde0b6b000000000):m(m(1)/k),w[a+16>>2]=B,Z=(h=m(d*v))==m(0)?m(0xde0b6b000000000):m(m(1)/h),w[a+12>>2]=Z,o[a+32>>2]=B>2]=Z>2]=G+m(m(n*u)+m(d*h)),n=n==m(0)?m(0xde0b6b000000000):m(m(1)/n),w[a+8>>2]=n,o[a+24>>2]=n>2],Zn[o[o[A>>2]+24>>2]](A,a+376|0,a+312|0,t,b,s),Zn[o[8295]](),S=a+400|0}function WA(A,r,f){A|=0,r|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0);if(n=o[r>>2],o[A+16>>2]=n,(0|(b=o[A+24>>2]))==o[A+28>>2]&&!((0|(c=b?b<<1:1))<=(0|b))){if(c&&(o[8488]=o[8488]+1,e=0|Zn[o[8290]](c<<2,16),b=o[A+24>>2]),!((0|b)<=0)){if(n=0,b>>>0>=4)for(s=-4&b;o[(t=n<<2)+e>>2]=o[t+o[A+32>>2]>>2],o[(l=4|t)+e>>2]=o[l+o[A+32>>2]>>2],o[(l=8|t)+e>>2]=o[l+o[A+32>>2]>>2],o[(t|=12)+e>>2]=o[t+o[A+32>>2]>>2],n=n+4|0,(0|s)!=(0|(i=i+4|0)););if(i=3&b)for(;o[(t=n<<2)+e>>2]=o[t+o[A+32>>2]>>2],n=n+1|0,(0|i)!=(0|(u=u+1|0)););}!(n=o[A+32>>2])|!v[A+36|0]||(n&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),b=o[A+24>>2]),o[A+32>>2]=e,a[A+36|0]=1,o[A+28>>2]=c,n=o[A+16>>2]}if(o[o[A+32>>2]+(b<<2)>>2]=n,o[A+24>>2]=b+1,f?(B=w[r+16>>2],Z=w[r+12>>2],k=w[r+8>>2],d=w[r+20>>2]):(f=o[A+16>>2],d=w[r+16>>2],k=w[r+8>>2],h=w[r+12>>2],B=m(m(w[f+44>>2]*d)+m(m(w[f+36>>2]*k)+m(h*w[f+40>>2]))),Z=m(m(w[f+28>>2]*d)+m(m(w[f+20>>2]*k)+m(h*w[f+24>>2]))),k=m(m(w[f+12>>2]*d)+m(m(w[f+4>>2]*k)+m(w[f+8>>2]*h))),d=m(0)),(0|(e=o[A+76>>2]))==o[A+80>>2]&&!((0|(b=e?e<<1:1))<=(0|e))){if(b?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](b<<4,16),e=o[A+76>>2]):f=0,!((0|e)<=0)){if(n=0,1!=(0|e))for(s=-2&e,u=0;c=(t=n<<4)+f|0,i=t+o[A+84>>2]|0,l=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=l,l=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=l,t=(i=16|t)+f|0,i=i+o[A+84>>2]|0,c=o[i+4>>2],o[t>>2]=o[i>>2],o[t+4>>2]=c,c=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=c,n=n+2|0,(0|s)!=(0|(u=u+2|0)););1&e&&(n=(e=n<<4)+f|0,e=e+o[A+84>>2]|0,i=o[e+4>>2],o[n>>2]=o[e>>2],o[n+4>>2]=i,i=o[e+12>>2],o[n+8>>2]=o[e+8>>2],o[n+12>>2]=i)}!(e=o[A+84>>2])||!e|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+84>>2]=f,a[A+88|0]=1,o[A+80>>2]=b,e=o[A+76>>2]}if(f=o[A+84>>2]+(e<<4)|0,w[f+12>>2]=d,w[f+8>>2]=B,w[f+4>>2]=Z,w[f>>2]=k,o[A+76>>2]=o[A+76>>2]+1,(0|(e=o[A+96>>2]))==o[A+100>>2]&&!((0|(b=e?e<<1:1))<=(0|e))){if(b?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](b<<4,16),e=o[A+96>>2]):f=0,!((0|e)<=0)){if(n=0,1!=(0|e))for(s=-2&e,u=0;c=(t=n<<4)+f|0,i=t+o[A+104>>2]|0,l=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=l,l=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=l,t=(i=16|t)+f|0,i=i+o[A+104>>2]|0,c=o[i+4>>2],o[t>>2]=o[i>>2],o[t+4>>2]=c,c=o[i+12>>2],o[t+8>>2]=o[i+8>>2],o[t+12>>2]=c,n=n+2|0,(0|s)!=(0|(u=u+2|0)););1&e&&(n=(e=n<<4)+f|0,e=e+o[A+104>>2]|0,i=o[e+4>>2],o[n>>2]=o[e>>2],o[n+4>>2]=i,i=o[e+12>>2],o[n+8>>2]=o[e+8>>2],o[n+12>>2]=i)}!(e=o[A+104>>2])||!e|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+104>>2]=f,a[A+108|0]=1,o[A+100>>2]=b,e=o[A+96>>2]}if(f=o[A+104>>2]+(e<<4)|0,e=o[r+28>>2],o[f>>2]=o[r+24>>2],o[f+4>>2]=e,e=o[r+36>>2],o[f+8>>2]=o[r+32>>2],o[f+12>>2]=e,o[A+96>>2]=o[A+96>>2]+1,(0|(i=o[A+116>>2]))==o[A+120>>2]&&!((0|(t=i?i<<1:1))<=(0|i))){t?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](t<<2,16),i=o[A+116>>2]):e=0,f=o[A+124>>2];A:{r:{if((0|i)>0){if(b=0,n=0,i>>>0>=4)for(s=-4&i,c=0;w[(u=n<<2)+e>>2]=w[f+u>>2],w[(l=4|u)+e>>2]=w[f+l>>2],w[(l=8|u)+e>>2]=w[f+l>>2],w[(u|=12)+e>>2]=w[f+u>>2],n=n+4|0,(0|s)!=(0|(c=c+4|0)););if(u=3&i)for(;w[(c=n<<2)+e>>2]=w[f+c>>2],n=n+1|0,(0|u)!=(0|(b=b+1|0)););if(v[A+128|0])break r;break A}if(!f|!v[A+128|0])break A}f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),i=o[A+116>>2]}o[A+124>>2]=e,o[A+120>>2]=t,a[A+128|0]=1}return w[o[A+124>>2]+(i<<2)>>2]=w[r+40>>2],o[A+116>>2]=i+1,m(w[A+4>>2])}function NA(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=0,b=m(0),u=0,l=0,s=m(0),k=m(0),d=m(0),v=0,h=m(0),B=0,Z=m(0),G=0,Q=0,E=m(0),W=m(0);S=e=S-48|0;A:{switch(o[r+4>>2]){case 8:o[A>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0;break A;case 0:i=w[r+40>>2],n=w[r+44>>2],t=w[f+4>>2],b=w[f+8>>2],a=w[r+36>>2],d=w[f>>2],o[A+12>>2]=0,w[A>>2]=d>=m(0)?a:m(-a),w[A+8>>2]=b>=m(0)?n:m(-n),w[A+4>>2]=t>=m(0)?i:m(-i);break A;case 1:i=w[f+8>>2],n=w[f>>2],a=w[f+4>>2],f=(t=m(m(i*w[r+72>>2])+m(m(n*w[r+64>>2])+m(a*w[r+68>>2]))))<(b=m(m(i*w[r+88>>2])+m(m(n*w[r+80>>2])+m(a*w[r+84>>2])))),r=(r- -64|0)+((m(m(i*w[r+104>>2])+m(m(n*w[r+96>>2])+m(a*w[r+100>>2])))>(f?b:t)?2:f)<<4)|0,f=o[r>>2],l=o[r+4>>2],i=w[r+8>>2],o[A+12>>2]=0,w[A+8>>2]=i,o[A>>2]=f,o[A+4>>2]=l;break A;case 13:c=o[r+48>>2],o[e+40>>2]=o[r+44>>2],o[e+44>>2]=c,c=o[r+40>>2],o[e+32>>2]=o[r+36>>2],o[e+36>>2]=c,w[e+16>>2]=w[f>>2],w[e+20>>2]=w[f+4>>2],i=w[f+8>>2],o[e+28>>2]=0,w[e+24>>2]=i,f=1,c=2;r:{f:{e:switch((r=o[r+60>>2])-1|0){case 0:break f;case 1:break e;default:break r}c=1}f=0,l=r}i=w[(u=r<<2)+(r=e+32|0)>>2],n=w[((u=r)|(r=f<<2))>>2],a=w[(u=r)+(r=e+16|0)>>2],t=w[r+(c<<2)>>2],(b=m(N(m(m(a*a)+m(t*t)))))==m(0)?(w[(f<<2)+e>>2]=n,w[(r=l<<2)+e>>2]=w[r+(e+16|0)>>2]>2]=a*n,w[(r=l<<2)+e>>2]=w[r+(e+16|0)>>2]>2]=Z,r=o[e+4>>2],f=o[e>>2],i=w[e+8>>2],o[A+12>>2]=0,w[A+8>>2]=i,o[A>>2]=f,o[A+4>>2]=r;break A;case 10:u=r,r=o[r+60>>2],E=w[36+(u+(l=r<<2)|0)>>2],s=m(1),i=w[f+8>>2],n=w[f>>2],a=w[f+4>>2],(t=m(m(i*i)+m(m(n*n)+m(a*a))))>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,w[l+(e+32|0)>>2]=E,i=m(-0xde0b6b000000000),n=m(0),a=m(0),t=w[e+40>>2],b=w[e+32>>2],d=w[e+36>>2],(k=m(m(W*t)+m(m(s*b)+m(Z*d))))>m(-0xde0b6b000000000)&&(n=d,a=t,h=b,i=k),o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,w[(e+32|0)+(r<<2)>>2]=-E,t=w[e+40>>2],b=w[e+32>>2],d=w[e+36>>2],o[A+12>>2]=0,r=m(m(W*t)+m(m(s*b)+m(Z*d)))>i,w[A+8>>2]=r?t:a,w[A+4>>2]=r?d:n,w[A>>2]=r?b:h;break A;case 5:if(t=w[r+20>>2],b=w[r+28>>2],d=w[r+24>>2],l=o[r+100>>2],(0|(r=o[r+104>>2]))<=0)c=-1;else{if(i=m(w[f>>2]*t),n=m(w[f+8>>2]*b),a=m(w[f+4>>2]*d),G=1&r,1!=(0|r))for(Q=-2&r,r=0,c=-1,s=m(-34028234663852886e22),f=0;u=(k=m(m(w[8+(u=l+(r<<4)|0)>>2]*n)+m(m(w[u>>2]*i)+m(a*w[u+4>>2]))))>s,s=(v=(h=m(m(w[8+(v=l+((B=1|r)<<4)|0)>>2]*n)+m(m(w[v>>2]*i)+m(a*w[v+4>>2]))))>(k=u?k:s))?h:k,c=v?B:u?r:c,r=r+2|0,(0|Q)!=(0|(f=f+2|0)););else r=0,c=-1,s=m(-34028234663852886e22);G&&(f=r,c=m(m(w[8+(r=l+(r<<4)|0)>>2]*n)+m(m(w[r>>2]*i)+m(a*w[r+4>>2])))>s?f:c)}i=w[(r=l+(c<<4)|0)>>2],n=w[r+4>>2],a=w[r+8>>2],o[A+12>>2]=0,w[A+8>>2]=b*a,w[A+4>>2]=d*n,w[A>>2]=t*i;break A;case 4:if(t=w[r+20>>2],b=w[r+28>>2],d=w[r+24>>2],l=o[r+112>>2],(0|(r=o[r+104>>2]))<=0)c=-1;else{if(i=m(w[f>>2]*t),n=m(w[f+8>>2]*b),a=m(w[f+4>>2]*d),G=1&r,1!=(0|r))for(Q=-2&r,r=0,c=-1,s=m(-34028234663852886e22),f=0;u=(k=m(m(w[8+(u=l+(r<<4)|0)>>2]*n)+m(m(w[u>>2]*i)+m(a*w[u+4>>2]))))>s,s=(v=(h=m(m(w[8+(v=l+((B=1|r)<<4)|0)>>2]*n)+m(m(w[v>>2]*i)+m(a*w[v+4>>2]))))>(k=u?k:s))?h:k,c=v?B:u?r:c,r=r+2|0,(0|Q)!=(0|(f=f+2|0)););else r=0,c=-1,s=m(-34028234663852886e22);G&&(f=r,c=m(m(w[8+(r=l+(r<<4)|0)>>2]*n)+m(m(w[r>>2]*i)+m(a*w[r+4>>2])))>s?f:c)}i=w[(r=l+(c<<4)|0)>>2],n=w[r+4>>2],a=w[r+8>>2],o[A+12>>2]=0,w[A+8>>2]=b*a,w[A+4>>2]=d*n,w[A>>2]=t*i;break A}Zn[o[o[r>>2]+68>>2]](A,r,f)}S=e+48|0}function pA(A,r){var f,e=0,i=0,n=0,a=0,t=0,u=0,l=0,d=0,v=0,h=0,B=0,w=0,E=0,N=0,p=0,F=0,R=0,Y=0,V=0,g=0,X=0,D=0;S=f=S-16|0,s(A);A:if((n=2147483647&(F=c(2)))>>>0<=1305022426){if(p=(d=+A)+-1.5707963109016418*(i=.6366197723675814*d+6755399441055744-6755399441055744)+-1.5893254773528196e-8*i,Z[r>>3]=p,e=p<-.7853981852531433,n=Q(i)<2147483648?~~i:-2147483648,e){i+=-1,Z[r>>3]=d+-1.5707963109016418*i+-1.5893254773528196e-8*i,n=n-1|0;break A}if(!(p>.7853981852531433))break A;i+=1,Z[r>>3]=d+-1.5707963109016418*i+-1.5893254773528196e-8*i,n=n+1|0}else if(n>>>0>=2139095040)Z[r>>3]=m(A-A),n=0;else{if(e=n,n=(n>>>23|0)-150|0,Z[f+8>>3]=(b(2,e-(n<<23)|0),k()),R=f+8|0,S=t=S-560|0,l=n+G(E=(0|(e=(n-3|0)/24|0))>0?e:0,-24)|0,(0|(h=o[6636]))>=0)for(n=h+1|0,e=E;Z[(t+320|0)+(a<<3)>>3]=(0|e)<0?0:+o[26560+(e<<2)>>2],e=e+1|0,(0|n)!=(0|(a=a+1|0)););for(v=l-24|0,n=0,a=(0|h)>0?h:0;;){for(e=0,i=0;i=Z[(e<<3)+R>>3]*Z[(t+320|0)+(n-e<<3)>>3]+i,1!=(0|(e=e+1|0)););if(Z[(n<<3)+t>>3]=i,e=(0|n)==(0|a),n=n+1|0,e)break}X=47-l|0,Y=48-l|0,D=l-25|0,n=h;r:{for(;;){if(i=Z[(n<<3)+t>>3],e=0,a=n,!(w=(0|n)<=0))for(;B=(t+480|0)+(e<<2)|0,u=Q(d=5.960464477539063e-8*i)<2147483648?~~d:-2147483648,u=Q(i=-16777216*(d=+(0|u))+i)<2147483648?~~i:-2147483648,o[B>>2]=u,i=Z[((a=a-1|0)<<3)+t>>3]+d,(0|n)!=(0|(e=e+1|0)););i=jf(i,v),i+=-8*W(.125*i),i-=+(0|(B=Q(i)<2147483648?~~i:-2147483648));f:{e:{i:{if(V=(0|v)<=0){if(v)break i;u=o[476+((n<<2)+t|0)>>2]>>23}else N=a=(n<<2)+t|0,a=(u=o[a+476>>2])-((e=u>>Y)<>2]=a,B=e+B|0,u=a>>X;if((0|u)<=0)break f;break e}if(u=2,!(i>=.5)){u=0;break f}}if(e=0,a=0,!w)for(;w=o[(N=(t+480|0)+(e<<2)|0)>>2],g=16777215,a||(g=16777216,w)?(o[N>>2]=g-w,a=1):a=0,(0|n)!=(0|(e=e+1|0)););e:if(!V){e=8388607;i:switch(0|D){case 1:e=4194303;break;case 0:break i;default:break e}o[476+(w=(n<<2)+t|0)>>2]=o[w+476>>2]&e}B=B+1|0,2==(0|u)&&(i=1-i,u=2,a&&(i-=jf(1,v)))}if(0!=i)break;if(a=0,e=n,!((0|h)>=(0|n))){for(;a=o[(t+480|0)+((e=e-1|0)<<2)>>2]|a,(0|e)>(0|h););if(a){for(l=v;l=l-24|0,!o[(t+480|0)+((n=n-1|0)<<2)>>2];);break r}}for(e=1;a=e,e=e+1|0,!o[(t+480|0)+(h-a<<2)>>2];);for(a=n+a|0;;){for(Z[(t+320|0)+((n=n+1|0)<<3)>>3]=o[26560+(n+E<<2)>>2],e=0,i=0;i=Z[(e<<3)+R>>3]*Z[(t+320|0)+(n-e<<3)>>3]+i,1!=(0|(e=e+1|0)););if(Z[(n<<3)+t>>3]=i,!((0|n)<(0|a)))break}n=a}(i=jf(i,24-l|0))>=16777216?(v=(t+480|0)+(n<<2)|0,e=Q(d=5.960464477539063e-8*i)<2147483648?~~d:-2147483648,a=Q(i=-16777216*+(0|e)+i)<2147483648?~~i:-2147483648,o[v>>2]=a,n=n+1|0):(e=Q(i)<2147483648?~~i:-2147483648,l=v),o[(t+480|0)+(n<<2)>>2]=e}if(i=jf(1,l),!((0|n)<0)){for(e=n;a=e,Z[(e<<3)+t>>3]=i*+o[(t+480|0)+(e<<2)>>2],e=e-1|0,i*=5.960464477539063e-8,a;);if(!((0|n)<0))for(a=n;;){if(i=0,e=0,(0|(v=(0|(l=n-a|0))>(0|h)?h:l))>=0)for(;i=Z[29328+(e<<3)>>3]*Z[(e+a<<3)+t>>3]+i,E=(0|e)!=(0|v),e=e+1|0,E;);if(Z[(t+160|0)+(l<<3)>>3]=i,e=(0|a)>0,a=a-1|0,!e)break}}if(i=0,(0|n)>=0)for(;e=n,n=n-1|0,i+=Z[(t+160|0)+(e<<3)>>3],e;);Z[f>>3]=u?-i:i,S=t+560|0,n=7&B,i=Z[f>>3],(0|F)<0?(Z[r>>3]=-i,n=0-n|0):Z[r>>3]=i}return S=f+16|0,n}function FA(A,r,f,e){var i,n=0,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=0,X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=0,I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=0,AA=0,rA=m(0),fA=m(0),iA=m(0),nA=m(0),aA=m(0),tA=m(0);S=i=S-240|0,o[A+16>>2]?(re(o[A+4>>2]),n=o[A+12>>2],G=o[n+4>>2],H=o[A+16>>2],_=o[H+4>>2],c=m(Zn[o[o[n>>2]+48>>2]](n)),g=o[A+16>>2],u=m(Zn[o[o[g>>2]+48>>2]](g)),g=o[A+4>>2],AA=o[A+8>>2],o[72+(A=i+160|0)>>2]=1,o[A+76>>2]=1,o[A+60>>2]=-1,a[A+52|0]=0,w[A+48>>2]=u,w[A+44>>2]=c,o[A+40>>2]=_,o[A+36>>2]=G,o[A+32>>2]=H,o[A+28>>2]=n,o[A+24>>2]=g,o[A+20>>2]=AA,o[A+4>>2]=0,o[A+8>>2]=1065353216,o[A+12>>2]=0,o[A+16>>2]=0,o[A>>2]=22908,o[i+152>>2]=1566444395,n=o[r+12>>2],o[i+32>>2]=o[r+8>>2],o[i+36>>2]=n,n=o[r+4>>2],o[i+24>>2]=o[r>>2],o[i+28>>2]=n,n=o[r+28>>2],o[i+48>>2]=o[r+24>>2],o[i+52>>2]=n,n=o[r+20>>2],o[i+40>>2]=o[r+16>>2],o[i+44>>2]=n,G=o[r+44>>2],o[(n=i- -64|0)>>2]=o[r+40>>2],o[n+4>>2]=G,n=o[r+36>>2],o[i+56>>2]=o[r+32>>2],o[i+60>>2]=n,n=o[r+60>>2],o[i+80>>2]=o[r+56>>2],o[i+84>>2]=n,n=o[r+52>>2],o[i+72>>2]=o[r+48>>2],o[i+76>>2]=n,r=o[f+12>>2],o[i+96>>2]=o[f+8>>2],o[i+100>>2]=r,r=o[f+4>>2],o[i+88>>2]=o[f>>2],o[i+92>>2]=r,r=o[f+20>>2],o[i+104>>2]=o[f+16>>2],o[i+108>>2]=r,r=o[f+28>>2],o[i+112>>2]=o[f+24>>2],o[i+116>>2]=r,r=o[f+44>>2],o[i+128>>2]=o[f+40>>2],o[i+132>>2]=r,r=o[f+36>>2],o[i+120>>2]=o[f+32>>2],o[i+124>>2]=r,r=o[f+52>>2],o[i+136>>2]=o[f+48>>2],o[i+140>>2]=r,r=o[f+60>>2],o[i+144>>2]=o[f+56>>2],o[i+148>>2]=r,eA(A,i+24|0,e,0,0)):(D=w[r+52>>2],C=w[r+56>>2],J=w[f+52>>2],x=w[f+56>>2],l=w[r+20>>2],s=w[r+36>>2],c=w[f+20>>2],u=w[f+36>>2],t=w[f+24>>2],k=w[r+24>>2],b=w[f+40>>2],h=w[r+40>>2],y=w[r+48>>2],rA=w[f+48>>2],n=o[A+12>>2],B=w[r+32>>2],Z=w[r+16>>2],Q=w[r>>2],E=w[r+4>>2],F=w[f+32>>2],R=w[f+16>>2],Y=w[f>>2],V=w[f+4>>2],d=w[f+8>>2],W=w[r+8>>2],A=o[A+20>>2],N=w[A+60>>2],p=w[(r=A- -64|0)>>2],v=w[A+56>>2],o[i+172>>2]=0,I=m(m(h*F)+m(m(W*Y)+m(k*R))),v=m(-v),T=m(m(h*u)+m(m(W*V)+m(k*c))),X=m(m(h*b)+m(m(W*d)+m(k*t))),w[i+168>>2]=m(m(I*v)-m(N*T))-m(p*X),U=m(m(s*F)+m(m(E*Y)+m(l*R))),j=m(m(s*u)+m(m(E*V)+m(l*c))),z=m(m(s*b)+m(m(E*d)+m(l*t))),w[i+164>>2]=m(m(U*v)-m(N*j))-m(p*z),P=m(m(B*F)+m(m(Q*Y)+m(Z*R))),O=m(m(B*u)+m(m(Q*V)+m(Z*c))),L=m(m(B*b)+m(m(Q*d)+m(Z*t))),w[i+160>>2]=m(m(P*v)-m(N*O))-m(p*L),G=i+160|0,Zn[o[o[n>>2]+64>>2]](i+24|0,n,G),l=w[A+60>>2],s=w[r>>2],fA=w[A+72>>2],k=w[A+56>>2],h=w[i+24>>2],B=w[i+28>>2],Z=w[i+32>>2],iA=w[f+52>>2],Q=w[f+24>>2],E=w[f+20>>2],nA=w[f+56>>2],W=w[f+40>>2],N=w[f+36>>2],aA=w[f+48>>2],p=w[f+8>>2],v=w[f>>2],$=w[f+4>>2],K=w[f+16>>2],q=w[f+32>>2],o[i+172>>2]=0,tA=m(m(C*b)+m(m(y*d)+m(D*t))),M=d,d=m(-rA),M=t=m(m(tA+m(m(m(M*d)-m(t*J))-m(b*x)))+m(m(Z*X)+m(m(h*L)+m(z*B)))),X=m(s*t),t=m(m(m(m(C*F)+m(m(y*Y)+m(D*R)))+m(m(m(Y*d)-m(R*J))-m(F*x)))+m(m(Z*I)+m(m(h*P)+m(U*B)))),b=m(m(m(m(C*u)+m(m(y*V)+m(D*c)))+m(m(m(V*d)-m(c*J))-m(u*x)))+m(m(Z*T)+m(m(h*O)+m(j*B)))),c=m(m(X+m(m(k*t)+m(l*b)))-fA),u=m(M-m(s*c)),t=m(t-m(k*c)),b=m(b-m(l*c)),w[i+168>>2]=nA+m(m(W*u)+m(m(q*t)+m(N*b))),w[i+164>>2]=iA+m(m(u*Q)+m(m(t*K)+m(b*E))),w[i+160>>2]=aA+m(m(u*p)+m(m(t*v)+m(b*$))),o[i+20>>2]=0,w[i+16>>2]=m(W*s)+m(m(q*k)+m(l*N)),w[i+12>>2]=m(Q*s)+m(m(K*k)+m(l*E)),w[i+8>>2]=m(p*s)+m(m(v*k)+m(l*$)),Zn[o[o[e>>2]+16>>2]](e,i+8|0,G,c)),S=i+240|0}function RA(A,r){var f=0,e=m(0),i=m(0),n=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=0;o[A+372>>2]=0,o[A+376>>2]=0,o[A+252>>2]=2,o[A+604>>2]=1065353216,o[A+608>>2]=1065353216,o[A+408>>2]=1065353216,o[A+412>>2]=1065353216,o[A+472>>2]=0,o[A+476>>2]=0,o[A+380>>2]=0,o[A+384>>2]=0,o[A+388>>2]=0,o[A+392>>2]=0,o[A+396>>2]=0,o[A+400>>2]=0,o[A+612>>2]=1065353216,o[A+616>>2]=0,o[A+420>>2]=0,o[A+424>>2]=0,o[A+416>>2]=1065353216,o[A+428>>2]=0,o[A+432>>2]=0,o[A+436>>2]=0,o[A+440>>2]=0,o[A+444>>2]=0,o[A+448>>2]=0,o[A+452>>2]=0,o[A+480>>2]=0,o[A+484>>2]=0,o[A+488>>2]=0,o[A+492>>2]=0,o[A+496>>2]=0,o[A+500>>2]=0,t=w[r+92>>2],e=w[r+96>>2],w[A+508>>2]=em(1)?m(1):e,w[A+504>>2]=tm(1)?m(1):t,w[A+532>>2]=w[r+116>>2],w[A+536>>2]=w[r+120>>2],f=o[r+4>>2],o[A+668>>2]=0,o[A+672>>2]=0,o[A+540>>2]=f,a[A+512|0]=v[r+124|0],w[A+516>>2]=w[r+128>>2],w[A+520>>2]=w[r+132>>2],w[A+524>>2]=w[r+136>>2],w[A+528>>2]=w[r+140>>2],f?Zn[o[o[f>>2]+8>>2]](f,A+4|0):(f=o[r+12>>2],o[A+4>>2]=o[r+8>>2],o[A+8>>2]=f,f=o[r+20>>2],o[A+12>>2]=o[r+16>>2],o[A+16>>2]=f,f=o[r+36>>2],o[A+28>>2]=o[r+32>>2],o[A+32>>2]=f,f=o[r+28>>2],o[A+20>>2]=o[r+24>>2],o[A+24>>2]=f,f=o[r+44>>2],o[A+36>>2]=o[r+40>>2],o[A+40>>2]=f,f=o[r+52>>2],o[A+44>>2]=o[r+48>>2],o[A+48>>2]=f,E=o[4+(f=r- -64|0)>>2],o[A+60>>2]=o[f>>2],o[A+64>>2]=E,f=o[r+60>>2],o[A+52>>2]=o[r+56>>2],o[A+56>>2]=f),o[A+132>>2]=0,o[A+136>>2]=0,f=o[A+8>>2],o[A+68>>2]=o[A+4>>2],o[A+72>>2]=f,o[A+156>>2]=0,o[A+160>>2]=0,o[A+148>>2]=0,o[A+152>>2]=0,o[A+140>>2]=0,o[A+144>>2]=0,f=o[A+24>>2],o[A+84>>2]=o[A+20>>2],o[A+88>>2]=f,f=o[A+16>>2],o[A+76>>2]=o[A+12>>2],o[A+80>>2]=f,f=o[A+32>>2],o[A+92>>2]=o[A+28>>2],o[A+96>>2]=f,f=o[A+40>>2],o[A+100>>2]=o[A+36>>2],o[A+104>>2]=f,f=o[A+48>>2],o[A+108>>2]=o[A+44>>2],o[A+112>>2]=f,f=o[A+56>>2],o[A+116>>2]=o[A+52>>2],o[A+120>>2]=f,f=o[A+64>>2],o[A+124>>2]=o[A+60>>2],o[A+128>>2]=f,w[A+228>>2]=w[r+100>>2],w[A+236>>2]=w[r+104>>2],w[A+240>>2]=w[r+108>>2],w[A+232>>2]=w[r+112>>2],Zn[o[o[A>>2]+8>>2]](A,o[r+72>>2]),f=o[8963],o[8963]=f+1,o[A+568>>2]=f,t=m(0),f=o[A+204>>2],(e=w[r>>2])==m(0)?f|=1:(t=m(m(1)/e),f&=-2),w[A+404>>2]=t,o[A+204>>2]=f,o[A+436>>2]=0,w[A+424>>2]=e*w[A+440>>2],w[A+432>>2]=e*w[A+448>>2],w[A+428>>2]=e*w[A+444>>2],i=w[r+84>>2],n=w[r+80>>2],e=w[r+76>>2],o[A+564>>2]=8,o[A+368>>2]=0,o[A+352>>2]=0,o[A+336>>2]=0,o[A+468>>2]=0,e=e!=m(0)?m(m(1)/e):m(0),w[A+456>>2]=e,n=n!=m(0)?m(m(1)/n):m(0),w[A+460>>2]=n,i=i!=m(0)?m(m(1)/i):m(0),w[A+464>>2]=i,k=w[A+12>>2],c=m(i*k),d=w[A+4>>2],b=m(e*d),h=w[A+8>>2],u=m(n*h),w[A+324>>2]=m(k*c)+m(m(d*b)+m(h*u)),B=w[A+28>>2],Z=w[A+20>>2],G=w[A+24>>2],w[A+328>>2]=m(B*c)+m(m(Z*b)+m(u*G)),Q=w[A+44>>2],l=m(Q*c),c=w[A+36>>2],s=m(c*b),b=w[A+40>>2],w[A+332>>2]=l+m(s+m(u*b)),u=m(i*B),l=m(e*Z),s=m(n*G),w[A+340>>2]=m(k*u)+m(m(d*l)+m(h*s)),w[A+344>>2]=m(B*u)+m(m(Z*l)+m(G*s)),w[A+348>>2]=m(Q*u)+m(m(c*l)+m(s*b)),i=m(i*Q),e=m(e*c),n=m(n*b),w[A+356>>2]=m(k*i)+m(m(d*e)+m(h*n)),w[A+360>>2]=m(B*i)+m(m(Z*e)+m(G*n)),w[A+364>>2]=m(Q*i)+m(m(c*e)+m(b*n)),e=w[A+408>>2],n=w[A+412>>2],i=w[A+416>>2],o[A+596>>2]=0,o[A+600>>2]=0,o[A+588>>2]=0,o[A+592>>2]=0,o[A+580>>2]=0,o[A+584>>2]=0,o[A+572>>2]=0,o[A+576>>2]=0,w[A+628>>2]=t*i,w[A+624>>2]=t*n,w[A+620>>2]=t*e,o[A+664>>2]=0,o[A+656>>2]=0,o[A+660>>2]=0,o[A+648>>2]=0,o[A+652>>2]=0,o[A+640>>2]=0,o[A+644>>2]=0,o[A+632>>2]=0,o[A+636>>2]=0}function YA(A,r,f,e,i,n,a,t,c,b,u,l,s){var k=m(0),d=m(0),h=0,B=m(0),Z=m(0),Q=0,E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0);b=G(o[c+24>>2],b);A:{r:{f:switch(o[r+84>>2]-3|0){case 1:B=w[(h=l?a:i)+8>>2],W=w[h>>2],V=w[h+4>>2],F=w[(h=l?t:n)+8>>2],R=w[h>>2],p=w[h+4>>2],d=w[u+8>>2],k=w[u>>2],Z=w[u+4>>2],jr(A,f,e,c,b,u,l,s),h=o[c+28>>2]+(b<<2)|0,Y=m(l?-1:1),E=m(Y*m(m(w[c>>2]*w[r+12>>2])*w[r+72>>2])),w[h>>2]=E,k=m(m(m(B*d)+m(m(W*k)+m(V*Z)))-m(m(F*d)+m(m(R*k)+m(Z*p)))),B=m(E-m(k*w[r+12>>2]));e:{i:{if(l){if(d=m(0),Z=m(34028234663852886e22),!(B>m(0)))break e;if(E<(B=m(k*m(-w[r+8>>2]))))break i;break e}if(Z=m(0),d=m(-34028234663852886e22),!(B(B=m(k*m(-w[r+8>>2])))))break e}w[h>>2]=B}w[(h=b<<2)+o[c+36>>2]>>2]=d,w[h+o[c+40>>2]>>2]=Z,w[h+o[c+32>>2]>>2]=w[r+16>>2],jr(A,f,e,c,b=o[c+24>>2]+b|0,u,l,s),h=o[c+28>>2]+(b<<2)|0,B=m(Y*m(m(w[c>>2]*w[r+12>>2])*w[r+76>>2])),w[h>>2]=B,E=m(B-m(k*w[r+12>>2]));e:{i:{if(l){if(Z=m(0),d=m(-34028234663852886e22),!(E(k=m(k*m(-w[r+8>>2]))))break i;break e}if(d=m(0),Z=m(34028234663852886e22),!(E>m(0)))break e;if(!(B<(k=m(k*m(-w[r+8>>2])))))break e}w[h>>2]=k}Q=r+16|0,w[(h=b<<2)+o[c+36>>2]>>2]=d,w[h+o[c+40>>2]>>2]=Z,h=2;break r;case 0:break f;default:break A}jr(A,f,e,c,b,u,l,s),w[(h=b<<2)+o[c+28>>2]>>2]=m(m(w[c>>2]*w[r+12>>2])*w[r+72>>2])*m(0|(l?-1:1)),o[h+o[c+36>>2]>>2]=-8388609,o[h+o[c+40>>2]>>2]=2139095039,Q=r+16|0,h=1}w[o[c+32>>2]+(b<<2)>>2]=w[Q>>2],b=o[c+24>>2]+b|0}return v[r+28|0]&&(!v[r+40|0]&&(jr(A,f,e,c,b,u,l,s),d=w[r+32>>2],d=Lf(w[r+80>>2],w[r>>2],w[r+4>>2],l?d:m(-d),m(w[c>>2]*w[r+20>>2])),w[(Q=b<<2)+o[c+28>>2]>>2]=d*w[r+32>>2],w[Q+o[c+36>>2]>>2]=-w[r+36>>2],w[Q+o[c+40>>2]>>2]=w[r+36>>2],w[Q+o[c+32>>2]>>2]=w[r+24>>2],h=h+1|0,b=o[c+24>>2]+b|0,!v[r+28|0]|!v[r+40|0])||(d=w[r+44>>2],k=m(w[r+80>>2]-d),l&&(d=(Q=k>m(3.1415927410125732))?m(d+m(6.2831854820251465)):d,(k=Q?m(k+m(-6.2831854820251465)):k)>2],E=k>2],(Z=w[r>>2])>(B=w[r+4>>2])?(B=km(0)?d:m(-34028234663852886e22)):(B=km(0)&&d>Z?d:Z),Z=Lf(p,k,B,W,m(w[c>>2]*w[r+20>>2]))),w[(Q=b<<2)+o[c+28>>2]>>2]=m(E*Z)*m(0|(l?-1:1)),w[Q+o[c+36>>2]>>2]=-w[r+36>>2],w[Q+o[c+40>>2]>>2]=w[r+36>>2],w[Q+o[c+32>>2]>>2]=w[r+24>>2],h=h+1|0,b=o[c+24>>2]+b|0)),v[r+48|0]&&(B=w[r+68>>2],W=w[r+80>>2],jr(A,f,e,c,b,u,l,s),f=l?a:i,d=w[u+8>>2],k=w[u>>2],Z=w[u+4>>2],p=m(m(w[f+8>>2]*d)+m(m(w[f>>2]*k)+m(w[f+4>>2]*Z))),E=m(p-m(m(w[(f=l?t:n)+8>>2]*d)+m(m(w[f>>2]*k)+m(Z*w[f+4>>2])))),d=m(m(1)/w[o[A+32>>2]+404>>2]),Z=(k=m(m(1)/w[o[A+28>>2]+404>>2]))>d?d:k,W=m(W-B),B=w[r+60>>2],k=m(m(1)/w[c>>2]),d=w[r+52>>2],!v[r+56|0]|!(m(k*m(N(m(d/Z))))>m(.25))||(d=m(m(m(m(m(1)/k)/k)*m(.0625))*Z)),A=b<<2,F=m(k*m(W*d)),p=k,R=m(E*m(-(v[r+64|0]&&Z>2]>>2]=m(Z*k)+E,k=(r=d>Z)?d:Z,d=r?Z:d,l?(w[A+o[c+36>>2]>>2]=k>2]>>2]=d>m(0)?m(0):d,w[(A=b<<2)+o[c+40>>2]>>2]=k>2]>>2]=0,h=h+1|0),h}function VA(A,r,f,e,i,n){return A=ne(A,12,r,f),o[A>>2]=23516,r=o[e+12>>2],o[A+56>>2]=o[e+8>>2],o[A+60>>2]=r,r=o[e+4>>2],o[A+48>>2]=o[e>>2],o[A+52>>2]=r,r=o[e+28>>2],o[A+72>>2]=o[e+24>>2],o[A+76>>2]=r,f=o[e+20>>2],o[(r=A- -64|0)>>2]=o[e+16>>2],o[r+4>>2]=f,r=o[e+44>>2],o[A+88>>2]=o[e+40>>2],o[A+92>>2]=r,r=o[e+36>>2],o[A+80>>2]=o[e+32>>2],o[A+84>>2]=r,r=o[e+60>>2],o[A+104>>2]=o[e+56>>2],o[A+108>>2]=r,r=o[e+52>>2],o[A+96>>2]=o[e+48>>2],o[A+100>>2]=r,r=o[i+12>>2],o[A+120>>2]=o[i+8>>2],o[A+124>>2]=r,r=o[i+4>>2],o[A+112>>2]=o[i>>2],o[A+116>>2]=r,r=o[i+20>>2],o[A+128>>2]=o[i+16>>2],o[A+132>>2]=r,r=o[i+28>>2],o[A+136>>2]=o[i+24>>2],o[A+140>>2]=r,r=o[i+36>>2],o[A+144>>2]=o[i+32>>2],o[A+148>>2]=r,r=o[i+44>>2],o[A+152>>2]=o[i+40>>2],o[A+156>>2]=r,r=o[i+52>>2],o[A+160>>2]=o[i+48>>2],o[A+164>>2]=r,r=o[i+60>>2],o[A+168>>2]=o[i+56>>2],o[A+172>>2]=r,o[A+680>>2]=0,o[A+684>>2]=0,o[A+688>>2]=0,o[A+692>>2]=0,o[A+696>>2]=0,o[A+700>>2]=0,o[A+704>>2]=0,o[A+708>>2]=0,o[A+712>>2]=0,o[A+716>>2]=0,o[A+720>>2]=0,o[A+724>>2]=0,o[A+728>>2]=1045220557,o[A+732>>2]=1045220557,o[A+736>>2]=1045220557,o[A+756>>2]=0,o[A+748>>2]=0,o[A+752>>2]=0,o[A+740>>2]=0,o[A+744>>2]=0,o[A+760>>2]=1063675494,o[A+764>>2]=1063675494,o[A+768>>2]=1063675494,o[A+812>>2]=0,o[A+804>>2]=0,o[A+808>>2]=0,o[A+828>>2]=0,o[A+820>>2]=0,o[A+824>>2]=0,a[A+838|0]=0,t[A+836>>1]=0,o[A+848>>2]=0,o[A+840>>2]=0,o[A+844>>2]=0,a[A+858|0]=0,t[A+856>>1]=0,o[A+868>>2]=0,o[A+860>>2]=0,o[A+864>>2]=0,o[A+884>>2]=0,o[A+876>>2]=0,o[A+880>>2]=0,o[A+900>>2]=0,o[A+892>>2]=0,o[A+896>>2]=0,a[A+793|0]=0,a[A+794|0]=0,a[A+795|0]=0,a[A+796|0]=0,a[A+797|0]=0,a[A+798|0]=0,a[A+799|0]=0,a[A+800|0]=0,o[A+788>>2]=0,o[A+792>>2]=0,o[A+780>>2]=0,o[A+784>>2]=0,o[A+772>>2]=0,o[A+776>>2]=0,o[A+964>>2]=0,o[A+956>>2]=0,o[A+960>>2]=0,o[A+948>>2]=0,o[A+952>>2]=0,o[A+940>>2]=0,o[A+944>>2]=0,o[A+932>>2]=0,o[A+936>>2]=0,o[A+924>>2]=0,o[A+928>>2]=0,o[A+916>>2]=0,o[A+920>>2]=0,o[A+908>>2]=0,o[A+912>>2]=0,a[A+1032|0]=0,o[A+1028>>2]=0,a[A+1024|0]=0,o[A+1020>>2]=0,a[A+1016|0]=0,o[A+1012>>2]=0,a[A+1008|0]=0,o[A+1e3>>2]=0,o[A+1004>>2]=1036831949,a[A+996|0]=0,o[A+992>>2]=0,o[A+984>>2]=0,o[A+988>>2]=1063675494,o[A+976>>2]=0,o[A+980>>2]=1045220557,o[A+968>>2]=1065353216,o[A+972>>2]=-1082130432,o[A+1052>>2]=0,o[(r=A+1044|0)>>2]=0,o[r+4>>2]=0,o[(r=A+1036|0)>>2]=0,o[r+4>>2]=0,a[A+1120|0]=0,o[A+1116>>2]=0,a[A+1112|0]=0,o[A+1108>>2]=0,a[A+1104|0]=0,o[A+1100>>2]=0,a[A+1096|0]=0,o[(r=A+1088|0)>>2]=0,o[r+4>>2]=1036831949,a[A+1084|0]=0,o[A+1080>>2]=0,o[(r=A+1072|0)>>2]=0,o[r+4>>2]=1063675494,o[(r=A+1064|0)>>2]=0,o[r+4>>2]=1045220557,o[(r=A+1056|0)>>2]=1065353216,o[r+4>>2]=-1082130432,o[A+1140>>2]=0,o[(r=A+1132|0)>>2]=0,o[r+4>>2]=0,o[(r=A+1124|0)>>2]=0,o[r+4>>2]=0,a[A+1208|0]=0,o[A+1204>>2]=0,a[A+1200|0]=0,o[A+1196>>2]=0,a[A+1192|0]=0,o[A+1188>>2]=0,a[A+1184|0]=0,o[(r=A+1176|0)>>2]=0,o[r+4>>2]=1036831949,a[A+1172|0]=0,o[A+1168>>2]=0,o[(r=A+1160|0)>>2]=0,o[r+4>>2]=1063675494,o[(r=A+1152|0)>>2]=0,o[r+4>>2]=1045220557,o[(r=A+1144|0)>>2]=1065353216,o[r+4>>2]=-1082130432,o[A+1228>>2]=0,o[(r=A+1220|0)>>2]=0,o[r+4>>2]=0,o[(r=A+1212|0)>>2]=0,o[r+4>>2]=0,o[A+1456>>2]=0,o[A+1232>>2]=n,fA(A,o[A+28>>2]+4|0,o[A+32>>2]+4|0),A}function gA(A){A|=0;var r,f=0,e=0,i=0,n=m(0),t=0,c=m(0),b=0,u=0,l=0,s=0,k=m(0),d=m(0),h=m(0),B=m(0);if(S=r=S-208|0,0|Zn[o[o[A>>2]+20>>2]](A)){if(e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+100>>2]](e),e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+8>>2]](r+80|0,e),e=0|Zn[o[o[A>>2]+20>>2]](A),8&Zn[o[o[e>>2]+56>>2]](e)&&(e=o[A+24>>2])&&!((0|(b=0|Zn[o[o[e>>2]+36>>2]](e)))<=0))for(s=r+176|0;;){if(t=0,e=o[A+24>>2],u=0|Zn[o[o[e>>2]+40>>2]](e,i),(0|(l=o[u+844>>2]))>0)for(;e=0|Zn[o[o[A>>2]+20>>2]](A),f=u+G(t,208)|0,Zn[o[o[e>>2]+40>>2]](e,f+36|0,f+68|0,w[f+84>>2],o[f+168>>2],s),(0|l)!=(0|(t=t+1|0)););if((0|b)==(0|(i=i+1|0)))break}if(e=0|Zn[o[o[A>>2]+20>>2]](A),!(!(3&Zn[o[o[e>>2]+56>>2]](e))|o[A+8>>2]<=0))for(b=r+160|0,s=r+96|0,u=r+112|0,l=r+128|0,e=r+144|0,t=0;;){if(i=o[o[A+16>>2]+(t<<2)>>2],!(32&v[i+204|0])){if(0|Zn[o[o[A>>2]+20>>2]](A)&&(f=0|Zn[o[o[A>>2]+20>>2]](A),1&Zn[o[o[f>>2]+56>>2]](f))){A:{switch(o[i+220>>2]-1|0){case 0:f=o[r+92>>2],o[r+72>>2]=o[r+88>>2],o[r+76>>2]=f,f=o[r+84>>2],o[r+64>>2]=o[r+80>>2],o[r+68>>2]=f;break A;case 1:f=o[s+12>>2],o[r+72>>2]=o[s+8>>2],o[r+76>>2]=f,f=o[s+4>>2],o[r+64>>2]=o[s>>2],o[r+68>>2]=f;break A;case 2:f=o[u+12>>2],o[r+72>>2]=o[u+8>>2],o[r+76>>2]=f,f=o[u+4>>2],o[r+64>>2]=o[u>>2],o[r+68>>2]=f;break A;case 3:f=o[l+12>>2],o[r+72>>2]=o[l+8>>2],o[r+76>>2]=f,f=o[l+4>>2],o[r+64>>2]=o[l>>2],o[r+68>>2]=f;break A;case 4:f=o[e+12>>2],o[r+72>>2]=o[e+8>>2],o[r+76>>2]=f,f=o[e+4>>2],o[r+64>>2]=o[e>>2],o[r+68>>2]=f;break A}o[r+72>>2]=1050253722,o[r+76>>2]=0,o[r+64>>2]=1050253722,o[r+68>>2]=1050253722}1&a[i+205|0]&&(f=o[i+320>>2],o[r+72>>2]=o[i+316>>2],o[r+76>>2]=f,f=o[i+312>>2],o[r+64>>2]=o[i+308>>2],o[r+68>>2]=f),Zn[o[o[A>>2]+28>>2]](A,i+4|0,o[i+192>>2],r- -64|0)}(f=o[A+72>>2])&&2&Zn[o[o[f>>2]+56>>2]](f)&&(f=o[b+12>>2],o[r+40>>2]=o[b+8>>2],o[r+44>>2]=f,f=o[b+4>>2],o[r+32>>2]=o[b>>2],o[r+36>>2]=f,f=o[i+192>>2],Zn[o[o[f>>2]+8>>2]](f,i+4|0,r- -64|0,r+48|0),n=w[8297],w[r+64>>2]=w[r+64>>2]-n,w[r+68>>2]=w[r+68>>2]-n,w[r+72>>2]=w[r+72>>2]-n,w[r+48>>2]=n+w[r+48>>2],w[r+52>>2]=n+w[r+52>>2],w[r+56>>2]=n+w[r+56>>2],3&v[i+204|0]|!v[A+44|0]|2!=o[i+252>>2]||(f=o[i+192>>2],Zn[o[o[f>>2]+8>>2]](f,i+68|0,r+16|0,r),k=m(w[r+16>>2]-n),w[r+16>>2]=k,d=m(w[r+20>>2]-n),w[r+20>>2]=d,c=m(w[r+24>>2]-n),w[r+24>>2]=c,h=m(n+w[r>>2]),w[r>>2]=h,B=m(n+w[r+4>>2]),w[r+4>>2]=B,n=m(n+w[r+8>>2]),w[r+8>>2]=n,k>2]&&(w[r+64>>2]=k),w[r+68>>2]>d&&(w[r+68>>2]=d),w[r+72>>2]>c&&(w[r+72>>2]=c),(c=w[r+28>>2])>2]&&(w[r+76>>2]=c),w[r+48>>2]>2]=h),w[r+52>>2]>2]=B),n>w[r+56>>2]&&(w[r+56>>2]=n),(c=w[r+12>>2])>w[r+60>>2]&&(w[r+60>>2]=c)),f=o[A+72>>2],Zn[o[o[f>>2]+60>>2]](f,r- -64|0,r+48|0,r+32|0))}if(!((0|(t=t+1|0))>2]))break}}S=r+208|0}function XA(A,r,f,e,i,n){var t=0,c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),Q=0,E=0,W=0,N=0,p=m(0),F=m(0),R=0,Y=m(0),V=0,g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0);if(Q=u=o[A+88>>2],(0|u)==o[A+92>>2]&&!((0|u)>=(0|(W=u?u<<1:1)))){if(W?(o[8488]=o[8488]+1,N=0|Zn[o[8290]](G(W,152),16),t=o[A+88>>2]):t=u,!((0|t)<=0)){if(Q=0,1!=(0|t))for(V=-2&t;pr((E=G(Q,152))+N|0,E+o[A+96>>2]|0,152),pr((E=G(1|Q,152))+N|0,E+o[A+96>>2]|0,152),Q=Q+2|0,(0|(R=R+2|0))!=(0|V););1&t&&pr((t=G(Q,152))+N|0,t+o[A+96>>2]|0,152)}!(t=o[A+96>>2])||!t|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](t)),o[A+96>>2]=N,a[A+100|0]=1,o[A+92>>2]=W,Q=o[A+88>>2]}o[A+88>>2]=Q+1,t=o[A+96>>2]+G(u,152)|0,o[t+140>>2]=i,o[t+16>>2]=0,o[t+20>>2]=0,o[t+48>>2]=-2147483648,o[t+52>>2]=-2147483648,o[t+24>>2]=0,o[t+28>>2]=0,o[t+56>>2]=-2147483648,o[t+60>>2]=0,u=o[A+16>>2],A=o[240+(u+G(e,244)|0)>>2],i=o[240+(u+G(f,244)|0)>>2],o[t+148>>2]=e,o[t+144>>2]=f,o[t+132>>2]=0,w[t+104>>2]=n,o[t+96>>2]=0,o[t+100>>2]=0,c=w[r>>2],b=w[r+4>>2],l=w[r+8>>2],o[t+12>>2]=0,d=m(-l),w[t+8>>2]=d,h=m(-b),w[t+4>>2]=h,B=m(-c),w[t>>2]=B,c=m(0),i?(c=m(m(m(w[i+364>>2]*d)+m(m(w[i+356>>2]*B)+m(w[i+360>>2]*h)))*w[i+612>>2]),s=m(m(m(w[i+348>>2]*d)+m(m(w[i+340>>2]*B)+m(w[i+344>>2]*h)))*w[i+608>>2]),b=m(m(m(w[i+332>>2]*d)+m(m(w[i+324>>2]*B)+m(w[i+328>>2]*h)))*w[i+604>>2])):b=m(0),w[t+64>>2]=b,o[t+76>>2]=0,w[t+72>>2]=c,w[t+68>>2]=s,c=w[r>>2],b=w[r+4>>2],l=w[r+8>>2],w[t+44>>2]=w[r+12>>2],w[t+40>>2]=l,w[t+36>>2]=b,w[t+32>>2]=c,A?(k=m(m(m(w[A+364>>2]*l)+m(m(w[A+356>>2]*c)+m(b*w[A+360>>2])))*w[A+612>>2]),Z=m(m(m(w[A+348>>2]*l)+m(m(w[A+340>>2]*c)+m(b*w[A+344>>2])))*w[A+608>>2]),s=m(m(m(w[A+332>>2]*l)+m(m(w[A+324>>2]*c)+m(b*w[A+328>>2])))*w[A+604>>2])):s=m(0),w[t+80>>2]=s,o[t+92>>2]=0,w[t+88>>2]=k,w[t+84>>2]=Z,Z=m(0),k=m(0),i?(Z=m(m(w[i+332>>2]*d)+m(m(w[i+324>>2]*B)+m(w[i+328>>2]*h))),k=m(m(w[i+348>>2]*d)+m(m(w[i+340>>2]*B)+m(w[i+344>>2]*h))),s=m(m(w[i+364>>2]*d)+m(m(w[i+356>>2]*B)+m(w[i+360>>2]*h)))):s=m(0),Z=m(m(m(s*d)+m(m(Z*B)+m(k*h)))+m(0)),A?(p=m(m(w[A+348>>2]*l)+m(m(w[A+340>>2]*c)+m(b*w[A+344>>2]))),F=m(m(w[A+332>>2]*l)+m(m(w[A+324>>2]*c)+m(w[A+328>>2]*b))),k=m(m(w[A+364>>2]*l)+m(m(w[A+356>>2]*c)+m(b*w[A+360>>2])))):k=m(0),Y=m(m(1)/m(Z+m(m(k*l)+m(m(F*c)+m(p*b))))),w[t+108>>2]=Y,F=m(0),Z=m(0),k=m(0),p=m(0),i&&(r=u+G(f,244)|0,F=m(w[r+176>>2]+w[r+208>>2]),g=w[r+200>>2],p=w[r+196>>2],Z=m(m(w[r+180>>2]+w[r+212>>2])*m(0)),X=w[r+192>>2],k=m(w[r+184>>2]+w[r+216>>2])),s=m(-0),A&&(A=u+G(e,244)|0,D=m(w[A+176>>2]+w[A+208>>2]),C=m(w[A+184>>2]+w[A+216>>2]),J=w[A+192>>2],x=w[A+200>>2],y=w[A+196>>2],s=m(m(w[A+180>>2]+w[A+212>>2])*m(-0))),w[t+124>>2]=n,w[t+116>>2]=0,w[t+120>>2]=-n,w[t+112>>2]=Y*m(m(0)-m(m(m(m(k*m(0))+m(m(F*m(0))+Z))+m(m(d*g)+m(m(B*X)+m(p*h))))+m(m(m(C*m(-0))+m(m(D*m(-0))+s))+m(m(l*x)+m(m(c*J)+m(b*y))))))}function DA(A){var r=0,f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0;A:if(A|=0){n=(e=A-8|0)+(A=-8&(r=o[A-4>>2]))|0;r:if(!(1&r)){if(!(3&r))break A;if((e=e-(r=o[e>>2])|0)>>>0>>0<=255){if(i=r>>>3|0,(0|(r=o[e+12>>2]))==(0|(f=o[e+8>>2]))){c=35936,b=o[8984]&Le(i),o[c>>2]=b;break r}o[f+12>>2]=r,o[r+8>>2]=f;break r}if(a=o[e+24>>2],(0|e)!=(0|(r=o[e+12>>2]))){f=o[e+8>>2],o[f+12>>2]=r,o[r+8>>2]=f;break f}if(!(f=o[(i=e+20|0)>>2])){if(!(f=o[e+16>>2]))break e;i=e+16|0}for(;t=i,(f=o[(i=(r=f)+20|0)>>2])||(i=r+16|0,f=o[r+16>>2]););o[t>>2]=0;break f}if(3&~(r=o[n+4>>2]))break r;return o[8986]=A,o[n+4>>2]=-2&r,o[e+4>>2]=1|A,void(o[n>>2]=A)}r=0}if(a){f=o[e+28>>2];f:{if(o[(i=36240+(f<<2)|0)>>2]==(0|e)){if(o[i>>2]=r,r)break f;c=35940,b=o[8985]&Le(f),o[c>>2]=b;break r}if(o[a+(o[a+16>>2]==(0|e)?16:20)>>2]=r,!r)break r}o[r+24>>2]=a,(f=o[e+16>>2])&&(o[r+16>>2]=f,o[f+24>>2]=r),(f=o[e+20>>2])&&(o[r+20>>2]=f,o[f+24>>2]=r)}}if(!(e>>>0>=n>>>0)&&1&(r=o[n+4>>2])){r:{f:{e:{i:{if(!(2&r)){if(o[8990]==(0|n)){if(o[8990]=e,A=o[8987]+A|0,o[8987]=A,o[e+4>>2]=1|A,o[8989]!=(0|e))break A;return o[8986]=0,void(o[8989]=0)}if(o[8989]==(0|n))return o[8989]=e,A=o[8986]+A|0,o[8986]=A,o[e+4>>2]=1|A,void(o[A+e>>2]=A);if(A=(-8&r)+A|0,r>>>0<=255){if(i=r>>>3|0,(0|(r=o[n+12>>2]))==(0|(f=o[n+8>>2]))){c=35936,b=o[8984]&Le(i),o[c>>2]=b;break f}o[f+12>>2]=r,o[r+8>>2]=f;break f}if(a=o[n+24>>2],(0|n)!=(0|(r=o[n+12>>2]))){f=o[n+8>>2],o[f+12>>2]=r,o[r+8>>2]=f;break e}if(!(f=o[(i=n+20|0)>>2])){if(!(f=o[n+16>>2]))break i;i=n+16|0}for(;t=i,(f=o[(i=(r=f)+20|0)>>2])||(i=r+16|0,f=o[r+16>>2]););o[t>>2]=0;break e}o[n+4>>2]=-2&r,o[e+4>>2]=1|A,o[A+e>>2]=A;break r}r=0}if(a){f=o[n+28>>2];e:{if(o[(i=36240+(f<<2)|0)>>2]==(0|n)){if(o[i>>2]=r,r)break e;c=35940,b=o[8985]&Le(f),o[c>>2]=b;break f}if(o[a+(o[a+16>>2]==(0|n)?16:20)>>2]=r,!r)break f}o[r+24>>2]=a,(f=o[n+16>>2])&&(o[r+16>>2]=f,o[f+24>>2]=r),(f=o[n+20>>2])&&(o[r+20>>2]=f,o[f+24>>2]=r)}}if(o[e+4>>2]=1|A,o[A+e>>2]=A,o[8989]==(0|e))return void(o[8986]=A)}if(A>>>0<=255)return r=35976+(-8&A)|0,(f=o[8984])&(A=1<<(A>>>3))?A=o[r+8>>2]:(o[8984]=A|f,A=r),o[r+8>>2]=e,o[A+12>>2]=e,o[e+12>>2]=r,void(o[e+8>>2]=A);f=31,A>>>0<=16777215&&(f=62+((A>>>38-(r=E(A>>>8|0))&1)-(r<<1)|0)|0),o[e+28>>2]=f,o[e+16>>2]=0,o[e+20>>2]=0,r=36240+(f<<2)|0;r:{f:{if((i=o[8985])&(t=1<>>1|0):0),r=o[r>>2];;){if(i=r,(-8&o[r+4>>2])==(0|A))break f;if(r=f>>>29|0,f<<=1,!(r=o[16+(t=i+(4&r)|0)>>2]))break}o[t+16>>2]=e,o[e+24>>2]=i}else o[8985]=i|t,o[r>>2]=e,o[e+24>>2]=r;o[e+12>>2]=e,o[e+8>>2]=e;break r}A=o[i+8>>2],o[A+12>>2]=e,o[i+8>>2]=e,o[e+24>>2]=0,o[e+12>>2]=i,o[e+8>>2]=A}A=o[8992]-1|0,o[8992]=A||-1}}}function CA(A,r,f,e,i,n,t,c,b){var u,l=0,s=0,k=0,d=0,h=0,B=0,Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),N=0,p=m(0),F=0,R=0,Y=m(0),V=0,g=0;if(S=u=S-32|0,A){if(!((0|(B=o[c+4>>2]))>127)){if(o[c+8>>2]<=127){if(o[8488]=o[8488]+1,d=0|Zn[o[8290]](512,16),!((0|(h=o[c+4>>2]))<=0)){if(h>>>0>=4)for(F=-4&h;o[(s=l<<2)+d>>2]=o[s+o[c+12>>2]>>2],o[(N=4|s)+d>>2]=o[N+o[c+12>>2]>>2],o[(N=8|s)+d>>2]=o[N+o[c+12>>2]>>2],o[(s|=12)+d>>2]=o[s+o[c+12>>2]>>2],l=l+4|0,(0|F)!=(0|(R=R+4|0)););if(s=3&h)for(;o[(h=l<<2)+d>>2]=o[h+o[c+12>>2]>>2],l=l+1|0,(0|s)!=(0|(k=k+1|0)););}!(l=o[c+12>>2])||!l|!v[c+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](l)),o[c+12>>2]=d,a[c+16|0]=1,o[c+8>>2]=128}if(k=0-(l=B)&3)for(;o[o[c+12>>2]+(l<<2)>>2]=0,l=l+1|0,(0|k)!=(0|(G=G+1|0)););if(!(B-125>>>0<3))for(;o[(G=l<<2)+o[c+12>>2]>>2]=0,o[4+(G+o[c+12>>2]|0)>>2]=0,o[8+(G+o[c+12>>2]|0)>>2]=0,o[12+(G+o[c+12>>2]|0)>>2]=0,128!=(0|(l=l+4|0)););}for(o[c+4>>2]=128,o[o[c+12>>2]>>2]=A,k=126,G=1;;){A=o[c+12>>2],B=o[A+(R=(l=G-1|0)<<2)>>2],Q=w[B>>2],E=w[B+4>>2],Z=w[t>>2],W=w[t+4>>2],w[u+8>>2]=w[B+8>>2]-w[t+8>>2],w[u+4>>2]=E-W,w[u>>2]=Q-Z,Q=w[B+16>>2],E=w[B+20>>2],Z=w[n>>2],W=w[n+4>>2],w[u+24>>2]=w[B+24>>2]-w[n+8>>2],w[u+20>>2]=E-W,w[u+16>>2]=Q-Z,d=o[e>>2],W=w[r>>2],p=w[f>>2],Q=m(m(w[(d<<4)+u>>2]-W)*p),Z=w[f+4>>2],s=o[e+4>>2],Y=w[r+4>>2];A:if(!(Q>(E=m(Z*m(w[4+((1-s<<4)+u|0)>>2]-Y)))||(Z=m(m(w[4+((s<<4)+u|0)>>2]-Y)*Z))>(W=m(p*m(w[(1-d<<4)+u>>2]-W)))||(Q=Z>Q?Z:Q,p=w[f+8>>2],d=o[e+8>>2],Y=w[r+8>>2],Q>(Z=m(p*m(w[8+((1-d<<4)+u|0)>>2]-Y)))||(p=m(m(w[8+((d<<4)+u|0)>>2]-Y)*p))>(E=Em(0))))){if(o[B+40>>2]){if((0|l)>(0|k)){if((0|(l=o[c+4>>2]))<(0|(d=l<<1))){if((0|d)>o[c+8>>2]){if(l){if(o[8488]=o[8488]+1,A=0|Zn[o[8290]](l<<3,16),!((0|(h=o[c+4>>2]))<=0)){if(F=0,k=0,h>>>0>=4)for(g=-4&h,N=0;o[(s=k<<2)+A>>2]=o[s+o[c+12>>2]>>2],o[(V=4|s)+A>>2]=o[V+o[c+12>>2]>>2],o[(V=8|s)+A>>2]=o[V+o[c+12>>2]>>2],o[(s|=12)+A>>2]=o[s+o[c+12>>2]>>2],k=k+4|0,(0|g)!=(0|(N=N+4|0)););if(s=3&h)for(;o[(h=k<<2)+A>>2]=o[h+o[c+12>>2]>>2],k=k+1|0,(0|s)!=(0|(F=F+1|0)););}}else A=0;!(k=o[c+12>>2])||!k|!v[c+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](k)),o[c+12>>2]=A,a[c+16|0]=1,o[c+8>>2]=d}if(A=l-1|0,k=0,s=3&l)for(;o[o[c+12>>2]+(l<<2)>>2]=0,l=l+1|0,(0|s)!=(0|(k=k+1|0)););if(A>>>0>=3)for(;o[(A=l<<2)+o[c+12>>2]>>2]=0,o[4+(A+o[c+12>>2]|0)>>2]=0,o[8+(A+o[c+12>>2]|0)>>2]=0,o[12+(A+o[c+12>>2]|0)>>2]=0,(0|d)!=(0|(l=l+4|0)););A=o[c+12>>2]}o[c+4>>2]=d,k=d-2|0}o[A+R>>2]=o[B+36>>2],o[o[c+12>>2]+(G<<2)>>2]=o[B+40>>2],l=G+1|0;break A}Zn[o[o[b>>2]+12>>2]](b,B)}if(!(G=l))break}}S=u+32|0}function JA(){v[35136]||(o[8702]=1062847606,o[8703]=0,o[8700]=1042701022,o[8701]=1056964440,o[8698]=1062847606,o[8699]=0,o[8696]=-1093024784,o[8697]=1050556081,o[8694]=1062847606,o[8695]=0,o[8692]=-1093024784,o[8693]=-1096927567,o[8690]=1062847606,o[8691]=0,o[8688]=1042701022,o[8689]=-1090519208,o[8686]=1062847572,o[8687]=0,o[8684]=1057396286,o[8685]=0,o[8682]=1057396386,o[8683]=0,o[8680]=1060121912,o[8681]=1056964507,o[8678]=1057396420,o[8679]=0,o[8676]=-1098475836,o[8677]=1062148969,o[8674]=1057396386,o[8675]=0,o[8672]=-1084636143,o[8673]=0,o[8670]=1057396420,o[8671]=0,o[8668]=-1098475836,o[8669]=-1085334679,o[8666]=1057396386,o[8667]=0,o[8664]=1060121912,o[8665]=-1090519141,o[8662]=-2147483648,o[8663]=0,o[8660]=1058437413,o[8661]=1062149053,o[8658]=-2147483648,o[8659]=0,o[8656]=-2147483648,o[8657]=1065353216,o[8654]=-2147483648,o[8655]=0,o[8652]=-1089046235,o[8653]=1062149053,o[8650]=-2147483648,o[8651]=0,o[8648]=-1082951543,o[8649]=1050556148,o[8646]=-2147483648,o[8647]=0,o[8644]=-1082951543,o[8645]=-1096927500,o[8642]=0,o[8643]=0,o[8640]=-1089046235,o[8641]=-1085334595,o[8638]=0,o[8639]=0,o[8636]=0,o[8637]=-1082130432,o[8634]=0,o[8635]=0,o[8632]=1058437413,o[8633]=-1085334595,o[8630]=0,o[8631]=0,o[8628]=1064532105,o[8629]=-1096927500,o[8626]=0,o[8627]=0,o[8624]=1064532105,o[8625]=1050556148,o[8622]=-1090087228,o[8623]=0,o[8620]=1049007812,o[8621]=1062148969,o[8618]=-1090087262,o[8619]=0,o[8616]=-1087361736,o[8617]=1056964507,o[8614]=-1084636042,o[8615]=0,o[8612]=-1104782626,o[8613]=1056964440,o[8610]=-1090087262,o[8611]=0,o[8608]=-1087361736,o[8609]=-1090519141,o[8606]=-1084636076,o[8607]=0,o[8604]=-1090087362,o[8605]=-2147483648,o[8602]=-1090087262,o[8603]=0,o[8600]=1062847505,o[8601]=-2147483648,o[8598]=-1084636042,o[8599]=0,o[8596]=1054458864,o[8597]=1050556081,o[8594]=-1090087228,o[8595]=0,o[8592]=1049007812,o[8593]=-1085334679,o[8590]=-1084636042,o[8591]=0,o[8588]=-1104782626,o[8589]=-1090519208,o[8586]=-1084636042,o[8587]=0,o[8584]=1054458864,o[8585]=-1096927567,o[8582]=1065353216,o[8583]=0,o[8580]=-2147483648,o[8581]=0,o[8578]=1055193471,o[8579]=0,o[8576]=1063581978,o[8577]=0,o[8574]=1055193572,o[8575]=0,o[8572]=1049461434,o[8573]=1062847522,o[8570]=1055193572,o[8571]=0,o[8568]=-1086767520,o[8569]=1057396202,o[8566]=1055193572,o[8567]=0,o[8564]=-1086767520,o[8565]=-1090087446,o[8562]=1055193605,o[8563]=0,o[8560]=1049461434,o[8561]=-1084636126,o[8558]=-1092290076,o[8559]=0,o[8556]=1060716128,o[8557]=1057396202,o[8554]=-1092290043,o[8555]=0,o[8552]=-1098022214,o[8553]=1062847522,o[8550]=-1092290177,o[8551]=0,o[8548]=-1083901670,o[8549]=-2147483648,o[8546]=-1092290076,o[8547]=0,o[8544]=-1098022214,o[8545]=-1084636126,o[8542]=-1092290076,o[8543]=0,o[8540]=1060716128,o[8541]=-1090087446,o[8538]=-1082130432,o[8539]=0,o[8536]=0,o[8537]=-2147483648,a[35136]=1)}function xA(A,r,f,e,i){var n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=0,G=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=m(0);return n=m(-1),l=w[A>>2],c=w[r>>2],a=m(l-c),u=w[r+4>>2],Q=w[f+4>>2],R=m(u-Q),E=w[f>>2],Y=m(c-E),h=w[A+4>>2],b=m(h-u),s=m(m(a*R)-m(Y*b)),t=w[r+8>>2],W=w[f+8>>2],V=m(t-W),B=w[A+8>>2],d=m(B-t),p=m(m(b*V)-m(R*d)),F=m(m(d*Y)-m(V*a)),(D=m(m(s*s)+m(m(p*p)+m(F*F))))>m(0)&&(m(m(B*m(m(a*F)+m(p*m(-b))))+m(m(l*m(m(b*s)+m(F*m(-d))))+m(h*m(m(d*p)+m(s*m(-a))))))>m(0)?(b=m(-1),d=m(t-B),k=m(c-l),v=m(u-h),(n=m(m(d*d)+m(m(k*k)+m(v*v))))>m(0)?(a=m(1),(n=m(m(-m(m(B*d)+m(m(l*k)+m(h*v))))/n))>=m(1)?(b=m(m(t*t)+m(m(c*c)+m(u*u))),X=2,Z=2):(a=m(0),n<=m(0)?(b=m(m(B*B)+m(m(l*l)+m(h*h))),G=m(1),Z=1):(a=m(B+m(d*n)),b=m(a*a),a=m(l+m(k*n)),c=m(a*a),a=m(h+m(v*n)),b=m(b+m(c+m(a*a))),G=m(m(1)-n),X=2,a=n,Z=3))):(a=m(0),Z=0),o[i>>2]=1&Z|X,o[e+8>>2]=0,w[e+4>>2]=a,w[e>>2]=G,t=w[r+8>>2],u=w[r+4>>2],c=w[r>>2]):(b=m(-1),a=m(0)),B=m(W-B),h=m(Q-h),d=m(E-l),m(m(t*m(m(Y*F)-m(p*R)))+m(m(c*m(m(R*s)-m(F*V)))+m(u*m(m(V*p)-m(s*Y)))))>m(0)?(X=b>2],l=m(Q-t),E=w[f>>2],k=m(E-c),W=w[f+4>>2],v=m(W-u),g=m(m(l*l)+m(m(k*k)+m(v*v))),n=m(-1),g>m(0)&&(a=m(1),(n=m(m(-m(m(t*l)+m(m(c*k)+m(u*v))))/g))>=m(1)?(G=m(0),Z=2,n=m(m(Q*Q)+m(m(E*E)+m(W*W)))):(a=m(0),n<=m(0)?(G=m(1),Z=1,n=m(m(t*t)+m(m(c*c)+m(u*u)))):(G=m(m(1)-n),Z=3,a=n,t=m(t+m(l*n)),c=m(c+m(k*n)),n=m(u+m(v*n)),n=m(m(t*t)+m(m(c*c)+m(n*n)))))),X|b>n?(o[i>>2]=Z<<1,w[e+8>>2]=a,w[e+4>>2]=G,o[e>>2]=0):n=b):n=b,u=w[f+8>>2],t=w[f>>2],l=w[f+4>>2],m(m(u*m(m(d*F)-m(p*h)))+m(m(t*m(m(h*s)-m(F*B)))+m(l*m(m(B*p)-m(s*d)))))>m(0)&&(c=m(-1),E=w[A+8>>2],k=m(E-u),W=w[A>>2],v=m(W-t),g=w[A+4>>2],Q=m(g-l),(b=m(m(k*k)+m(m(v*v)+m(Q*Q))))>m(0)&&(a=m(1),(b=m(m(-m(m(u*k)+m(m(t*v)+m(l*Q))))/b))>=m(1)?(c=m(m(E*E)+m(m(W*W)+m(g*g))),G=m(0),Z=2):(a=m(0),b<=m(0)?(c=m(m(u*u)+m(m(t*t)+m(l*l))),G=m(1),Z=1):(a=m(u+m(k*b)),c=m(a*a),a=m(t+m(v*b)),t=m(a*a),a=m(l+m(Q*b)),c=m(c+m(t+m(a*a))),G=m(m(1)-b),Z=3,a=b))),nc&&(o[i>>2]=Z<<2&4|Z>>>1,o[e+4>>2]=0,w[e>>2]=a,w[e+8>>2]=G,n=c)),n>2],a=w[A>>2],b=w[A+4>>2],o[i>>2]=7,b=m(m(m(n*s)+m(m(a*p)+m(F*b)))/D),n=m(F*b),c=m(w[r+4>>2]-n),a=m(p*b),u=m(w[r>>2]-a),t=m(m(Y*c)+m(u*m(-R))),l=m(t*t),b=m(s*b),t=m(w[r+8>>2]-b),c=m(m(R*t)+m(c*m(-V))),s=m(c*c),c=m(m(V*u)+m(t*m(-Y))),t=m(N(m(l+m(s+m(c*c))))),c=m(N(D)),u=m(t/c),w[e>>2]=u,t=m(w[f+4>>2]-n),G=m(w[f>>2]-a),s=m(m(d*t)+m(G*m(-h))),l=m(s*s),s=m(w[f+8>>2]-b),t=m(m(h*s)+m(t*m(-B))),k=m(t*t),t=m(m(B*G)+m(s*m(-d))),c=m(m(N(m(l+m(k+m(t*t)))))/c),w[e+4>>2]=c,w[e+8>>2]=m(1)-m(u+c),n=m(m(b*b)+m(m(a*a)+m(n*n))))),n}function yA(A,r,f,e){var i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0,Z=0,G=0;if(!(!r|!f)){if(!(o[A+24>>2]>127|o[A+28>>2]>127)){if(o[8488]=o[8488]+1,s=0|Zn[o[8290]](1024,16),!((0|(t=o[A+24>>2]))<=0)){if(t>>>0>=4)for(B=-4&t;b=(n=d<<3)+s|0,c=n+o[A+32>>2]|0,k=o[c+4>>2],o[b>>2]=o[c>>2],o[b+4>>2]=k,c=(b=8|n)+s|0,b=b+o[A+32>>2]|0,k=o[b+4>>2],o[c>>2]=o[b>>2],o[c+4>>2]=k,c=(b=16|n)+s|0,b=b+o[A+32>>2]|0,k=o[b+4>>2],o[c>>2]=o[b>>2],o[c+4>>2]=k,b=(n|=24)+s|0,n=n+o[A+32>>2]|0,c=o[n+4>>2],o[b>>2]=o[n>>2],o[b+4>>2]=c,d=d+4|0,(0|B)!=(0|(i=i+4|0)););if(i=3&t)for(;t=(n=d<<3)+s|0,n=n+o[A+32>>2]|0,B=o[n+4>>2],o[t>>2]=o[n>>2],o[t+4>>2]=B,d=d+1|0,(0|i)!=(0|(u=u+1|0)););}!(i=o[A+32>>2])||!i|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+32>>2]=s,a[A+36|0]=1,o[A+28>>2]=128}for(o[A+24>>2]=128,i=o[A+32>>2],o[i+4>>2]=f,o[i>>2]=r,r=124,i=1;;){if(u=o[A+32>>2],s=i,t=o[4+(f=u+(b=(i=i-1|0)<<3)|0)>>2],n=o[f>>2],(0|r)<(0|i)){if(!((0|(B=(r=o[A+24>>2])<<1))<=o[A+28>>2]|(0|r)>=(0|B))){if(r){if(o[8488]=o[8488]+1,u=0|Zn[o[8290]](r<<4,16),!((0|(k=o[A+24>>2]))<=0)){if(r=0,d=0,k>>>0>=4)for(G=-4&k,f=0;l=(c=d<<3)+u|0,h=c+o[A+32>>2]|0,Z=o[h+4>>2],o[l>>2]=o[h>>2],o[l+4>>2]=Z,h=(l=8|c)+u|0,l=l+o[A+32>>2]|0,Z=o[l+4>>2],o[h>>2]=o[l>>2],o[h+4>>2]=Z,h=(l=16|c)+u|0,l=l+o[A+32>>2]|0,Z=o[l+4>>2],o[h>>2]=o[l>>2],o[h+4>>2]=Z,l=(c|=24)+u|0,c=c+o[A+32>>2]|0,h=o[c+4>>2],o[l>>2]=o[c>>2],o[l+4>>2]=h,d=d+4|0,(0|G)!=(0|(f=f+4|0)););if(f=3&k)for(;k=(c=d<<3)+u|0,c=c+o[A+32>>2]|0,G=o[c+4>>2],o[k>>2]=o[c>>2],o[k+4>>2]=G,d=d+1|0,(0|f)!=(0|(r=r+1|0)););}}else u=0;!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=u,a[A+36|0]=1,o[A+28>>2]=B}o[A+24>>2]=B,r=B-4|0}A:if((0|n)!=(0|t)){if(!(!(w[n>>2]<=w[t+16>>2])|!(w[n+16>>2]>=w[t>>2])|!(w[n+4>>2]<=w[t+20>>2])|!(w[n+20>>2]>=w[t+4>>2])||!(w[n+8>>2]<=w[t+24>>2])|!(w[n+24>>2]>=w[t+8>>2])))if(f=o[t+40>>2],o[n+40>>2]){if(i=o[n+36>>2],f){o[4+(f=u+b|0)>>2]=o[t+36>>2],o[f>>2]=i,i=o[n+40>>2],u=(f=s<<3)+o[A+32>>2]|0,o[u+4>>2]=o[t+36>>2],o[u>>2]=i,i=o[n+36>>2],u=f+o[A+32>>2]|0,o[u+12>>2]=o[t+40>>2],o[u+8>>2]=i,i=o[n+40>>2],f=f+o[A+32>>2]|0,o[f+20>>2]=o[t+40>>2],o[f+16>>2]=i,i=s+3|0;break A}o[4+(f=u+b|0)>>2]=t,o[f>>2]=i,f=o[n+40>>2],i=o[A+32>>2]+(s<<3)|0,o[i+4>>2]=t,o[i>>2]=f,i=s+1|0}else f?(o[4+(f=u+b|0)>>2]=o[t+36>>2],o[f>>2]=n,f=o[A+32>>2]+(s<<3)|0,o[f+4>>2]=o[t+40>>2],o[f>>2]=n,i=s+1|0):Zn[o[o[e>>2]+8>>2]](e,n,t)}else{if(!o[n+40>>2])break A;f=u+b|0,i=o[n+36>>2],o[f+4>>2]=i,o[f>>2]=i,i=(f=s<<3)+o[A+32>>2]|0,t=o[n+40>>2],o[i+4>>2]=t,o[i>>2]=t,i=o[n+40>>2],f=f+o[A+32>>2]|0,o[f+8>>2]=o[n+36>>2],o[f+12>>2]=i,i=s+2|0}if(!i)break}}}function MA(A,r,f,e,i,n,a){var t,c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),B=m(0),Z=m(0),G=0,Q=m(0),E=0,W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=0,X=0,D=0,C=0,J=0,x=0,y=0,M=0,H=0,I=0,T=0,U=0,j=0,z=0,P=0,O=0;if(S=t=S-32|0,F=w[f+4>>2],R=w[e+4>>2],Y=w[f>>2],V=w[e>>2],k=w[A+28>>2],v=w[A+12>>2],W=w[e+8>>2],p=w[f+8>>2],c=(c=m((W>2]))>2],X=(c=m(m((c>k?k:c)-v)*l))=m(0)?~~c>>>0:0,d=w[A+24>>2],B=w[A+8>>2],c=(c=m((F>R?R:F)+w[i+4>>2]))>2],g=(c=m(m((c>d?d:c)-B)*Q))=m(0)?~~c>>>0:0,s=w[A+20>>2],Z=w[A+4>>2],c=(c=m((Y>V?V:Y)+w[i>>2]))>2],E=(c=m(m((c>s?s:c)-Z)*b))=m(0)?~~c>>>0:0,c=m((W>p?W:p)+w[n+8>>2]),G=(c=m(m(m(((c=ck?k:c)-v)*l)+m(1)))=m(0)?~~c>>>0:0,c=m((F>2]),u=(c=m(m(m(((c=cd?d:c)-B)*Q)+m(1)))=m(0)?~~c>>>0:0,c=m((Y>2]),e=(c=m(m(m(((c=cs?s:c)-Z)*b)+m(1)))=m(0)?~~c>>>0:0,(0|a)>0)for(b=m(W-p),s=m(V-Y),Q=m(R-F),c=m(m(1)/m(N(m(m(b*b)+m(m(s*s)+m(Q*Q)))))),l=m(b*c),k=m(l*b),b=m(s*c),c=m(Q*c),Q=m(k+m(m(b*s)+m(Q*c))),x=65534&X,y=65534&g,M=65534&E,H=1|G,I=1|u,T=1|e,e=o[A+136>>2],U=((G=(v=l==m(0)?m(0xde0b6b000000000):m(m(1)/l))>2],E=0;A:{r:{f:{e:if(!(h[e+6>>1]>>0||T>>>0<(g=h[e>>1])>>>0|h[e+10>>1]>>0||(G=h[e+4>>1],h[e+8>>1]>>0|G>>>0>H>>>0||(u=h[e+2>>1])>>>0>I>>>0))){if(W=w[A+4>>2],p=w[A+36>>2],k=w[A+8>>2],d=w[A+40>>2],s=w[A+12>>2],l=w[A+44>>2],o[t+12>>2]=0,b=m(s+m(m(G>>>0)/l)),w[t+8>>2]=b,c=m(k+m(m(u>>>0)/d)),w[t+4>>2]=c,E=h[e+10>>1],G=h[e+8>>1],u=h[e+6>>1],o[t+28>>2]=0,w[t>>2]=m(W+m(m(g>>>0)/p))-w[n>>2],w[t+4>>2]=c-w[n+4>>2],w[t+8>>2]=b-w[n+8>>2],w[t+16>>2]=m(W+m(m(u>>>0)/p))-w[i>>2],w[t+20>>2]=m(k+m(m(G>>>0)/d))-w[i+4>>2],w[t+24>>2]=m(s+m(m(E>>>0)/l))-w[i+8>>2],b=w[f>>2],l=m(Z*m(w[O>>2]-b)),c=w[f+4>>2],!(l>(k=m(B*m(w[P>>2]-c)))||(c=m(B*m(w[j>>2]-c)))>(d=m(Z*m(w[X>>2]-b)))||(s=c>l?c:l,c=w[f+8>>2],s>(l=m(v*m(w[z>>2]-c)))||(b=m(v*m(w[U>>2]-c)))>(c=k(b>s?b:s)&(c>l?l:c)>m(0))|(0|J)<0)break e;u=o[e+12>>2],Zn[o[o[r>>2]+8>>2]](r,u>>21,2097151&u);break f}E=0}if(!((0|J)>=0||E))break r}D=D+1|0,e=e+16|0;break A}D=D-(u=o[e+12>>2])|0,e=e-(u<<4)|0}if(C=C+1|0,!((0|a)>(0|D)))break}o[8502]<(0|C)&&(o[8502]=C),S=t+32|0}function HA(A,r,f,e,i,n){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0;var t,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=0,h=m(0),B=m(0),Z=0,G=m(0),Q=m(0),E=0,W=m(0),p=m(0),F=m(0),R=m(0);S=t=S-304|0,c=w[r+52>>2],l=w[f+52>>2],s=w[r+56>>2],b=w[f+56>>2],k=w[r+48>>2],u=w[f+48>>2],o[t+300>>2]=0,B=m(b-s),w[t+296>>2]=B,h=m(l-c),w[t+292>>2]=h,W=m(u-k),w[t+288>>2]=W,jA(r,E=f,f=t+116|0,d=t+52|0),o[t+284>>2]=0,c=w[t+52>>2],l=m(c*w[t+124>>2]),w[t+280>>2]=l,s=m(c*w[t+120>>2]),w[t+276>>2]=s,c=m(c*w[t+116>>2]),w[t+272>>2]=c,b=w[e+52>>2],k=w[i+52>>2],u=w[e+56>>2],G=w[i+56>>2],Q=w[e+48>>2],R=w[i+48>>2],o[t+268>>2]=0,p=m(G-u),w[t+264>>2]=p,F=m(k-b),w[t+260>>2]=F,Q=m(R-Q),w[t+256>>2]=Q,jA(e,i,f,d),o[t+252>>2]=0,b=w[t+52>>2],k=m(b*w[t+124>>2]),w[t+248>>2]=k,u=m(b*w[t+120>>2]),w[t+244>>2]=u,b=m(b*w[t+116>>2]),w[t+240>>2]=b,f=o[A+12>>2],l=m(m(N(m(m(l*l)+m(m(c*c)+m(s*s)))))*m(Zn[o[o[f>>2]+16>>2]](f))),f=o[A+16>>2],c=m(f?Zn[o[o[f>>2]+16>>2]](f):0),G=m(l+m(c*m(N(m(m(k*k)+m(m(b*b)+m(u*u))))))),s=m(p-B),b=m(Q-W),k=m(F-h);A:if(m(G+m(N(m(m(s*s)+m(m(b*b)+m(k*k))))))!=m(0)&&(a[t+220|0]=0,o[t+216>>2]=1566444395,o[t+180>>2]=22640,FA(A,r,e,t+180|0),f=o[t+212>>2],o[t+232>>2]=o[t+208>>2],o[t+236>>2]=f,f=o[t+204>>2],o[t+224>>2]=o[t+200>>2],o[t+228>>2]=f,v[t+220|0]&&(l=w[t+192>>2],u=w[t+184>>2],B=w[t+188>>2],!(m(G+m(m(s*l)+m(m(b*u)+m(k*B))))<=m(1.1920928955078125e-7))))){r:{if((h=m(w[t+216>>2]+w[n+172>>2]))>m(.0010000000474974513)){for(i=t+28|0,E=t+164|0,f=0,c=m(0);;){if((Z=o[n+168>>2])&&(o[t+124>>2]=1065353216,o[t+128>>2]=0,o[t+116>>2]=1065353216,o[t+120>>2]=1065353216,Zn[o[o[Z>>2]+28>>2]](Z,t+224|0,m(.20000000298023224),t+116|0)),Z=0,(u=m(G+m(m(s*l)+m(m(b*u)+m(k*B)))))<=m(1.1920928955078125e-7))break A;if((l=c)>=(c=m(c+m(h/u)))|c>m(1)|c>2])&&(o[t+16>>2]=0,o[t+20>>2]=0,o[t+8>>2]=1065353216,o[t+12>>2]=0,Zn[o[o[d>>2]+28>>2]](d,E,m(.20000000298023224),t+8|0)),Zn[o[o[n>>2]>>2]](n,c),a[t+48|0]=0,o[t+44>>2]=1566444395,o[t+8>>2]=22640,FA(A,t+116|0,t+52|0,t+8|0),!v[t+48|0])break r;if(h=w[n+172>>2],d=o[i+12>>2],o[t+232>>2]=o[i+8>>2],o[t+236>>2]=d,d=o[i+4>>2],o[t+224>>2]=o[i>>2],o[t+228>>2]=d,64==(0|f)){Zn[o[o[n>>2]+8>>2]](n,-2,65);break A}if(f=f+1|0,u=w[t+12>>2],B=w[t+16>>2],l=w[t+20>>2],!((h=m(w[t+44>>2]+h))>m(.0010000000474974513)))break}s=w[t+24>>2]}else c=m(0),s=w[t+196>>2];w[n+132>>2]=u,w[n+164>>2]=c,w[n+144>>2]=s,w[n+140>>2]=l,w[n+136>>2]=B,A=o[t+228>>2],o[n+148>>2]=o[t+224>>2],o[n+152>>2]=A,A=o[t+236>>2],o[n+156>>2]=o[t+232>>2],o[n+160>>2]=A,Z=1;break A}Zn[o[o[n>>2]+8>>2]](n,-1,f)}return S=t+304|0,0|Z}function IA(A,r,f,e,i,n){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0;var t,c,b=0,u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=0,E=m(0),W=m(0),N=m(0);S=t=S-272|0,re(o[A+4>>2]),l=w[r+52>>2],u=w[f+52>>2],h=w[e+52>>2],s=w[i+52>>2],k=w[r+56>>2],d=w[f+56>>2],B=w[e+56>>2],Z=w[i+56>>2],G=w[r+48>>2],E=w[f+48>>2],W=w[e+48>>2],N=w[i+48>>2],a[t+252|0]=0,o[t+248>>2]=1566444395,o[t+212>>2]=22640,c=Hf(t+132|0,o[A+8>>2],o[A+12>>2],o[A+4>>2],0),o[t+128>>2]=1566444395,A=o[r+12>>2],o[t+8>>2]=o[r+8>>2],o[t+12>>2]=A,A=o[r+4>>2],o[t>>2]=o[r>>2],o[t+4>>2]=A,A=o[r+28>>2],o[t+24>>2]=o[r+24>>2],o[t+28>>2]=A,A=o[r+20>>2],o[t+16>>2]=o[r+16>>2],o[t+20>>2]=A,A=o[r+44>>2],o[t+40>>2]=o[r+40>>2],o[t+44>>2]=A,A=o[r+36>>2],o[t+32>>2]=o[r+32>>2],o[t+36>>2]=A,A=o[r+60>>2],o[t+56>>2]=o[r+56>>2],o[t+60>>2]=A,A=o[r+52>>2],o[t+48>>2]=o[r+48>>2],o[t+52>>2]=A,A=o[e+12>>2],o[t+72>>2]=o[e+8>>2],o[t+76>>2]=A,A=o[e+4>>2],o[t+64>>2]=o[e>>2],o[t+68>>2]=A,A=o[e+20>>2],o[t+80>>2]=o[e+16>>2],o[t+84>>2]=A,A=o[e+28>>2],o[t+88>>2]=o[e+24>>2],o[t+92>>2]=A,A=o[e+44>>2],o[t+104>>2]=o[e+40>>2],o[t+108>>2]=A,A=o[e+36>>2],o[t+96>>2]=o[e+32>>2],o[t+100>>2]=A,A=o[e+52>>2],o[t+112>>2]=o[e+48>>2],o[t+116>>2]=A,A=o[e+60>>2],o[t+120>>2]=o[e+56>>2],o[t+124>>2]=A,eA(c,t,t+212|0,0,0),A=o[t+244>>2],o[t+264>>2]=o[t+240>>2],o[t+268>>2]=A,A=o[t+236>>2],o[t+256>>2]=o[t+232>>2],o[t+260>>2]=A,b=0;A:if(v[t+252|0]){B=m(m(d-k)-m(Z-B)),Z=m(m(u-l)-m(s-h)),G=m(m(E-G)-m(N-W)),s=w[t+224>>2],k=w[t+220>>2],d=w[t+216>>2];r:{if((u=w[t+248>>2])>m(.0010000000474974513)){for(Q=t+232|0,A=0,h=m(0);;){if(b=0,32==(0|A))break A;if(b=0,h>=(l=m(h-m(u/m(m(B*s)+m(m(G*d)+m(Z*k)))))))break A;if(b=0,l>m(1))break A;if(b=0,l>2]>>2]](n,l),u=m(m(1)-l),w[t+48>>2]=m(u*w[r+48>>2])+m(l*w[f+48>>2]),w[t+52>>2]=m(u*w[r+52>>2])+m(l*w[f+52>>2]),w[t+56>>2]=m(u*w[r+56>>2])+m(l*w[f+56>>2]),w[t+112>>2]=m(u*w[e+48>>2])+m(l*w[i+48>>2]),w[t+116>>2]=m(u*w[e+52>>2])+m(l*w[i+52>>2]),w[t+120>>2]=m(u*w[e+56>>2])+m(l*w[i+56>>2]),eA(c,t,t+212|0,0,0),b=0,!v[t+252|0])break A;if((u=w[t+248>>2])>2]=l,u=w[t+228>>2],s=w[t+224>>2],k=w[t+220>>2],d=w[t+216>>2];break r}if(A=A+1|0,b=o[t+244>>2],o[t+264>>2]=o[t+240>>2],o[t+268>>2]=b,b=o[t+236>>2],o[t+256>>2]=o[t+232>>2],o[t+260>>2]=b,s=w[t+224>>2],k=w[t+220>>2],d=w[t+216>>2],h=l,!(u>m(.0010000000474974513)))break}u=w[t+228>>2]}else l=m(0),u=w[t+228>>2];if(b=0,m(-w[n+172>>2])<=m(m(s*B)+m(m(d*G)+m(Z*k))))break A;w[n+164>>2]=l,Q=t+256|0}w[n+132>>2]=d,w[n+144>>2]=u,w[n+140>>2]=s,w[n+136>>2]=k,r=o[(A=Q)+4>>2],o[n+148>>2]=o[A>>2],o[n+152>>2]=r,r=o[A+12>>2],o[n+156>>2]=o[A+8>>2],o[n+160>>2]=r,b=1}return S=t+272|0,0|b}function TA(A){var r=0,f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0;if(o[8455]=16876,r=o[A+20>>2],o[8488]=o[8488]+1,i=0|Zn[o[8290]](4,16),o[i>>2]=8+(r?22792:22952),o[8461]=i,o[8488]=o[8488]+1,r=0|Zn[o[8290]](20,16),i=o[8461],o[r+12>>2]=0,o[r+16>>2]=3,a[r+4|0]=0,o[r+8>>2]=i,o[r>>2]=15196,o[8462]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=16992,a[r+4|0]=0,o[8463]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17116,a[r+4|0]=0,o[8464]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17208,a[r+4|0]=0,o[8465]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17288,a[r+4|0]=0,o[8466]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17376,a[r+4|0]=0,o[8467]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17460,a[r+4|0]=0,o[8468]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17528,a[r+4|0]=0,o[8469]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17612,a[r+4|0]=0,o[8473]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17612,o[8474]=r,a[r+4|0]=1,o[8488]=o[8488]+1,r=0|Zn[o[8290]](8,16),o[r>>2]=17696,a[r+4|0]=0,o[8472]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](16,16),o[r+8>>2]=1,o[r+12>>2]=0,o[r>>2]=17772,a[r+4|0]=0,o[8476]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](16,16),o[r+8>>2]=1,o[r+12>>2]=0,o[r>>2]=17772,o[8475]=r,a[r+4|0]=1,c=o[A+16>>2],e=o[A>>2])a[33832]=0;else{if(a[33832]=1,o[8488]=o[8488]+1,e=0|Zn[o[8290]](24,16),r=o[A+8>>2],o[e+20>>2]=0,o[e+4>>2]=r,o[e>>2]=868,o[8488]=o[8488]+1,r=0|Zn[o[8290]](G(r,868),16),o[e+12>>2]=r,o[e+16>>2]=r,b=o[e+4>>2],o[e+8>>2]=b,i=b-1|0){if(n=o[e>>2],u=7&i)for(;f=r,r=r+n|0,o[f>>2]=r,i=i-1|0,(0|u)!=(0|(t=t+1|0)););if(!(b-2>>>0<7))for(;f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,f=r,r=r+n|0,o[f>>2]=r,i=i-8|0;);}o[r>>2]=0}if(o[8457]=e,r=o[A+4>>2])return a[33840]=0,void(o[8459]=r);if(a[33840]=1,o[8488]=o[8488]+1,e=0|Zn[o[8290]](24,16),A=o[A+12>>2],t=0,o[e+20>>2]=0,o[e+4>>2]=A,r=16+(2147483632&((r=(0|c)<=72?72:c)>>>0<=116?116:r))|0,o[e>>2]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](G(A,r),16),o[e+12>>2]=r,o[e+16>>2]=r,n=o[e+4>>2],o[e+8>>2]=n,i=n-1|0){if(A=o[e>>2],c=7&i)for(;f=r,r=A+r|0,o[f>>2]=r,i=i-1|0,(0|c)!=(0|(t=t+1|0)););if(!(n-2>>>0<7))for(;f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,f=r,r=A+r|0,o[f>>2]=r,i=i-8|0;);}o[r>>2]=0,o[8459]=e}function UA(A,r){var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;A:{r:if(!((0|(e=o[A+548>>2]))<=0)){for(i=o[A+556>>2];;){if(o[i+(n<<2)>>2]!=(0|r)){if((0|(n=n+1|0))!=(0|e))continue;break r}break}if((0|e)!=(0|n))break A}if(o[A+552>>2]==(0|e)&&!((0|(b=e?e<<1:1))<=(0|e))){if(b?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](b<<2,16),e=o[A+548>>2]):i=0,!((0|e)<=0)){if(n=0,e>>>0>=4)for(l=-4&e;o[(f=n<<2)+i>>2]=o[f+o[A+556>>2]>>2],o[(t=4|f)+i>>2]=o[t+o[A+556>>2]>>2],o[(t=8|f)+i>>2]=o[t+o[A+556>>2]>>2],o[(f|=12)+i>>2]=o[f+o[A+556>>2]>>2],n=n+4|0,(0|l)!=(0|(c=c+4|0)););if(f=3&e)for(;o[(c=n<<2)+i>>2]=o[c+o[A+556>>2]>>2],n=n+1|0,(0|f)!=(0|(u=u+1|0)););}!(n=o[A+556>>2])|!v[A+560|0]||(n&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),e=o[A+548>>2]),o[A+556>>2]=i,a[A+560|0]=1,o[A+552>>2]=b}o[o[A+556>>2]+(e<<2)>>2]=r,o[A+548>>2]=e+1,n=o[r+32>>2];r:if((0|(r=o[r+28>>2]))!=(0|A)){if((0|(i=o[n+288>>2]))==o[n+292>>2]&&!((0|(c=i?i<<1:1))<=(0|i))){if(c?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](c<<2,16),i=o[n+288>>2]):e=0,!((0|i)<=0)){if(b=0,A=0,i>>>0>=4)for(l=-4&i,u=0;o[(f=A<<2)+e>>2]=o[f+o[n+296>>2]>>2],o[(t=4|f)+e>>2]=o[t+o[n+296>>2]>>2],o[(t=8|f)+e>>2]=o[t+o[n+296>>2]>>2],o[(f|=12)+e>>2]=o[f+o[n+296>>2]>>2],A=A+4|0,(0|l)!=(0|(u=u+4|0)););if(u=3&i)for(;o[(f=A<<2)+e>>2]=o[f+o[n+296>>2]>>2],A=A+1|0,(0|u)!=(0|(b=b+1|0)););}!(A=o[n+296>>2])|!v[n+300|0]||(A&&(o[8489]=o[8489]+1,Zn[o[8291]](A)),i=o[n+288>>2]),o[n+296>>2]=e,a[n+300|0]=1,o[n+292>>2]=c}A=n,n=r}else{if((0|(i=o[A+288>>2]))!=o[A+292>>2])break r;if((0|(b=i?i<<1:1))<=(0|i))break r;if(b?(o[8488]=o[8488]+1,r=0|Zn[o[8290]](b<<2,16),i=o[A+288>>2]):r=0,!((0|i)<=0)){if(u=0,e=0,i>>>0>=4)for(l=-4&i,c=0;o[(f=e<<2)+r>>2]=o[f+o[A+296>>2]>>2],o[(t=4|f)+r>>2]=o[t+o[A+296>>2]>>2],o[(t=8|f)+r>>2]=o[t+o[A+296>>2]>>2],o[(f|=12)+r>>2]=o[f+o[A+296>>2]>>2],e=e+4|0,(0|l)!=(0|(c=c+4|0)););if(f=3&i)for(;o[(c=e<<2)+r>>2]=o[c+o[A+296>>2]>>2],e=e+1|0,(0|f)!=(0|(u=u+1|0)););}!(e=o[A+296>>2])|!v[A+300|0]||(e&&(o[8489]=o[8489]+1,Zn[o[8291]](e)),i=o[A+288>>2]),o[A+296>>2]=r,a[A+300|0]=1,o[A+292>>2]=b}o[o[A+296>>2]+(i<<2)>>2]=n,o[A+280>>2]=~i>>>31,o[A+288>>2]=i+1}}function jA(A,r,f,e){var i,n=m(0),a=m(0),t=m(0),u=m(0),l=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0);S=i=S+-64|0,G=w[r+24>>2],Q=w[r+20>>2],E=w[r+40>>2],W=w[r+36>>2],l=w[A+40>>2],d=w[A+20>>2],v=w[A+36>>2],h=w[A+24>>2],p=w[r+8>>2],F=w[r>>2],R=w[r+4>>2],Y=w[r+16>>2],V=w[r+32>>2],a=w[A+8>>2],t=w[A+4>>2],Z=w[A+32>>2],B=w[A+16>>2],u=w[A>>2],o[i+60>>2]=0,o[i+44>>2]=0,X=m(m(B*v)-m(Z*d)),D=m(m(d*l)-m(v*h)),C=m(m(h*Z)-m(l*B)),n=m(m(1)/m(m(a*X)+m(m(u*D)+m(t*C)))),g=m(m(m(u*d)-m(B*t))*n),d=m(m(m(t*h)-m(d*a))*n),h=m(m(m(a*B)-m(h*u))*n),w[i+56>>2]=m(E*g)+m(m(V*d)+m(W*h)),B=m(m(m(t*Z)-m(v*u))*n),t=m(m(m(a*v)-m(l*t))*n),a=m(m(m(u*l)-m(Z*a))*n),w[i+52>>2]=m(E*B)+m(m(V*t)+m(W*a)),w[i+40>>2]=m(g*G)+m(m(d*Y)+m(h*Q)),w[i+36>>2]=m(B*G)+m(m(t*Y)+m(a*Q)),o[i+28>>2]=0,u=m(X*n),l=m(D*n),n=m(C*n),w[i+48>>2]=m(E*u)+m(m(V*l)+m(W*n)),w[i+32>>2]=m(u*G)+m(m(l*Y)+m(n*Q)),w[i+24>>2]=m(g*p)+m(m(d*F)+m(R*h)),w[i+20>>2]=m(B*p)+m(m(t*F)+m(R*a)),w[i+16>>2]=m(u*p)+m(m(l*F)+m(R*n)),rf(i+16|0,i),n=w[i+12>>2],u=w[i+8>>2],l=w[i>>2],d=w[i+4>>2],t=m(m(1)/m(N(m(m(n*n)+m(m(u*u)+m(m(l*l)+m(d*d))))))),s(a=(n=(n=m(n*t))m(1)?m(1):n);A:if((A=2147483647&(r=c(2)))>>>0>=1065353216){if(n=m((0|r)>=0?0:3.141592502593994),1065353216==(0|A))break A;n=m(m(0)/m(a-a))}else r:{if(A>>>0<=1056964607){if(n=m(1.570796251296997),A>>>0<847249409)break r;n=m(a*a),n=m(m(m(m(7.549789415861596e-8)-m(a*m(m(m(m(n*m(m(n*m(-.008656363002955914))+m(-.04274342209100723)))+m(.16666586697101593))*n)/m(m(n*m(-.7066296339035034))+m(1)))))-a)+m(1.570796251296997));break A}if((0|r)<0){n=m(m(a+m(1))*m(.5)),a=m(N(n)),n=m(m(1.570796251296997)-m(a+m(m(a*m(m(m(m(n*m(m(n*m(-.008656363002955914))+m(-.04274342209100723)))+m(.16666586697101593))*n)/m(m(n*m(-.7066296339035034))+m(1))))+m(-7.549789415861596e-8)))),n=m(n+n);break A}n=m(m(m(1)-a)*m(.5)),b(2,-4096&(s(v=m(N(n))),c(2))),a=k(),n=m(m(m(v*m(m(m(m(n*m(m(n*m(-.008656363002955914))+m(-.04274342209100723)))+m(.16666586697101593))*n)/m(m(n*m(-.7066296339035034))+m(1))))+m(m(n-m(a*a))/m(v+a)))+a),n=m(n+n)}w[e>>2]=n+n,o[f+12>>2]=0,n=m(u*t),a=m(l*t),t=m(d*t),(u=m(m(n*n)+m(m(a*a)+m(t*t))))>2]=1065353216,o[f+4>>2]=0,n=m(0)):(l=t,t=m(m(1)/m(N(u))),w[f+4>>2]=l*t,w[f>>2]=a*t,n=m(n*t)),w[f+8>>2]=n,S=i- -64|0}function zA(A,r,f){var e,i=0,n=0,a=m(0),t=0,c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=0;S=e=S-160|0,n=o[A+4>>2],i=o[n+12>>2],X=w[i+52>>2],D=w[i+56>>2],a=w[i+24>>2],b=w[i+20>>2],u=w[i+40>>2],l=w[i+36>>2],C=w[i+48>>2],s=w[i+8>>2],k=w[i>>2],d=w[i+4>>2],v=w[i+16>>2],h=w[i+32>>2],i=o[o[n+4>>2]+32>>2]+G(f,80)|0,B=w[i+32>>2],Z=w[i>>2],Q=w[i+16>>2],E=w[i+56>>2],W=w[i+52>>2],N=w[i+48>>2],p=w[i+36>>2],F=w[i+20>>2],R=w[i+4>>2],Y=w[i+40>>2],V=w[i+24>>2],g=w[i+8>>2],i=0,o[e+156>>2]=0,o[e+140>>2]=0,o[e+124>>2]=0,w[e+136>>2]=m(Y*u)+m(m(g*h)+m(l*V)),w[e+132>>2]=m(p*u)+m(m(R*h)+m(l*F)),w[e+120>>2]=m(Y*a)+m(m(g*v)+m(b*V)),w[e+116>>2]=m(p*a)+m(m(R*v)+m(b*F)),w[e+152>>2]=D+m(m(E*u)+m(m(N*h)+m(l*W))),w[e+148>>2]=X+m(m(E*a)+m(m(N*v)+m(b*W))),o[e+108>>2]=0,w[e+128>>2]=m(B*u)+m(m(Z*h)+m(l*Q)),w[e+112>>2]=m(B*a)+m(m(Z*v)+m(b*Q)),w[e+96>>2]=m(B*s)+m(m(Z*k)+m(d*Q)),w[e+104>>2]=m(Y*s)+m(m(g*k)+m(d*V)),w[e+100>>2]=m(p*s)+m(m(R*k)+m(d*F)),w[e+144>>2]=C+m(m(E*s)+m(m(N*k)+m(d*W))),Zn[o[o[r>>2]+8>>2]](r,e+96|0,e+80|0,e- -64|0),a=w[o[A+20>>2]+32>>2],w[e+80>>2]=w[e+80>>2]-a,w[e+84>>2]=w[e+84>>2]-a,w[e+88>>2]=w[e+88>>2]-a,w[e+64>>2]=a+w[e+64>>2],w[e+68>>2]=a+w[e+68>>2],w[e+72>>2]=a+w[e+72>>2],n=o[A+8>>2],t=o[n+4>>2],Zn[o[o[t>>2]+8>>2]](t,o[n+12>>2],e+48|0,e+32|0),(!(n=o[8496])||0|Zn[0|n](o[o[A+8>>2]+4>>2],r))&&(i=w[e+64>>2]>2]|w[e+80>>2]>w[e+32>>2]?i:1,n=0,1^(w[e+72>>2]>2]|w[e+88>>2]>w[e+40>>2]?n:i)|w[e+68>>2]>2]|w[e+84>>2]>w[e+36>>2]||(i=o[A+4>>2],n=o[i+8>>2],o[e+28>>2]=f,o[e+24>>2]=-1,o[e+16>>2]=n,o[e+12>>2]=r,o[e+8>>2]=i,o[e+20>>2]=e+96,w[o[A+20>>2]+32>>2]>m(0)?(r=o[A+12>>2],r=0|Zn[o[o[r>>2]+8>>2]](r,e+8|0,o[A+8>>2],0,2)):(r=o[(i=f<<2)+o[A+24>>2]>>2])||(r=o[A+12>>2],r=0|Zn[o[o[r>>2]+8>>2]](r,e+8|0,o[A+8>>2],o[A+28>>2],1),o[i+o[A+24>>2]>>2]=r,r=o[i+o[A+24>>2]>>2]),n=o[A+20>>2],t=o[n+8>>2],o[t+8>>2]!=o[o[A+4>>2]+8>>2]?(t=o[n+12>>2],c=n+12|0,i=3):(c=n+8|0,i=2),J=c,c=e+8|0,o[J>>2]=c,Zn[o[o[n>>2]+(i<<2)>>2]](n,-1,f),Zn[o[o[r>>2]+8>>2]](r,c,o[A+8>>2],o[A+16>>2],o[A+20>>2]),r=o[A+20>>2],o[(o[o[r+8>>2]+8>>2]==o[o[A+4>>2]+8>>2]?8:12)+r>>2]=t)),S=e+160|0}function PA(A,r,f){A|=0,r|=0,f|=0;var e,i,n,a=0,t=0,c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=0,d=0,v=m(0),B=m(0),Q=0;S=e=S-80|0,a=o[A+4>>2],Zn[o[o[a>>2]+16>>2]](a,e+28|0,e+24|0,e+20|0,e+16|0,e+12|0,e+8|0,e+4|0,e,r),c=o[e+12>>2]+G(o[e+8>>2],f)|0,a=o[A+4>>2],i=o[e+16>>2],n=o[e+28>>2],t=o[e>>2];A:if(o[e+20>>2])3==(0|t)?(t=G(h[c+4>>1],i)+n|0,k=Z[t>>3],d=Z[t+8>>3],Q=Z[t+16>>3],b=w[a+4>>2],u=w[a+8>>2],l=w[a+12>>2],o[e+76>>2]=0,w[e+72>>2]=l*m(Q),w[e+68>>2]=u*m(d),w[e+64>>2]=b*m(k),t=G(h[c+2>>1],i)+n|0,k=Z[t>>3],d=Z[t+8>>3],Q=Z[t+16>>3],b=w[a+4>>2],u=w[a+8>>2],l=w[a+12>>2],o[e+60>>2]=0,w[e+56>>2]=l*m(Q),w[e+52>>2]=u*m(d),w[e+48>>2]=b*m(k),c=G(h[c>>1],i)+n|0,k=Z[c+8>>3],d=Z[c+16>>3],b=w[a+8>>2],u=w[a+12>>2],w[e+32>>2]=w[a+4>>2]*m(Z[c>>3]),u=m(u*m(d)),b=m(b*m(k))):(t=G(o[c+8>>2],i)+n|0,k=Z[t>>3],d=Z[t+8>>3],Q=Z[t+16>>3],b=w[a+4>>2],u=w[a+8>>2],l=w[a+12>>2],o[e+76>>2]=0,w[e+72>>2]=l*m(Q),w[e+68>>2]=u*m(d),w[e+64>>2]=b*m(k),t=G(o[c+4>>2],i)+n|0,k=Z[t>>3],d=Z[t+8>>3],Q=Z[t+16>>3],b=w[a+4>>2],u=w[a+8>>2],l=w[a+12>>2],o[e+60>>2]=0,w[e+56>>2]=l*m(Q),w[e+52>>2]=u*m(d),w[e+48>>2]=b*m(k),c=G(o[c>>2],i)+n|0,k=Z[c+8>>3],d=Z[c+16>>3],b=w[a+8>>2],u=w[a+12>>2],w[e+32>>2]=w[a+4>>2]*m(Z[c>>3]),u=m(u*m(d)),b=m(b*m(k)));else{if(3!=(0|t)){t=G(o[c+8>>2],i)+n|0,b=w[t>>2],u=w[t+4>>2],l=w[t+8>>2],s=w[a+4>>2],v=w[a+8>>2],B=w[a+12>>2],o[e+76>>2]=0,w[e+72>>2]=l*B,w[e+68>>2]=u*v,w[e+64>>2]=b*s,t=G(o[c+4>>2],i)+n|0,b=w[t>>2],u=w[t+4>>2],l=w[t+8>>2],s=w[a+4>>2],v=w[a+8>>2],B=w[a+12>>2],o[e+60>>2]=0,w[e+56>>2]=l*B,w[e+52>>2]=u*v,w[e+48>>2]=b*s,c=G(o[c>>2],i)+n|0,b=w[c+4>>2],u=w[c+8>>2],l=w[a+8>>2],s=w[a+12>>2],w[e+32>>2]=w[c>>2]*w[a+4>>2],u=m(u*s),b=m(b*l);break A}t=G(h[c+4>>1],i)+n|0,b=w[t>>2],u=w[t+4>>2],l=w[t+8>>2],s=w[a+4>>2],v=w[a+8>>2],B=w[a+12>>2],o[e+76>>2]=0,w[e+72>>2]=l*B,w[e+68>>2]=u*v,w[e+64>>2]=b*s,t=G(h[c+2>>1],i)+n|0,b=w[t>>2],u=w[t+4>>2],l=w[t+8>>2],s=w[a+4>>2],v=w[a+8>>2],B=w[a+12>>2],o[e+60>>2]=0,w[e+56>>2]=l*B,w[e+52>>2]=u*v,w[e+48>>2]=b*s,c=G(h[c>>1],i)+n|0,b=w[c+4>>2],u=w[c+8>>2],l=w[a+8>>2],s=w[a+12>>2],w[e+32>>2]=w[c>>2]*w[a+4>>2],u=m(u*s),b=m(b*l)}o[e+44>>2]=0,w[e+40>>2]=u,w[e+36>>2]=b,a=o[A+8>>2],Zn[o[o[a>>2]+8>>2]](a,e+32|0,r,f),A=o[A+4>>2],Zn[o[o[A>>2]+24>>2]](A,r),S=e+80|0}function OA(A,r,f){var e,i=0,n=0,a=m(0),t=m(0),c=m(0),b=0,u=m(0),l=m(0),s=m(0),k=0,d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0);if(S=e=S-16|0,!((0|(i=o[A+844>>2]))<=0)){for(;d=w[r+48>>2],B=w[r+8>>2],Z=w[r>>2],Q=w[r+4>>2],v=w[r+52>>2],E=w[r+24>>2],u=w[r+16>>2],W=w[r+20>>2],a=w[r+56>>2],c=w[r+40>>2],t=w[r+32>>2],h=w[r+36>>2],n=G(b=i-1|0,208)+A|0,o[n- -64>>2]=0,s=a,a=w[n+12>>2],l=m(c*a),c=w[n+4>>2],N=m(t*c),t=w[n+8>>2],h=m(s+m(l+m(N+m(h*t)))),w[n+60>>2]=h,v=m(v+m(m(a*E)+m(m(c*u)+m(t*W)))),w[n+56>>2]=v,d=m(d+m(m(a*B)+m(m(c*Z)+m(t*Q)))),w[n+52>>2]=d,B=w[f+56>>2],Z=w[f+40>>2],Q=w[f+32>>2],E=w[f+36>>2],u=w[f+52>>2],W=w[f+24>>2],N=w[f+16>>2],p=w[f+20>>2],a=w[f+48>>2],c=w[f+8>>2],t=w[f>>2],l=w[f+4>>2],o[n+48>>2]=0,s=a,a=w[n+28>>2],F=m(c*a),c=w[n+20>>2],R=m(t*c),t=w[n+24>>2],l=m(s+m(F+m(R+m(l*t)))),w[n+36>>2]=l,u=m(u+m(m(a*W)+m(m(c*N)+m(t*p)))),w[n+40>>2]=u,a=m(B+m(m(a*Z)+m(m(c*Q)+m(t*E)))),w[n+44>>2]=a,w[n+84>>2]=m(m(h-a)*w[n+76>>2])+m(m(m(d-l)*w[n+68>>2])+m(m(v-u)*w[n+72>>2])),o[n+168>>2]=o[n+168>>2]+1,n=i>>>0>1,i=b,n;);if(!((0|(r=o[A+844>>2]))<=0))for(;;){b=4+(i=G(r=(f=r)-1|0,208)+A|0)|0;A:if((a=w[i+84>>2])<=(c=w[A+848>>2]))if(t=m(w[i+44>>2]-m(w[i+60>>2]-m(a*w[i+76>>2]))),s=m(t*t),t=m(w[i+36>>2]-m(w[i+52>>2]-m(w[i+68>>2]*a))),a=m(w[i+40>>2]-m(w[i+56>>2]-m(a*w[i+72>>2]))),m(s+m(m(t*t)+m(a*a)))>m(c*c)){if((n=o[i+120>>2])&&(k=o[8785])&&(Zn[0|k](n),o[i+120>>2]=0),(0|f)!=(0|(i=o[A+844>>2]))?(pr(b,(i=G(i,208)+A|0)-204|0,208),o[168+(i=i-208|0)>>2]=0,o[i+120>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+140>>2]=0,o[i+144>>2]=0,i=o[A+844>>2]):i=f,i=i-1|0,o[A+844>>2]=i,i|!(b=o[8788]))break A;o[e+12>>2]=A,Zn[0|b](e+12|0)}else(i=o[8786])&&Zn[0|i](b,o[A+836>>2],o[A+840>>2]);else{if((n=o[i+120>>2])&&(k=o[8785])&&(Zn[0|k](n),o[i+120>>2]=0),(0|f)!=(0|(i=o[A+844>>2]))?(pr(b,(i=G(i,208)+A|0)-204|0,208),o[168+(i=i-208|0)>>2]=0,o[i+120>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+140>>2]=0,o[i+144>>2]=0,i=o[A+844>>2]):i=f,i=i-1|0,o[A+844>>2]=i,i|!(b=o[8788]))break A;o[e+8>>2]=A,Zn[0|b](e+8|0)}if(!(f>>>0>1))break}}S=e+16|0}function SA(A,r,f,e,i,n,a){var t,c=0,b=0,u=0,l=0,s=0,k=0,d=0,v=0,h=0,B=0,w=0,Z=0,m=0,Q=0,E=0,W=0,N=0;if(S=t=S-48|0,c=o[f+8>>2])for(v=c;;){if(o[v+20>>2]>o[A+100>>2]){u=o[v+12>>2],b=o[u+92>>2],l=o[u+96>>2],c=o[f+88>>2],s=o[u+88>>2],d=o[f+92>>2],u=o[f+96>>2],o[t+44>>2]=-1,u=l-u|0,o[t+40>>2]=u,b=b-d|0,o[t+36>>2]=b,l=s-c|0,o[t+32>>2]=l,s=b,b=ee(b,h=b>>31,o[i+8>>2],o[i+12>>2]),c=L,d=l,l=ee(l,B=l>>31,o[i>>2],o[i+4>>2]),c=L+c|0,c=(b=l+b|0)>>>0>>0?c+1|0:c,l=(Z=ee(u,w=u>>31,o[i+16>>2],o[i+20>>2]))+b|0,b=L+c|0,b=l>>>0>>0?b+1|0:b,c=ee(o[n+8>>2],o[n+12>>2],s,h),h=L,s=(d=ee(o[n>>2],o[n+4>>2],d,B))+c|0,c=L+h|0,c=s>>>0>>0?c+1|0:c,m=s,s=ee(o[n+16>>2],o[n+20>>2],u,w),c=L+c|0,s=c=(u=m+s|0)>>>0>>0?c+1|0:c,!!u&(0|c)>=0|(0|c)>0?(o[t+24>>2]=1,d=0,c=-1):(0|s)<0?(o[t+24>>2]=-1,c=u,u=0-u|0,s=0-(!!(0|c)+s|0)|0,d=0,c=1):(o[t+24>>2]=0,u=0,s=0,d=1,c=0),o[t+8>>2]=u,o[t+12>>2]=s;A:{r:{f:{if(s=t,!l&(0|b)<=0|(0|b)<0){if((0|b)>0|(0|b)>=0)break f;o[t+24>>2]=c,b=0-(!!(0|l)+b|0)|0,l=0-l|0}o[s+16>>2]=l,o[t+20>>2]=b;break r}if(o[t+16>>2]=0,o[t+20>>2]=0,d)break A}if(k){if((0|(u=Er(t+8|0,a)))<0)k=o[t+12>>2],o[a>>2]=o[t+8>>2],o[a+4>>2]=k,o[a+16>>2]=o[t+24>>2],k=o[t+20>>2],o[a+8>>2]=o[t+16>>2],o[a+12>>2]=k,k=v;else if(!u){W=k,b=o[k+4>>2];r:f:{if(o[k>>2]==(0|v)){if(c=2,(0|b)!=(0|v))break f;u=o[v+12>>2],b=o[o[v+8>>2]+12>>2],c=o[b+96>>2],s=o[u+96>>2]-c|0,l=o[k+12>>2],d=o[b+92>>2],h=o[l+92>>2]-d|0,d=o[u+92>>2]-d|0,c=o[l+96>>2]-c|0,k=B=G(s,h)-G(d,c)|0,m=B>>31,B=o[e+8>>2],w=o[t+36>>2],Z=o[e+4>>2],E=o[t+40>>2],Q=ee(k,m,Q=G(B,w)-G(Z,E)|0,Q>>31),k=L,b=o[b+88>>2],l=o[l+88>>2]-b|0,m=G(l,d),d=o[u+88>>2]-b|0,m=u=m-G(d,h)|0,N=u>>31,h=o[t+32>>2],b=w,w=o[e>>2],Z=ee(m,N,u=G(h,Z)-G(b,w)|0,u>>31),u=L+k|0,u=(b=Z+Q|0)>>>0>>0?u+1|0:u,k=b,l=ee(c=b=G(c,d)-G(l,s)|0,s=b>>31,b=G(w,E)-G(h,B)|0,b>>31),u=L+u|0,c=!!(b=k+l|0)&(0|(u=b>>>0>>0?u+1|0:u))>=0|(0|u)>0?2:1;break r}c=(0|b)==(0|v)}k=2!=(0|c)^r?v:W}}else k=o[t+12>>2],o[a>>2]=o[t+8>>2],o[a+4>>2]=k,o[a+16>>2]=o[t+24>>2],k=o[t+20>>2],o[a+8>>2]=o[t+16>>2],o[a+12>>2]=k,k=v}c=o[f+8>>2]}if((0|(v=o[v>>2]))==(0|c))break}return S=t+48|0,k}function LA(A,r){var f=0,e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=0,B=0,Z=m(0),G=m(0),Q=m(0);2&v[A+204|0]?(f=o[A+8>>2],o[A+68>>2]=o[A+4>>2],o[A+72>>2]=f,f=o[A+16>>2],o[A+76>>2]=o[A+12>>2],o[A+80>>2]=f,f=o[A+24>>2],o[A+84>>2]=o[A+20>>2],o[A+88>>2]=f,f=o[A+32>>2],o[A+92>>2]=o[A+28>>2],o[A+96>>2]=f,f=o[A+40>>2],o[A+100>>2]=o[A+36>>2],o[A+104>>2]=f,f=o[A+48>>2],o[A+108>>2]=o[A+44>>2],o[A+112>>2]=f,f=A+52|0):(f=o[r+4>>2],o[A+68>>2]=o[r>>2],o[A+72>>2]=f,f=o[r+12>>2],o[A+76>>2]=o[r+8>>2],o[A+80>>2]=f,f=o[r+20>>2],o[A+84>>2]=o[r+16>>2],o[A+88>>2]=f,f=o[r+28>>2],o[A+92>>2]=o[r+24>>2],o[A+96>>2]=f,f=o[r+36>>2],o[A+100>>2]=o[r+32>>2],o[A+104>>2]=f,f=o[r+44>>2],o[A+108>>2]=o[r+40>>2],o[A+112>>2]=f,f=r+48|0),h=o[f+4>>2],o[A+116>>2]=o[f>>2],o[A+120>>2]=h,h=o[f+8>>2],f=o[f+12>>2],B=o[A+400>>2],o[A+156>>2]=o[A+396>>2],o[A+160>>2]=B,B=o[A+392>>2],o[A+148>>2]=o[A+388>>2],o[A+152>>2]=B,o[A+124>>2]=h,o[A+128>>2]=f,f=o[A+376>>2],o[A+132>>2]=o[A+372>>2],o[A+136>>2]=f,f=o[A+384>>2],o[A+140>>2]=o[A+380>>2],o[A+144>>2]=f,f=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=f,f=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=f,f=o[r+28>>2],o[A+28>>2]=o[r+24>>2],o[A+32>>2]=f,f=o[r+20>>2],o[A+20>>2]=o[r+16>>2],o[A+24>>2]=f,f=o[r+44>>2],o[A+44>>2]=o[r+40>>2],o[A+48>>2]=f,f=o[r+36>>2],o[A+36>>2]=o[r+32>>2],o[A+40>>2]=f,f=o[r+60>>2],o[A+60>>2]=o[r+56>>2],o[A+64>>2]=f,f=o[r+52>>2],o[A+52>>2]=o[r+48>>2],o[A+56>>2]=f,b=w[A+8>>2],u=w[A+12>>2],l=w[A+28>>2],s=w[A+20>>2],k=w[A+24>>2],a=w[A+44>>2],Z=w[A+464>>2],t=w[A+36>>2],c=w[A+40>>2],G=w[A+460>>2],d=w[A+4>>2],Q=w[A+456>>2],o[A+368>>2]=0,o[A+352>>2]=0,o[A+336>>2]=0,e=m(Z*a),i=m(Q*t),n=m(G*c),w[A+364>>2]=m(a*e)+m(m(t*i)+m(c*n)),w[A+360>>2]=m(l*e)+m(m(s*i)+m(k*n)),w[A+356>>2]=m(u*e)+m(m(d*i)+m(b*n)),e=m(Z*l),i=m(Q*s),n=m(G*k),w[A+348>>2]=m(a*e)+m(m(t*i)+m(c*n)),w[A+344>>2]=m(l*e)+m(m(s*i)+m(k*n)),w[A+340>>2]=m(u*e)+m(m(d*i)+m(b*n)),e=a,a=m(u*Z),i=t,t=m(d*Q),n=c,c=m(b*G),w[A+332>>2]=m(e*a)+m(m(i*t)+m(n*c)),w[A+328>>2]=m(l*a)+m(m(s*t)+m(c*k)),w[A+324>>2]=m(u*a)+m(m(d*t)+m(b*c))}function $A(A,r,f,e,i){var n,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0);n=-16&v[i+16|0],a[i+16|0]=n,g=w[e+8>>2],k=w[r+8>>2],G=m(g-k),s=w[A+8>>2],t=m(s-k),X=w[e>>2],d=w[r>>2],Q=m(X-d),u=w[A>>2],c=m(u-d),D=w[e+4>>2],h=w[r+4>>2],E=m(D-h),B=w[A+4>>2],b=m(B-h),l=m(m(G*t)+m(m(Q*c)+m(E*b))),F=w[f+8>>2],W=m(F-k),R=w[f>>2],N=m(R-d),Y=w[f+4>>2],p=m(Y-h),!((c=m(m(W*t)+m(m(N*c)+m(p*b))))<=m(0))|!(l<=m(0))?(t=m(s-F),b=m(u-R),Z=m(B-Y),V=m(m(G*t)+m(m(Q*b)+m(E*Z))),!((b=m(m(W*t)+m(m(N*b)+m(p*Z))))>=m(0))|!(b>=V)?(Z=m(m(c*V)-m(l*b)),!(b<=m(0))|!(c>=m(0))||(t=m(0),!(Z<=m(0)))?(t=m(s-g),u=m(u-X),B=m(B-D),s=m(m(W*t)+m(m(N*u)+m(p*B))),!((t=m(m(G*t)+m(m(Q*u)+m(E*B))))>=m(0))|!(t>=s)?(u=m(m(s*l)-m(t*c)),!(t<=m(0))|!(l>=m(0))||(c=m(0),!(u<=m(0)))?(l=m(m(b*t)-m(V*s)))<=m(0)&&(c=m(V-b))>=m(0)&&(t=m(s-t))>=m(0)?(o[i+12>>2]=0,a[i+16|0]=6|n,t=m(c/m(c+t)),w[i+8>>2]=F+m(m(g-F)*t),w[i+4>>2]=Y+m(m(D-Y)*t),w[i>>2]=R+m(m(X-R)*t),c=m(m(1)-t),b=m(0)):(o[i+12>>2]=0,a[i+16|0]=7|n,c=m(m(1)/m(Z+m(l+u))),t=m(Z*c),c=m(u*c),w[i+8>>2]=m(G*t)+m(k+m(W*c)),w[i+4>>2]=m(E*t)+m(h+m(p*c)),w[i>>2]=m(Q*t)+m(d+m(N*c)),b=m(m(m(1)-c)-t)):(o[i+12>>2]=0,a[i+16|0]=5|n,t=m(l/m(l-t)),w[i+8>>2]=k+m(G*t),w[i+4>>2]=h+m(E*t),w[i>>2]=d+m(Q*t),b=m(m(1)-t))):(A=o[e+4>>2],o[i>>2]=o[e>>2],o[i+4>>2]=A,A=o[e+12>>2],o[i+8>>2]=o[e+8>>2],o[i+12>>2]=A,a[i+16|0]=4|n,t=m(1),c=m(0),b=m(0))):(o[i+12>>2]=0,a[i+16|0]=3|n,c=m(c/m(c-b)),w[i+8>>2]=k+m(W*c),w[i+4>>2]=h+m(p*c),w[i>>2]=d+m(N*c),b=m(m(1)-c))):(A=o[f+4>>2],o[i>>2]=o[f>>2],o[i+4>>2]=A,A=o[f+12>>2],o[i+8>>2]=o[f+8>>2],o[i+12>>2]=A,a[i+16|0]=2|n,c=m(1),t=m(0),b=m(0))):(A=o[r+4>>2],o[i>>2]=o[r>>2],o[i+4>>2]=A,A=o[r+12>>2],o[i+8>>2]=o[r+8>>2],o[i+12>>2]=A,a[i+16|0]=1|n,c=m(0),t=m(0),b=m(1)),w[i+20>>2]=b,o[i+32>>2]=0,w[i+28>>2]=t,w[i+24>>2]=c}function KA(A,r,f,e,i,n){var a,t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=0,B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),p=0,F=0,R=m(0),Y=m(0),V=m(0),g=0,X=0,D=0,C=0,J=0,x=0;if(S=a=S-32|0,o[A+56>>2]>0)for(k=w[e+8>>2],d=w[f+8>>2],b=m(k-d),v=w[e>>2],l=w[f>>2],u=m(v-l),s=w[e+4>>2],c=w[f+4>>2],B=m(s-c),Z=m(m(1)/m(N(m(m(b*b)+m(m(u*u)+m(B*B)))))),Q=m(b*Z),E=m(Q*b),b=m(u*Z),W=m(b*u),u=m(B*Z),B=m(E+m(W+m(B*u))),Z=m((k>d?k:d)+w[n+8>>2]),E=m((c>2]),W=m((l>2]),R=m((k>2]),Y=m((c>s?s:c)+w[i+4>>2]),V=m((l>v?v:l)+w[i>>2]),e=o[A+96>>2],g=((t=(k=Q==m(0)?m(0xde0b6b000000000):m(m(1)/Q))>2],o[a>>2]=o[e>>2],o[a+4>>2]=t,t=o[e+12>>2],o[a+8>>2]=o[e+8>>2],o[a+12>>2]=t,t=o[e+28>>2],o[a+24>>2]=o[e+24>>2],o[a+28>>2]=t,t=o[e+20>>2],o[a+16>>2]=o[e+16>>2],o[a+20>>2]=t,w[a>>2]=w[a>>2]-w[n>>2],w[a+4>>2]=w[a+4>>2]-w[n+4>>2],w[a+8>>2]=w[a+8>>2]-w[n+8>>2],w[a+16>>2]=w[a+16>>2]-w[i>>2],w[a+20>>2]=w[a+20>>2]-w[i+4>>2],w[a+24>>2]=w[a+24>>2]-w[i+8>>2],t=0,w[e+16>>2]>2]>W||(t=1)),h=0;A:{r:{f:{e:{if(!(1^(w[e+24>>2]>2]?h:t)|w[e+4>>2]>E|w[e+20>>2]>2],l=m(v*m(w[J>>2]-b)),c=w[f+4>>2],l>(s=m(d*m(w[C>>2]-c)))||(c=m(d*m(w[X>>2]-c)))>(b=m(v*m(w[x>>2]-b)))||(l=c>l?c:l,u=w[f+8>>2],l>(c=m(k*m(w[D>>2]-u)))||(u=m(k*m(w[g>>2]-u)))>(s=b>s?s:b))))){if(h=-1==(0|(F=o[e+32>>2])),!(t=B>(u>l?u:l)&(cm(0))|-1!=(0|F))break e;Zn[o[o[r>>2]+8>>2]](r,o[e+36>>2],o[e+40>>2]);break f}h=-1==o[e+32>>2],t=0}if(!h&&!t)break r}G=G+1|0,e=e- -64|0;break A}G=(t=o[e+32>>2])+G|0,e=(t<<6)+e|0}if(p=p+1|0,!(o[A+56>>2]>(0|G)))break}o[8502]<(0|p)&&(o[8502]=p),S=a+32|0}function qA(A){var r,f,e=0,i=0,n=0,t=0,c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=0,h=0,B=0,Z=0,Q=m(0),E=m(0);if(S=r=S+-64|0,e=o[A+8>>2],f=o[A+4>>2],i=r+48|0,n=r+32|0,Zn[o[o[e>>2]+8>>2]](e,f+4|0,i,n),e=o[A+12>>2],t=o[e+68>>2],Zn[o[o[t>>2]+16>>2]](t,o[o[A+4>>2]+188>>2],i,n,o[e+24>>2]),i=o[A+12>>2],e=o[i+24>>2],Zn[o[o[e>>2]+32>>2]](e,o[o[A+4>>2]+344>>2],i+28|0,e),o[r+24>>2]=0,o[r+16>>2]=0,o[r+20>>2]=0,a[r+28|0]=1,e=o[o[A+4>>2]+344>>2],!((0|Zn[o[o[e>>2]+36>>2]](e))<=0)){for(;;){if(!((0|(i=o[r+16>>2]))>=0)){if(o[r+20>>2]<0&&(!(e=o[r+24>>2])||!e|!v[r+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),a[r+28|0]=1,o[r+20>>2]=0,o[r+24>>2]=0),n=0,t=0-(e=i)&3)for(;o[o[r+24>>2]+(e<<2)>>2]=0,e=e+1|0,(0|t)!=(0|(n=n+1|0)););if(!(i>>>0>4294967292))for(;o[(i=e<<2)+o[r+24>>2]>>2]=0,o[4+(i+o[r+24>>2]|0)>>2]=0,o[8+(i+o[r+24>>2]|0)>>2]=0,o[12+(i+o[r+24>>2]|0)>>2]=0,e=e+4|0;);}if(o[r+16>>2]=0,e=o[o[A+4>>2]+344>>2],e=o[12+(0|Zn[o[o[e>>2]+28>>2]](e))>>2]+(c<<4)|0,i=o[o[o[e+4>>2]>>2]+188>>2],n=o[o[o[e>>2]>>2]+188>>2],!(!(o[i+8>>2]&o[n+4>>2])|!(o[n+8>>2]&o[i+4>>2])||((e=o[e+8>>2])&&Zn[o[o[e>>2]+16>>2]](e,r+12|0),(0|(d=o[r+16>>2]))<=0)))for(B=o[A+4>>2],i=0,Z=o[r+24>>2];;){if(t=o[(i<<2)+Z>>2],(0|(h=o[t+844>>2]))>0)for(b=o[t+836>>2]==(0|B)?m(-1):m(1),u=w[f+60>>2],l=w[f+56>>2],s=w[f+52>>2],e=0;n=t+G(e,208)|0,Q=w[n+68>>2],E=w[n+72>>2],k=w[n+84>>2],u=m(m(k*m(b*w[n+76>>2]))+u),w[f+60>>2]=u,l=m(m(k*m(b*E))+l),w[f+56>>2]=l,s=m(m(k*m(b*Q))+s),w[f+52>>2]=s,(0|h)!=(0|(e=e+1|0)););if((0|d)==(0|(i=i+1|0)))break}if(e=o[o[A+4>>2]+344>>2],c=c+1|0,!((0|Zn[o[o[e>>2]+36>>2]](e))>(0|c)))break}!(A=o[r+24>>2])|!v[r+28|0]||A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}S=r- -64|0}function _A(A){var r,f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(!((0|(r=o[A+32>>2]))>=(0|(f=o[A+12>>2])))){A:if((0|f)<=o[A+36>>2])i=o[A+40>>2];else{f?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](f<<2,16),e=o[A+32>>2]):e=r,c=o[A+40>>2];r:if((0|e)>0){if(e>>>0>=4)for(l=-4&e;o[(n=t<<2)+i>>2]=o[n+c>>2],o[(b=4|n)+i>>2]=o[c+b>>2],o[(b=8|n)+i>>2]=o[c+b>>2],o[(n|=12)+i>>2]=o[n+c>>2],t=t+4|0,(0|l)!=(0|(u=u+4|0)););if(!(e&=3))break r;for(;o[(n=t<<2)+i>>2]=o[n+c>>2],t=t+1|0,(0|e)!=(0|(s=s+1|0)););}else if(!c){o[A+40>>2]=i,o[A+36>>2]=f,a[A+44|0]=1;break A}c&&v[A+44|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[A+40>>2]=i,a[A+44|0]=1,o[A+36>>2]=f}if(Af((e=r<<2)+i|0,0,(l=f<<2)-e|0),o[A+32>>2]=f,(0|(c=o[A+52>>2]))<(0|f)){A:if((0|f)<=o[A+56>>2])i=o[A+60>>2];else{f?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](l,16),e=o[A+52>>2]):(i=0,e=c),n=o[A+60>>2];r:if((0|e)>0){if(s=0,t=0,e>>>0>=4)for(d=-4&e,u=0;o[(b=t<<2)+i>>2]=o[n+b>>2],o[(k=4|b)+i>>2]=o[n+k>>2],o[(k=8|b)+i>>2]=o[n+k>>2],o[(b|=12)+i>>2]=o[n+b>>2],t=t+4|0,(0|d)!=(0|(u=u+4|0)););if(!(e&=3))break r;for(;o[(u=t<<2)+i>>2]=o[n+u>>2],t=t+1|0,(0|e)!=(0|(s=s+1|0)););}else if(!n){o[A+60>>2]=i,o[A+56>>2]=f,a[A- -64|0]=1;break A}n&&v[A- -64|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),o[A+60>>2]=i,a[A+64|0]=1,o[A+56>>2]=f}Af((e=c<<2)+i|0,0,l-e|0)}if(o[A+52>>2]=f,(0|f)>0&&(Af(o[A+40>>2],255,l),Af(o[A+60>>2],255,l)),!((0|r)<=0))for(e=o[A+60>>2],c=o[A+16>>2],i=o[A+40>>2],t=0;f=o[o[4+(f=c+(t<<4)|0)>>2]+12>>2]<<16|o[o[f>>2]+12>>2],f=G((f=~(f<<15)+f|0)>>>10^f,9),f=~((f^=f>>>6)<<11)+f|0,f=i+((o[A+12>>2]-1&(f>>>16^f))<<2)|0,o[e+(t<<2)>>2]=o[f>>2],o[f>>2]=t,(0|r)!=(0|(t=t+1|0)););}}function Ar(A){var r,f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(!((0|(r=o[A+28>>2]))>=(0|(f=o[A+12>>2])))){A:if((0|f)<=o[A+32>>2])i=o[A+36>>2];else{f?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](f<<2,16),e=o[A+28>>2]):e=r,c=o[A+36>>2];r:if((0|e)>0){if(e>>>0>=4)for(l=-4&e;o[(n=t<<2)+i>>2]=o[n+c>>2],o[(b=4|n)+i>>2]=o[c+b>>2],o[(b=8|n)+i>>2]=o[c+b>>2],o[(n|=12)+i>>2]=o[n+c>>2],t=t+4|0,(0|l)!=(0|(u=u+4|0)););if(!(e&=3))break r;for(;o[(n=t<<2)+i>>2]=o[n+c>>2],t=t+1|0,(0|e)!=(0|(s=s+1|0)););}else if(!c){o[A+36>>2]=i,o[A+32>>2]=f,a[A+40|0]=1;break A}c&&v[A+40|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[A+36>>2]=i,a[A+40|0]=1,o[A+32>>2]=f}if(Af((e=r<<2)+i|0,0,(l=f<<2)-e|0),o[A+28>>2]=f,(0|(c=o[A+48>>2]))<(0|f)){A:if((0|f)<=o[A+52>>2])i=o[A+56>>2];else{f?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](l,16),e=o[A+48>>2]):(i=0,e=c),n=o[A+56>>2];r:if((0|e)>0){if(s=0,t=0,e>>>0>=4)for(d=-4&e,u=0;o[(b=t<<2)+i>>2]=o[n+b>>2],o[(k=4|b)+i>>2]=o[n+k>>2],o[(k=8|b)+i>>2]=o[n+k>>2],o[(b|=12)+i>>2]=o[n+b>>2],t=t+4|0,(0|d)!=(0|(u=u+4|0)););if(!(e&=3))break r;for(;o[(u=t<<2)+i>>2]=o[n+u>>2],t=t+1|0,(0|e)!=(0|(s=s+1|0)););}else if(!n){o[A+56>>2]=i,o[A+52>>2]=f,a[A+60|0]=1;break A}n&&v[A+60|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),o[A+56>>2]=i,a[A+60|0]=1,o[A+52>>2]=f}Af((e=c<<2)+i|0,0,l-e|0)}if(o[A+48>>2]=f,(0|f)>0&&(Af(o[A+36>>2],255,l),Af(o[A+56>>2],255,l)),!((0|r)<=0))for(e=o[A+56>>2],c=o[A+16>>2],i=o[A+36>>2],t=0;f=c+G(t,12)|0,f=o[f+4>>2]<<16|o[f>>2],f=G((f=~(f<<15)+f|0)>>>10^f,9),f=~((f^=f>>>6)<<11)+f|0,f=i+((o[A+12>>2]-1&(f>>>16^f))<<2)|0,o[e+(t<<2)>>2]=o[f>>2],o[f>>2]=t,(0|r)!=(0|(t=t+1|0)););}}function rr(A,r,f,e,i,n,a){var t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0);o[i>>2]=0,o[i+4>>2]=0,o[i+32>>2]=0,o[i+24>>2]=0,o[i+28>>2]=0,o[i+16>>2]=0,o[i+20>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,o[n+4>>2]=f,o[n>>2]=A,l=w[e+20>>2],s=w[e+36>>2],t=w[r+20>>2],c=w[r+36>>2],k=w[e+24>>2],d=w[r+24>>2],v=w[e+40>>2],h=w[r+40>>2],b=w[e+32>>2],B=w[e>>2],Z=w[e+16>>2],G=w[e+4>>2],Q=w[r+32>>2],E=w[r>>2],W=w[r+16>>2],N=w[r+4>>2],p=w[e+8>>2],u=w[r+8>>2],o[n+52>>2]=0,o[n+36>>2]=0,o[n+20>>2]=0,w[n+48>>2]=m(v*h)+m(m(p*u)+m(d*k)),w[n+44>>2]=m(v*c)+m(m(p*N)+m(t*k)),w[n+40>>2]=m(v*Q)+m(m(p*E)+m(W*k)),w[n+32>>2]=m(s*h)+m(m(G*u)+m(d*l)),w[n+28>>2]=m(s*c)+m(m(G*N)+m(t*l)),w[n+24>>2]=m(s*Q)+m(m(G*E)+m(W*l)),w[n+16>>2]=m(b*h)+m(m(B*u)+m(Z*d)),w[n+12>>2]=m(b*c)+m(m(B*N)+m(Z*t)),w[n+8>>2]=m(b*Q)+m(m(B*E)+m(Z*W)),Y=w[r+52>>2],V=w[e+52>>2],g=w[r+56>>2],F=w[e+56>>2],l=w[r+20>>2],s=w[r+36>>2],B=w[e+20>>2],Z=w[e+36>>2],t=w[r+24>>2],G=w[e+24>>2],c=w[r+40>>2],Q=w[e+40>>2],X=w[r+48>>2],R=w[e+48>>2],k=w[r+32>>2],d=w[r>>2],v=w[r+16>>2],h=w[r+4>>2],E=w[e+32>>2],W=w[e>>2],N=w[e+16>>2],p=w[e+4>>2],b=w[r+8>>2],u=w[e+8>>2],o[n+124>>2]=0,o[n+120>>2]=a?907:908,o[n+116>>2]=0,o[n+100>>2]=0,o[n+84>>2]=0,o[n+68>>2]=0,w[n+96>>2]=m(c*Q)+m(m(b*u)+m(G*t)),w[n+92>>2]=m(c*Z)+m(m(b*p)+m(B*t)),w[n+88>>2]=m(c*E)+m(m(b*W)+m(N*t)),w[n+80>>2]=m(s*Q)+m(m(h*u)+m(G*l)),w[n+76>>2]=m(s*Z)+m(m(h*p)+m(B*l)),w[n+72>>2]=m(s*E)+m(m(h*W)+m(N*l)),w[n- -64>>2]=m(k*Q)+m(m(d*u)+m(v*G)),w[n+60>>2]=m(k*Z)+m(m(d*p)+m(v*B)),w[n+56>>2]=m(k*E)+m(m(d*W)+m(v*N)),u=c,c=m(F-g),F=b,b=m(R-X),R=t,t=m(V-Y),w[n+112>>2]=m(u*c)+m(m(F*b)+m(R*t)),w[n+108>>2]=m(s*c)+m(m(h*b)+m(t*l)),w[n+104>>2]=m(k*c)+m(m(d*b)+m(t*v))}function fr(A,r,f){var e,i=m(0),n=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=0,k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0);S=e=S-48|0,a[A+60|0]=0,o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,i=w[r+8>>2],t=w[A+48>>2],n=w[r>>2],k=w[A+40>>2],b=w[r+4>>2],d=w[A+44>>2],u=m(m(i*t)+m(m(n*k)+m(b*d))),c=i,i=m(t*u),h=m(c-i),c=m(d*u),B=m(b-c),b=n,n=m(k*u),l=m(b-n),u<=m(0)?(w[e+24>>2]=i,w[e+20>>2]=c,w[e+16>>2]=n,b=c,G=n,c=m(0),n=m(0)):(o[e+44>>2]=0,w[e+40>>2]=i,w[e+36>>2]=c,w[e+32>>2]=n,b=m(0),Z=i,i=m(0)),r=0,o[e+12>>2]=0,w[e+4>>2]=B,w[e>>2]=l,w[e+8>>2]=h;A:{r:{if((l=m(m(h*h)+m(m(l*l)+m(B*B))))>2],w[e+40>>2]=m(u*t)+Z,w[e+36>>2]=m(d*t)+c,w[e+32>>2]=m(k*t)+n}a[A+108|0]=0,r=kA(A,e+32|0,f,10)?2:0,s=v[A+64|0]}s||(v[A+61|0]||1==(0|Zn[o[o[A>>2]+16>>2]](A))&&(a[A+108|0]=1),r=kA(A,e,f,10)|r,v[A+61|0]||1==(0|Zn[o[o[A>>2]+16>>2]](A))&&(a[A+108|0]=0)),l>2],Z=w[A+44>>2],t=i,i=w[A+32>>2],w[e+24>>2]=t-m(i*w[A+48>>2]),w[e+20>>2]=b-m(i*Z),w[e+16>>2]=G-m(n*i)),v[A+61|0]||1==(0|Zn[o[o[A>>2]+16>>2]](A))&&(a[A+108|0]=1),v[A+65|0]&&!v[A+64|0]||(a[A+108|0]=0);A:{r:{if(kA(A,e+16|0,f,1)&&(r|=4,!(v[A+64|0]||!((f=m(m(w[A+80>>2]*w[A+48>>2])+m(m(w[A+72>>2]*w[A+40>>2])+m(w[A+76>>2]*w[A+44>>2]))))>=m(0))|!($r(w[A+28>>2])>f)))){if(a[A+60|0]=1,v[A+61|0])break A;if(1==(0|Zn[o[o[A>>2]+16>>2]](A)))break r;break A}if(v[A+61|0])break A;if(1!=(0|Zn[o[o[A>>2]+16>>2]](A)))break A}a[A+108|0]=0}return S=e+48|0,r}function er(A,r,f){var e=0,i=m(0),n=m(0),a=m(0),t=0;if(!o[A>>2])return o[A>>2]=f,void(o[f+32>>2]=0);if(e=o[r+40>>2])for(n=m(w[f>>2]+w[f+16>>2]),i=m(w[f+8>>2]+w[f+24>>2]),a=m(w[f+4>>2]+w[f+20>>2]);t=r+36|0,r=o[r+36>>2],r=o[t+(!(m(m(m(Q(m(n-m(w[r>>2]+w[r+16>>2]))))+m(Q(m(a-m(w[r+4>>2]+w[r+20>>2])))))+m(Q(m(i-m(w[r+8>>2]+w[r+24>>2])))))>2]+w[e+16>>2]))))+m(Q(m(a-m(w[e+4>>2]+w[e+20>>2])))))+m(Q(m(i-m(w[e+8>>2]+w[e+24>>2]))))))<<2)>>2],e=o[r+40>>2];);t=o[r+32>>2],(e=o[A+4>>2])?o[A+4>>2]=0:(o[8488]=o[8488]+1,e=0|Zn[o[8290]](44,16),o[e>>2]=0,o[e+4>>2]=0,o[e+40>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0),o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=t,n=w[f>>2],i=w[r>>2],w[e>>2]=i>n?n:i,n=w[f+16>>2],i=w[r+16>>2],w[e+16>>2]=i>2],i=w[r+4>>2],w[e+4>>2]=i>n?n:i,n=w[f+20>>2],i=w[r+20>>2],w[e+20>>2]=i>2],i=w[r+8>>2],w[e+8>>2]=i>n?n:i,n=w[f+24>>2],i=w[r+24>>2],w[e+24>>2]=i>2]+40>>2]==(0|r))<<2)+t|0)>>2]=e,o[e+36>>2]=r,o[r+32>>2]=e,o[e+40>>2]=f,o[f+32>>2]=e,n=w[e>>2];;){if(A=e,!(!(w[(e=t)>>2]<=n)|!(w[e+4>>2]<=w[A+4>>2])|!(w[e+8>>2]<=w[A+8>>2])|!(w[e+16>>2]>=w[A+16>>2]))&&w[e+20>>2]>=w[A+20>>2]&&w[e+24>>2]>=w[A+24>>2])break A;if(A=o[e+36>>2],n=w[A>>2],r=o[e+40>>2],n=(i=w[r>>2])>n?n:i,w[e>>2]=n,i=w[A+16>>2],a=w[r+16>>2],w[e+16>>2]=i>a?i:a,i=w[A+4>>2],a=w[r+4>>2],w[e+4>>2]=i>2],a=w[r+20>>2],w[e+20>>2]=i>a?i:a,i=w[A+8>>2],a=w[r+8>>2],w[e+8>>2]=i>2],a=w[r+24>>2],w[e+24>>2]=i>a?i:a,!(t=o[e+32>>2]))break}else o[e+36>>2]=r,o[r+32>>2]=e,o[e+40>>2]=f,o[f+32>>2]=e,o[A>>2]=e}function ir(A,r,f){var e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0;if(!((a=o[A+56>>2])||((e=o[A+52>>2])?(o[A+52>>2]=o[e+8>>2],a=o[e>>2]):(o[8488]=o[8488]+1,e=0|Zn[o[8290]](12,16),i=o[A+60>>2],o[e+8>>2]=0,o[e+4>>2]=i,o[8488]=o[8488]+1,a=0|Zn[o[8290]](G(i,24),16),o[e>>2]=a,o[e+8>>2]=o[A+48>>2],o[A+48>>2]=e),(0|(t=o[e+4>>2]))<=0))){if(i=a,t>>>0>=4)for(s=-4&t,e=a;i=e+96|0,b=c+4|0,o[e+72>>2]=(0|t)>(0|b)?i:0,o[e+48>>2]=(0|t)>(3|c)?e+72|0:0,o[e+24>>2]=(0|t)>(2|c)?e+48|0:0,o[e>>2]=(0|t)>(1|c)?e+24|0:0,c=b,e=i,(0|s)!=(0|(n=n+4|0)););if(e=3&t)for(;n=i,i=i+24|0,b=b+1|0,o[n>>2]=(0|t)>(0|b)?i:0,(0|e)!=(0|(l=l+1|0)););}if(o[A+56>>2]=o[a>>2],o[a+16>>2]=0,o[a+20>>2]=0,o[a+8>>2]=0,o[a+12>>2]=0,o[a>>2]=0,o[a+4>>2]=0,!((n=o[A+56>>2])||((e=o[A+52>>2])?(o[A+52>>2]=o[e+8>>2],n=o[e>>2]):(o[8488]=o[8488]+1,e=0|Zn[o[8290]](12,16),i=o[A+60>>2],o[e+8>>2]=0,o[e+4>>2]=i,o[8488]=o[8488]+1,n=0|Zn[o[8290]](G(i,24),16),o[e>>2]=n,o[e+8>>2]=o[A+48>>2],o[A+48>>2]=e),(0|(u=o[e+4>>2]))<=0))){if(l=0,b=0,i=n,u>>>0>=4)for(s=-4&u,c=0,e=n,t=0;i=e+96|0,b=c+4|0,o[e+72>>2]=(0|u)>(0|b)?i:0,o[e+48>>2]=(3|c)<(0|u)?e+72|0:0,o[e+24>>2]=(2|c)<(0|u)?e+48|0:0,o[e>>2]=(1|c)<(0|u)?e+24|0:0,c=b,e=i,(0|s)!=(0|(t=t+4|0)););if(e=3&u)for(;c=i,i=i+24|0,b=b+1|0,o[c>>2]=(0|u)>(0|b)?i:0,(0|e)!=(0|(l=l+1|0)););}return o[A+56>>2]=o[n>>2],o[n+16>>2]=0,o[n+20>>2]=0,o[n+8>>2]=0,o[n+12>>2]=0,o[n>>2]=0,o[n+4>>2]=0,o[a+8>>2]=n,o[n+8>>2]=a,i=o[A+100>>2],o[a+20>>2]=i,o[n+20>>2]=i,o[a+12>>2]=f,o[n+12>>2]=r,o[a+16>>2]=0,o[n+16>>2]=0,r=(f=o[A+116>>2])+1|0,o[A+116>>2]=r,(0|f)>=o[A+120>>2]&&(o[A+120>>2]=r),a}function nr(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=m(0);return w[r+16>>2]=w[A+4>>2],w[r+20>>2]=w[A+8>>2],w[r+24>>2]=w[A+12>>2],w[r+28>>2]=w[A+16>>2],w[r+32>>2]=w[A+20>>2],w[r+36>>2]=w[A+24>>2],w[r+40>>2]=w[A+28>>2],w[r+44>>2]=w[A+32>>2],w[r+48>>2]=w[A+36>>2],w[r+52>>2]=w[A+40>>2],w[r+56>>2]=w[A+44>>2],w[r+60>>2]=w[A+48>>2],w[r- -64>>2]=w[A+52>>2],w[r+68>>2]=w[A+56>>2],w[r+72>>2]=w[A+60>>2],w[r+76>>2]=w[A- -64>>2],w[r+80>>2]=w[A+68>>2],w[r+84>>2]=w[A+72>>2],w[r+88>>2]=w[A+76>>2],w[r+92>>2]=w[A+80>>2],w[r+96>>2]=w[A+84>>2],w[r+100>>2]=w[A+88>>2],w[r+104>>2]=w[A+92>>2],w[r+108>>2]=w[A+96>>2],w[r+112>>2]=w[A+100>>2],w[r+116>>2]=w[A+104>>2],w[r+120>>2]=w[A+108>>2],w[r+124>>2]=w[A+112>>2],w[r+128>>2]=w[A+116>>2],w[r+132>>2]=w[A+120>>2],w[r+136>>2]=w[A+124>>2],w[r+140>>2]=w[A+128>>2],w[r+144>>2]=w[A+132>>2],w[r+148>>2]=w[A+136>>2],w[r+152>>2]=w[A+140>>2],w[r+156>>2]=w[A+144>>2],w[r+160>>2]=w[A+148>>2],w[r+164>>2]=w[A+152>>2],w[r+168>>2]=w[A+156>>2],w[r+172>>2]=w[A+160>>2],w[r+176>>2]=w[A+164>>2],w[r+180>>2]=w[A+168>>2],w[r+184>>2]=w[A+172>>2],w[r+188>>2]=w[A+176>>2],o[r+232>>2]=o[A+180>>2],n=w[A+184>>2],o[r>>2]=0,w[r+192>>2]=n,i=0|Zn[o[o[f>>2]+28>>2]](f,o[A+192>>2]),o[r+8>>2]=0,o[r+4>>2]=i,o[r+236>>2]=o[A+204>>2],o[r+240>>2]=o[A+208>>2],o[r+244>>2]=o[A+212>>2],o[r+248>>2]=o[A+220>>2],w[r+196>>2]=w[A+224>>2],w[r+200>>2]=w[A+228>>2],w[r+204>>2]=w[A+236>>2],w[r+208>>2]=w[A+244>>2],w[r+212>>2]=w[A+248>>2],w[r+216>>2]=w[A+232>>2],o[r+252>>2]=o[A+252>>2],i=0|Zn[o[o[f>>2]+40>>2]](f,A),e=0|Zn[o[o[f>>2]+28>>2]](f,i),o[r+12>>2]=e,e&&Zn[o[o[f>>2]+48>>2]](f,i),w[r+220>>2]=w[A+268>>2],w[r+224>>2]=w[A+272>>2],w[r+228>>2]=w[A+276>>2],A=o[A+280>>2],o[r+260>>2]=0,o[r+256>>2]=A,8805}function ar(A,r,f){var e,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=0;if(S=e=S-256|0,A){for(v=w[r+24>>2],h=w[r+20>>2],B=w[r+16>>2],Z=w[r+8>>2],G=w[r+4>>2],Q=w[r>>2],o[e>>2]=A,i=e,A=64,r=1;;){A:{r:{f:{if(c=o[(s=(n=r-1|0)<<2)+i>>2],!(!(w[c>>2]<=B)|!(w[c+16>>2]>=Q)|!(w[c+4>>2]<=h)|!(w[c+20>>2]>=G)||!(w[c+8>>2]<=v)|!(w[c+24>>2]>=Z))){if(o[c+40>>2]){if((0|A)!=(0|n))break f;if((0|(a=A?A<<1:1))<(0|r))break f;if(a?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](a<<2,16)):n=0,A){if(b=0,u=0,A>>>0>=4)for(E=-4&A,t=0;o[(l=u<<2)+n>>2]=o[i+l>>2],o[(k=4|l)+n>>2]=o[i+k>>2],o[(k=8|l)+n>>2]=o[i+k>>2],o[(l|=12)+n>>2]=o[i+l>>2],u=u+4|0,(0|E)!=(0|(t=t+4|0)););if(A&=3)for(;o[(t=u<<2)+n>>2]=o[i+t>>2],u=u+1|0,(0|A)!=(0|(b=b+1|0)););}if(A=d,d=1,!A)break r;i&&(o[8489]=o[8489]+1,Zn[o[8291]](i));break r}Zn[o[o[f>>2]+12>>2]](f,c)}r=n;break A}a=A,n=i}if(o[n+s>>2]=o[c+36>>2],(0|r)==(0|a))if((0|r)>=(0|(A=r?r<<1:1)))A=r,i=n;else{if(A?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](A<<2,16)):i=0,!((0|r)<=0)){if(u=0,t=0,r>>>0>=4)for(l=-4&r,b=0;o[(a=t<<2)+i>>2]=o[n+a>>2],o[(s=4|a)+i>>2]=o[n+s>>2],o[(s=8|a)+i>>2]=o[n+s>>2],o[(a|=12)+i>>2]=o[n+a>>2],t=t+4|0,(0|l)!=(0|(b=b+4|0)););if(a=3&r)for(;o[(b=t<<2)+i>>2]=o[n+b>>2],t=t+1|0,(0|a)!=(0|(u=u+1|0)););}a=d,d=1,a&&n&&(o[8489]=o[8489]+1,Zn[o[8291]](n))}else A=a,i=n;o[(r<<2)+i>>2]=o[c+40>>2],r=r+1|0}if(!((0|r)>0))break}d&&i&&(o[8489]=o[8489]+1,Zn[o[8291]](i))}S=e+256|0}function tr(A,r,f,e,i){var n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0);S=n=S-16|0,a=w[A+52>>2],t=w[A+56>>2],b=w[A+48>>2],c=w[r>>2],u=w[r+4>>2],l=w[r+8>>2],o[i+60>>2]=0,w[i+56>>2]=t+m(l*e),w[i+52>>2]=a+m(u*e),w[i+48>>2]=b+m(c*e),b=w[f+8>>2],s=w[f>>2],k=w[f+4>>2],a=(a=m(m(b*b)+m(m(s*s)+m(k*k))))>m(1.1920928955078125e-7)?m(N(a)):m(0),a=(t=m(a*e)>m(.7853981852531433)?m(m(.7853981852531433)/e):a)>2],u=w[n+12>>2],t=$r(m(m(t*e)*m(.5))),l=w[n>>2],s=m(s*a),k=m(k*a),d=m(b*a),v=w[n+8>>2],a=m(m(m(m(u*t)-m(l*s))-m(c*k))-m(d*v)),b=m(m(m(s*c)+m(m(t*v)+m(d*u)))-m(k*l)),e=m(m(m(k*v)+m(m(t*l)+m(s*u)))-m(d*c)),t=m(m(m(d*l)+m(m(t*c)+m(k*u)))-m(s*v)),(c=m(m(a*a)+m(m(b*b)+m(m(e*e)+m(t*t)))))>m(1.1920928955078125e-7)&&(c=m(m(1)/m(N(c))),a=m(a*c),b=m(b*c),e=m(e*c),t=m(t*c),c=m(m(a*a)+m(m(b*b)+m(m(e*e)+m(t*t))))),c>m(1.1920928955078125e-7)?(o[i+12>>2]=0,o[i+44>>2]=0,o[i+28>>2]=0,u=m(m(2)/c),c=m(b*u),l=m(t*c),s=m(e*u),k=m(a*s),w[i+36>>2]=l+k,d=m(e*c),u=m(t*u),v=m(a*u),w[i+32>>2]=d-v,w[i+24>>2]=l-k,l=m(e*u),a=m(a*c),w[i+16>>2]=l+a,w[i+8>>2]=d+v,w[i+4>>2]=l-a,e=m(e*s),a=m(t*u),w[i+40>>2]=m(1)-m(e+a),t=e,e=m(b*c),w[i+20>>2]=m(1)-m(t+e),w[i>>2]=m(1)-m(a+e)):(r=o[A+4>>2],o[i>>2]=o[A>>2],o[i+4>>2]=r,r=o[A+12>>2],o[i+8>>2]=o[A+8>>2],o[i+12>>2]=r,r=o[A+20>>2],o[i+16>>2]=o[A+16>>2],o[i+20>>2]=r,r=o[A+28>>2],o[i+24>>2]=o[A+24>>2],o[i+28>>2]=r,r=o[A+36>>2],o[i+32>>2]=o[A+32>>2],o[i+36>>2]=r,r=o[A+44>>2],o[i+40>>2]=o[A+40>>2],o[i+44>>2]=r),S=n+16|0}function or(A){var r,f,e,i=0,n=0,t=0,c=0;if(i=o[A+8>>2],r=(n=o[A+32>>2])?o[A+40>>2]:0,t=n,f=(n=o[A+52>>2])?o[A+60>>2]:0,e=n,n=o[A+72>>2],m(Zn[o[o[i>>2]+12>>2]](i,r,t,f,e,n?o[A+80>>2]:0,n,o[A+4>>2],o[A+20>>2],o[A+24>>2])),!((0|(n=o[A+32>>2]))>=0)){if(o[A+36>>2]<0&&(!(i=o[A+40>>2])||!i|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),a[A+44|0]=1,o[A+36>>2]=0,o[A+40>>2]=0),t=0-(i=n)&3)for(;o[o[A+40>>2]+(i<<2)>>2]=0,i=i+1|0,(0|t)!=(0|(c=c+1|0)););if(!(n>>>0>4294967292))for(;o[(n=i<<2)+o[A+40>>2]>>2]=0,o[4+(n+o[A+40>>2]|0)>>2]=0,o[8+(n+o[A+40>>2]|0)>>2]=0,o[12+(n+o[A+40>>2]|0)>>2]=0,i=i+4|0;);}if(o[A+32>>2]=0,!((0|(n=o[A+52>>2]))>=0)){if(o[A+56>>2]<0&&(!(i=o[A+60>>2])||!i|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),a[A+64|0]=1,o[A+56>>2]=0,o[A+60>>2]=0),c=0,t=0-(i=n)&3)for(;o[o[A+60>>2]+(i<<2)>>2]=0,i=i+1|0,(0|t)!=(0|(c=c+1|0)););if(!(n>>>0>4294967292))for(;o[(n=i<<2)+o[A+60>>2]>>2]=0,o[4+(n+o[A+60>>2]|0)>>2]=0,o[8+(n+o[A+60>>2]|0)>>2]=0,o[12+(n+o[A+60>>2]|0)>>2]=0,i=i+4|0;);}if(o[A+52>>2]=0,!((0|(n=o[A+72>>2]))>=0)){if(o[A+76>>2]<0&&(!(i=o[A+80>>2])||!i|!v[A+84|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),a[A+84|0]=1,o[A+76>>2]=0,o[A+80>>2]=0),c=0,t=0-(i=n)&3)for(;o[o[A+80>>2]+(i<<2)>>2]=0,i=i+1|0,(0|t)!=(0|(c=c+1|0)););if(!(n>>>0>4294967292))for(;o[(n=i<<2)+o[A+80>>2]>>2]=0,o[4+(n+o[A+80>>2]|0)>>2]=0,o[8+(n+o[A+80>>2]|0)>>2]=0,o[12+(n+o[A+80>>2]|0)>>2]=0,i=i+4|0;);}o[A+72>>2]=0}function cr(A){var r=0;return o[(A|=0)>>2]=16876,v[A+20|0]&&((r=o[o[A+16>>2]+16>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),(r=o[A+16>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),v[A+12|0]&&((r=o[o[A+8>>2]+16>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),(r=o[A+8>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),r=o[A+28>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+28>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+32>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+32>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+36>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+36>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+40>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+40>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+44>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+44>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+48>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+48>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+52>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+52>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+56>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+56>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+72>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+72>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+76>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+76>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+68>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+68>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+84>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+84>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+80>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+80>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),r=o[A+24>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+24>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),0|A}function br(A){var r,f=0,e=0,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=0;if((0|(r=o[A+28>>2]))<=0)return 1;n=w[A+84>>2],a=w[A+68>>2],c=m(n+a),t=w[A+88>>2],i=w[A+72>>2],b=m(t+i),t=m(i-t),n=m(a-n),i=w[A+80>>2],u=w[A+64>>2],a=m(i+u),i=m(u-i),A=o[A+36>>2];A:{r:{for(;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(b*w[f+28>>2])+m(m(a*w[f+20>>2])+m(c*w[f+24>>2]))))>m(0))break r;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(t*w[f+28>>2])+m(m(a*w[f+20>>2])+m(c*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(b*w[f+28>>2])+m(m(a*w[f+20>>2])+m(n*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(t*w[f+28>>2])+m(m(a*w[f+20>>2])+m(n*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(b*w[f+28>>2])+m(m(i*w[f+20>>2])+m(c*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(t*w[f+28>>2])+m(m(i*w[f+20>>2])+m(c*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;;){if(f=A+G(e,36)|0,m(w[f+32>>2]+m(m(b*w[f+28>>2])+m(m(i*w[f+20>>2])+m(n*w[f+24>>2]))))>m(0))break A;if((0|r)==(0|(e=e+1|0)))break}for(e=0;f=A+G(e,36)|0,l=!(f=m(w[f+32>>2]+m(m(t*w[f+28>>2])+m(m(i*w[f+20>>2])+m(n*w[f+24>>2]))))>m(0)),!f&&(0|r)!=(0|(e=e+1|0)););return l}return 0}return 0}function ur(A,r){var f=0,e=0,i=0,n=0,a=0,t=m(0),d=0,v=0;s(r),n=16777216+((i=c(2))<<1)>>>0<16777217;A:{r:{f:{s(A);e:{if((f=c(2))-2139095040>>>0>=2164260864){if(n)break e;break r}if(!n)break f}if(t=m(1),1065353216==(0|f))break A;if(!(a=i<<1))break A;if(!(a>>>0<4278190081&(f<<=1)>>>0<=4278190080))return m(A+r);if(2130706432==(0|f))break A;return m(f>>>0>2130706431^(0|i)>=0?0:r*r)}if(16777216+(f<<1)>>>0<16777217){if(t=m(A*A),(0|f)<0&&(t=1==(0|ge(i))?m(-t):t),(0|i)>=0)break A;return w[12+(f=S-16|0)>>2]=m(1)/t,w[f+12>>2]}if((0|f)<0){if(!(i=ge(i)))return A=m(A-A),m(A/A);a=(1==(0|i))<<16,f&=2147483647}f>>>0>8388607||(f=(2147483647&(s(m(A*m(8388608))),c(2)))-192937984|0)}if(n=(i=f-1060306944|0)>>>15&240,b(2,f-(-8388608&i)|0),d=(e=+k()*Z[n+29720>>3]-1)*e,l(+(e=((Z[3747]*e+Z[3748])*d*d+((Z[3749]*e+Z[3750])*d+(Z[3751]*e+(Z[n+29728>>3]+ +(i>>23)))))*+r)),f=0|c(1),c(0),!(1079967744==(0|(f&=2147450880))|f>>>0<1079967744)){if(e>127.99999995700433)return w[12+(f=S-16|0)>>2]=m(a?-15845632502852868e13:15845632502852868e13),m(w[f+12>>2]*m(15845632502852868e13));if(e<=-150)return w[12+(f=S-16|0)>>2]=m(a?-2524354896707238e-44:2524354896707238e-44),m(w[f+12>>2]*m(2524354896707238e-44))}e-=(v=(d=Z[3706])+e)-d,e=(Z[3707]*e+Z[3708])*e*e+Z[3709]*e+1,l(+v),c(1),f=a+(n=0|c(0))|0,i=n=o[(a=29392+((31&n)<<3)|0)>>2],f=o[a+4>>2]+(f<<15)|0,b(0,0|i),b(1,0|(i>>>0>>0?f+1:f)),t=m(e*+u())}return t}function lr(A,r,f,e,i){var n,t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=0,B=m(0);if(n=o[A+18504>>2]){if((t=o[n+48>>2])&&(o[t+44>>2]=o[n+44>>2]),(t=o[n+44>>2])&&(o[t+48>>2]=o[n+48>>2]),o[A+18504>>2]==(0|n)&&(o[A+18504>>2]=o[n+48>>2]),o[(t=A+18508|0)>>2]=o[t>>2]-1,o[n+44>>2]=0,o[n+48>>2]=o[A+18496>>2],(t=o[A+18496>>2])&&(o[t+44>>2]=n),o[A+18496>>2]=n,o[(t=A+18500|0)>>2]=o[t>>2]+1,o[n+28>>2]=e,o[n+24>>2]=f,o[n+20>>2]=r,a[n+55|0]=0,l=w[f+24>>2],B=w[e+24>>2],c=w[r+24>>2],s=w[e+20>>2],u=w[r+20>>2],k=w[f+20>>2],d=w[f+16>>2],v=w[e+16>>2],b=w[r+16>>2],o[n+12>>2]=0,d=m(d-b),s=m(s-u),b=m(v-b),k=m(k-u),u=m(m(d*s)-m(b*k)),w[n+8>>2]=u,l=m(l-c),v=m(l*b),b=m(B-c),c=m(v-m(b*d)),w[n+4>>2]=c,b=m(m(k*b)-m(s*l)),w[n>>2]=b,h=2,(c=m(N(m(m(u*u)+m(m(b*b)+m(c*c))))))>m(9999999747378752e-20)){if(bf(n,r,f,t=n+16|0)||bf(n,f,e,t)||bf(n,e,r,t)||(w[n+16>>2]=m(m(w[r+24>>2]*w[n+8>>2])+m(m(w[r+16>>2]*w[n>>2])+m(w[r+20>>2]*w[n+4>>2])))/c),c=m(m(1)/c),w[n>>2]=c*w[n>>2],w[n+4>>2]=c*w[n+4>>2],w[n+8>>2]=c*w[n+8>>2],i)return n;if(h=3,w[t>>2]>=m(-9999999747378752e-21))return n}return o[A>>2]=h,(r=o[n+48>>2])&&(o[r+44>>2]=o[n+44>>2]),(r=o[n+44>>2])&&(o[r+48>>2]=o[n+48>>2]),o[A+18496>>2]==(0|n)&&(o[A+18496>>2]=o[n+48>>2]),o[A+18500>>2]=o[A+18500>>2]-1,o[n+44>>2]=0,o[n+48>>2]=o[A+18504>>2],(r=o[A+18504>>2])&&(o[r+44>>2]=n),o[A+18504>>2]=n,o[A+18508>>2]=o[A+18508>>2]+1,0}return o[A>>2]=5,0}function sr(A,r){var f=0,e=0,i=0,n=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;A:{r:{f:{e:{i:{if(v[A+164|0]){if((0|(f=o[(d=A+128|0)>>2]))!=o[A+132>>2])break r;if((0|(u=f?f<<1:1))<=(0|f))break r;if(u&&(o[8488]=o[8488]+1,b=0|Zn[o[8290]](u<<2,16),f=o[A+128>>2]),e=o[A+136>>2],(0|f)<=0)break i;if(f>>>0>=4)for(s=-4&f;o[(n=i<<2)+b>>2]=o[e+n>>2],o[(l=4|n)+b>>2]=o[e+l>>2],o[(l=8|n)+b>>2]=o[e+l>>2],o[(n|=12)+b>>2]=o[e+n>>2],i=i+4|0,(0|s)!=(0|(k=k+4|0)););if(!(f&=3))break e;for(;o[(n=i<<2)+b>>2]=o[e+n>>2],i=i+1|0,(0|f)!=(0|(c=c+1|0)););break e}if((0|(c=o[(d=A+148|0)>>2]))==o[A+152>>2]&&!((0|(n=c?c<<1:1))<=(0|c))){n&&(o[8488]=o[8488]+1,b=0|Zn[o[8290]](n<<1,16),c=o[A+148>>2]),f=o[A+156>>2];n:{a:{if((0|c)>0){if(c>>>0>=4)for(u=-4&c;t[(e=i<<1)+b>>1]=h[f+e>>1],t[(s=2|e)+b>>1]=h[f+s>>1],t[(s=4|e)+b>>1]=h[f+s>>1],t[(e|=6)+b>>1]=h[f+e>>1],i=i+4|0,(0|u)!=(0|(l=l+4|0)););if(e=3&c)for(;t[(u=i<<1)+b>>1]=h[f+u>>1],i=i+1|0,(0|e)!=(0|(k=k+1|0)););if(v[A+160|0])break a;break n}if(!f|!v[A+160|0])break n}f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),c=o[A+148>>2]}o[A+156>>2]=b,o[A+152>>2]=n,a[A+160|0]=1}i=o[A+156>>2],t[i+(c<<1)>>1]=r;break A}if(!e)break f}e&&v[A+140|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](e)),f=o[A+128>>2]}o[A+136>>2]=b,o[A+132>>2]=u,a[A+140|0]=1}i=o[A+136>>2],o[i+(f<<2)>>2]=r,c=o[A+128>>2]}o[d>>2]=c+1,o[o[A+32>>2]+4>>2]=i}function kr(A,r,f,e){var i,n=m(0),a=0,t=0,c=0,b=0,u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=0,Z=0,Q=0,E=m(0),W=m(0),N=m(0);for(S=i=S-32|0;;){for(B=f,c=o[A+12>>2]+G((f+e|0)/2|0,24)|0,Z=o[c+20>>2],s=w[c+16>>2],E=w[c+8>>2],W=w[c+4>>2],N=w[c>>2],c=e;;){for(k=w[r+8>>2],u=m(E-k),n=m(u*u),d=w[r>>2],u=m(N-d),l=m(u*u),v=w[r+4>>2],u=m(W-v),u=m(n+m(l+m(u*u))),b=o[A+12>>2];;){A:{a=G(f,24)+b|0;r:{if((n=w[a+16>>2])!=s){if(n>2]-k),l=m(n*n),n=m(w[a>>2]-d),h=m(n*n),n=m(w[a+4>>2]-v),1!=(0|((n=m(l+m(h+m(n*n))))!=u?n>2]<(0|Z))))break A}f=f+1|0;continue}break}for(;;){A:{Q=G(c,24);r:{if((n=w[16+(t=Q+b|0)>>2])!=s){if(n>s)break r;break A}if(n=m(w[t+8>>2]-k),l=m(n*n),n=m(w[t>>2]-d),h=m(n*n),n=m(w[t+4>>2]-v),1!=(0|((n=m(l+m(h+m(n*n))))!=u?n>u:o[t+20>>2]>(0|Z))))break A}c=c-1|0;continue}break}if((0|f)<=(0|c)&&(b=o[a+20>>2],o[i+24>>2]=o[a+16>>2],o[i+28>>2]=b,b=o[a+12>>2],o[i+16>>2]=o[a+8>>2],o[i+20>>2]=b,b=o[a+4>>2],o[i+8>>2]=o[a>>2],o[i+12>>2]=b,b=o[t+4>>2],o[a>>2]=o[t>>2],o[a+4>>2]=b,b=o[t+12>>2],o[a+8>>2]=o[t+8>>2],o[a+12>>2]=b,b=o[t+20>>2],o[a+16>>2]=o[t+16>>2],o[a+20>>2]=b,t=o[i+12>>2],a=o[A+12>>2]+Q|0,o[a>>2]=o[i+8>>2],o[a+4>>2]=t,t=o[i+28>>2],o[a+16>>2]=o[i+24>>2],o[a+20>>2]=t,t=o[i+20>>2],o[a+8>>2]=o[i+16>>2],o[a+12>>2]=t,c=c-1|0,f=f+1|0),!((0|f)<=(0|c)))break}if((0|c)>(0|B)&&kr(A,r,B,c),!((0|f)<(0|e)))break}S=i+32|0}function dr(A,r,f){var e,i,n,t,c,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0,w=0;if(S=i=S-32|0,u=o[A+52>>2],c=v[A+68|0],t=o[(n=c?f:r)+4>>2],!((0|u)>=(0|(e=o[t+24>>2])))){if(o[A+56>>2]<(0|e)){if(e?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](e<<2,16),b=o[A+52>>2]):b=u,!((0|b)<=0)){if(b>>>0>=4)for(w=-4&b;o[(l=k<<2)+s>>2]=o[l+o[A+60>>2]>>2],o[(d=4|l)+s>>2]=o[d+o[A+60>>2]>>2],o[(d=8|l)+s>>2]=o[d+o[A+60>>2]>>2],o[(l|=12)+s>>2]=o[l+o[A+60>>2]>>2],k=k+4|0,(0|(h=h+4|0))!=(0|w););if(b&=3)for(;o[(l=k<<2)+s>>2]=o[l+o[A+60>>2]>>2],k=k+1|0,(0|b)!=(0|(B=B+1|0)););}!(b=o[A+60>>2])||!b|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),o[A+60>>2]=s,a[A+64|0]=1,o[A+56>>2]=e}if(b=~u+e|0,s=e-u&3)for(k=0;o[o[A+60>>2]+(u<<2)>>2]=0,u=u+1|0,(0|s)!=(0|(k=k+1|0)););if(!(b>>>0<3))for(;o[(b=u<<2)+o[A+60>>2]>>2]=0,o[4+(b+o[A+60>>2]|0)>>2]=0,o[8+(b+o[A+60>>2]|0)>>2]=0,o[12+(b+o[A+60>>2]|0)>>2]=0,(0|e)!=(0|(u=u+4|0)););}if(o[A+52>>2]=e,(0|e)>0)for(r=c?r:f,u=0;o[t+72>>2]?o[o[A+60>>2]+(u<<2)>>2]=0:(f=o[n+12>>2],b=o[n+8>>2],o[i+12>>2]=o[64+(o[t+32>>2]+G(u,80)|0)>>2],o[i+28>>2]=u,o[i+24>>2]=-1,o[i+16>>2]=b,o[i+20>>2]=f,o[i+8>>2]=n,f=o[A+4>>2],f=0|Zn[o[o[f>>2]+8>>2]](f,i+8|0,r,o[A+72>>2],1),o[o[A+60>>2]+(u<<2)>>2]=f),(0|e)!=(0|(u=u+1|0)););S=i+32|0}function vr(A,r,f,e,i,n,a,t,c,b,u){var l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0);h=w[32+(a=(a<<2)+c|0)>>2],B=m(w[b+56>>2]-w[c+56>>2]),Z=w[a>>2],E=m(w[b+48>>2]-w[c+48>>2]),d=w[a+16>>2],W=m(w[b+52>>2]-w[c+52>>2]),G=m(m(h*B)+m(m(Z*E)+m(d*W))),p=w[32+(a=(t<<2)+b|0)>>2],F=w[a>>2],R=w[a+16>>2],k=m(-m(m(p*B)+m(m(F*E)+m(R*W)))),v=m(m(h*p)+m(m(Z*F)+m(d*R))),(s=m(m(1)-m(v*v)))!=m(0)&&((l=m(-f))>(s=m(m(m(k*v)+G)/s))||(l=s)>f&&(l=f));A:{if((s=m(m(l*v)+k))<(k=m(-i))){if((l=m(-f))>(i=m(m(k*v)+G))){s=k;break A}if(!(f(k=m(m(i*v)+G))){s=i;break A}if(!(fm(.7071067690849304)){o[A>>2]=0,e=m(m(1)/m(N(m(m(d*d)+m(h*h))))),f=m(d*e),w[A+8>>2]=f,l=m(e*m(-h)),w[A+4>>2]=l,e=m(0);break A}o[A+8>>2]=0,f=m(m(1)/m(N(m(m(Z*Z)+m(d*d))))),l=m(Z*f),w[A+4>>2]=l,e=m(f*m(-d)),w[A>>2]=e,f=m(0)}else o[A+12>>2]=0,e=m(m(-1)/G),f=m(f*e),w[A+8>>2]=f,l=m(u*e),w[A+4>>2]=l,e=m(i*e),w[A>>2]=e;i=w[b+48>>2],u=w[b+52>>2],d=w[b+56>>2],o[r+12>>2]=0,w[r+8>>2]=m(k+d)+m(f*n),w[r+4>>2]=m(s+u)+m(l*n),w[r>>2]=m(v+i)+m(e*n)}return B}function hr(A,r,f){A|=0,r|=0,f|=0;var e=0,i=0,n=0,a=0,t=0,c=m(0),b=0,u=0,l=0;if(u=r,l=0|Zn[o[o[f>>2]+28>>2]](f,o[A+28>>2]),o[u>>2]=l,u=r,l=0|Zn[o[o[f>>2]+28>>2]](f,o[A+32>>2]),o[u+4>>2]=l,e=0|Zn[o[o[f>>2]+40>>2]](f,A),n=0|Zn[o[o[f>>2]+28>>2]](f,e),o[r+8>>2]=n,n&&Zn[o[o[f>>2]+48>>2]](f,e),o[r+12>>2]=o[A+4>>2],o[r+24>>2]=v[A+21|0],o[r+40>>2]=o[A+24>>2],w[r+44>>2]=w[A+16>>2],o[r+48>>2]=v[A+20|0],o[r+20>>2]=o[A+12>>2],o[r+16>>2]=o[A+8>>2],w[r+28>>2]=w[A+36>>2],c=w[A+40>>2],f=0,o[r+36>>2]=0,w[r+32>>2]=c,e=o[A+28>>2],!((0|(i=o[e+548>>2]))<=0)){if(n=o[e+556>>2],i>>>0>=4)for(t=-4&i,e=0;o[(a=f<<2)+n>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(4|a)>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(8|a)>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(12|a)>>2]==(0|A)&&(o[r+36>>2]=1),f=f+4|0,(0|t)!=(0|(e=e+4|0)););if(i&=3)for(e=0;o[n+(f<<2)>>2]==(0|A)&&(o[r+36>>2]=1),f=f+1|0,(0|i)!=(0|(e=e+1|0)););}if(f=o[A+32>>2],!((0|(i=o[f+548>>2]))<=0)){if(n=o[f+556>>2],e=0,f=0,i>>>0>=4)for(b=-4&i,t=0;o[(a=f<<2)+n>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(4|a)>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(8|a)>>2]==(0|A)&&(o[r+36>>2]=1),o[n+(12|a)>>2]==(0|A)&&(o[r+36>>2]=1),f=f+4|0,(0|b)!=(0|(t=t+4|0)););if(i&=3)for(;o[n+(f<<2)>>2]==(0|A)&&(o[r+36>>2]=1),f=f+1|0,(0|i)!=(0|(e=e+1|0)););}return 8778}function Br(A,r){var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if(o[A+12>>2]=0,a[A+16|0]=1,o[A+4>>2]=0,o[A+8>>2]=0,(0|(n=o[r+4>>2]))<=0)o[A+4>>2]=n;else{if(o[8488]=o[8488]+1,e=0|Zn[o[8290]](n<<2,16),!((0|(b=o[A+4>>2]))<=0)){if(b>>>0>=4)for(l=-4&b;o[(t=f<<2)+e>>2]=o[t+o[A+12>>2]>>2],o[(u=4|t)+e>>2]=o[u+o[A+12>>2]>>2],o[(u=8|t)+e>>2]=o[u+o[A+12>>2]>>2],o[(t|=12)+e>>2]=o[t+o[A+12>>2]>>2],f=f+4|0,(0|l)!=(0|(i=i+4|0)););if(i=3&b)for(;o[(t=f<<2)+e>>2]=o[t+o[A+12>>2]>>2],f=f+1|0,(0|i)!=(0|(c=c+1|0)););}if(!(f=o[A+12>>2])||!f|!v[A+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+12>>2]=e,a[A+16|0]=1,o[A+8>>2]=n,i=0,f=0,n>>>0>=4)for(t=-4&n,c=0;o[(e=f<<2)+o[A+12>>2]>>2]=0,o[o[A+12>>2]+(4|e)>>2]=0,o[o[A+12>>2]+(8|e)>>2]=0,o[o[A+12>>2]+(12|e)>>2]=0,f=f+4|0,(0|t)!=(0|(c=c+4|0)););if(c=3&n)for(;o[o[A+12>>2]+(f<<2)>>2]=0,f=f+1|0,(0|c)!=(0|(i=i+1|0)););if(o[A+4>>2]=n,!((0|n)<=0)){if(A=o[A+12>>2],c=0,f=0,n>>>0>=4)for(t=-4&n,i=0;o[(e=f<<2)+A>>2]=o[e+o[r+12>>2]>>2],o[(b=4|e)+A>>2]=o[b+o[r+12>>2]>>2],o[(b=8|e)+A>>2]=o[b+o[r+12>>2]>>2],o[(e|=12)+A>>2]=o[e+o[r+12>>2]>>2],f=f+4|0,(0|t)!=(0|(i=i+4|0)););if(n&=3)for(;o[(i=f<<2)+A>>2]=o[i+o[r+12>>2]>>2],f=f+1|0,(0|n)!=(0|(c=c+1|0)););}}}function wr(A,r,f,e){r|=0,f|=0,e|=0;var i,n,t,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0;if(S=i=S-96|0,c=o[8+(A|=0)>>2],o[r+216>>2]=c,o[A+12>>2]==(0|c)&&!((0|(k=c?c<<1:1))<=(0|c))){if(k&&(o[8488]=o[8488]+1,u=0|Zn[o[8290]](k<<2,16),c=o[A+8>>2]),!((0|c)<=0)){if(c>>>0>=4)for(d=-4&c;o[(b=l<<2)+u>>2]=o[b+o[A+16>>2]>>2],o[(s=4|b)+u>>2]=o[s+o[A+16>>2]>>2],o[(s=8|b)+u>>2]=o[s+o[A+16>>2]>>2],o[(b|=12)+u>>2]=o[b+o[A+16>>2]>>2],l=l+4|0,(0|d)!=(0|(h=h+4|0)););if(b=3&c)for(;o[(d=l<<2)+u>>2]=o[d+o[A+16>>2]>>2],l=l+1|0,(0|b)!=(0|(B=B+1|0)););}!(l=o[A+16>>2])|!v[A+20|0]||(l&&(o[8489]=o[8489]+1,Zn[o[8291]](l)),c=o[A+8>>2]),o[A+16>>2]=u,a[A+20|0]=1,o[A+12>>2]=k}o[o[A+16>>2]+(c<<2)>>2]=r,o[A+8>>2]=c+1,c=o[r+16>>2],o[i+40>>2]=o[r+12>>2],o[i+44>>2]=c,c=o[r+8>>2],o[i+32>>2]=o[r+4>>2],o[i+36>>2]=c,c=o[r+32>>2],o[i+56>>2]=o[r+28>>2],o[i+60>>2]=c,c=o[r+24>>2],o[i+48>>2]=o[r+20>>2],o[i+52>>2]=c,c=o[r+48>>2],o[i+72>>2]=o[r+44>>2],o[i+76>>2]=c,c=o[r+40>>2],o[i+64>>2]=o[r+36>>2],o[i+68>>2]=c,c=o[r+64>>2],o[i+88>>2]=o[r+60>>2],o[i+92>>2]=c,c=o[r+56>>2],o[i+80>>2]=o[r+52>>2],o[i+84>>2]=c,c=o[r+192>>2],u=i+16|0,Zn[o[o[c>>2]+8>>2]](c,i+32|0,u,i),c=o[A+68>>2],n=r,t=0|Zn[o[o[c>>2]+8>>2]](c,u,i,o[o[r+192>>2]+4>>2],r,f,e,o[A+24>>2]),o[n+188>>2]=t,S=i+96|0}function Zr(A,r){var f,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0;if(S=f=S-32|0,o[A>>2]&&!((0|(a=(0|r)<0?o[A+12>>2]:r))<=0))for(;;){if(t=0,r=o[A>>2],o[(n=r+40|0)>>2])for(;(i=o[r+32>>2])>>>0<=r>>>0?i=r:(l=(0|(e=o[i+40>>2]))==(0|r),b=o[36+((c=((0|r)!=(0|e))<<2)+i|0)>>2],u=(e=o[i+32>>2])?36+(((o[e+40>>2]==(0|i))<<2)+e|0)|0:A,o[u>>2]=r,o[b+32>>2]=r,o[i+32>>2]=r,o[r+32>>2]=e,o[i+36>>2]=o[r+36>>2],o[i+40>>2]=o[n>>2],o[o[r+36>>2]+32>>2]=i,o[o[n>>2]+32>>2]=i,o[(e=r+36|0)+(l<<2)>>2]=i,o[e+c>>2]=b,n=o[4+(e=i+24|0)>>2],o[f+24>>2]=o[e>>2],o[f+28>>2]=n,n=o[4+(e=i+16|0)>>2],o[f+16>>2]=o[e>>2],o[f+20>>2]=n,n=o[4+(e=i+8|0)>>2],o[f+8>>2]=o[e>>2],o[f+12>>2]=n,e=o[i+4>>2],o[f>>2]=o[i>>2],o[f+4>>2]=e,n=o[4+(e=r+24|0)>>2],o[i+24>>2]=o[e>>2],o[i+28>>2]=n,n=o[4+(e=r+16|0)>>2],o[i+16>>2]=o[e>>2],o[i+20>>2]=n,n=o[4+(e=r+8|0)>>2],o[i+8>>2]=o[e>>2],o[i+12>>2]=n,e=o[r+4>>2],o[i>>2]=o[r>>2],o[i+4>>2]=e,e=o[f+28>>2],o[r+24>>2]=o[f+24>>2],o[r+28>>2]=e,e=o[f+20>>2],o[r+16>>2]=o[f+16>>2],o[r+20>>2]=e,e=o[f+12>>2],o[r+8>>2]=o[f+8>>2],o[r+12>>2]=e,e=o[f+4>>2],o[r>>2]=o[f>>2],o[r+4>>2]=e),r=o[A+16>>2]>>>t|0,t=t+1&31,r=o[36+(((1&r)<<2)+i|0)>>2],o[(n=r+40|0)>>2];);if(er(A,(i=Jr(A,r))?o[A>>2]:0,r),o[A+16>>2]=o[A+16>>2]+1,!(a=a-1|0))break}S=f+32|0}function Gr(A){var r=0;return o[(A|=0)>>2]=23860,!(r=o[A+204>>2])||!r|!v[A+208|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+204>>2]=0,a[A+208|0]=1,o[A+196>>2]=0,o[A+200>>2]=0,!(r=o[A+176>>2])||!r|!v[A+180|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+176>>2]=0,a[A+180|0]=1,o[A+168>>2]=0,o[A+172>>2]=0,!(r=o[A+156>>2])||!r|!v[A+160|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+156>>2]=0,a[A+160|0]=1,o[A+148>>2]=0,o[A+152>>2]=0,!(r=o[A+136>>2])||!r|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+136>>2]=0,a[A+140|0]=1,o[A+128>>2]=0,o[A+132>>2]=0,!(r=o[A+116>>2])||!r|!v[A+120|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+116>>2]=0,a[A+120|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,!(r=o[A+96>>2])||!r|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+96>>2]=0,a[A+100|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,!(r=o[A+76>>2])||!r|!v[A+80|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+76>>2]=0,a[A+80|0]=1,o[A+68>>2]=0,o[A+72>>2]=0,!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+56>>2]=0,a[A+60|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,!(r=o[A+36>>2])||!r|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+36>>2]=0,a[A+40|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function mr(A,r,f,e,i,n){var a;return o[A+4>>2]=r,o[A>>2]=23264,r=o[f+12>>2],o[A+16>>2]=o[f+8>>2],o[A+20>>2]=r,r=o[f+4>>2],o[A+8>>2]=o[f>>2],o[A+12>>2]=r,r=o[f+28>>2],o[A+32>>2]=o[f+24>>2],o[A+36>>2]=r,r=o[f+20>>2],o[A+24>>2]=o[f+16>>2],o[A+28>>2]=r,r=o[f+44>>2],o[A+48>>2]=o[f+40>>2],o[A+52>>2]=r,r=o[f+36>>2],o[A+40>>2]=o[f+32>>2],o[A+44>>2]=r,a=o[f+60>>2],o[(r=A- -64|0)>>2]=o[f+56>>2],o[r+4>>2]=a,r=o[f+52>>2],o[A+56>>2]=o[f+48>>2],o[A+60>>2]=r,r=o[e+12>>2],o[A+80>>2]=o[e+8>>2],o[A+84>>2]=r,r=o[e+4>>2],o[A+72>>2]=o[e>>2],o[A+76>>2]=r,r=o[e+28>>2],o[A+96>>2]=o[e+24>>2],o[A+100>>2]=r,r=o[e+20>>2],o[A+88>>2]=o[e+16>>2],o[A+92>>2]=r,r=o[e+44>>2],o[A+112>>2]=o[e+40>>2],o[A+116>>2]=r,r=o[e+36>>2],o[A+104>>2]=o[e+32>>2],o[A+108>>2]=r,r=o[e+60>>2],o[A+128>>2]=o[e+56>>2],o[A+132>>2]=r,r=o[e+52>>2],o[A+120>>2]=o[e+48>>2],o[A+124>>2]=r,r=o[i+12>>2],o[A+144>>2]=o[i+8>>2],o[A+148>>2]=r,r=o[i+4>>2],o[A+136>>2]=o[i>>2],o[A+140>>2]=r,r=o[i+28>>2],o[A+160>>2]=o[i+24>>2],o[A+164>>2]=r,r=o[i+20>>2],o[A+152>>2]=o[i+16>>2],o[A+156>>2]=r,r=o[i+44>>2],o[A+176>>2]=o[i+40>>2],o[A+180>>2]=r,r=o[i+36>>2],o[A+168>>2]=o[i+32>>2],o[A+172>>2]=r,r=o[i+60>>2],o[A+192>>2]=o[i+56>>2],o[A+196>>2]=r,r=o[i+52>>2],o[A+184>>2]=o[i+48>>2],o[A+188>>2]=r,o[A+208>>2]=0,w[A+204>>2]=n,o[A+200>>2]=1065353216,A}function Qr(A){var r;return o[A+132>>2]=0,o[A+136>>2]=0,o[A+188>>2]=0,o[A+192>>2]=0,o[A+180>>2]=0,o[A+184>>2]=1566444395,o[A+164>>2]=1065353216,o[A+168>>2]=1065353216,o[A+276>>2]=0,o[A+280>>2]=0,o[A+268>>2]=1065353216,o[A+272>>2]=0,o[A+260>>2]=-1,o[A+264>>2]=-1,o[A+252>>2]=1,o[A+256>>2]=0,o[A+244>>2]=1036831949,o[A+248>>2]=1176256512,o[A+236>>2]=0,o[A+240>>2]=0,o[A+228>>2]=1056964608,o[A+232>>2]=0,o[A+220>>2]=1,o[A+224>>2]=0,o[A+212>>2]=-1,o[A+216>>2]=-1,o[A+204>>2]=1,o[A+208>>2]=-1,o[A>>2]=13128,o[A+140>>2]=0,o[A+144>>2]=0,o[A+148>>2]=0,o[A+152>>2]=0,o[A+156>>2]=0,o[A+160>>2]=0,o[A+172>>2]=1065353216,o[A+176>>2]=0,o[A+196>>2]=0,o[A+200>>2]=0,a[A+300|0]=1,o[A+304>>2]=0,o[A+296>>2]=0,o[A+288>>2]=0,o[A+292>>2]=0,o[A+4>>2]=1065353216,o[A+8>>2]=0,o[A+12>>2]=0,o[A+16>>2]=0,o[A+20>>2]=0,o[A+24>>2]=1065353216,o[A+28>>2]=0,o[A+32>>2]=0,o[A+36>>2]=0,o[A+40>>2]=0,o[A+44>>2]=1065353216,o[A+48>>2]=0,o[A+52>>2]=0,o[A+56>>2]=0,o[A+60>>2]=0,o[(r=A- -64|0)>>2]=0,o[r+4>>2]=1065353216,o[A+72>>2]=0,o[A+76>>2]=0,o[A+80>>2]=0,o[A+84>>2]=0,o[A+88>>2]=1065353216,o[A+92>>2]=0,o[A+96>>2]=0,o[A+100>>2]=0,o[A+104>>2]=0,o[A+112>>2]=0,o[A+116>>2]=0,o[A+108>>2]=1065353216,o[A+120>>2]=0,o[A+124>>2]=0,o[A+128>>2]=0,A}function Er(A,r){var f,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0;return(0|(i=o[A+16>>2]))!=(0|(e=o[r+16>>2]))?i-e|0:i?(f=i,n=o[r+8>>2],a=o[A+4>>2],u=ee(b=o[r+12>>2],0,l=o[A>>2],0),t=a,c=(i=L)+(a=ee(b,0,a,e=0))|0,i=L+e|0,s=n,n=ee(n,b=0,t,e),e=a>>>0>c>>>0?i+1|0:i,a=(a=L)>>>0>(i=t=a+c|0)>>>0?e+1|0:e,e=0,t=(u=(t=n)>>>0>(n=n+u|0)>>>0?e+1|0:e)+i|0,i=a,i=t>>>0>>0?i+1|0:i,c=t,u=0,a=ee(l,0,s,b),e=L+n|0,t=e=a>>>0>(b=u+a|0)>>>0?e+1|0:e,n=(0|n)==(0|e)&b>>>0>>0|e>>>0>>0,e=i,u=i=n+c|0,l=e=i>>>0>>0?e+1|0:e,n=o[r>>2],i=o[r+4>>2],r=o[A+8>>2],A=o[A+12>>2],s=r,a=ee(i,e=0,r,0),r=L,c=A,A=ee(i,e,A,0),i=L,i=A>>>0>(r=r+A|0)>>>0?i+1|0:i,A=ee(n,0,c,e),e=i,i=r,r=(r=L)>>>0>(i=c=i+r|0)>>>0?e+1|0:e,e=0,c=(a=(c=A)>>>0>(A=A+a|0)>>>0?e+1|0:e)+i|0,i=r,i=a>>>0>c>>>0?i+1|0:i,a=0,n=ee(n,0,s,0),e=L+A|0,n=e=(r=a+n|0)>>>0>>0?e+1|0:e,A=(0|A)==(0|e)&r>>>0>>0|A>>>0>e>>>0,e=i,e=(i=A)>>>0>(A=A+c|0)>>>0?e+1|0:e,i=-1,(0|e)==(0|l)&A>>>0>u>>>0|e>>>0>l>>>0||(i=1,(0|e)==(0|l)&A>>>0>>0|e>>>0>>0||(i=-1,(0|n)==(0|t)&r>>>0>b>>>0|n>>>0>t>>>0||(i=(0|n)==(0|t)&r>>>0>>0|n>>>0>>0))),G(f,i)):0}function Wr(A,r,f,e){for(var i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,v=0,h=0,w=0,Z=0,G=0,m=0;;){for(h=f,a=o[A+12>>2]+((f+e|0)/2<<4)|0,w=o[a+8>>2],l=o[a+4>>2],u=o[a>>2],a=e;;){for(Z=o[A+12>>2];;){i=-1,c=-1,(s=o[(n=(f<<4)+Z|0)>>2])&&(c=o[s+12>>2]),i=u?o[u+12>>2]:i,b=-1,t=-1,(k=o[n+4>>2])&&(t=o[k+12>>2]),b=l?o[l+12>>2]:b;A:{r:if(!((0|i)<(0|c))){if(!((i=(0|u)==(0|s)&(0|t)>(0|b))|(0|u)!=(0|s))){if((0|l)!=(0|k))break A;if(B[n+8>>2]>w>>>0)break r;break A}if(!i)break A}f=f+1|0;continue}break}for(;;){i=(G=a<<4)+Z|0,c=-1,b=-1,b=u?o[u+12>>2]:b,(t=o[i>>2])&&(c=o[t+12>>2]),m=-1,d=-1,d=l?o[l+12>>2]:d,(v=o[i+4>>2])&&(m=o[v+12>>2]);A:{r:if(!((0|c)<(0|b))){if(!((c=(0|t)==(0|u)&(0|m)<(0|d))|(0|t)!=(0|u))){if((0|l)!=(0|v))break A;if(B[i+8>>2]>>0)break r;break A}if(!c)break A}a=a-1|0;continue}break}if((0|f)<=(0|a)&&(c=o[n+8>>2],b=o[n+12>>2],t=o[i+4>>2],o[n>>2]=o[i>>2],o[n+4>>2]=t,t=o[i+12>>2],o[n+8>>2]=o[i+8>>2],o[n+12>>2]=t,n=o[A+12>>2]+G|0,o[n+4>>2]=k,o[n+8>>2]=c,o[n+12>>2]=b,o[n>>2]=s,a=a-1|0,f=f+1|0),!((0|f)<=(0|a)))break}if((0|a)>(0|h)&&Wr(A,r,h,a),!((0|f)<(0|e)))break}}function Nr(A,r){A|=0;var f,e=0,i=0;S=f=S-48|0,e=o[4+(r|=0)>>2],i=o[A+56>>2],o[i+4>>2]=o[r>>2],o[i+8>>2]=e,e=o[r+12>>2],o[i+12>>2]=o[r+8>>2],o[i+16>>2]=e,o[f+44>>2]=0,o[f+36>>2]=0,o[f+40>>2]=0,o[f+32>>2]=1065353216,i=f+16|0,r=f+32|0,Zn[o[o[A>>2]+68>>2]](i,A,r),w[A+40>>2]=w[f+16>>2]+w[A+20>>2],o[f+32>>2]=-1082130432,Zn[o[o[A>>2]+68>>2]](f,A,r),e=o[f+12>>2],o[f+24>>2]=o[f+8>>2],o[f+28>>2]=e,e=o[f+4>>2],o[f+16>>2]=o[f>>2],o[f+20>>2]=e,w[A+24>>2]=w[f+16>>2]-w[A+20>>2],o[f+40>>2]=0,o[f+44>>2]=0,o[f+32>>2]=0,o[f+36>>2]=0,o[f+36>>2]=1065353216,Zn[o[o[A>>2]+68>>2]](i,A,r),w[A+44>>2]=w[f+20>>2]+w[A+20>>2],o[f+36>>2]=-1082130432,Zn[o[o[A>>2]+68>>2]](f,A,r),e=o[f+12>>2],o[f+24>>2]=o[f+8>>2],o[f+28>>2]=e,e=o[f+4>>2],o[f+16>>2]=o[f>>2],o[f+20>>2]=e,w[A+28>>2]=w[f+20>>2]-w[A+20>>2],o[f+40>>2]=0,o[f+44>>2]=0,o[f+40>>2]=1065353216,o[f+32>>2]=0,o[f+36>>2]=0,Zn[o[o[A>>2]+68>>2]](i,A,r),w[A+48>>2]=w[f+24>>2]+w[A+20>>2],o[f+40>>2]=-1082130432,Zn[o[o[A>>2]+68>>2]](f,A,r),r=o[f+12>>2],o[f+24>>2]=o[f+8>>2],o[f+28>>2]=r,r=o[f+4>>2],o[f+16>>2]=o[f>>2],o[f+20>>2]=r,w[A+32>>2]=w[f+24>>2]-w[A+20>>2],S=f+48|0}function pr(A,r,f){var e,i=0,n=0;if(f>>>0>=512)return j(0|A,0|r,0|f),A;e=A+f|0;A:if(3&(A^r))if(e>>>0<4)f=A;else if((i=e-4|0)>>>0>>0)f=A;else for(f=A;a[0|f]=v[0|r],a[f+1|0]=v[r+1|0],a[f+2|0]=v[r+2|0],a[f+3|0]=v[r+3|0],r=r+4|0,i>>>0>=(f=f+4|0)>>>0;);else{r:if(3&A)if(f)for(f=A;;){if(a[0|f]=v[0|r],r=r+1|0,!(3&(f=f+1|0)))break r;if(!(f>>>0>>0))break}else f=A;else f=A;if(!((i=-4&e)>>>0<64||(n=i+-64|0)>>>0>>0))for(;o[f>>2]=o[r>>2],o[f+4>>2]=o[r+4>>2],o[f+8>>2]=o[r+8>>2],o[f+12>>2]=o[r+12>>2],o[f+16>>2]=o[r+16>>2],o[f+20>>2]=o[r+20>>2],o[f+24>>2]=o[r+24>>2],o[f+28>>2]=o[r+28>>2],o[f+32>>2]=o[r+32>>2],o[f+36>>2]=o[r+36>>2],o[f+40>>2]=o[r+40>>2],o[f+44>>2]=o[r+44>>2],o[f+48>>2]=o[r+48>>2],o[f+52>>2]=o[r+52>>2],o[f+56>>2]=o[r+56>>2],o[f+60>>2]=o[r+60>>2],r=r- -64|0,n>>>0>=(f=f- -64|0)>>>0;);if(f>>>0>=i>>>0)break A;for(;o[f>>2]=o[r>>2],r=r+4|0,i>>>0>(f=f+4|0)>>>0;);}if(f>>>0>>0)for(;a[0|f]=v[0|r],r=r+1|0,(0|e)!=(0|(f=f+1|0)););return A}function Fr(A,r){var f,e,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0;if(o[A+12>>2]=0,a[A+16|0]=1,o[A+4>>2]=0,o[A+8>>2]=0,(0|(n=o[r+4>>2]))<=0)o[A+4>>2]=n;else{o[8488]=o[8488]+1,e=n<<2,f=0|Zn[o[8290]](e,16),c=o[A+12>>2];A:{r:{f:{if((0|(s=o[A+4>>2]))>0){if(s>>>0>=4)for(k=-4&s;o[(i=t<<2)+f>>2]=o[i+c>>2],o[(l=4|i)+f>>2]=o[c+l>>2],o[(l=8|i)+f>>2]=o[c+l>>2],o[(i|=12)+f>>2]=o[i+c>>2],t=t+4|0,(0|k)!=(0|(b=b+4|0)););if(i=3&s)for(;o[(b=t<<2)+f>>2]=o[c+b>>2],t=t+1|0,(0|i)!=(0|(u=u+1|0)););if(!v[A+16|0])break f}else if(!v[A+16|0]||!c){o[A+12>>2]=f,a[A+16|0]=1,o[A+8>>2]=n,Af(f,0,e),o[A+4>>2]=n;break r}c&&(o[8489]=o[8489]+1,Zn[o[8291]](c))}if(o[A+12>>2]=f,a[A+16|0]=1,o[A+8>>2]=n,Af(f,0,e),o[A+4>>2]=n,(0|n)<=0)break A}if(A=o[r+12>>2],u=0,t=0,n>>>0>=4)for(c=-4&n,b=0;o[(r=t<<2)+f>>2]=o[A+r>>2],o[(i=4|r)+f>>2]=o[A+i>>2],o[(i=8|r)+f>>2]=o[A+i>>2],o[(r|=12)+f>>2]=o[A+r>>2],t=t+4|0,(0|c)!=(0|(b=b+4|0)););if(r=3&n)for(;o[(n=t<<2)+f>>2]=o[A+n>>2],t=t+1|0,(0|r)!=(0|(u=u+1|0)););}}}function Rr(A,r){var f=m(0),e=m(0),i=0,n=m(0),a=m(0),t=m(0);if(e=w[1364+((r<<2)+A|0)>>2],i=G(r,88)+A|0,(n=w[i+968>>2])>=(a=w[i+972>>2])||(em(3.1415927410125732)&&(f=m(f+m(-6.2831854820251465))),t=m(Q(f)),(f=af(m(a-e)))m(3.1415927410125732)&&(f=m(f+m(-6.2831854820251465))),e=ta&&((f=af(m(e-a)))m(3.1415927410125732)&&(f=m(f+m(-6.2831854820251465))),t=m(Q(f)),(f=af(m(e-n)))m(3.1415927410125732)&&(f=m(f+m(-6.2831854820251465))),e=t>m(Q(f))?m(e+m(-6.2831854820251465)):e)),w[i+1048>>2]=e,i=i+1040|0,n>a)return o[1052+(G(r,88)+A|0)>>2]=0,void(o[i>>2]=0);w[i>>2]=e-n,n!=a?(A=G(r,88)+A|0,o[A+1052>>2]=4,w[A+1044>>2]=e-a):o[1052+(G(r,88)+A|0)>>2]=3}function Yr(A,r,f){var e,i,n=m(0),a=0,t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0);S=e=S-48|0,a=o[r+120>>2],i=o[r+124>>2],t=o[r>>2]+(i>>1)|0,1&i&&(a=o[a+o[t>>2]>>2]),Zn[0|a](e,t,f),c=w[f+8>>2],b=w[f+4>>2],l=w[f>>2],a=o[r+124>>2],t=o[r+4>>2]+(a>>1)|0,f=o[r+120>>2],f=1&a?o[o[t>>2]+f>>2]:f,s=w[r+16>>2],k=w[r+12>>2],d=w[r+32>>2],v=w[r+24>>2],h=w[r+28>>2],B=w[r+48>>2],n=w[r+40>>2],Z=w[r+44>>2],G=w[r+8>>2],o[e+28>>2]=0,u=n,n=m(-l),w[e+24>>2]=m(m(u*n)-m(Z*b))-m(B*c),w[e+20>>2]=m(m(v*n)-m(h*b))-m(d*c),w[e+16>>2]=m(m(G*n)-m(k*b))-m(s*c),Zn[0|f](e+32|0,t,e+16|0),W=w[r+104>>2],N=w[r- -64>>2],p=w[r+60>>2],c=w[r+108>>2],b=w[r+80>>2],l=w[r+72>>2],s=w[r+76>>2],k=w[r+112>>2],d=w[r+96>>2],v=w[r+88>>2],h=w[r+92>>2],B=w[r+56>>2],u=w[e+40>>2],Q=w[e+32>>2],E=w[e+36>>2],n=w[e>>2],Z=w[e+4>>2],G=w[e+8>>2],o[A+12>>2]=0,w[A+8>>2]=G-m(k+m(m(u*d)+m(m(Q*v)+m(E*h)))),w[A+4>>2]=Z-m(c+m(m(u*b)+m(m(Q*l)+m(E*s)))),w[A>>2]=n-m(W+m(m(u*N)+m(m(Q*B)+m(E*p)))),S=e+48|0}function Vr(A){var r=0,f=0,e=0,i=0,n=0,t=0,c=0,b=0;if(!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,!(r=o[A+36>>2])||!r|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+36>>2]=0,a[A+40|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+56>>2]=0,a[A+60|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,o[A+12>>2]<=1){if(o[8488]=o[8488]+1,n=0|Zn[o[8290]](24,16),!((0|(e=o[A+8>>2]))<=0)){if(r=0,1!=(0|e))for(b=-2&e;i=(f=G(r,12))+o[A+16>>2]|0,t=o[i+4>>2],o[(f=f+n|0)>>2]=o[i>>2],o[f+4>>2]=t,o[f+8>>2]=o[i+8>>2],i=(f=G(1|r,12))+o[A+16>>2]|0,t=o[i+4>>2],o[(f=f+n|0)>>2]=o[i>>2],o[f+4>>2]=t,o[f+8>>2]=o[i+8>>2],r=r+2|0,(0|(c=c+2|0))!=(0|b););1&e&&(r=(e=G(r,12))+o[A+16>>2]|0,i=o[r+4>>2],o[(e=e+n|0)>>2]=o[r>>2],o[e+4>>2]=i,o[e+8>>2]=o[r+8>>2])}!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=n,a[A+20|0]=1,o[A+12>>2]=2}Ar(A)}function gr(A){var r=0;return o[(A|=0)>>2]=24244,v[A+288|0]&&(r=o[A+220>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+220>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),(r=o[A+212>>2])&&(Zn[o[o[r>>2]>>2]](r),(r=o[A+212>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),v[A+289|0]&&(r=o[A+216>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+216>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),!(r=o[A+332>>2])||!r|!v[A+336|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+332>>2]=0,a[A+336|0]=1,o[A+324>>2]=0,o[A+328>>2]=0,!(r=o[A+304>>2])||!r|!v[A+308|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+304>>2]=0,a[A+308|0]=1,o[A+296>>2]=0,o[A+300>>2]=0,!(r=o[A+256>>2])||!r|!v[A+260|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+256>>2]=0,a[A+260|0]=1,o[A+248>>2]=0,o[A+252>>2]=0,!(r=o[A+236>>2])||!r|!v[A+240|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+236>>2]=0,a[A+240|0]=1,o[A+228>>2]=0,o[A+232>>2]=0,!(r=o[A+204>>2])||!r|!v[A+208|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+204>>2]=0,a[A+208|0]=1,o[A+196>>2]=0,o[A+200>>2]=0,0|Ff(A)}function Xr(A,r,f,e,i,n,a){var t,c=m(0),b=m(0),u=0,l=0,s=m(0),k=m(0),d=m(0);if(o[e>>2]=2139095039,o[i>>2]=-8388609,(0|(t=o[A+8>>2]))<=0)c=m(-34028234663852886e22);else{for(;l=o[A+16>>2]+(u<<4)|0,c=w[l+8>>2],b=w[l>>2],s=w[l+4>>2],k=m(m(m(c*w[r+40>>2])+m(m(b*w[r+32>>2])+m(s*w[r+36>>2])))+w[r+56>>2]),d=m(m(m(c*w[r+8>>2])+m(m(b*w[r>>2])+m(s*w[r+4>>2])))+w[r+48>>2]),b=m(m(m(c*w[r+24>>2])+m(m(b*w[r+16>>2])+m(s*w[r+20>>2])))+w[r+52>>2]),(c=m(m(k*w[f+8>>2])+m(m(d*w[f>>2])+m(b*w[f+4>>2]))))>2]&&(w[e>>2]=c,o[n+12>>2]=0,w[n+8>>2]=k,w[n+4>>2]=b,w[n>>2]=d),c>w[i>>2]&&(w[i>>2]=c,o[a+12>>2]=0,w[a+8>>2]=k,w[a+4>>2]=b,w[a>>2]=d),(0|t)!=(0|(u=u+1|0)););c=w[i>>2]}c<(b=w[e>>2])&&(w[e>>2]=c,w[i>>2]=b,r=o[n+12>>2],o[8+(A=S-16|0)>>2]=o[n+8>>2],o[A+12>>2]=r,r=o[n+4>>2],o[A>>2]=o[n>>2],o[A+4>>2]=r,r=o[a+12>>2],o[n+8>>2]=o[a+8>>2],o[n+12>>2]=r,r=o[a+4>>2],o[n>>2]=o[a>>2],o[n+4>>2]=r,r=o[A+12>>2],o[a+8>>2]=o[A+8>>2],o[a+12>>2]=r,r=o[A+4>>2],o[a>>2]=o[A>>2],o[a+4>>2]=r)}function Dr(A,r,f,e){var i,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;for(S=i=S-16|0;;){for(s=f,t=o[A+12>>2]+((f+e|0)/2<<4)|0,k=o[t+8>>2],u=o[t+4>>2],l=o[t>>2],t=e;;){for(c=o[A+12>>2];;){A:{if(!((0|(n=o[4+(a=(f<<4)+c|0)>>2]))<(0|u))){if((0|n)!=(0|u))break A;if(!((0|(n=o[a>>2]))<(0|l))&&(0|n)!=(0|l)|o[a+8>>2]>=(0|k))break A}f=f+1|0;continue}break}for(;;){A:{if(!((0|(b=o[4+(n=(d=t<<4)+c|0)>>2]))>(0|u))){if((0|u)!=(0|b))break A;if(!((0|(b=o[n>>2]))>(0|l))&&(0|l)!=(0|b)|o[n+8>>2]<=(0|k))break A}t=t-1|0;continue}break}if((0|f)<=(0|t)&&(c=o[a+12>>2],o[i+8>>2]=o[a+8>>2],o[i+12>>2]=c,c=o[a+4>>2],o[i>>2]=o[a>>2],o[i+4>>2]=c,c=o[n+4>>2],o[a>>2]=o[n>>2],o[a+4>>2]=c,c=o[n+12>>2],o[a+8>>2]=o[n+8>>2],o[a+12>>2]=c,n=o[i+4>>2],a=o[A+12>>2]+d|0,o[a>>2]=o[i>>2],o[a+4>>2]=n,n=o[i+12>>2],o[a+8>>2]=o[i+8>>2],o[a+12>>2]=n,t=t-1|0,f=f+1|0),!((0|f)<=(0|t)))break}if((0|t)>(0|s)&&Dr(A,r,s,t),!((0|f)<(0|e)))break}S=i+16|0}function Cr(A,r,f){var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0);p=w[r+52>>2],F=w[r+56>>2],s=w[f+52>>2],k=w[f+56>>2],e=w[r+20>>2],i=w[r+24>>2],d=w[f+20>>2],v=w[f+36>>2],n=w[r+36>>2],h=w[f+24>>2],a=w[r+40>>2],B=w[f+40>>2],R=w[r+48>>2],Z=w[f+48>>2],t=w[r+16>>2],G=w[f+4>>2],c=w[r+32>>2],Q=w[f+8>>2],b=w[r+8>>2],E=w[f+32>>2],u=w[r>>2],W=w[f>>2],l=w[r+4>>2],N=w[f+16>>2],o[A+60>>2]=0,o[A+44>>2]=0,o[A+28>>2]=0,o[A+12>>2]=0,w[A>>2]=m(E*b)+m(m(W*u)+m(N*l)),w[A+40>>2]=m(B*a)+m(m(Q*c)+m(h*n)),w[A+36>>2]=m(v*a)+m(m(G*c)+m(d*n)),w[A+32>>2]=m(E*a)+m(m(W*c)+m(N*n)),w[A+24>>2]=m(B*i)+m(m(Q*t)+m(h*e)),w[A+20>>2]=m(v*i)+m(m(G*t)+m(d*e)),w[A+16>>2]=m(E*i)+m(m(W*t)+m(N*e)),w[A+8>>2]=m(B*b)+m(m(Q*u)+m(l*h)),w[A+4>>2]=m(v*b)+m(m(G*u)+m(l*d)),w[A+56>>2]=F+m(m(k*a)+m(m(Z*c)+m(n*s))),w[A+52>>2]=p+m(m(k*i)+m(m(Z*t)+m(e*s))),w[A+48>>2]=R+m(m(k*b)+m(m(Z*u)+m(l*s)))}function Jr(A,r){var f=0,e=0,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0);if(o[A>>2]==(0|r))return o[A>>2]=0,0;e=o[r+32>>2],f=o[36+(((o[e+40>>2]!=(0|r))<<2)+e|0)>>2];A:{if(r=o[e+32>>2])for(o[36+((((0|e)==o[r+40>>2])<<2)+r|0)>>2]=f,o[f+32>>2]=r,(f=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+4>>2]=e;;){if(h=w[r>>2],e=o[r+36>>2],i=w[e>>2],f=o[r+40>>2],i=i<(u=w[f>>2])?i:u,w[r>>2]=i,u=w[r+16>>2],n=(n=w[e+16>>2])>(l=w[f+16>>2])?n:l,w[r+16>>2]=n,l=w[r+4>>2],a=(a=w[e+4>>2])<(s=w[f+4>>2])?a:s,w[r+4>>2]=a,s=w[r+20>>2],t=(t=w[e+20>>2])>(k=w[f+20>>2])?t:k,w[r+20>>2]=t,k=w[r+8>>2],c=(c=w[e+8>>2])<(d=w[f+8>>2])?c:d,w[r+8>>2]=c,d=w[r+24>>2],b=(b=w[e+24>>2])>(v=w[f+24>>2])?b:v,w[r+24>>2]=b,!(i!=h|l!=a|k!=c|u!=n)&&s==t&&d==b)break A;if(!(r=o[r+32>>2]))break}else o[A>>2]=f,o[f+32>>2]=0,(r=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+4>>2]=e;r=o[A>>2]}return r}function xr(A,r,f,e){for(var i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;;){for(k=f,s=o[o[A+12>>2]+((f+e|0)/2<<2)>>2],n=e;;){u=o[A+12>>2];A:{if(!(a=(0|(b=o[o[s+836>>2]+208>>2]))<0))for(;;)if(t=f,c=o[(l=(f<<2)+u|0)>>2],(0|(i=o[o[c+836>>2]+208>>2]))<0&&(i=o[o[c+840>>2]+208>>2]),f=t+1|0,!((0|i)<(0|b)))break A;for(d=o[o[s+840>>2]+208>>2];t=f,c=o[(l=(f<<2)+u|0)>>2],(0|(i=o[o[c+836>>2]+208>>2]))<0&&(i=o[o[c+840>>2]+208>>2]),f=t+1|0,(0|i)<(0|d););}A:{if(!a)for(;;)if(a=o[((f=n)<<2)+u>>2],(0|(i=o[o[a+836>>2]+208>>2]))<0&&(i=o[o[a+840>>2]+208>>2]),n=f-1|0,!((0|i)>(0|b)))break A;for(b=o[o[s+840>>2]+208>>2];a=o[((f=n)<<2)+u>>2],(0|(i=o[o[a+836>>2]+208>>2]))<0&&(i=o[o[a+840>>2]+208>>2]),n=f-1|0,(0|i)>(0|b););}if((0|f)<(0|t)?(n=f,f=t):(o[l>>2]=a,o[o[A+12>>2]+(f<<2)>>2]=c,n=f-1|0,f=t+1|0),!((0|f)<=(0|n)))break}if((0|n)>(0|k)&&xr(A,r,k,n),!((0|f)<(0|e)))break}}function yr(A,r,f,e){for(var i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;;){for(k=f,s=o[o[A+12>>2]+((f+e|0)/2<<2)>>2],n=e;;){u=o[A+12>>2];A:{if(!(a=(0|(b=o[o[s+28>>2]+208>>2]))<0))for(;;)if(t=f,c=o[(l=(f<<2)+u|0)>>2],(0|(i=o[o[c+28>>2]+208>>2]))<0&&(i=o[o[c+32>>2]+208>>2]),f=t+1|0,!((0|i)<(0|b)))break A;for(d=o[o[s+32>>2]+208>>2];t=f,c=o[(l=(f<<2)+u|0)>>2],(0|(i=o[o[c+28>>2]+208>>2]))<0&&(i=o[o[c+32>>2]+208>>2]),f=t+1|0,(0|i)<(0|d););}A:{if(!a)for(;;)if(a=o[((f=n)<<2)+u>>2],(0|(i=o[o[a+28>>2]+208>>2]))<0&&(i=o[o[a+32>>2]+208>>2]),n=f-1|0,!((0|i)>(0|b)))break A;for(b=o[o[s+32>>2]+208>>2];a=o[((f=n)<<2)+u>>2],(0|(i=o[o[a+28>>2]+208>>2]))<0&&(i=o[o[a+32>>2]+208>>2]),n=f-1|0,(0|i)>(0|b););}if((0|f)<(0|t)?(n=f,f=t):(o[l>>2]=a,o[o[A+12>>2]+(f<<2)>>2]=c,n=f-1|0,f=t+1|0),!((0|f)<=(0|n)))break}if((0|n)>(0|k)&&yr(A,r,k,n),!((0|f)<(0|e)))break}}function Mr(A){var r,f,e=0,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=0,u=0;S=r=S-16|0,(e=o[A+8>>2])?(n=w[A+156>>2],i=w[A+152>>2],w[e+52>>2]=i,o[e+48>>2]=0,w[e+44>>2]=i,w[e+36>>2]=i,o[e+28>>2]=1065353216,o[e+32>>2]=0,o[e+20>>2]=1065353216,o[e+24>>2]=1065353216,o[e+60>>2]=1,w[e+40>>2]=n*m(.5)):(o[8488]=o[8488]+1,e=Ve(0|Zn[o[8290]](64,16),w[A+152>>2],w[A+156>>2]),o[A+8>>2]=e),f=o[A+4>>2],Zn[o[o[f>>2]+8>>2]](f,e),n=m(Zn[o[o[A>>2]+20>>2]](A)),i=w[A+152>>2],o[r+12>>2]=0,w[r+8>>2]=i,w[r+4>>2]=n,w[r>>2]=i,(e=o[A+104>>2])?(a=m(Zn[o[o[e>>2]+48>>2]](e)),t=m(Zn[o[o[e>>2]+48>>2]](e)),c=m(Zn[o[o[e>>2]+48>>2]](e)),o[e+48>>2]=0,w[e+44>>2]=m(i*w[e+28>>2])-c,w[e+40>>2]=m(n*w[e+24>>2])-t,w[e+36>>2]=m(i*w[e+20>>2])-a,i=m(w[((i>((A=i>2]*m(.10000000149011612)),m(Zn[o[o[e>>2]+48>>2]](e))>i&&Zn[o[o[e>>2]+44>>2]](e,i)):(o[8488]=o[8488]+1,b=A,u=tf(0|Zn[o[8290]](64,16),r),o[b+104>>2]=u),S=r+16|0}function Hr(A,r){var f=0,e=0,i=0,n=0;A:if(!((0|(e=o[A+548>>2]))<=0)){for(i=o[A+556>>2];;){if(o[i+(f<<2)>>2]!=(0|r)){if((0|e)!=(0|(f=f+1|0)))continue;break A}break}if(!((0|f)>=(0|e))){f=0;r:{for(;;){if(o[(n=i+(f<<2)|0)>>2]!=(0|r)){if((0|e)!=(0|(f=f+1|0)))continue;break r}break}(0|f)>=(0|e)||(f=(e=e-1|0)<<2,o[n>>2]=o[f+i>>2],o[f+o[A+556>>2]>>2]=r,o[A+548>>2]=e)}e=o[r+32>>2];r:if((0|(i=o[r+28>>2]))!=(0|A)){f:if(!((0|(r=o[e+288>>2]))<=0)){for(A=o[e+296>>2],f=0;;){if((0|i)!=o[(n=A+(f<<2)|0)>>2]){if((0|(f=f+1|0))!=(0|r))continue;break f}break}(0|r)<=(0|f)||(f=A,A=(r=r-1|0)<<2,o[n>>2]=o[f+A>>2],o[A+o[e+296>>2]>>2]=i,o[e+288>>2]=r)}A=e}else{if((0|(r=o[A+288>>2]))<=0)break r;for(i=o[A+296>>2],f=0;;){if((0|e)!=o[(n=i+(f<<2)|0)>>2]){if((0|(f=f+1|0))!=(0|r))continue;break r}break}if((0|r)<=(0|f))break r;f=(r=r-1|0)<<2,o[n>>2]=o[f+i>>2],o[f+o[A+296>>2]>>2]=e,o[A+288>>2]=r}o[A+280>>2]=(0|r)>0}}}function Ir(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0);i=m(Zn[o[o[A>>2]+48>>2]](A)),F=w[r+52>>2],c=w[r+24>>2],b=w[r+20>>2],u=w[r+56>>2],a=w[r+40>>2],t=w[A+72>>2],n=w[A+88>>2],l=w[r+36>>2],v=w[A+68>>2],h=w[A+84>>2],R=w[r+48>>2],B=w[r+8>>2],Z=w[r>>2],G=w[r+4>>2],E=w[r+16>>2],W=w[r+32>>2],N=w[A+64>>2],p=w[A+80>>2],o[f+12>>2]=0,s=u,u=m(m(n+t)*m(.5)),k=m(m(p+N)*m(.5)),d=m(m(h+v)*m(.5)),s=m(s+m(m(a*u)+m(m(W*k)+m(l*d)))),t=m(i+m(m(n-t)*m(.5))),n=m(t*m(Q(a))),a=m(i+m(m(p-N)*m(.5))),i=m(i+m(m(h-v)*m(.5))),n=m(n+m(m(a*m(Q(W)))+m(i*m(Q(l))))),w[f+8>>2]=s-n,l=m(F+m(m(u*c)+m(m(k*E)+m(d*b)))),c=m(m(t*m(Q(c)))+m(m(a*m(Q(E)))+m(i*m(Q(b))))),w[f+4>>2]=l-c,b=m(R+m(m(u*B)+m(m(k*Z)+m(d*G)))),i=m(m(t*m(Q(B)))+m(m(a*m(Q(Z)))+m(i*m(Q(G))))),w[f>>2]=b-i,o[e+12>>2]=0,w[e+8>>2]=n+s,w[e+4>>2]=c+l,w[e>>2]=i+b}function Tr(A,r,f,e,i,n){var t=0,c=0,b=0;A:if(v[e+55|0]!=(0|r)){if(c=o[22768+(t=i<<2)>>2],m(m(m(w[e+8>>2]*w[f+24>>2])+m(m(w[e>>2]*w[f+16>>2])+m(w[e+4>>2]*w[f+20>>2])))-w[e+16>>2])>2],o[A+t>>2],f,0)))break A;o[A+32>>2]=e,a[A+52|0]=i,a[52+(e+i|0)|0]=0,o[32+((i<<2)+e|0)>>2]=A,(r=o[n>>2])?(o[r+36>>2]=A,a[r+53|0]=2,o[A+40>>2]=r,a[A+54|0]=1):o[n+4>>2]=A,o[n>>2]=A,A=n+8|0}else{if(a[e+55|0]=r,i=o[t+22780>>2],!Tr(A,r,f,o[32+((c<<2)+e|0)>>2],v[52+(e+c|0)|0],n))break A;if(!Tr(A,r,f,o[32+((i<<2)+e|0)>>2],v[52+(e+i|0)|0],n))break A;(r=o[e+48>>2])&&(o[r+44>>2]=o[e+44>>2]),(r=o[e+44>>2])&&(o[r+48>>2]=o[e+48>>2]),o[A+18496>>2]==(0|e)&&(o[A+18496>>2]=o[e+48>>2]),o[(r=A+18500|0)>>2]=o[r>>2]-1,o[e+44>>2]=0,o[e+48>>2]=o[A+18504>>2],(r=o[A+18504>>2])&&(o[r+44>>2]=e),o[A+18504>>2]=e,A=A+18508|0}b=1,o[A>>2]=o[A>>2]+1}return b}function Ur(A,r,f){A|=0,f|=0;var e,i=0;i=o[4+(r|=0)>>2],o[A+48>>2]=o[r>>2],o[A+52>>2]=i,i=o[r+12>>2],o[A+56>>2]=o[r+8>>2],o[A+60>>2]=i,i=o[r+28>>2],o[A+72>>2]=o[r+24>>2],o[A+76>>2]=i,e=o[r+20>>2],o[(i=A- -64|0)>>2]=o[r+16>>2],o[i+4>>2]=e,i=o[r+44>>2],o[A+88>>2]=o[r+40>>2],o[A+92>>2]=i,i=o[r+36>>2],o[A+80>>2]=o[r+32>>2],o[A+84>>2]=i,i=o[r+60>>2],o[A+104>>2]=o[r+56>>2],o[A+108>>2]=i,i=o[r+52>>2],o[A+96>>2]=o[r+48>>2],o[A+100>>2]=i,r=o[f+12>>2],o[A+120>>2]=o[f+8>>2],o[A+124>>2]=r,r=o[f+4>>2],o[A+112>>2]=o[f>>2],o[A+116>>2]=r,r=o[f+20>>2],o[A+128>>2]=o[f+16>>2],o[A+132>>2]=r,r=o[f+28>>2],o[A+136>>2]=o[f+24>>2],o[A+140>>2]=r,r=o[f+36>>2],o[A+144>>2]=o[f+32>>2],o[A+148>>2]=r,r=o[f+44>>2],o[A+152>>2]=o[f+40>>2],o[A+156>>2]=r,r=o[f+60>>2],o[A+168>>2]=o[f+56>>2],o[A+172>>2]=r,r=o[f+52>>2],o[A+160>>2]=o[f+48>>2],o[A+164>>2]=r,Zn[o[o[A>>2]+8>>2]](A),fA(A,o[A+28>>2]+4|0,o[A+32>>2]+4|0)}function jr(A,r,f,e,i,n,a,t){var c,b,u,l,s,k=m(0),d=m(0),h=m(0),B=0,Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0);c=o[(a?20:16)+e>>2],B=o[(a?12:8)+e>>2],w[B+(b=i<<2)>>2]=w[n>>2],w[(l=(u=i+1|0)<<2)+B>>2]=w[n+4>>2],w[B+(s=(B=i+2|0)<<2)>>2]=w[n+8>>2],w[c+b>>2]=-w[n>>2],w[c+l>>2]=-w[n+4>>2],w[c+s>>2]=-w[n+8>>2],a||(Z=m(w[A+1352>>2]-w[f+52>>2]),d=w[n+8>>2],h=w[n+4>>2],G=m(w[A+1356>>2]-w[f+56>>2]),E=m(m(Z*d)-m(h*G)),N=m(w[A+1288>>2]-w[r+52>>2]),p=m(w[A+1292>>2]-w[r+56>>2]),W=m(m(N*d)-m(h*p)),Q=m(w[A+1348>>2]-w[f+48>>2]),k=w[n>>2],Z=m(m(Q*h)-m(k*Z)),G=m(m(G*k)-m(d*Q)),Q=m(w[A+1284>>2]-w[r+48>>2]),h=m(m(Q*h)-m(k*N)),d=m(m(p*k)-m(d*Q)),!v[A+1452|0]|t||(k=w[A+1448>>2],Z=m(k*Z),G=m(k*G),E=m(E*k),k=w[A+1444>>2],h=m(k*h),W=m(W*k),d=m(k*d)),A=(r=i<<2)+o[e+12>>2]|0,w[A+8>>2]=h,w[A+4>>2]=d,w[A>>2]=W,A=o[e+20>>2],w[A+r>>2]=-E,w[A+(u<<2)>>2]=-G,w[A+(B<<2)>>2]=-Z)}function zr(A,r){var f,e,i=0,n=0,a=m(0);if(!((2147483647&(s(A),c(2)))>>>0<2139095041&(2147483647&(s(r),c(2)))>>>0<=2139095040))return m(A+r);if(s(r),1065353216==(0|(i=c(2))))return Sr(A);e=i>>>30&2,s(A),f=e|(n=c(2))>>>31;A:{r:{f:{if(!(n&=2147483647)){e:switch(f-2|0){case 0:return m(3.1415927410125732);case 1:break e;default:break f}return m(-3.1415927410125732)}if(2139095040!=(0|(i&=2147483647))){if(!i|!(2139095040!=(0|n)&n>>>0<=i+218103808>>>0))break A;switch(e&&(a=m(0),i>>>0>n+218103808>>>0)||(a=Sr(m(Q(m(A/r))))),A=a,0|f){case 1:return m(-A);case 2:return m(m(3.1415927410125732)-m(A+m(8.742277657347586e-8)));case 0:break f}return m(m(A+m(8.742277657347586e-8))+m(-3.1415927410125732))}if(2139095040==(0|n))break r;A=w[26492+(f<<2)>>2]}return A}return w[26476+(f<<2)>>2]}return b(2,-2147483648&(s(A),c(2))|1070141403),k()}function Pr(A){return o[A>>2]=1025,o[A+120>>2]=0,o[A+124>>2]=0,o[A+128>>2]=0,o[A+132>>2]=0,o[A+136>>2]=0,o[A+140>>2]=0,o[A+144>>2]=0,o[A+148>>2]=0,o[A+152>>2]=0,o[A+156>>2]=0,o[A+160>>2]=0,o[A+164>>2]=0,o[A+168>>2]=0,o[A+328>>2]=0,o[A+332>>2]=0,o[A+336>>2]=0,o[A+340>>2]=0,o[A+344>>2]=0,o[A+348>>2]=0,o[A+352>>2]=0,o[A+356>>2]=0,o[A+360>>2]=0,o[A+364>>2]=0,o[A+368>>2]=0,o[A+372>>2]=0,o[A+376>>2]=0,o[A+536>>2]=0,o[A+540>>2]=0,o[A+544>>2]=0,o[A+548>>2]=0,o[A+552>>2]=0,o[A+556>>2]=0,o[A+560>>2]=0,o[A+564>>2]=0,o[A+568>>2]=0,o[A+572>>2]=0,o[A+576>>2]=0,o[A+580>>2]=0,o[A+584>>2]=0,o[A+792>>2]=0,o[A+784>>2]=0,o[A+788>>2]=0,o[A+776>>2]=0,o[A+780>>2]=0,o[A+768>>2]=0,o[A+772>>2]=0,o[A+760>>2]=0,o[A+764>>2]=0,o[A+752>>2]=0,o[A+756>>2]=0,o[A+744>>2]=0,o[A+748>>2]=0,o[A+836>>2]=0,o[A+840>>2]=0,o[A+864>>2]=0,o[A+844>>2]=0,A}function Or(){O(30404,8381),P(30428,6346,1,1,0),g(30440,5359,1,-128,127),g(30464,5352,1,-128,127),g(30452,5350,1,0,255),g(30476,2375,2,-32768,32767),g(30488,2366,2,0,65535),g(30500,2561,4,-2147483648,2147483647),g(30512,2552,4,0,-1),g(30524,6694,4,-2147483648,2147483647),g(30536,6685,4,0,-1),wi(30548,3510,-2147483648,2147483647),wi(30560,3509,0,-1),H(30572,3476,4),H(30584,7669,8),M(31756,6712),M(25724,10071),y(25796,4,6699),y(25872,2,6724),y(25948,4,6739),z(31464,6351),F(25988,0,10002),F(26028,0,10104),F(26068,1,10032),F(26108,2,9567),F(26148,3,9598),F(26188,4,9638),F(26228,5,9667),F(26268,4,10141),F(26308,5,10171),F(26028,0,9769),F(26068,1,9736),F(26108,2,9835),F(26148,3,9801),F(26188,4,9969),F(26228,5,9935),F(26348,8,9902),F(26388,9,9868),F(26428,6,9705),F(26468,7,10210)}function Sr(A){var r,f,e=0,i=m(0),n=m(0),a=m(0);if(s(A),(r=2147483647&(f=c(2)))>>>0>=1283457024)return(2147483647&(s(A),c(2)))>>>0>2139095040?A:(b(2,-2147483648&(s(A),c(2))|1070141402),k());A:{r:{if(r>>>0<=1054867455){if(e=-1,r>>>0>=964689920)break r;break A}if(A=m(Q(A)),r>>>0<=1066926079){if(r>>>0<=1060110335){A=m(m(m(A+A)+m(-1))/m(A+m(2))),e=0;break r}A=m(m(A+m(-1))/m(A+m(1))),e=1}else r>>>0<=1075576831?(A=m(m(A+m(-1.5))/m(m(A*m(1.5))+m(1))),e=2):(A=m(m(-1)/A),e=3)}if(n=m(A*A),i=m(n*n),a=m(i*m(m(i*m(-.106480173766613))+m(-.19999158382415771))),i=m(n*m(m(i*m(m(i*m(.06168760731816292))+m(.14253635704517365)))+m(.333333283662796))),r>>>0<=1054867455)return m(A-m(A*m(a+i)));A=m(w[26512+(e<<=2)>>2]-m(m(m(A*m(a+i))-w[e+26528>>2])-A)),A=(0|f)<0?m(-A):A}return A}function Lr(A,r){r|=0;var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if(!(!(f=o[12+(A|=0)>>2])|!v[A+8|0])){if((0|(e=o[r+4>>2]))==o[r+8>>2]&&!((0|(c=e?e<<1:1))<=(0|e))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),e=o[r+4>>2]),!((0|e)<=0)){if(f=0,e>>>0>=4)for(b=-4&e;o[(i=f<<2)+n>>2]=o[i+o[r+12>>2]>>2],o[(t=4|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(t=8|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(i|=12)+n>>2]=o[i+o[r+12>>2]>>2],f=f+4|0,(0|b)!=(0|(u=u+4|0)););if(i=3&e)for(;o[(b=f<<2)+n>>2]=o[b+o[r+12>>2]>>2],f=f+1|0,(0|i)!=(0|(l=l+1|0)););}!(f=o[r+12>>2])|!v[r+16|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),e=o[r+4>>2]),o[r+12>>2]=n,a[r+16|0]=1,o[r+8>>2]=c,f=o[A+12>>2]}o[o[r+12>>2]+(e<<2)>>2]=f,o[r+4>>2]=e+1}}function $r(A){var r,f,e=m(0),i=0,n=0;S=r=S-16|0,s(A);A:if((f=2147483647&(i=c(2)))>>>0<=1061752794){if(e=m(1),f>>>0<964689920)break A;e=Xe(+A)}else if(f>>>0<=1081824209){if(f>>>0>=1075235812){e=m(-Xe(+A+((0|i)<0?3.141592653589793:-3.141592653589793)));break A}if(n=+A,(0|i)<0){e=Qe(n+1.5707963267948966);break A}e=Qe(1.5707963267948966-n)}else if(f>>>0<=1088565717){if(f>>>0>=1085271520){e=Xe(+A+((0|i)<0?6.283185307179586:-6.283185307179586));break A}if((0|i)<0){e=Qe(-4.71238898038469-+A);break A}e=Qe(+A-4.71238898038469)}else if(e=m(A-A),!(f>>>0>=2139095040)){switch(3&pA(A,r+8|0)){case 0:e=Xe(Z[r+8>>3]);break A;case 1:e=Qe(-Z[r+8>>3]);break A;case 2:e=m(-Xe(Z[r+8>>3]));break A}e=Qe(Z[r+8>>3])}return S=r+16|0,e}function Kr(A){var r,f,e=0,i=0;S=r=S-16|0,s(A);A:if((f=2147483647&(i=c(2)))>>>0<=1061752794){if(f>>>0<964689920)break A;A=Qe(+A)}else if(f>>>0<=1081824209){if(e=+A,f>>>0<=1075235811){if((0|i)<0){A=m(-Xe(e+1.5707963267948966));break A}A=Xe(e+-1.5707963267948966);break A}A=Qe(-(((0|i)>=0?-3.141592653589793:3.141592653589793)+e))}else if(f>>>0<=1088565717){if(f>>>0<=1085271519){if(e=+A,(0|i)<0){A=Xe(e+4.71238898038469);break A}A=m(-Xe(e+-4.71238898038469));break A}A=Qe(+A+((0|i)<0?6.283185307179586:-6.283185307179586))}else if(f>>>0>=2139095040)A=m(A-A);else{switch(3&pA(A,r+8|0)){case 0:A=Qe(Z[r+8>>3]);break A;case 1:A=Xe(Z[r+8>>3]);break A;case 2:A=Qe(-Z[r+8>>3]);break A}A=m(-Xe(Z[r+8>>3]))}return S=r+16|0,A}function qr(A,r){var f,e,i=0;S=f=S+-64|0,i=o[A>>2],e=o[i-4>>2],i=o[i-8>>2],o[f+32>>2]=0,o[f+36>>2]=0,o[f+40>>2]=0,o[f+44>>2]=0,o[f+48>>2]=0,o[f+52>>2]=0,a[f+55|0]=0,a[f+56|0]=0,a[f+57|0]=0,a[f+58|0]=0,a[f+59|0]=0,a[f+60|0]=0,a[f+61|0]=0,a[f+62|0]=0,o[f+24>>2]=0,o[f+28>>2]=0,o[f+20>>2]=0,o[f+16>>2]=30052,o[f+12>>2]=A,o[f+8>>2]=r,A=A+i|0,i=0;A:if(Ue(e,r,0))o[f+56>>2]=1,Zn[o[o[e>>2]+20>>2]](e,f+8|0,A,A,1,0),i=1==o[f+32>>2]?A:0;else{Zn[o[o[e>>2]+24>>2]](e,f+8|0,A,1,0);r:switch(o[f+44>>2]){case 0:i=1==o[f+48>>2]&&1==o[f+36>>2]&&1==o[f+40>>2]?o[f+28>>2]:0;break A;case 1:break r;default:break A}1!=o[f+32>>2]&&o[f+48>>2]|1!=o[f+36>>2]|1!=o[f+40>>2]||(i=o[f+24>>2])}return S=f- -64|0,i}function _r(A){var r=0;return o[(A|=0)>>2]=30968,!(r=o[A+144>>2])||!r|!v[A+148|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+144>>2]=0,a[A+148|0]=1,o[A+136>>2]=0,o[A+140>>2]=0,o[A>>2]=31016,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,o[A>>2]=30944,0|A}function Af(A,r,f){var e=0,i=0,n=0,t=0;if(f&&(a[0|A]=r,a[(e=A+f|0)-1|0]=r,!(f>>>0<3||(a[A+2|0]=r,a[A+1|0]=r,a[e-3|0]=r,a[e-2|0]=r,f>>>0<7||(a[A+3|0]=r,a[e-4|0]=r,f>>>0<9||(i=(e=0-A&3)+A|0,r=G(255&r,16843009),o[i>>2]=r,o[(f=(e=f-e&-4)+i|0)-4>>2]=r,e>>>0<9||(o[i+8>>2]=r,o[i+4>>2]=r,o[f-8>>2]=r,o[f-12>>2]=r,e>>>0<25||(o[i+24>>2]=r,o[i+20>>2]=r,o[i+16>>2]=r,o[i+12>>2]=r,o[f-16>>2]=r,o[f-20>>2]=r,o[f-24>>2]=r,o[f-28>>2]=r,(f=e-(t=4&i|24)|0)>>>0<32))))))))for(e=ee(r,0,1,1),n=L,r=i+t|0;o[r+24>>2]=e,o[r+28>>2]=n,o[r+16>>2]=e,o[r+20>>2]=n,o[r+8>>2]=e,o[r+12>>2]=n,o[r>>2]=e,o[r+4>>2]=n,r=r+32|0,(f=f-32|0)>>>0>31;);return A}function rf(A,r){var f,e=m(0),i=0,n=m(0),a=0,t=m(0),o=m(0),c=0,b=0,u=0;f=S-16|0,e=w[A>>2],t=w[A+20>>2],o=w[A+40>>2],(n=m(m(e+t)+o))>m(0)?(n=m(N(m(n+m(1)))),e=m(m(.5)/n),t=m(e*m(w[A+16>>2]-w[A+4>>2])),o=m(e*m(w[A+8>>2]-w[A+32>>2])),n=m(n*m(.5)),e=m(e*m(w[A+36>>2]-w[A+24>>2]))):(c=(a=e>>0)%3|0)<<4)|0,A<<=2,e=m(N(m(m(m(w[b+c>>2]-w[u+i>>2])-w[a+A>>2])+m(1)))),w[c+f>>2]=e*m(.5),e=m(m(.5)/e),w[f+12>>2]=m(w[i+a>>2]-w[A+u>>2])*e,w[f+i>>2]=e*m(w[c+u>>2]+w[i+b>>2]),w[(A|f)>>2]=e*m(w[a+c>>2]+w[A+b>>2]),n=w[f+12>>2],t=w[f+8>>2],o=w[f+4>>2],e=w[f>>2]),w[r+12>>2]=n,w[r+8>>2]=t,w[r+4>>2]=o,w[r>>2]=e}function ff(A){var r=0;return o[(A|=0)>>2]=31096,!(r=o[A+144>>2])||!r|!v[A+148|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+144>>2]=0,a[A+148|0]=1,o[A+136>>2]=0,o[A+140>>2]=0,o[A>>2]=31144,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,0|A}function ef(A,r){A|=0;var f=0,e=0,i=0,n=0,a=0,t=0,c=0;(e=o[188+(r|=0)>>2])&&(f=o[A+68>>2],f=0|Zn[o[o[f>>2]+36>>2]](f),Zn[o[o[f>>2]+40>>2]](f,e,o[A+24>>2]),f=o[A+68>>2],Zn[o[o[f>>2]+12>>2]](f,e,o[A+24>>2]),o[r+188>>2]=0);A:if((0|(f=o[r+216>>2]))<0|(0|f)>=(0|(e=o[A+8>>2]))){if(!((0|e)<=0)){for(i=o[A+16>>2],f=0;;){if(o[(n=i+(f<<2)|0)>>2]!=(0|r)){if((0|e)!=(0|(f=f+1|0)))continue;break A}break}(0|f)>=(0|e)||(f=(e=e-1|0)<<2,o[n>>2]=o[f+i>>2],o[f+o[A+16>>2]>>2]=r,o[A+8>>2]=e)}}else{if(i=o[A+16>>2],t=o[(a=i+(n=f<<2)|0)>>2],c=i,i=(e=e-1|0)<<2,o[a>>2]=o[c+i>>2],o[i+o[A+16>>2]>>2]=t,o[A+8>>2]=e,(0|f)>=(0|e))break A;o[o[n+o[A+16>>2]>>2]+216>>2]=f}o[r+216>>2]=-1}function nf(A){var r=0;return o[(A|=0)>>2]=18584,!(r=o[A+160>>2])||!r|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+160>>2]=0,a[A+164|0]=1,o[A+152>>2]=0,o[A+156>>2]=0,!(r=o[A+136>>2])||!r|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+136>>2]=0,a[A+140|0]=1,o[A+128>>2]=0,o[A+132>>2]=0,!(r=o[A+116>>2])||!r|!v[A+120|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+116>>2]=0,a[A+120|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,!(r=o[A+96>>2])||!r|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+96>>2]=0,a[A+100|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,!(r=o[A+76>>2])||!r|!v[A+80|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+76>>2]=0,a[A+80|0]=1,o[A+68>>2]=0,o[A+72>>2]=0,0|A}function af(A){var r,f=0,e=0,i=0;if(s(A),255==(0|(e=(r=c(2))>>>23&255)))return A=m(A*m(6.2831854820251465)),m(A/A);if((f=r<<1)>>>0<=2173837238)return-2121130058==(0|f)?m(A*m(0)):A;if(e)f=8388607&r|8388608;else{if(e=0,(0|(f=r<<9))>=0)for(;e=e-1|0,(0|(f<<=1))>=0;);f=r<<1-e}if((0|e)>129){for(;;){if(!((0|(i=f-13176795|0))<0||(f=i)))return m(A*m(0));if(f<<=1,!((0|(e=e-1|0))>129))break}e=129}if(!((0|(i=f-13176795|0))<0||(f=i)))return m(A*m(0));if(f>>>0<=8388607)for(;e=e-1|0,i=f>>>0<4194304,f<<=1,i;);return b(2,-2147483648&r|((0|e)>0?f-8388608|e<<23:f>>>1-e)),k()}function tf(A,r){var f,e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);return A=oi(A),o[A+4>>2]=0,o[A>>2]=18252,i=w[r>>2],a=w[r+4>>2],e=w[r+8>>2],o[A+48>>2]=0,n=m(e*w[A+28>>2]),e=w[A+52>>2],w[A+44>>2]=n-e,w[A+40>>2]=m(a*w[A+24>>2])-e,w[A+36>>2]=m(i*w[A+20>>2])-e,n=e,f=(e=w[r>>2])<(i=w[r+4>>2]),n>(e=m(w[((w[r+8>>2]>(f?e:i)?!f:2)<<2)+r>>2]*m(.10000000149011612)))&&(i=w[A+52>>2],a=m(Zn[o[o[A>>2]+48>>2]](A)),t=m(Zn[o[o[A>>2]+48>>2]](A)),w[A+52>>2]=e,e=w[A+44>>2],c=w[A+36>>2],b=w[A+40>>2],u=m(Zn[o[o[A>>2]+48>>2]](A)),l=m(Zn[o[o[A>>2]+48>>2]](A)),n=m(Zn[o[o[A>>2]+48>>2]](A)),o[A+48>>2]=0,w[A+40>>2]=m(a+b)-l,w[A+36>>2]=m(i+c)-u,w[A+44>>2]=m(t+e)-n),A}function of(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0);i=m(Zn[o[o[A>>2]+48>>2]](A)),b=w[r+52>>2],t=w[r+20>>2],s=w[r+24>>2],u=w[r+56>>2],c=w[r+36>>2],k=w[A+40>>2],n=w[r+40>>2],a=w[A+44>>2],l=w[r+48>>2],d=w[r>>2],v=w[r+4>>2],h=w[r+8>>2],B=w[r+16>>2],Z=w[r+32>>2],G=w[A+36>>2],o[f+12>>2]=0,a=m(i+a),E=m(a*m(Q(n))),n=m(i+G),i=m(i+k),c=m(E+m(m(n*m(Q(Z)))+m(i*m(Q(c))))),w[f+8>>2]=u-c,t=m(m(a*m(Q(s)))+m(m(n*m(Q(B)))+m(i*m(Q(t))))),w[f+4>>2]=b-t,i=m(m(a*m(Q(h)))+m(m(n*m(Q(d)))+m(i*m(Q(v))))),w[f>>2]=l-i,o[e+12>>2]=0,w[e+8>>2]=u+c,w[e+4>>2]=t+b,w[e>>2]=i+l}function cf(A){var r,f=0,e=m(0),i=m(0),n=m(0),a=0,t=m(0),c=m(0),b=m(0),u=0,l=0;S=r=S-16|0,e=w[A+156>>2],w[r>>2]=e,i=w[A+152>>2],w[r+4>>2]=i,n=w[A+160>>2],o[r+12>>2]=0,w[r+8>>2]=n,(f=o[A+8>>2])?(t=m(Zn[o[o[f>>2]+48>>2]](f)),c=m(Zn[o[o[f>>2]+48>>2]](f)),b=m(Zn[o[o[f>>2]+48>>2]](f)),o[f+48>>2]=0,w[f+44>>2]=m(n*w[f+28>>2])-b,w[f+40>>2]=m(i*w[f+24>>2])-c,w[f+36>>2]=m(e*w[f+20>>2])-t,e=m(w[((((a=e>2]*m(.10000000149011612)),m(Zn[o[o[f>>2]+48>>2]](f))>e&&Zn[o[o[f>>2]+44>>2]](f,e)):(o[8488]=o[8488]+1,u=A,l=tf(0|Zn[o[8290]](64,16),r),o[u+8>>2]=l),f=o[A+4>>2],Zn[o[o[f>>2]+8>>2]](f,o[A+8>>2]),S=r+16|0}function bf(A,r,f,e){var i=m(0),n=m(0),a=m(0),t=m(0),o=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0);return o=w[f+24>>2],i=w[r+24>>2],u=m(o-i),c=w[f+16>>2],a=w[r+16>>2],l=m(c-a),n=w[A+4>>2],k=w[A>>2],b=w[f+20>>2],t=w[r+20>>2],s=m(b-t),d=w[A+8>>2],(A=m(m(i*m(m(l*n)-m(k*s)))+m(m(a*m(m(s*d)-m(n*u)))+m(t*m(m(u*k)-m(d*l)))))m(0)||(n=m(m(o*o)+m(m(c*c)+m(b*b))),m(m(o*u)+m(m(c*l)+m(b*s)))m(0)?i:m(0))),w[e>>2]=N(n)),A}function uf(A){var r,f=0,e=0,i=0;if(o[(A|=0)>>2]=20936,!(f=o[A+56>>2])||!f|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+56>>2]=0,a[A+60|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,(0|(r=o[A+28>>2]))>0)for(;f=o[A+36>>2]+G(e,36)|0,!(i=o[f+12>>2])||!i|!v[f+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[f+12>>2]=0,a[f+16|0]=1,o[f+4>>2]=0,o[f+8>>2]=0,(0|r)!=(0|(e=e+1|0)););return!(f=o[A+36>>2])||!f|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+36>>2]=0,a[A+40|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,!(f=o[A+16>>2])||!f|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function lf(A){return a[A+20|0]=1,o[A>>2]=23860,o[A+16>>2]=0,a[A+40|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,o[A+36>>2]=0,a[A+60|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,o[A+56>>2]=0,a[A+80|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,o[A+76>>2]=0,a[A+100|0]=1,o[A+68>>2]=0,o[A+72>>2]=0,o[A+96>>2]=0,a[A+120|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,o[A+116>>2]=0,a[A+140|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,o[A+136>>2]=0,o[A+128>>2]=0,o[A+132>>2]=0,a[A+160|0]=1,o[A+156>>2]=0,o[A+148>>2]=0,o[A+152>>2]=0,a[A+180|0]=1,o[A+176>>2]=0,o[A+168>>2]=0,o[A+172>>2]=0,a[A+208|0]=1,o[A+232>>2]=0,o[A+204>>2]=0,o[A+196>>2]=0,o[A+200>>2]=0,o[A+224>>2]=0,o[A+212>>2]=955,o[A+216>>2]=956,o[A+220>>2]=957,A}function sf(A){var r,f,e=0,i=m(0);if(s(A),(r=2147483647&(f=c(2)))>>>0>=1065353216)return m(1065353216==(0|r)?1.5707963267948966*+A+752316384526264e-51:m(0)/m(A-A));A:{if(r>>>0<=1056964607){if(r-8388608>>>0<956301312)break A;return i=m(A*A),m(m(A*m(m(m(m(i*m(m(i*m(-.008656363002955914))+m(-.04274342209100723)))+m(.16666586697101593))*i)/m(m(i*m(-.7066296339035034))+m(1))))+A)}A=m(m(m(1)-m(Q(A)))*m(.5)),e=N(+A),e+=e*+m(m(m(m(A*m(m(A*m(-.008656363002955914))+m(-.04274342209100723)))+m(.16666586697101593))*A)/m(m(A*m(-.7066296339035034))+m(1))),A=m(1.5707963267948966-(e+e)),A=(0|f)<0?m(-A):A}return A}function kf(A){var r,f=0,e=0,i=0;if(o[(A|=0)>>2]=16316,(0|(r=o[A+52>>2]))>0)for(;(e=o[(i=f<<2)+o[A+60>>2]>>2])&&(Zn[o[o[e>>2]>>2]](e),e=o[A+4>>2],Zn[o[o[e>>2]+60>>2]](e,o[o[A+60>>2]+i>>2])),(0|r)!=(0|(f=f+1|0)););return!(f=o[A+60>>2])||!f|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+60>>2]=0,a[A+64|0]=1,o[A+52>>2]=0,o[A+56>>2]=0,!(f=o[A+40>>2])||!f|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+40>>2]=0,a[A+44|0]=1,o[A+32>>2]=0,o[A+36>>2]=0,!(f=o[A+20>>2])||!f|!v[A+24|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+20>>2]=0,a[A+24|0]=1,o[A+12>>2]=0,o[A+16>>2]=0,0|A}function df(A,r,f,e){var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);n=$r(f),i=w[r+444>>2],f=Kr(f),m(Q(n))>m(1.1920928955078125e-7)?(t=m(n*n),a=m(m(f*f)/t),c=m(a/m(i*i)),i=w[r+448>>2],i=m(N(m(m(a+m(1))/m(c+m(m(1)/m(i*i))))))):t=m(n*n),o[A+12>>2]=0,i=m(i*m(.5)),a=m(Kr(i)/m(N(m(m(f*f)+m(t+m(0)))))),f=m(a*m(-f)),i=$r(i),c=m(i*m(0)),t=m(a*m(0)),b=m(t*m(0)),u=m(m(c+m(f*e))-b),n=m(n*a),a=m(m(c+b)-m(n*e)),b=m(f*m(-0)),c=m(b+m(m(n*m(-0))-m(t*e))),e=m(b+m(m(i*e)+m(n*m(0)))),w[A+8>>2]=m(u*t)+m(m(m(i*a)-m(c*f))-m(e*n)),w[A+4>>2]=m(e*f)+m(m(m(i*u)-m(c*n))-m(a*t)),w[A>>2]=m(a*n)+m(m(m(i*e)-m(c*t))-m(u*f))}function vf(A){var r=0,f=m(0);S=r=S-96|0,a[A+96|0]=1,v[34128]||(o[8509]=0,o[8510]=0,o[8508]=1065353216,o[8511]=0,o[8512]=0,o[8514]=0,o[8515]=0,o[8513]=1065353216,o[8516]=0,o[8517]=0,o[8521]=0,o[8522]=0,o[8520]=-1082130432,o[8518]=1065353216,o[8519]=0,o[8523]=0,o[8524]=0,o[8526]=0,o[8527]=0,o[8525]=-1082130432,o[8528]=0,o[8529]=0,o[8530]=-1082130432,o[8531]=0,a[34128]=1),r=Af(r,0,96),Zn[o[o[A>>2]+76>>2]](A,34032,r,6),f=w[A+52>>2],w[A+80>>2]=w[r>>2]+f,w[A+64>>2]=w[r+48>>2]-f,w[A+84>>2]=f+w[r+20>>2],w[A+68>>2]=w[r+68>>2]-f,w[A+88>>2]=f+w[r+40>>2],w[A+72>>2]=w[r+88>>2]-f,S=r+96|0}function hf(A){var r,f,e=0,i=0,n=0;if(o[A+24>>2]=0,o[A+68>>2]=0,a[A+20|0]=1,o[A>>2]=12408,o[A+16>>2]=0,a[A+44|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,o[A+40>>2]=0,a[A- -64|0]=1,o[A+32>>2]=0,o[A+36>>2]=0,o[A+60>>2]=0,o[A+52>>2]=0,o[A+56>>2]=0,o[8488]=o[8488]+1,r=0|Zn[o[8290]](32,16),(0|(f=o[A+8>>2]))>0)for(;e=(i=n<<4)+r|0,i=i+o[A+16>>2]|0,o[e>>2]=o[i>>2],o[e+4>>2]=o[i+4>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=o[i+12>>2],(0|f)!=(0|(n=n+1|0)););return!(e=o[A+16>>2])||!e|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+16>>2]=r,a[A+20|0]=1,o[A+12>>2]=2,_A(A),A}function Bf(A){var r=0;return o[(A|=0)>>2]=22164,!(r=o[A+156>>2])||!r|!v[A+160|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+156>>2]=0,a[A+160|0]=1,o[A+148>>2]=0,o[A+152>>2]=0,!(r=o[A+136>>2])||!r|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+136>>2]=0,a[A+140|0]=1,o[A+128>>2]=0,o[A+132>>2]=0,!(r=o[A+116>>2])||!r|!v[A+120|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+116>>2]=0,a[A+120|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,!(r=o[A+96>>2])||!r|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+96>>2]=0,a[A+100|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,0|Be(A)}function wf(A,r){var f,e=m(0),i=0,n=0,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=0;if(i=0,!((0|(f=o[A>>2]))<=0||(c=w[A+308>>2],b=w[r+8>>2],e=m(b-w[A+12>>2]),a=m(e*e),u=w[r>>2],e=m(u-w[A+4>>2]),t=m(e*e),l=w[r+4>>2],e=m(l-w[A+8>>2]),i=1,c>=m(a+m(t+m(e*e)))))){for(;!((0|f)==(0|(n=n+1|0))||(e=m(b-w[12+(i=(n<<4)+A|0)>>2]),a=m(e*e),e=m(u-w[i+4>>2]),t=m(e*e),e=m(l-w[i+8>>2]),m(a+m(t+m(e*e)))<=c)););i=(0|n)<(0|f)}return w[r+12>>2]!=w[A+304>>2]|w[r+8>>2]!=w[A+300>>2]|w[r+4>>2]!=w[A+296>>2]||(s=w[r>>2]==w[A+292>>2]),i|s}function Zf(A){var r,f=0,e=0,i=0;if(o[(A|=0)>>2]=12040,v[A+152|0]&&(f=o[A+96>>2],Zn[o[o[f>>2]>>2]](f),(f=o[A+96>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f))),(0|(r=o[A+160>>2]))>0)for(;f=o[A+168>>2]+G(e,20)|0,!(i=o[f+12>>2])||!i|!v[f+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),a[f+16|0]=1,o[f+12>>2]=0,o[f+4>>2]=0,o[f+8>>2]=0,(0|r)!=(0|(e=e+1|0)););return!(f=o[A+168>>2])||!f|!v[A+172|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+168>>2]=0,a[A+172|0]=1,o[A+160>>2]=0,o[A+164>>2]=0,Kf(A+44|0),Kf(A+4|0),0|A}function Gf(A,r,f){var e=0;return(e=o[A+4>>2])?o[A+4>>2]=0:(o[8488]=o[8488]+1,e=0|Zn[o[8290]](44,16),o[e>>2]=0,o[e+4>>2]=0,o[e+40>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0),o[e+36>>2]=f,o[e+32>>2]=0,o[e+40>>2]=0,f=o[r+4>>2],o[e>>2]=o[r>>2],o[e+4>>2]=f,f=o[r+12>>2],o[e+8>>2]=o[r+8>>2],o[e+12>>2]=f,f=o[r+20>>2],o[e+16>>2]=o[r+16>>2],o[e+20>>2]=f,f=o[r+28>>2],o[e+24>>2]=o[r+24>>2],o[e+28>>2]=f,er(A,o[A>>2],e),o[A+12>>2]=o[A+12>>2]+1,e}function mf(A){return a[A+60|0]=0,o[A+52>>2]=287,o[A+144>>2]=0,a[A+80|0]=1,o[A>>2]=18584,o[A+76>>2]=0,a[A+100|0]=1,o[A+68>>2]=0,o[A+72>>2]=0,o[A+96>>2]=0,a[A+120|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,o[A+116>>2]=0,a[A+140|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,o[A+136>>2]=0,a[A+164|0]=1,o[A+128>>2]=0,o[A+132>>2]=0,o[A+160>>2]=0,o[A+168>>2]=0,o[A+152>>2]=0,o[A+156>>2]=0,o[A+4>>2]=-8388609,o[A+8>>2]=-8388609,o[A+12>>2]=-8388609,o[A+16>>2]=0,o[A+20>>2]=2139095039,o[A+24>>2]=2139095039,o[A+28>>2]=2139095039,o[A+32>>2]=0,A}function Qf(A,r,f,e){for(var i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0;;){for(u=f,l=o[o[A+12>>2]+((f+e|0)/2<<3)>>2],i=e;;){for(a=o[A+12>>2],t=f;t=(f=t)+1|0,o[(n=(f<<3)+a|0)>>2]<(0|l););for(c=i;c=(i=c)-1|0,o[(b=(s=i<<3)+a|0)>>2]>(0|l););if((0|f)<=(0|i)&&(f=o[n>>2],i=o[n+4>>2],a=o[b+4>>2],o[n>>2]=o[b>>2],o[n+4>>2]=a,n=o[A+12>>2]+s|0,o[n>>2]=f,o[n+4>>2]=i,i=c,f=t),!((0|f)<=(0|i)))break}if((0|i)>(0|u)&&Qf(A,r,u,i),!((0|f)<(0|e)))break}}function Ef(A){var r,f=0,e=0,i=0,n=0;if(o[(A|=0)>>2]=16464,f=o[A+84>>2],(0|(r=o[f+8>>2]))>0){for(;(e=o[8+(o[f+16>>2]+G(i,12)|0)>>2])&&(Zn[o[o[e>>2]>>2]](e),n=o[A+4>>2],Zn[o[o[n>>2]+60>>2]](n,e)),(0|r)!=(0|(i=i+1|0)););f=o[A+84>>2]}return Vr(f),f=o[A+84>>2],Zn[o[o[f>>2]>>2]](f),(f=o[A+84>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),!(f=o[A+100>>2])||!f|!v[A+104|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+100>>2]=0,a[A+104|0]=1,o[A+92>>2]=0,o[A+96>>2]=0,0|kf(A)}function Wf(A,r,f,e){var i=0,n=0;i=o[r+4>>2],o[A+292>>2]=o[r>>2],o[A+296>>2]=i,i=o[r+12>>2],o[A+300>>2]=o[r+8>>2],o[A+304>>2]=i,a[A+356|0]=1,n=o[r+4>>2],i=A+(o[A>>2]<<4)|0,o[i+4>>2]=o[r>>2],o[i+8>>2]=n,n=o[r+12>>2],o[i+12>>2]=o[r+8>>2],o[i+16>>2]=n,i=o[f+12>>2],r=(o[A>>2]<<4)+A|0,o[r+92>>2]=o[f+8>>2],o[r+96>>2]=i,i=o[f+4>>2],o[r+84>>2]=o[f>>2],o[r+88>>2]=i,f=o[e+12>>2],r=(o[A>>2]<<4)+A|0,o[r+172>>2]=o[e+8>>2],o[r+176>>2]=f,f=o[e+4>>2],o[r+164>>2]=o[e>>2],o[r+168>>2]=f,o[A>>2]=o[A>>2]+1}function Nf(A,r,f){var e,i=m(0),n=m(0),a=m(0);e=o[A+204>>2],r!=m(0)?(o[A+204>>2]=-2&e,i=m(m(1)/r)):o[A+204>>2]=1|e,w[A+404>>2]=i,o[A+436>>2]=0,w[A+424>>2]=w[A+440>>2]*r,w[A+432>>2]=w[A+448>>2]*r,w[A+428>>2]=w[A+444>>2]*r,r=w[f+8>>2],n=w[f+4>>2],a=w[f>>2],w[A+620>>2]=w[A+408>>2]*i,w[A+624>>2]=i*w[A+412>>2],w[A+628>>2]=i*w[A+416>>2],o[A+632>>2]=0,o[A+468>>2]=0,w[A+456>>2]=a!=m(0)?m(m(1)/a):m(0),w[A+460>>2]=n!=m(0)?m(m(1)/n):m(0),w[A+464>>2]=r!=m(0)?m(m(1)/r):m(0)}function pf(A,r,f,e,i,n){var a;return A|=0,r|=0,f|=0,e=m(e),i|=0,n|=0,S=a=S+-64|0,o[a+56>>2]=n,o[a+52>>2]=i,o[a+60>>2]=o[A+220>>2],i=o[A+212>>2],w[i+4>>2]>=e&&(o[a+8>>2]=o[A+216>>2],o[a+12>>2]=a+52,A=o[r+12>>2],o[a+24>>2]=o[r+8>>2],o[a+28>>2]=A,A=o[r+4>>2],o[a+16>>2]=o[r>>2],o[a+20>>2]=A,A=o[f+12>>2],o[a+40>>2]=o[f+8>>2],o[a+44>>2]=A,A=o[f+4>>2],o[a+32>>2]=o[f>>2],o[a+36>>2]=A,w[a+48>>2]=e,e=m(Zn[o[o[i>>2]+12>>2]](i,a+8|0,1))),S=a- -64|0,m(e)}function Ff(A){var r=0,f=0,e=0,i=0;if(o[(A|=0)>>2]=13192,(0|(r=o[A+8>>2]))>0)for(;i=o[o[A+16>>2]+(f<<2)>>2],(e=o[i+188>>2])&&(r=o[A+68>>2],r=0|Zn[o[o[r>>2]+36>>2]](r),Zn[o[o[r>>2]+40>>2]](r,e,o[A+24>>2]),r=o[A+68>>2],Zn[o[o[r>>2]+12>>2]](r,e,o[A+24>>2]),o[i+188>>2]=0,r=o[A+8>>2]),(0|(f=f+1|0))<(0|r););return!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function Rf(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0);Zn[o[o[r>>2]+68>>2]](A,r,f),m(Zn[o[o[r>>2]+48>>2]](r))!=m(0)&&(i=w[f+4>>2],e=w[f>>2],n=w[f+8>>2],a=m(Zn[o[o[r>>2]+48>>2]](r)),t=e=(r=m(m(n*n)+m(m(e*e)+m(i*i)))>2]=w[A>>2]+m(a*m(t*e)),w[A+4>>2]=w[A+4>>2]+m(a*m(i*e)),w[A+8>>2]=w[A+8>>2]+m(a*m(n*e)))}function Yf(A){var r=0;return o[(A|=0)>>2]=12408,!(r=o[A+60>>2])||!r|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+60>>2]=0,a[A+64|0]=1,o[A+52>>2]=0,o[A+56>>2]=0,!(r=o[A+40>>2])||!r|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+40>>2]=0,a[A+44|0]=1,o[A+32>>2]=0,o[A+36>>2]=0,!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function Vf(A){var r=0;return o[(A|=0)>>2]=17912,!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+56>>2]=0,a[A+60|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,!(r=o[A+36>>2])||!r|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+36>>2]=0,a[A+40|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function gf(A){var r=0;return o[(A|=0)>>2]=24184,!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+56>>2]=0,a[A+60|0]=1,o[A+48>>2]=0,o[A+52>>2]=0,!(r=o[A+36>>2])||!r|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+36>>2]=0,a[A+40|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+16>>2]=0,a[A+20|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,0|A}function Xf(A,r,f){var e=0,i=0,n=0,a=0;A:if(i=Jr(A,r))if((0|(n=o[A+8>>2]))>=0){if(!n)break A;for(;;){if(!(e=o[i+32>>2]))break A;if(i=e,(0|n)==(0|(a=a+1|0)))break}}else i=o[A>>2];else i=0;e=o[f+4>>2],o[r>>2]=o[f>>2],o[r+4>>2]=e,e=o[f+28>>2],o[r+24>>2]=o[f+24>>2],o[r+28>>2]=e,e=o[f+20>>2],o[r+16>>2]=o[f+16>>2],o[r+20>>2]=e,e=o[f+12>>2],o[r+8>>2]=o[f+8>>2],o[r+12>>2]=e,er(A,i,r)}function Df(A,r){A|=0,r|=0;var f=m(0),e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);f=m(Zn[o[o[A>>2]+48>>2]](A)),e=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(Zn[o[o[A>>2]+48>>2]](A)),n=w[A+24>>2],a=w[A+40>>2],t=w[A+28>>2],c=w[A+44>>2],b=w[A+20>>2],u=w[A+36>>2],We(A,r),o[A+48>>2]=0,w[A+44>>2]=m(m(m(i+c)/t)*w[A+28>>2])-i,w[A+40>>2]=m(m(m(e+a)/n)*w[A+24>>2])-e,w[A+36>>2]=m(m(m(f+u)/b)*w[A+20>>2])-f}function Cf(A){var r=0,f=0;return o[(A|=0)>>2]=15216,v[A+52|0]&&(r=o[A+56>>2])&&(f=o[A+4>>2],Zn[o[o[f>>2]+16>>2]](f,r)),!(r=o[A+44>>2])||!r|!v[A+48|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+44>>2]=0,a[A+48|0]=1,o[A+36>>2]=0,o[A+40>>2]=0,!(r=o[A+24>>2])||!r|!v[A+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+24>>2]=0,a[A+28|0]=1,o[A+16>>2]=0,o[A+20>>2]=0,0|A}function Jf(A,r){var f=m(0);o[A+20>>2]=0,o[A+24>>2]=0,a[A+28|0]=0;A:if((f=w[A+4>>2])>=m(0)){if((r=af(m(r-w[A>>2])))m(3.1415927410125732)&&(r=m(r+m(-6.2831854820251465))),m(-f)>r)a[A+28|0]=1,r=m(-m(f+r)),f=m(1);else{if(!(r>f))break A;a[A+28|0]=1,r=m(f-r),f=m(-1)}w[A+24>>2]=f,w[A+20>>2]=r}}function xf(A,r){A|=0,r=m(r);var f=m(0),e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0);f=m(Zn[o[o[A>>2]+48>>2]](A)),e=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(Zn[o[o[A>>2]+48>>2]](A)),w[A+52>>2]=r,r=w[A+44>>2],n=w[A+40>>2],a=w[A+36>>2],t=m(Zn[o[o[A>>2]+48>>2]](A)),c=m(Zn[o[o[A>>2]+48>>2]](A)),b=m(Zn[o[o[A>>2]+48>>2]](A)),o[A+48>>2]=0,w[A+40>>2]=m(e+n)-c,w[A+36>>2]=m(f+a)-t,w[A+44>>2]=m(i+r)-b}function yf(A){var r,f,e=0,i=0,n=m(0);return S=r=S-16|0,i=o[A+8>>2],(0|(f=o[A+12>>2]))>0|(0|f)>=0?n=m(m(m(+(i>>>0)+4294967296*+(f>>>0))*m(0x10000000000000000))+m(+B[A>>2]+4294967296*+B[A+4>>2])):(e=o[A>>2],A=o[A+4>>2],o[r>>2]=0-e,o[r+4>>2]=0-(A+!!(0|e)|0),i=(A=!(A|e))+(e=~i)|0,A=~f,o[r+8>>2]=i,o[r+12>>2]=i>>>0>>0?A+1|0:A,n=m(-yf(r))),S=r+16|0,n}function Mf(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0);t=m(Zn[o[o[A>>2]+48>>2]](A)),c=m(Zn[o[o[A>>2]+48>>2]](A)),b=m(Zn[o[o[A>>2]+48>>2]](A)),i=w[r+52>>2],n=w[r+56>>2],a=w[r+48>>2],o[f+12>>2]=0,w[f+8>>2]=n-b,w[f+4>>2]=i-c,w[f>>2]=a-t,i=w[r+52>>2],n=w[r+56>>2],a=w[r+48>>2],o[e+12>>2]=0,w[e+8>>2]=b+n,w[e+4>>2]=c+i,w[e>>2]=t+a}function Hf(A,r,f,e,i){var n,t=m(0),c=m(0);return o[A+32>>2]=f,o[A+28>>2]=r,o[A+24>>2]=e,o[A+20>>2]=i,o[A+4>>2]=0,o[A+8>>2]=1065353216,o[A+12>>2]=0,o[A+16>>2]=0,o[A>>2]=22908,o[A+36>>2]=o[r+4>>2],o[A+40>>2]=o[f+4>>2],n=A,c=m(Zn[o[o[r>>2]+48>>2]](r)),w[n+44>>2]=c,t=m(Zn[o[o[f>>2]+48>>2]](f)),o[A+72>>2]=1,o[A+76>>2]=1,o[A+60>>2]=-1,a[A+52|0]=0,w[A+48>>2]=t,A}function If(A,r,f,e,i){for(var n=0,a=0;;){A:{if(!(h[i>>1]>1]|h[e>>1]>h[r+6>>1]|h[i+4>>1]>1]|h[e+4>>1]>h[r+10>>1]||h[i+2>>1]>1]|h[e+2>>1]>h[r+8>>1])){if((0|(n=o[r+12>>2]))<0)break A;Zn[o[o[f>>2]+8>>2]](f,n>>>21|0,2097151&n)}return}If(A,n=r+16|0,f,e,i),a=n,r=(0|(n=o[r+28>>2]))<0?a-(n<<4)|0:r+32|0}}function Tf(A,r,f,e){a[A+53|0]=1;A:if(o[A+4>>2]==(0|f)){a[A+52|0]=1;r:{if(!(f=o[A+16>>2])){if(o[A+36>>2]=1,o[A+24>>2]=e,o[A+16>>2]=r,1!=(0|e))break A;if(1==o[A+48>>2])break r;break A}if((0|r)==(0|f)){if(2==(0|(f=o[A+24>>2]))&&(o[A+24>>2]=e,f=e),1!=o[A+48>>2])break A;if(1==(0|f))break r;break A}o[A+36>>2]=o[A+36>>2]+1}a[A+54|0]=1}}function Uf(A,r,f,e,i){return o[A>>2]=15064,o[A+4>>2]=o[r>>2],o[A>>2]=15092,o[A>>2]=16316,a[A+68|0]=i,a[A+24|0]=1,o[A+20>>2]=0,a[A+44|0]=1,o[A+12>>2]=0,o[A+16>>2]=0,o[A+40>>2]=0,a[A- -64|0]=1,o[A+32>>2]=0,o[A+36>>2]=0,o[A+60>>2]=0,o[A+52>>2]=0,o[A+56>>2]=0,r=o[r+4>>2],a[A+76|0]=0,o[A+72>>2]=r,o[A+80>>2]=o[o[(i?e:f)+4>>2]+76>>2],dr(A,f,e),A}function jf(A,r){A:if((0|r)>=1024){if(A*=898846567431158e293,r>>>0<2047){r=r-1023|0;break A}A*=898846567431158e293,r=((0|r)>=3069?3069:r)-2046|0}else(0|r)>-1023||(A*=2004168360008973e-307,r>>>0>4294965304?r=r+969|0:(A*=2004168360008973e-307,r=((0|r)<=-2960?-2960:r)+1938|0));return b(0,0),b(1,r+1023<<20),A*+u()}function zf(A,r,f,e,i){var n;return o[A>>2]=15064,o[A+4>>2]=o[r>>2],o[A>>2]=15092,o[A>>2]=15820,r=o[r>>2],o[A+60>>2]=0,o[A+56>>2]=r,o[A+8>>2]=15848,n=i?f:e,o[A+48>>2]=n,f=i?e:f,o[A+44>>2]=f,r=0|Zn[o[o[r>>2]+12>>2]](r,o[f+8>>2],o[n+8>>2]),o[A+72>>2]=r,f=o[A+56>>2],Zn[o[o[f>>2]+20>>2]](f,r),a[A+76|0]=i,A}function Pf(A){var r=0;return o[(A|=0)>>2]=25228,r=o[A+344>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+344>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A>>2]=25184,!(r=o[A+336>>2])||!r|!v[A+340|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+336>>2]=0,a[A+340|0]=1,o[A+328>>2]=0,o[A+332>>2]=0,0|se(A)}function Of(A,r){var f=m(0),e=0,i=m(0),n=m(0),a=m(0);(f=w[A+404>>2])!=m(0)&&(i=w[r>>2],n=w[r+4>>2],a=w[r+8>>2],o[A+436>>2]=0,f=m(m(1)/f),w[A+432>>2]=a*f,w[A+428>>2]=f*n,w[A+424>>2]=f*i),e=o[r+4>>2],o[A+440>>2]=o[r>>2],o[A+444>>2]=e,e=o[r+12>>2],o[A+448>>2]=o[r+8>>2],o[A+452>>2]=e}function Sf(A,r,f,e){var i=0;return o[A>>2]=23240,i=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=i,i=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=i,r=o[f+4>>2],o[A+20>>2]=o[f>>2],o[A+24>>2]=r,r=o[f+12>>2],o[A+28>>2]=o[f+8>>2],o[A+32>>2]=r,o[A+40>>2]=1065353216,o[A+36>>2]=e,A}function Lf(A,r,f,e,i){var n=m(0);if(n=m(1),!(r>f)&&(n=m(0),r!=f)){if((e=m(e/i))=r)|!(m(r-e)>A)?m(Am(0)){if(!(!(A<=f)|!(m(f-e)f?0:1)}}return n}function $f(A,r,f,e,i,n,a,t,c,b){r|=0,f|=0,e|=0,i|=0,n|=0,a|=0,t|=0,c|=0,b|=0,A=o[32+(A|=0)>>2]+(b<<5)|0,o[f>>2]=o[A+12>>2],o[r>>2]=o[A+16>>2],o[e>>2]=o[A+28>>2],o[i>>2]=o[A+20>>2],o[t>>2]=o[A>>2],o[n>>2]=o[A+4>>2],o[a>>2]=o[A+8>>2],o[c>>2]=o[A+24>>2]}function Kf(A){var r=0;(r=o[A>>2])&&Ze(A,r),(r=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+4>>2]=0,o[A+8>>2]=-1,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+36|0]=1,o[A+16>>2]=0,o[A+32>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0}function qf(A){var r=0;(r=o[A>>2])&&Ze(A,r),(r=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+4>>2]=0,o[A+8>>2]=-1,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+16>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0}function _f(A){var r=0;return o[(A|=0)>>2]=19400,(r=o[A+72>>2])&&(Kf(r),(r=o[A+72>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,0|A}function Ae(A){return A=ae(A),a[A+96|0]=0,o[A+80>>2]=-1082130432,o[A+84>>2]=-1082130432,o[A+64>>2]=1065353216,o[A+68>>2]=1065353216,o[A>>2]=21116,o[A+60>>2]=0,o[A+88>>2]=-1082130432,o[A+92>>2]=0,o[A+72>>2]=1065353216,o[A+76>>2]=0,A}function re(A){a[A+356|0]=1,o[A>>2]=0,a[A+312|0]=0,o[A+292>>2]=1566444395,o[A+296>>2]=1566444395,o[A+336>>2]=0,o[A+340>>2]=0,o[A+300>>2]=1566444395,o[A+304>>2]=0,o[A+344>>2]=0,o[A+348>>2]=0,a[A+352|0]=0,a[A+332|0]=240&v[A+332|0]}function fe(A,r,f){var e=0;AA(A),e=o[A+248>>2],o[r>>2]=o[A+244>>2],o[r+4>>2]=e,e=o[A+256>>2],o[r+8>>2]=o[A+252>>2],o[r+12>>2]=e,r=o[A+272>>2],o[f+8>>2]=o[A+268>>2],o[f+12>>2]=r,r=o[A+264>>2],o[f>>2]=o[A+260>>2],o[f+4>>2]=r}function ee(A,r,f,e){var i,n,a,t,o=0,c=0;return t=G(o=f>>>16|0,c=A>>>16|0),o=(65535&(c=((a=G(i=65535&f,n=65535&A))>>>16|0)+G(c,i)|0))+G(o,n)|0,L=(G(r,f)+t|0)+G(A,e)+(c>>>16)+(o>>>16)|0,65535&a|o<<16}function ie(A,r,f){var e;if(!(e=o[A+16>>2]))return o[A+36>>2]=1,o[A+24>>2]=f,void(o[A+16>>2]=r);A:{if((0|r)==(0|e)){if(2!=o[A+24>>2])break A;return void(o[A+24>>2]=f)}a[A+54|0]=1,o[A+24>>2]=2,o[A+36>>2]=o[A+36>>2]+1}}function ne(A,r,f,e){return o[A+44>>2]=0,o[A+36>>2]=0,o[A+40>>2]=1028443341,o[A+32>>2]=e,o[A+28>>2]=f,o[A+24>>2]=-1,t[A+20>>1]=1,o[A+16>>2]=2139095039,o[A+8>>2]=-1,o[A+12>>2]=-1,o[A+4>>2]=r,o[A>>2]=24e3,A}function ae(A){return o[A+12>>2]=0,o[A+16>>2]=0,o[A+4>>2]=35,o[A+8>>2]=0,o[A>>2]=19776,o[A+52>>2]=1025758986,o[A+20>>2]=1065353216,o[A+24>>2]=1065353216,o[A>>2]=19640,o[A+28>>2]=1065353216,o[A+32>>2]=0,A}function te(A,r,f){var e,i;return A|=0,r|=0,e=0|Zn[o[o[(f|=0)>>2]+40>>2]](f,A),i=0|Zn[o[o[f>>2]+28>>2]](f,e),o[r>>2]=i,i&&Zn[o[o[f>>2]+48>>2]](f,e),A=o[A+4>>2],o[r+8>>2]=0,o[r+4>>2]=A,8941}function oe(A){switch(o[A+4>>2]){case 8:return m(w[A+36>>2]*w[A+20>>2]);case 0:case 1:case 4:case 5:case 10:case 11:case 13:return w[A+52>>2]}return m(Zn[o[o[A>>2]+48>>2]](A))}function ce(A){var r,f;return A=Qr(A),o[A+252>>2]=4,o[A>>2]=25228,o[A+336>>2]=0,a[A+340|0]=1,o[A+328>>2]=0,o[A+332>>2]=0,o[8488]=o[8488]+1,r=A,f=hf(0|Zn[o[8290]](72,16)),o[r+344>>2]=f,A}function be(A){3&v[A+204|0]||(w[A+472>>2]=m(w[A+424>>2]*w[A+408>>2])+w[A+472>>2],w[A+476>>2]=m(w[A+428>>2]*w[A+412>>2])+w[A+476>>2],w[A+480>>2]=m(w[A+432>>2]*w[A+416>>2])+w[A+480>>2])}function ue(A){var r;return o[(A|=0)>>2]=25184,!(r=o[A+336>>2])||!r|!v[A+340|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+336>>2]=0,a[A+340|0]=1,o[A+328>>2]=0,o[A+332>>2]=0,0|se(A)}function le(A,r){var f=0,e=0;A:if(!(!(f=v[0|A])|(0|f)!=(0|(e=v[0|r]))))for(;;){if(e=v[r+1|0],!(f=v[A+1|0]))break A;if(r=r+1|0,A=A+1|0,(0|f)!=(0|e))break}return f-e|0}function se(A){var r;return o[(A|=0)>>2]=13128,!(r=o[A+296>>2])||!r|!v[A+300|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+296>>2]=0,a[A+300|0]=1,o[A+288>>2]=0,o[A+292>>2]=0,0|A}function ke(A,r){var f=0;return r&&(!(r=qr(r,30308))|o[r+8>>2]&~o[A+8>>2]||Ue(o[A+12>>2],o[r+12>>2],0)&&(f=Ue(o[A+16>>2],o[r+16>>2],0))),f}function de(A){var r=m(0);return(r=af(m(w[A>>2]+w[A+4>>2])))m(3.1415927410125732)?m(r+m(-6.2831854820251465)):r}function ve(A){var r=m(0);return(r=af(m(w[A>>2]-w[A+4>>2])))m(3.1415927410125732)?m(r+m(-6.2831854820251465)):r}function he(A){var r;return o[(A|=0)>>2]=12960,!(r=o[A+20>>2])||!r|!v[A+24|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+20>>2]=0,a[A+24|0]=1,o[A+12>>2]=0,o[A+16>>2]=0,0|A}function Be(A){var r;return o[(A|=0)>>2]=22052,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,0|A}function we(A){var r,f;return(A=(r=o[8300])+(f=A+7&-8)|0)>>>0<=r>>>0&&f||A>>>0>Gn()<<16>>>0&&!(0|U(0|A))?(o[8983]=48,-1):(o[8300]=A,r)}function Ze(A,r){var f;o[r+40>>2]&&(Ze(A,o[r+36>>2]),Ze(A,o[r+40>>2])),o[A>>2]==(0|r)&&(o[A>>2]=0),(f=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+4>>2]=r}function Ge(A,r,f,e){var i,n;i=o[A+4>>2],n=o[A>>2],A=0,f&&(A=i>>8,1&i&&(A=o[A+o[f>>2]>>2])),Zn[o[o[n>>2]+28>>2]](n,r,A+f|0,2&i?e:2)}function me(A){var r=0;return o[(A|=0)>>2]=18648,v[A+69|0]&&(r=o[A+60>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+60>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),0|A}function Qe(A){var r,f;return m((f=(r=A*A)*A)*r*r*(2718311493989822e-21*r-.00019839334836096632)+(f*(.008333329385889463*r-.16666666641626524)+A))}function Ee(A){var r=0;return o[(A|=0)>>2]=15848,r=o[A+48>>2],Zn[o[o[r>>2]+20>>2]](r,o[A+64>>2]),r=o[A+48>>2],Zn[o[o[r>>2]+16>>2]](r,o[A+64>>2]),0|A}function We(A,r){A|=0,r|=0;var f=m(0),e=m(0),i=m(0);f=w[r>>2],e=w[r+4>>2],i=w[r+8>>2],o[A+32>>2]=0,w[A+28>>2]=Q(i),w[A+24>>2]=Q(e),w[A+20>>2]=Q(f)}function Ne(A){var r=0;return o[(A|=0)>>2]=20984,(r=o[A+60>>2])&&(Zn[o[o[r>>2]>>2]](r),(r=o[A+60>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),0|A}function pe(A){var r=0,f=0;return o[(A|=0)>>2]=16728,v[A+8|0]&&(r=o[A+12>>2])&&(f=o[A+4>>2],Zn[o[o[f>>2]+16>>2]](f,r)),0|A}function Fe(A){var r=0,f=0;return o[(A|=0)>>2]=16800,v[A+8|0]&&(r=o[A+12>>2])&&(f=o[A+4>>2],Zn[o[o[f>>2]+16>>2]](f,r)),0|A}function Re(A){var r=0,f=0;return o[(A|=0)>>2]=18036,v[A+8|0]&&(r=o[A+12>>2])&&(f=o[A+4>>2],Zn[o[o[f>>2]+16>>2]](f,r)),0|A}function Ye(A){var r=0,f=0;return o[(A|=0)>>2]=18112,v[A+8|0]&&(r=o[A+12>>2])&&(f=o[A+4>>2],Zn[o[o[f>>2]+16>>2]](f,r)),0|A}function Ve(A,r,f){return A=ae(A),w[A+52>>2]=r,o[A>>2]=19240,o[A+60>>2]=1,o[A+4>>2]=10,w[A+36>>2]=r,o[A+48>>2]=0,w[A+44>>2]=r,w[A+40>>2]=f*m(.5),A}function ge(A){var r=0,f=0;return r=0,(f=A>>>23&255)>>>0<127||(r=2,f>>>0>150||(r=0,(f=1<<150-f)-1&A||(r=A&f?1:2))),r}function Xe(A){var r;return m((A*=A)*(r=A*A)*(2439044879627741e-20*A-.001388676377460993)+.04166662332373906*r+-.499999997251031*A+1)}function De(A,r){var f,e=0;return f=AA(A),e=o[A+288>>2],o[r+8>>2]=o[A+284>>2],o[r+12>>2]=e,e=o[A+280>>2],o[r>>2]=o[A+276>>2],o[r+4>>2]=e,f}function Ce(A,r,f,e,i,n){var a,t=0;t=(a=o[A+4>>2])>>8,A=o[A>>2],1&a&&(t=o[o[e>>2]+t>>2]),Zn[o[o[A>>2]+20>>2]](A,r,f,e+t|0,2&a?i:2,n)}function Je(A,r,f,e,i){var n,a=0;a=(n=o[A+4>>2])>>8,A=o[A>>2],1&n&&(a=o[o[f>>2]+a>>2]),Zn[o[o[A>>2]+24>>2]](A,r,f+a|0,2&n?e:2,i)}function xe(A){var r=0;A=A>>>0<=1?1:A;A:{for(;;){if(r=iA(A))break A;if(!(r=o[9108]))break;Zn[0|r]()}J(),d()}return r}function ye(A,r){A|=0;var f=0;f=o[4+(r|=0)>>2],o[A+24>>2]=o[r>>2],o[A+28>>2]=f,f=o[r+12>>2],o[A+32>>2]=o[r+8>>2],o[A+36>>2]=f}function Me(A){var r;o[(A|=0)>>2]=25340,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),DA(A)}function He(A,r){var f;return A|=0,r|=0,S=f=S-16|0,o[f+12>>2]=r,A=0|Zn[0|A](f+12|0),V(o[f+12>>2]),S=f+16|0,0|A}function Ie(A,r){var f;Jr(A,r),(f=o[A+4>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+4>>2]=r,o[A+12>>2]=o[A+12>>2]-1}function Te(A,r){r|=0,o[(A|=0)>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,o[A+(o[r+60>>2]<<2)>>2]=1065353216}function Ue(A,r,f){return f?(0|A)==(0|r)?1:!le(o[A+4>>2],o[r+4>>2]):o[A+4>>2]==o[r+4>>2]}function je(A,r,f,e,i){A|=0,r=m(r),f=m(f),e=m(e),i=m(i),w[A+12>>2]=i,w[A+8>>2]=e,w[A+4>>2]=f,w[A>>2]=r}function ze(A,r){3&v[A+204|0]&&!r||(4!=(-2&o[A+220>>2])&&(o[A+220>>2]=1),o[A+224>>2]=0)}function Pe(A,r,f){o[(f|=0)>>2]=0,o[f+4>>2]=0,o[f+8>>2]=0,o[f+12>>2]=0}function Oe(A,r,f,e,i,n){r|=0,f|=0,e|=0,i|=0,n|=0,Zn[0|(A|=0)](r,f,e,i,n)}function Se(A,r){r|=0,A=o[4+(A|=0)>>2],Zn[o[o[A>>2]+8>>2]](A,o[r+36>>2])}function Le(A){var r;return(-1>>>(r=31&A)&-2)<>>A}function $e(A,r){return r|=0,A=o[24+(A|=0)>>2],0|Zn[o[o[A>>2]+8>>2]](A,r)}function Ke(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+80>>2]](A,r,f,e)}function qe(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+8>>2]](A,r,f,e)}function _e(A){o[(A|=0)>>2]=24e3,A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}function Ai(A,r,f,e,i){r|=0,f|=0,e|=0,i|=0,Zn[0|(A|=0)](r,f,e,i)}function ri(A){(A=Ne(A|=0))&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}function fi(A,r,f,e){return r|=0,f|=0,e|=0,0|Zn[0|(A|=0)](r,f,e)}function ei(){return m(m(1))}function ii(A){nf(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}function ni(A,r){return r|=0,o[o[236+(A|=0)>>2]+(r<<2)>>2]}function ai(A){(A|=0)&&(o[8489]=o[8489]+1,Zn[o[8291]](A))}function ti(A,r,f,e){r|=0,f|=0,e|=0,Zn[0|(A|=0)](r,f,e)}function oi(A){return A=ae(A),o[A+60>>2]=0,o[A>>2]=20984,A}function ci(A){return o[(A|=0)>>2]=15820,Ee(A+8|0),0|A}function bi(A,r){r|=0,Zn[o[o[(A|=0)>>2]+68>>2]](A,r)}function ui(A,r){r|=0,Zn[o[o[(A|=0)>>2]+64>>2]](A,r)}function li(A,r){r|=0,Zn[o[o[(A|=0)>>2]+8>>2]](A,r)}function si(A){return A?31-E(A-1^A)|0:32}function ki(A){(A|=0)&&Zn[o[o[A>>2]+12>>2]](A)}function di(A){(A|=0)&&Zn[o[o[A>>2]+4>>2]](A)}function vi(A,r,f){r|=0,f|=0,Zn[0|(A|=0)](r,f)}function hi(A,r,f){tr(A+4|0,A+372|0,A+388|0,r,f)}function Bi(A,r){return r|=0,0|Zn[0|(A|=0)](r)}function wi(A,r,f,e){T(0|A,0|r,8,0,0|f,-1,0|e)}function Zi(){return 0}function Gi(A){return A=mf(A),o[A>>2]=20608,A}function mi(){}function Qi(){}function Ei(A){return o[(A|=0)>>2]=24e3,0|A}function Wi(A){return o[o[(A|=0)>>2]-4>>2]}function Ni(A,r){r|=0,Zn[o[(A|=0)>>2]](r)}function pi(A,r){A|=0,r=m(r),w[A+52>>2]=r}function Fi(A,r){r|=0,o[16+(A|=0)>>2]=r}function Ri(A){return m(w[52+(A|=0)>>2])}function Yi(A){return m(w[4+(A|=0)>>2])}function Vi(A){return m(w[8+(A|=0)>>2])}function gi(A){return o[204+(A|=0)>>2]}function Xi(A){return o[96+(A|=0)>>2]}function Di(A){return o[56+(A|=0)>>2]}function Ci(A){return m(w[(A|=0)>>2])}function Ji(A){return o[60+(A|=0)>>2]}function xi(A){return o[72+(A|=0)>>2]}function yi(A){return o[16+(A|=0)>>2]}function Mi(A){return o[24+(A|=0)>>2]}function Hi(A){return o[84+(A|=0)>>2]}function Ii(){return 1}function Ti(){}function Ui(A){return o[4+(A|=0)>>2]}function ji(A){return o[8+(A|=0)>>2]}function zi(){}function Pi(A){return 0|iA(A|=0)}function Oi(A){return 132+(A|=0)|0}function Si(A){return 20+(A|=0)|0}function Li(A){return 24+(A|=0)|0}function $i(A){return 36+(A|=0)|0}function Ki(A){return 52+(A|=0)|0}function qi(A){return 68+(A|=0)|0}function _i(A){return 92+(A|=0)|0}function An(A){return 72+(A|=0)|0}function rn(A){return 48+(A|=0)|0}function fn(A){return 4+(A|=0)|0}function en(A){return 0|A}function nn(){return 84}function an(){return 60}function tn(){return 52}function on(){return 12}function cn(){return 0}function bn(){}function un(){return 2}function ln(){return 3}function sn(){return 1}function kn(){return 6}function dn(){}function vn(A){DA(A|=0)}function hn(){d()}function Bn(){}i(r=v,1024,"UXVhdF96AFZlYzNfegBFbXB0eQBSaWdpZEJvZHlfc2V0R3Jhdml0eQBEeW5hbWljc1dvcmxkX3NldEdyYXZpdHkAVHJhbnNmb3JtX3NldElkZW50aXR5AEdlbmVyaWM2RG9mU3ByaW5nMkNvbnN0cmFpbnRfc2V0VGFyZ2V0VmVsb2NpdHkASGluZ2VDb25zdHJhaW50X3NldE1vdG9yVmVsb2NpdHkAUmlnaWRCb2R5X3NldEFuZ3VsYXJWZWxvY2l0eQBSaWdpZEJvZHlfZ2V0QW5ndWxhclZlbG9jaXR5AFJpZ2lkQm9keV9zZXRMaW5lYXJWZWxvY2l0eQBSaWdpZEJvZHlfZ2V0TGluZWFyVmVsb2NpdHkAQ2hhcmFjdGVyQ29udHJvbGxlcl9zZXRPdmVybGFwUmVjb3ZlcnkASGluZ2VDb25zdHJhaW50X3NldEFuZ3VsYXJPbmx5AER5bmFtaWNzV29ybGRfcmVtb3ZlUmlnaWRCb2R5AER5bmFtaWNzV29ybGRfYWRkUmlnaWRCb2R5AFR5cGVkQ29uc3RyYWludF9nZXRGaXhlZEJvZHkAUXVhdF95AFZlYzNfeQBCb3gAU2ltcGxleFNoYXBlX2FkZFZlcnRleABDb2xsaXNpb25PYmplY3Rfc2V0VXNlckluZGV4AENvbGxpc2lvbk9iamVjdF9nZXRVc2VySW5kZXgAQ29uZVNoYXBlX3NldENvbmVVcEluZGV4AFF1YXRfeABWZWMzX3gAUmlnaWRCb2R5X25ldwBIaW5nZUNvbnN0cmFpbnRfbmV3AEZpeGVkQ29uc3RyYWludF9uZXcAUDJQQ29uc3RyYWludF9uZXcAR2VuZXJpYzZEb2ZTcHJpbmcyQ29uc3RyYWludF9uZXcAQ29sbGlzaW9uT2JqZWN0X25ldwBRdWF0X25ldwBTZXF1ZW50aWFsSW1wdWxzZUNvbnN0cmFpbnRTb2x2ZXJfbmV3AEJveENoYXJhY3RlckNvbnRyb2xsZXJfbmV3AENhcHN1bGVDaGFyYWN0ZXJDb250cm9sbGVyX25ldwBDb2xsaXNpb25EaXNwYXRjaGVyX25ldwBUcmFuc2Zvcm1fbmV3AGNjTWF0ZXJpYWxfbmV3AFRyaWFuZ2xlTWVzaF9uZXcARGJ2dEJyb2FkcGhhc2VfbmV3AEJveFNoYXBlX25ldwBTaW1wbGV4U2hhcGVfbmV3AEN5bGluZGVyU2hhcGVfbmV3AFRlcnJhaW5TaGFwZV9uZXcAQ29udmV4VHJpYW5nbGVNZXNoU2hhcGVfbmV3AFNjYWxlZEJ2aFRyaWFuZ2xlTWVzaFNoYXBlX25ldwBTcGhlcmVTaGFwZV9uZXcAQ29uZVNoYXBlX25ldwBTdGF0aWNQbGFuZVNoYXBlX25ldwBDYXBzdWxlU2hhcGVfbmV3AGNjQ29tcG91bmRTaGFwZV9uZXcAY2NEaXNjcmV0ZUR5bmFtaWNzV29ybGRfbmV3AEJveENoYXJhY3RlckNvbnRyb2xsZXJEZXNjX25ldwBDYXBzdWxlQ2hhcmFjdGVyQ29udHJvbGxlckRlc2NfbmV3AFZlYzNfbmV3AERlYnVnRHJhdwBRdWF0X3cAb25TaGFwZUhpdEV4dABDb2xsaXNpb25Xb3JsZF9yYXlUZXN0AENvbGxpc2lvbldvcmxkX2NvbnZleFN3ZWVwVGVzdABwcmVkaWN0aXZlIGNvbnZleFN3ZWVwVGVzdABDb250cm9sbGVySGl0UmVwb3J0AHVuc2lnbmVkIHNob3J0AGlzbGFuZFVuaW9uRmluZEFuZFF1aWNrU29ydABQZXJzaXN0ZW50TWFuaWZvbGRfZ2V0Q29udGFjdFBvaW50AEdlbmVyaWM2RG9mU3ByaW5nMkNvbnN0cmFpbnRfc2V0RXF1aWxpYnJpdW1Qb2ludABEeW5hbWljc1dvcmxkX3JlbW92ZUNvbnN0cmFpbnQARHluYW1pY3NXb3JsZF9hZGRDb25zdHJhaW50AHVuc2lnbmVkIGludABCb3hDaGFyYWN0ZXJDb250cm9sbGVyX3NldEhhbGZTaWRlRXh0ZW50AEJveENoYXJhY3RlckNvbnRyb2xsZXJfc2V0SGFsZkZvcndhcmRFeHRlbnQAaW1wbGVtZW50AFN0YXRpY1BsYW5lU2hhcGVfc2V0UGxhbmVDb25zdGFudABIaW5nZUNvbnN0cmFpbnRfc2V0TGltaXQAR2VuZXJpYzZEb2ZTcHJpbmcyQ29uc3RyYWludF9zZXRMaW1pdABDaGFyYWN0ZXJDb250cm9sbGVyX3NldFNsb3BlTGltaXQAUmF5Q2FsbGJhY2tfaGFzSGl0AENvbnZleENhbGxiYWNrX2hhc0hpdABDYXBzdWxlQ2hhcmFjdGVyQ29udHJvbGxlcl9zZXRIZWlnaHQAQ29uZVNoYXBlX3NldEhlaWdodABCb3hDaGFyYWN0ZXJDb250cm9sbGVyX3NldEhhbGZIZWlnaHQAQ2hhcmFjdGVyQ29udHJvbGxlcl9zZXRDb250YWN0T2Zmc2V0AENoYXJhY3RlckNvbnRyb2xsZXJfc2V0U3RlcE9mZnNldABjY0Nsb3Nlc3RSYXlDYWxsYmFja19yZXNldABjY0FsbFJheUNhbGxiYWNrX3Jlc2V0AGNjQ2xvc2VzdENvbnZleENhbGxiYWNrX3Jlc2V0AGNjQWxsQ29udmV4Q2FsbGJhY2tfcmVzZXQAUXVhdF9zZXQAY2NNYXRlcmlhbF9zZXQAVmVjM19zZXQASGluZ2VDb25zdHJhaW50X3NldE1vdG9yVGFyZ2V0AEdlbmVyaWM2RG9mU3ByaW5nMkNvbnN0cmFpbnRfc2V0U2Vydm9UYXJnZXQAX19kZXN0cnVjdABDaGFyYWN0ZXJDb250cm9sbGVyX2dldEdob3N0T2JqZWN0AENvbnRyb2xsZXJTaGFwZUhpdF9nZXRIaXRDb2xsaXNpb25PYmplY3QAQ29sbGlzaW9uV29ybGRfcmVtb3ZlQ29sbGlzaW9uT2JqZWN0AENvbGxpc2lvbldvcmxkX2FkZENvbGxpc2lvbk9iamVjdABDb2xsaXNpb25PYmplY3RfaXNTdGF0aWNPYmplY3QAQ29sbGlzaW9uT2JqZWN0X2lzS2luZW1hdGljT2JqZWN0AENvbGxpc2lvbk9iamVjdF9pc1N0YXRpY09yS2luZW1hdGljT2JqZWN0AGZsb2F0AGludF9hcnJheV9hdABWZWMzX2FycmF5X2F0AHVpbnQ2NF90AENhcHN1bGVDaGFyYWN0ZXJDb250cm9sbGVyX3NldFJhZGl1cwBDb25lU2hhcGVfc2V0UmFkaXVzAENvbGxpc2lvbk9iamVjdF9zZXRDY2RTd2VwdFNwaGVyZVJhZGl1cwBTcGhlcmVTaGFwZV9zZXRVbnNjYWxlZFJhZGl1cwBzb2x2ZUNvbnN0cmFpbnRzAEJveFNoYXBlX3NldFVuc2NhbGVkSGFsZkV4dGVudHMAUGVyc2lzdGVudE1hbmlmb2xkX2dldE51bUNvbnRhY3RzAGNyZWF0ZVByZWRpY3RpdmVDb250YWN0cwBHZW5lcmljNkRvZlNwcmluZzJDb25zdHJhaW50X3NldFN0aWZmbmVzcwBidENvbXBvdW5kQ29tcG91bmRMZWFmQ2FsbGJhY2s6OlByb2Nlc3MAUmlnaWRCb2R5X3NldE1hc3MAY2NBbGxSYXlDYWxsYmFja19nZXRDb2xsaXNpb25TaGFwZVB0cnMAY2NBbGxDb252ZXhDYWxsYmFja19nZXRDb2xsaXNpb25TaGFwZVB0cnMAZGlzcGF0Y2hBbGxDb2xsaXNpb25QYWlycwBidEhhc2hlZE92ZXJsYXBwaW5nUGFpckNhY2hlOjpwcm9jZXNzQWxsT3ZlcmxhcHBpbmdQYWlycwBjYWxjdWxhdGVPdmVybGFwcGluZ1BhaXJzAFJpZ2lkQm9keV9zZXRNYXNzUHJvcHMAQ29udHJvbGxlckhpdF9nZXRIaXRXb3JsZFBvcwB1cGRhdGVBY3Rpb25zAHNvbHZlR3JvdXBDYWNoZUZyaWVuZGx5SXRlcmF0aW9ucwBDb252ZXhJbnRlcm5hbFNoYXBlX2dldEltcGxpY2l0U2hhcGVEaW1lbnNpb25zAGludGVncmF0ZVRyYW5zZm9ybXMAUmlnaWRCb2R5X3NldEZsYWdzAGNjQ2xvc2VzdFJheUNhbGxiYWNrX3NldEZsYWdzAGNjQWxsUmF5Q2FsbGJhY2tfc2V0RmxhZ3MAUmlnaWRCb2R5X2dldEZsYWdzAENvbGxpc2lvbk9iamVjdF9zZXRDb2xsaXNpb25GbGFncwBDb2xsaXNpb25PYmplY3RfZ2V0Q29sbGlzaW9uRmxhZ3MAQ29tcG91bmRTaGFwZV9nZXROdW1DaGlsZFNoYXBlcwBjbGVhckxpbmVzAGZsdXNoTGluZXMASGluZ2VDb25zdHJhaW50X3NldEZyYW1lcwBGaXhlZENvbnN0cmFpbnRfc2V0RnJhbWVzAEdlbmVyaWM2RG9mU3ByaW5nMkNvbnN0cmFpbnRfc2V0RnJhbWVzAFJpZ2lkQm9keV9jbGVhckZvcmNlcwBwcm9jZXNzSXNsYW5kcwBjYWxjdWxhdGVTaW11bGF0aW9uSXNsYW5kcwBSaWdpZEJvZHlfc2V0U2xlZXBpbmdUaHJlc2hvbGRzAHJlbGVhc2UgcHJlZGljdGl2ZSBjb250YWN0IG1hbmlmb2xkcwBEaXNwYXRjaGVyX2dldE51bU1hbmlmb2xkcwBzeW5jUGh5c2ljc1RvR3JhcGhpY3MAdXBkYXRlQWFiYnMAY2NDbG9zZXN0UmF5Q2FsbGJhY2tfZ2V0Q29sbGlzaW9uU2hhcGVQdHIAY2NDbG9zZXN0Q29udmV4Q2FsbGJhY2tfZ2V0Q29sbGlzaW9uU2hhcGVQdHIASGluZ2VDb25zdHJhaW50X2VuYWJsZU1vdG9yAEdlbmVyaWM2RG9mU3ByaW5nMkNvbnN0cmFpbnRfZW5hYmxlTW90b3IAUmlnaWRCb2R5X3NldEFuZ3VsYXJGYWN0b3IAUmlnaWRCb2R5X3NldExpbmVhckZhY3RvcgBEZWJ1Z0RyYXdfc2V0Q29udGFjdFBvaW50Q29sb3IARGVidWdEcmF3X3NldENvbnN0cmFpbnRMaW1pdENvbG9yAERlYnVnRHJhd19zZXRXYW50c0RlYWN0aXZhdGlvbk9iamVjdENvbG9yAERlYnVnRHJhd19zZXREaXNhYmxlZERlYWN0aXZhdGlvbk9iamVjdENvbG9yAERlYnVnRHJhd19zZXREaXNhYmxlZFNpbXVsYXRpb25PYmplY3RDb2xvcgBEZWJ1Z0RyYXdfc2V0RGVhY3RpdmVPYmplY3RDb2xvcgBEZWJ1Z0RyYXdfc2V0QWN0aXZlT2JqZWN0Q29sb3IARGVidWdEcmF3X3NldEFBQkJDb2xvcgBDb250cm9sbGVySGl0X2dldEhpdE1vdGlvbkRpcgBDb2xsaXNpb25Xb3JsZF9zZXREZWJ1Z0RyYXdlcgBDb2xsaXNpb25TaGFwZV9zZXRVc2VyUG9pbnRlcgBEcmF3V3JhcHBlcgBDb250cm9sbGVySGl0UmVwb3J0V3JhcHBlcgBNb3Rpb25TdGF0ZVdyYXBwZXIAdW5zaWduZWQgY2hhcgBjY01vdGlvblN0YXRlX3NldHVwAHNvbHZlR3JvdXBDYWNoZUZyaWVuZGx5U2V0dXAAc29sdmVHcm91cABDeWxpbmRlclNoYXBlX3VwZGF0ZVByb3AAQ2Fwc3VsZVNoYXBlX3VwZGF0ZVByb3AAY2NEaXNjcmV0ZUR5bmFtaWNzV29ybGRfc2V0QWxsb3dTbGVlcABHZW5lcmljNkRvZlNwcmluZzJDb25zdHJhaW50X3NldFNlcnZvAGFwcGx5IHNwZWN1bGF0aXZlIGNvbnRhY3QgcmVzdGl0dXRpb24AcHJlZGljdFVuY29uc3RyYWludE1vdGlvbgBDaGFyYWN0ZXJDb250cm9sbGVyX2dldFBvc2l0aW9uAG5vdGlmeU9uRGVzdHJ1Y3Rpb24AcGVyZm9ybURpc2NyZXRlQ29sbGlzaW9uRGV0ZWN0aW9uAGNjQWxsUmF5Q2FsbGJhY2tfZ2V0Q2xvc2VzdEhpdEZyYWN0aW9uAGNjQ2xvc2VzdENvbnZleENhbGxiYWNrX2dldENsb3Nlc3RIaXRGcmFjdGlvbgBjY0FsbENvbnZleENhbGxiYWNrX2dldENsb3Nlc3RIaXRGcmFjdGlvbgBEeW5hbWljc1dvcmxkX3JlbW92ZUFjdGlvbgBEeW5hbWljc1dvcmxkX2FkZEFjdGlvbgBUcmFuc2Zvcm1fc2V0Um90YXRpb24AVHJhbnNmb3JtX2dldFJvdGF0aW9uAE92ZXJmbG93IGluIEFBQkIsIG9iamVjdCByZW1vdmVkIGZyb20gc2ltdWxhdGlvbgBEeW5hbWljc1dvcmxkX3N0ZXBTaW11bGF0aW9uAGludGVybmFsU2luZ2xlU3RlcFNpbXVsYXRpb24AQ2hhcmFjdGVyQ29udHJvbGxlcl9zZXRDb2xsaXNpb24AYnRDb252ZXhDb25jYXZlQ29sbGlzaW9uQWxnb3JpdGhtOjpwcm9jZXNzQ29sbGlzaW9uAENvbGxpc2lvblNoYXBlX3NldE1hcmdpbgBUcmFuc2Zvcm1fZ2V0T3JpZ2luAFRyYW5zZm9ybV9nZXRSb3RhdGlvbkFuZE9yaWdpbgBNb3Rpb25TdGF0ZV9zZXRXb3JsZFRyYW5zZm9ybQBSaWdpZEJvZHlfZ2V0V29ybGRUcmFuc2Zvcm0AQ29sbGlzaW9uT2JqZWN0X2dldFdvcmxkVHJhbnNmb3JtAE1vdGlvblN0YXRlX2dldFdvcmxkVHJhbnNmb3JtAENvbXBvdW5kU2hhcGVfdXBkYXRlQ2hpbGRUcmFuc2Zvcm0AYm9vbABlbXNjcmlwdGVuOjp2YWwARGlzcGF0Y2hlcl9nZXRNYW5pZm9sZEJ5SW5kZXhJbnRlcm5hbABTdGF0aWNQbGFuZVNoYXBlX2dldFBsYW5lTm9ybWFsAENvbnRyb2xsZXJIaXRfZ2V0SGl0V29ybGROb3JtYWwAQ29sbGlzaW9uT2JqZWN0X3NldE1hdGVyaWFsAENvbGxpc2lvblNoYXBlX3NldE1hdGVyaWFsAENvbGxpc2lvbk9iamVjdF9zZXRJZ25vcmVDb2xsaXNpb25DaGVjawBCdmhUcmlhbmdsZU1lc2hTaGFwZV9zZXRPcHRpbWl6ZWRCdmgAQnZoVHJpYW5nbGVNZXNoU2hhcGVfZ2V0T3B0aW1pemVkQnZoAENvbnRyb2xsZXJIaXRfZ2V0SGl0TW90aW9uTGVuZ3RoAENvbnZleFRyaW1lc2gAdW5zaWduZWQgbG9uZwBzdGQ6OndzdHJpbmcAc3RkOjpzdHJpbmcAc3RkOjp1MTZzdHJpbmcAc3RkOjp1MzJzdHJpbmcAR2VuZXJpYzZEb2ZTcHJpbmcyQ29uc3RyYWludF9lbmFibGVTcHJpbmcAQ0NEIG1vdGlvbiBjbGFtcGluZwBSaWdpZEJvZHlfc2V0RGFtcGluZwBHZW5lcmljNkRvZlNwcmluZzJDb25zdHJhaW50X3NldERhbXBpbmcAUmlnaWRCb2R5X3dhbnRzU2xlZXBpbmcAQ29sbGlzaW9uT2JqZWN0X2lzU2xlZXBpbmcAQ29sbGlzaW9uU2hhcGVfc2V0TG9jYWxTY2FsaW5nAGludF9hcnJheV9zaXplAFR5cGVkQ29uc3RyYWludF9zZXREYmdEcmF3U2l6ZQBUeXBlZENvbnN0cmFpbnRfZ2V0RGJnRHJhd1NpemUAQ2hhcmFjdGVyQ29udHJvbGxlcl9tb3ZlAENvbGxpc2lvbk9iamVjdF9pc0FjdGl2ZQBSaWdpZEJvZHlfYXBwbHlUb3JxdWUAX3NhZmVfZGVsZXRlAENvbGxpc2lvbk9iamVjdF9hY3RpdmF0ZQBSaWdpZEJvZHlfY2xlYXJTdGF0ZQBSaWdpZEJvZHlfZ2V0TW90aW9uU3RhdGUAQ29sbGlzaW9uT2JqZWN0X2dldEFjdGl2YXRpb25TdGF0ZQB1cGRhdGVBY3RpdmF0aW9uU3RhdGUAQ29sbGlzaW9uT2JqZWN0X2ZvcmNlQWN0aXZhdGlvblN0YXRlAFJpZ2lkQm9keV9hcHBseUltcHVsc2UASGluZ2VDb25zdHJhaW50X3NldE1heE1vdG9ySW1wdWxzZQBDb250cm9sbGVyU2hhcGVIaXRfZ2V0SGl0U2hhcGUAQ29sbGlzaW9uT2JqZWN0X3NldENvbGxpc2lvblNoYXBlAENvbGxpc2lvbk9iamVjdF9nZXRDb2xsaXNpb25TaGFwZQBDaGFyYWN0ZXJDb250cm9sbGVyX2dldENvbGxpc2lvblNoYXBlAENhcHN1bGVTaGFwZQBDb21wb3VuZFNoYXBlX2dldENoaWxkU2hhcGUAQ29tcG91bmRTaGFwZV9yZW1vdmVDaGlsZFNoYXBlAENvbXBvdW5kU2hhcGVfYWRkQ2hpbGRTaGFwZQBDb25lAG9uRGVidWdEcmF3TGluZQBidENvbnZleFRyaWFuZ2xlQ2FsbGJhY2s6OnByb2Nlc3NUcmlhbmdsZQBUcmlhbmdsZU1lc2hfYWRkVHJpYW5nbGUAZG91YmxlAF9mcmVlAERlYnVnRHJhd19zZXREZWJ1Z01vZGUARGVidWdEcmF3X2dldERlYnVnTW9kZQBSaWdpZEJvZHlfYXBwbHlGb3JjZQBHZW5lcmljNkRvZlNwcmluZzJDb25zdHJhaW50X3NldE1heE1vdG9yRm9yY2UAR2VuZXJpYzZEb2ZTcHJpbmcyQ29uc3RyYWludF9zZXRCb3VuY2UAQ29sbGlzaW9uU2hhcGVfaXNDb21wb3VuZABjb252ZXhTd2VlcENvbXBvdW5kAGV4dGVuZABDb2xsaXNpb25Xb3JsZF9kZWJ1Z0RyYXdXb3JsZABjY0Nsb3Nlc3RSYXlDYWxsYmFja19nZXRIaXRQb2ludFdvcmxkAGNjQWxsUmF5Q2FsbGJhY2tfZ2V0SGl0UG9pbnRXb3JsZABjY0Nsb3Nlc3RDb252ZXhDYWxsYmFja19nZXRIaXRQb2ludFdvcmxkAGNjQWxsQ29udmV4Q2FsbGJhY2tfZ2V0SGl0UG9pbnRXb3JsZABjY0Nsb3Nlc3RSYXlDYWxsYmFja19nZXRIaXROb3JtYWxXb3JsZABjY0FsbFJheUNhbGxiYWNrX2dldEhpdE5vcm1hbFdvcmxkAGNjQ2xvc2VzdENvbnZleENhbGxiYWNrX2dldEhpdE5vcm1hbFdvcmxkAGNjQWxsQ29udmV4Q2FsbGJhY2tfZ2V0SGl0Tm9ybWFsV29ybGQAQ29sbGlzaW9uT2JqZWN0X3NldENjZE1vdGlvblRocmVzaG9sZABDb2xsaXNpb25PYmplY3Rfc2V0Q29udGFjdFByb2Nlc3NpbmdUaHJlc2hvbGQAUmlnaWRCb2R5X2dldExpbmVhclNsZWVwaW5nVGhyZXNob2xkAFR5cGVkQ29uc3RyYWludF9zZXRNYXhJbXB1bHNlVGhyZXNob2xkAHZvaWQAX21hbGxvYwBEZWZhdWx0Q29sbGlzaW9uQ29uZmlndXJhdGlvbl9zdGF0aWMAY2NDbG9zZXN0UmF5Q2FsbGJhY2tfc3RhdGljAGNjQWxsUmF5Q2FsbGJhY2tfc3RhdGljAGNjQ2xvc2VzdENvbnZleENhbGxiYWNrX3N0YXRpYwBjY0FsbENvbnZleENhbGxiYWNrX3N0YXRpYwBFbXB0eVNoYXBlX3N0YXRpYwBDb2xsaXNpb25TaGFwZV9nZXRBYWJiAGJ0SW50SW5kZXhEYXRhAGJ0TWVzaFBhcnREYXRhAGJ0R2VuZXJpYzZEb2ZTcHJpbmcyQ29uc3RyYWludERhdGEAYnRTaG9ydEludEluZGV4VHJpcGxldERhdGEAYnRDaGFySW5kZXhUcmlwbGV0RGF0YQBidFJpZ2lkQm9keUZsb2F0RGF0YQBidFBvaW50MlBvaW50Q29uc3RyYWludEZsb2F0RGF0YQBidEhpbmdlQ29uc3RyYWludEZsb2F0RGF0YQBidFR5cGVkQ29uc3RyYWludEZsb2F0RGF0YQBidENvbGxpc2lvbk9iamVjdEZsb2F0RGF0YQBidFF1YW50aXplZEJ2aEZsb2F0RGF0YQBidER5bmFtaWNzV29ybGRGbG9hdERhdGEAYnRWZWN0b3IzRmxvYXREYXRhAGJ0QnZoU3VidHJlZUluZm9EYXRhAGJ0Q3lsaW5kZXJTaGFwZURhdGEAYnRDb2xsaXNpb25TaGFwZURhdGEAYnRDb252ZXhJbnRlcm5hbFNoYXBlRGF0YQBidFRyaWFuZ2xlTWVzaFNoYXBlRGF0YQBidFNjYWxlZFRyaWFuZ2xlTWVzaFNoYXBlRGF0YQBidENvbmVTaGFwZURhdGEAYnRTdGF0aWNQbGFuZVNoYXBlRGF0YQBidENhcHN1bGVTaGFwZURhdGEAYnRDb21wb3VuZFNoYXBlRGF0YQBidFZlY3RvcjNEb3VibGVEYXRhAGJ0UXVhbnRpemVkQnZoTm9kZURhdGEAYnRPcHRpbWl6ZWRCdmhOb2RlRGF0YQBidFN0cmlkaW5nTWVzaEludGVyZmFjZURhdGEAYnRDb21wb3VuZFNoYXBlQ2hpbGREYXRhAENvbGxpc2lvblNoYXBlX2NhbGN1bGF0ZUxvY2FsSW5lcnRpYQBDeWxpbmRlclkAU0VOU09SAFNDQUxFREJWSFRSSUFOR0xFTUVTSABTUEhFUkUAU1RBVElDUExBTkUASEVJR0hURklFTEQAUDJQQ29uc3RyYWludF9zZXRQaXZvdEIATWFuaWZvbGRQb2ludF9nZXRfbV9sb2NhbFBvaW50QgBNYW5pZm9sZFBvaW50X2dldF9tX3Bvc2l0aW9uV29ybGRPbkIATWFuaWZvbGRQb2ludF9nZXRfbV9ub3JtYWxXb3JsZE9uQgBQMlBDb25zdHJhaW50X3NldFBpdm90QQBNYW5pZm9sZFBvaW50X2dldF9tX2xvY2FsUG9pbnRBAE1hbmlmb2xkUG9pbnRfZ2V0X21fcG9zaXRpb25Xb3JsZE9uQQBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxzaG9ydD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgc2hvcnQ+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGludD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgaW50PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxmbG9hdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dWludDhfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50OF90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50MTZfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50MTZfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dWludDY0X3Q+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGludDY0X3Q+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVpbnQzMl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQzMl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxjaGFyPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBjaGFyPgBzdGQ6OmJhc2ljX3N0cmluZzx1bnNpZ25lZCBjaGFyPgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxzaWduZWQgY2hhcj4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8bG9uZz4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgbG9uZz4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8ZG91YmxlPgBidEJVX1NpbXBsZXgxdG80AF93cml0ZV9mMzIAX3JlYWRfZjMyAFBlcnNpc3RlbnRNYW5pZm9sZF9nZXRCb2R5MQBNYW5pZm9sZFBvaW50X2dldF9tX2luZGV4MQBNYW5pZm9sZFBvaW50X2dldFNoYXBlMQBQZXJzaXN0ZW50TWFuaWZvbGRfZ2V0Qm9keTAATWFuaWZvbGRQb2ludF9nZXRfbV9pbmRleDAATWFuaWZvbGRQb2ludF9nZXRTaGFwZTAAUHVyZSB2aXJ0dWFsIGZ1bmN0aW9uIGNhbGxlZCEASWYgeW91IGNhbiByZXByb2R1Y2UgdGhpcywgcGxlYXNlIGVtYWlsIGJ1Z3NAY29udGludW91c3BoeXNpY3MuY29tCgBUaGFua3MuCgBQbGVhc2UgaW5jbHVkZSBhYm92ZSBpbmZvcm1hdGlvbiwgeW91ciBQbGF0Zm9ybSwgdmVyc2lvbiBvZiBPUy4KAE4yY2MyNmNjQ2xvc2VzdFJheVJlc3VsdENhbGxiYWNrRQBOMTZidENvbGxpc2lvbldvcmxkMjRDbG9zZXN0UmF5UmVzdWx0Q2FsbGJhY2tFAE4xNmJ0Q29sbGlzaW9uV29ybGQxN1JheVJlc3VsdENhbGxiYWNrRQBOMmNjMjZjY0FsbEhpdHNSYXlSZXN1bHRDYWxsYmFja0UATjE2YnRDb2xsaXNpb25Xb3JsZDI0QWxsSGl0c1JheVJlc3VsdENhbGxiYWNrRQBOMmNjMjljY0Nsb3Nlc3RDb252ZXhSZXN1bHRDYWxsYmFja0UATjE2YnRDb2xsaXNpb25Xb3JsZDI3Q2xvc2VzdENvbnZleFJlc3VsdENhbGxiYWNrRQBOMTZidENvbGxpc2lvbldvcmxkMjBDb252ZXhSZXN1bHRDYWxsYmFja0UATjJjYzI5Y2NBbGxIaXRzQ29udmV4UmVzdWx0Q2FsbGJhY2tFAE4xNmJ0Q29sbGlzaW9uV29ybGQyN0FsbEhpdHNDb252ZXhSZXN1bHRDYWxsYmFja0UATjJjYzE1Y2NDb21wb3VuZFNoYXBlRQAxM2J0TW90aW9uU3RhdGUAMTFidERlYnVnRHJhdwAxMmJ0SURlYnVnRHJhdwBQMTFidERlYnVnRHJhdwBQSzExYnREZWJ1Z0RyYXcAaWkAdgB2aQBQMTJidElEZWJ1Z0RyYXcAdmlpAHZpaWlpaQAxOGJ0RGVidWdEcmF3V3JhcHBlcgBOMTBlbXNjcmlwdGVuN3dyYXBwZXJJMTFidERlYnVnRHJhd0VFAE4xMGVtc2NyaXB0ZW44aW50ZXJuYWwxMVdyYXBwZXJCYXNlRQBQMThidERlYnVnRHJhd1dyYXBwZXIAUEsxOGJ0RGVidWdEcmF3V3JhcHBlcgBOMTBlbXNjcmlwdGVuM3ZhbEUAaWlpAE5TdDNfXzIxMmJhc2ljX3N0cmluZ0ljTlNfMTFjaGFyX3RyYWl0c0ljRUVOU185YWxsb2NhdG9ySWNFRUVFAGlpaWkAMjFidENvbnRyb2xsZXJIaXRSZXBvcnQAMjVidFVzZXJDb250cm9sbGVySGl0UmVwb3J0AFAyMWJ0Q29udHJvbGxlckhpdFJlcG9ydABQSzIxYnRDb250cm9sbGVySGl0UmVwb3J0AHZpaWlpADI4YnRDb250cm9sbGVySGl0UmVwb3J0V3JhcHBlcgBOMTBlbXNjcmlwdGVuN3dyYXBwZXJJMjFidENvbnRyb2xsZXJIaXRSZXBvcnRFRQBQMjhidENvbnRyb2xsZXJIaXRSZXBvcnRXcmFwcGVyAFBLMjhidENvbnRyb2xsZXJIaXRSZXBvcnRXcmFwcGVyAE4yY2MxM2NjTW90aW9uU3RhdGVFAFBOMmNjMTNjY01vdGlvblN0YXRlRQBQS04yY2MxM2NjTW90aW9uU3RhdGVFAHZpaWkAMjBjY01vdGlvblN0YXRlV3JhcHBlcgBOMTBlbXNjcmlwdGVuN3dyYXBwZXJJTjJjYzEzY2NNb3Rpb25TdGF0ZUVFRQBQMjBjY01vdGlvblN0YXRlV3JhcHBlcgBQSzIwY2NNb3Rpb25TdGF0ZVdyYXBwZXIAZmlpAHZpaWYAaWlmZmYAdmlpZmZmAGlpZmZmZgB2aWlmZmZmAGlpaWlpaQB2aWlmZmZmZgB2aWlmZgBpaWlpaWlpAHZpaWlmZgB2aWlpZgB2aWlmaQBpaWYAdmlpZmZpAGlpZmYAaWlpZgBpaWlpaWZmZgB2aWlpaWlpAGlpaWlpAHZpaWlmZmYAaWlpZmZmAGlpZmkAdmlpaWlpaWYAdmlpZmlmAGlpaWlmZgBpaWZmZmlpaWZmAGlpZmZmaWlpZmZmAAAAAAB0LwAAowEAAKQBAAClAQAApgEAAKcBAACoAQAAqQEAAKoBAACrAQAArAEAAK0BAACuAQAArwEAALABAAAxNmJ0RGJ2dEJyb2FkcGhhc2UAMjFidEJyb2FkcGhhc2VJbnRlcmZhY2UAAIh3AABTLwAAsHcAAEAvAABsLwAAAAAAANQvAACxAQAAsgEAALMBAAC0AQAAtQEAALYBAAC3AQAAMThidERidnRUcmVlQ29sbGlkZXIATjZidERidnQ4SUNvbGxpZGVFAIh3AAC5LwAAsHcAAKQvAADMLwAAAAAAABwwAACxAQAAuAEAALkBAAC6AQAAtQEAALYBAAC3AQAAMTlCcm9hZHBoYXNlUmF5VGVzdGVyAAAAsHcAAAQwAADMLwAAAAAAAGQwAACxAQAAuwEAALkBAAC8AQAAtQEAALYBAAC3AQAAMjBCcm9hZHBoYXNlQWFiYlRlc3RlcgAAsHcAAEwwAADMLwAAAAAAACQxAAC/AQAAwAEAAMEBAADCAQAAwwEAAMQBAADFAQAAxgEAAMcBAADIAQAAyQEAAMoBAADLAQAAzAEAAM0BAADOAQAAzwEAADI4YnRIYXNoZWRPdmVybGFwcGluZ1BhaXJDYWNoZQAyMmJ0T3ZlcmxhcHBpbmdQYWlyQ2FjaGUAMjVidE92ZXJsYXBwaW5nUGFpckNhbGxiYWNrAIh3AAD0MAAAsHcAANswAAAQMQAAsHcAALwwAAAYMQAAAAAAANAxAADQAQAA0QEAANIBAABaTjI4YnRIYXNoZWRPdmVybGFwcGluZ1BhaXJDYWNoZTE5Y2xlYW5Qcm94eUZyb21QYWlyc0VQMTdidEJyb2FkcGhhc2VQcm94eVAxMmJ0RGlzcGF0Y2hlckUxN0NsZWFuUGFpckNhbGxiYWNrADE3YnRPdmVybGFwQ2FsbGJhY2sAAACIdwAAsjEAALB3AABEMQAAyDEAAAAAAAB0MgAA0AEAANMBAADUAQAAWk4yOGJ0SGFzaGVkT3ZlcmxhcHBpbmdQYWlyQ2FjaGUzN3JlbW92ZU92ZXJsYXBwaW5nUGFpcnNDb250YWluaW5nUHJveHlFUDE3YnRCcm9hZHBoYXNlUHJveHlQMTJidERpc3BhdGNoZXJFMThSZW1vdmVQYWlyQ2FsbGJhY2sAAAAAsHcAAPAxAADIMQAAMTJidERpc3BhdGNoZXIAAIh3AACAMgAAAAAAAPgyAADWAQAA1wEAANgBAADZAQAA2gEAANsBAADcAQAA3QEAAN4BAADfAQAA4AEAAOEBAADiAQAA4wEAAOQBAADlAQAAMjFidENvbGxpc2lvbkRpc3BhdGNoZXIAsHcAAOAyAACQMgAAAAAAADQzAADQAQAA5gEAAOcBAAAyM2J0Q29sbGlzaW9uUGFpckNhbGxiYWNrAAAAsHcAABgzAADIMQAAAAAAAHgzAADoAQAA6QEAAOoBAADrAQAA7AEAAO0BAADuAQAAMTdidENvbGxpc2lvbk9iamVjdACIdwAAZDMAAAAAAADQMwAA7wEAAPABAADxAQAA8gEAAPMBAAD0AQAA9QEAAPYBAAD3AQAA+AEAAPkBAAD6AQAA+wEAADE2YnRDb2xsaXNpb25Xb3JsZAAAiHcAALwzAAAAAAAAFDQAAPwBAAD9AQAA/gEAAP8BAAAAAgAATjEyYnRDb252ZXhDYXN0MTBDYXN0UmVzdWx0RQAAAACIdwAA9DMAAAAAAADINAAAAQIAAAICAAADAgAABAIAAFpOMTZidENvbGxpc2lvbldvcmxkMjFyYXlUZXN0U2luZ2xlSW50ZXJuYWxFUksxMWJ0VHJhbnNmb3JtUzJfUEsyNGJ0Q29sbGlzaW9uT2JqZWN0V3JhcHBlclJOU18xN1JheVJlc3VsdENhbGxiYWNrRUUyOUJyaWRnZVRyaWFuZ2xlUmF5Y2FzdENhbGxiYWNrAACwdwAANDQAAAxbAAAAAAAAeDUAALEBAAAFAgAAuQEAAAYCAAC1AQAAtgEAALcBAABaTjE2YnRDb2xsaXNpb25Xb3JsZDIxcmF5VGVzdFNpbmdsZUludGVybmFsRVJLMTFidFRyYW5zZm9ybVMyX1BLMjRidENvbGxpc2lvbk9iamVjdFdyYXBwZXJSTlNfMTdSYXlSZXN1bHRDYWxsYmFja0VFOVJheVRlc3RlcgAAALB3AAD4NAAAzC8AAAAAAAAkNgAASAEAAAcCAAAIAgAACQIAAFpOMTZidENvbGxpc2lvbldvcmxkMjFyYXlUZXN0U2luZ2xlSW50ZXJuYWxFUksxMWJ0VHJhbnNmb3JtUzJfUEsyNGJ0Q29sbGlzaW9uT2JqZWN0V3JhcHBlclJOU18xN1JheVJlc3VsdENhbGxiYWNrRUUxNUxvY2FsSW5mb0FkZGVyMgAAAACwdwAAnDUAALh4AAAAAAAA+DYAAAECAAAKAgAACwIAAAwCAABaTjE2YnRDb2xsaXNpb25Xb3JsZDI1b2JqZWN0UXVlcnlTaW5nbGVJbnRlcm5hbEVQSzEzYnRDb252ZXhTaGFwZVJLMTFidFRyYW5zZm9ybVM1X1BLMjRidENvbGxpc2lvbk9iamVjdFdyYXBwZXJSTlNfMjBDb252ZXhSZXN1bHRDYWxsYmFja0VmRTMyQnJpZGdlVHJpYW5nbGVDb252ZXhjYXN0Q2FsbGJhY2sAALB3AABINgAAOFsAAAAAAADQNwAAAQIAAA0CAAALAgAADgIAAFpOMTZidENvbGxpc2lvbldvcmxkMjVvYmplY3RRdWVyeVNpbmdsZUludGVybmFsRVBLMTNidENvbnZleFNoYXBlUksxMWJ0VHJhbnNmb3JtUzVfUEsyNGJ0Q29sbGlzaW9uT2JqZWN0V3JhcHBlclJOU18yMENvbnZleFJlc3VsdENhbGxiYWNrRWZFMzJCcmlkZ2VUcmlhbmdsZUNvbnZleGNhc3RDYWxsYmFja18wAAAAALB3AAAcNwAAOFsAAAAAAACoOAAAsQEAAA8CAAC5AQAAEAIAALUBAAC2AQAAtwEAAFpOMTZidENvbGxpc2lvbldvcmxkMjVvYmplY3RRdWVyeVNpbmdsZUludGVybmFsRVBLMTNidENvbnZleFNoYXBlUksxMWJ0VHJhbnNmb3JtUzVfUEsyNGJ0Q29sbGlzaW9uT2JqZWN0V3JhcHBlclJOU18yMENvbnZleFJlc3VsdENhbGxiYWNrRWZFMjJidENvbXBvdW5kTGVhZkNhbGxiYWNrAAAAALB3AAAAOAAAzC8AAAAAAACsOQAAVgEAABECAAASAgAAEwIAAFpaTjE2YnRDb2xsaXNpb25Xb3JsZDI1b2JqZWN0UXVlcnlTaW5nbGVJbnRlcm5hbEVQSzEzYnRDb252ZXhTaGFwZVJLMTFidFRyYW5zZm9ybVM1X1BLMjRidENvbGxpc2lvbk9iamVjdFdyYXBwZXJSTlNfMjBDb252ZXhSZXN1bHRDYWxsYmFja0VmRU4yMmJ0Q29tcG91bmRMZWFmQ2FsbGJhY2sxMlByb2Nlc3NDaGlsZEVpUzVfUEsxNmJ0Q29sbGlzaW9uU2hhcGVFMTRMb2NhbEluZm9BZGRlcgAAsHcAAMw4AABQeQAAAAAAACw6AAAUAgAAFQIAABYCAAAxOWJ0U2luZ2xlUmF5Q2FsbGJhY2sAMjNidEJyb2FkcGhhc2VSYXlDYWxsYmFjawAyNGJ0QnJvYWRwaGFzZUFhYmJDYWxsYmFjawAAiHcAAPw5AACwdwAA4jkAABg6AACwdwAAzDkAACA6AAAAAAAAZDoAABQCAAAXAgAAGAIAADIxYnRTaW5nbGVTd2VlcENhbGxiYWNrALB3AABMOgAAIDoAAAAAAACwOgAAGQIAABoCAAAbAgAAHAIAAPz///+wOgAAHQIAAB4CAAAfAgAAMTdEZWJ1Z0RyYXdjYWxsYmFjawAMeAAAnDoAAAAAAAACAAAAxFUAAAIAAADwVQAAAgQAAAAAAABAOwAAIAIAACECAABOAQAATgEAAE4BAAAAAAAASDsAACICAAAjAgAATgEAAE4BAABOAQAAMzBidEFjdGl2YXRpbmdDb2xsaXNpb25BbGdvcml0aG0AMjBidENvbGxpc2lvbkFsZ29yaXRobQCIdwAAKTsAALB3AAAIOwAAQDsAAAAAAACsOwAAJAIAACUCAAAmAgAAAAAAANQ7AAAnAgAAKAIAACkCAAAqAgAAKwIAAE4yM2J0Q29udmV4Q29udmV4QWxnb3JpdGhtMTBDcmVhdGVGdW5jRQCwdwAAhDsAAMBCAAAyM2J0Q29udmV4Q29udmV4QWxnb3JpdGhtAAAAsHcAALg7AABIOwAAAAAAALw8AAAsAgAALQIAAC4CAAAvAgAAMAIAAFpOMjNidENvbnZleENvbnZleEFsZ29yaXRobTE2cHJvY2Vzc0NvbGxpc2lvbkVQSzI0YnRDb2xsaXNpb25PYmplY3RXcmFwcGVyUzJfUksxNmJ0RGlzcGF0Y2hlckluZm9QMTZidE1hbmlmb2xkUmVzdWx0RTEzYnREdW1teVJlc3VsdABOMzZidERpc2NyZXRlQ29sbGlzaW9uRGV0ZWN0b3JJbnRlcmZhY2U2UmVzdWx0RQAAAACIdwAAgTwAALB3AAD8OwAAtDwAAAAAAAB0PQAALAIAADECAAAyAgAAMwIAADQCAABaTjIzYnRDb252ZXhDb252ZXhBbGdvcml0aG0xNnByb2Nlc3NDb2xsaXNpb25FUEsyNGJ0Q29sbGlzaW9uT2JqZWN0V3JhcHBlclMyX1JLMTZidERpc3BhdGNoZXJJbmZvUDE2YnRNYW5pZm9sZFJlc3VsdEUyMWJ0V2l0aG91dE1hcmdpblJlc3VsdAAAAACwdwAA5DwAALQ8AAAAAAAAuD0AACwCAAA1AgAANgIAADcCAAA4AgAAMjRidFBlcnR1cmJlZENvbnRhY3RSZXN1bHQAALB3AACcPQAAYEYAAAAAAAAYPgAAOQIAADoCAAA7AgAAPAIAAD0CAAAAAAAAQD4AAD4CAAA/AgAAQAIAADMzYnRDb252ZXhDb25jYXZlQ29sbGlzaW9uQWxnb3JpdGhtALB3AAD0PQAASDsAADI0YnRDb252ZXhUcmlhbmdsZUNhbGxiYWNrAACwdwAAJD4AAMRVAAAAAAAA6D4AAEECAABCAgAAQwIAAGUBAABmAQAAZwEAAEQCAABFAgAARgIAAEcCAABsAQAASAIAAEkCAABKAgAASwIAAHEBAABMAgAATQIAAE4CAABPAgAAUAIAAFECAABSAgAAUwIAAFQCAABVAgAAVgIAAFcCAABYAgAAWQIAAFoCAABbAgAAMTVidFRyaWFuZ2xlU2hhcGUAAACwdwAA1D4AABRTAAAAAAAAqD8AAAECAABcAgAAXQIAAFpOMzNidENvbnZleENvbmNhdmVDb2xsaXNpb25BbGdvcml0aG0yMWNhbGN1bGF0ZVRpbWVPZkltcGFjdEVQMTdidENvbGxpc2lvbk9iamVjdFMxX1JLMTZidERpc3BhdGNoZXJJbmZvUDE2YnRNYW5pZm9sZFJlc3VsdEUzMUxvY2FsVHJpYW5nbGVTcGhlcmVDYXN0Q2FsbGJhY2sAAACwdwAACD8AAMRVAAAAAAAA8D8AAF4CAABfAgAAYAIAAGECAABiAgAAMjhidENvbXBvdW5kQ29sbGlzaW9uQWxnb3JpdGhtAACwdwAA0D8AAEg7AAAAAAAAPEAAALEBAABjAgAAuQEAAGQCAAC1AQAAtgEAALcBAAAyMmJ0Q29tcG91bmRMZWFmQ2FsbGJhY2sAAAAAsHcAACBAAADMLwAAAAAAAIxAAABlAgAAZgIAAGcCAABoAgAAaQIAADM2YnRDb21wb3VuZENvbXBvdW5kQ29sbGlzaW9uQWxnb3JpdGhtAACwdwAAZEAAAPA/AAAAAAAA4EAAALEBAABqAgAAawIAAGwCAAC1AQAAtgEAALcBAAAzMGJ0Q29tcG91bmRDb21wb3VuZExlYWZDYWxsYmFjawAAAACwdwAAvEAAAMwvAAAAAAAAREEAAG0CAABuAgAAbwIAADE2YnRCb3hCb3hEZXRlY3RvcgAzNmJ0RGlzY3JldGVDb2xsaXNpb25EZXRlY3RvckludGVyZmFjZQAAAIh3AAATQQAAsHcAAABBAAA8QQAAAAAAAIxBAABwAgAAcQIAAHICAABzAgAAdAIAADI2YnRCb3hCb3hDb2xsaXNpb25BbGdvcml0aG0AAAAAsHcAAGxBAABIOwAAAAAAANhBAAB1AgAAdgIAAHcCAAB4AgAAeQIAADMxYnRDb252ZXhQbGFuZUNvbGxpc2lvbkFsZ29yaXRobQAAALB3AAC0QQAAQDsAAAAAAABMQgAAegIAAHsCAAB8AgAAfQIAAH4CAAB/AgAAMzFidERlZmF1bHRDb2xsaXNpb25Db25maWd1cmF0aW9uADI0YnRDb2xsaXNpb25Db25maWd1cmF0aW9uAAAAAIh3AAAmQgAAsHcAAARCAABEQgAAAAAAAMhCAACAAgAAgQIAAIICAABOMzNidENvbnZleENvbmNhdmVDb2xsaXNpb25BbGdvcml0aG0xMENyZWF0ZUZ1bmNFADMwYnRDb2xsaXNpb25BbGdvcml0aG1DcmVhdGVGdW5jAACIdwAAnkIAALB3AABsQgAAwEIAAAAAAAAkQwAAgAIAAIMCAACEAgAATjMzYnRDb252ZXhDb25jYXZlQ29sbGlzaW9uQWxnb3JpdGhtMTdTd2FwcGVkQ3JlYXRlRnVuY0UAAAAAsHcAAOhCAADAQgAAAAAAAHRDAACAAgAAhQIAAIYCAABOMjhidENvbXBvdW5kQ29sbGlzaW9uQWxnb3JpdGhtMTBDcmVhdGVGdW5jRQAAAACwdwAAREMAAMBCAAAAAAAAzEMAAIACAACHAgAAiAIAAE4zNmJ0Q29tcG91bmRDb21wb3VuZENvbGxpc2lvbkFsZ29yaXRobTEwQ3JlYXRlRnVuY0UAAAAAsHcAAJRDAADAQgAAAAAAACBEAACAAgAAiQIAAIoCAABOMjhidENvbXBvdW5kQ29sbGlzaW9uQWxnb3JpdGhtMTdTd2FwcGVkQ3JlYXRlRnVuY0UAsHcAAOxDAADAQgAAAAAAAGREAACAAgAAiwIAAIwCAABOMTZidEVtcHR5QWxnb3JpdGhtMTBDcmVhdGVGdW5jRQAAAACwdwAAQEQAAMBCAAAAAAAAuEQAAIACAACNAgAAjgIAAE4zMmJ0U3BoZXJlU3BoZXJlQ29sbGlzaW9uQWxnb3JpdGhtMTBDcmVhdGVGdW5jRQAAAACwdwAAhEQAAMBCAAAAAAAADEUAAIACAACPAgAAkAIAAE4zNGJ0U3BoZXJlVHJpYW5nbGVDb2xsaXNpb25BbGdvcml0aG0xMENyZWF0ZUZ1bmNFAACwdwAA2EQAAMBCAAAAAAAAWEUAAIACAACRAgAAkgIAAE4yNmJ0Qm94Qm94Q29sbGlzaW9uQWxnb3JpdGhtMTBDcmVhdGVGdW5jRQAAsHcAACxFAADAQgAAAAAAAKhFAACAAgAAkwIAAJQCAABOMzFidENvbnZleFBsYW5lQ29sbGlzaW9uQWxnb3JpdGhtMTBDcmVhdGVGdW5jRQCwdwAAeEUAAMBCAAAAAAAA5EUAACACAACVAgAAlgIAAJcCAACYAgAAMTZidEVtcHR5QWxnb3JpdGhtAACwdwAA0EUAAEA7AAAAAAAAKEYAAJkCAACaAgAAmwIAAJwCAACdAgAAMjNidEhhc2hlZFNpbXBsZVBhaXJDYWNoZQAAAIh3AAAMRgAAAAAAAGBGAAAsAgAAngIAADYCAAA3AgAAnwIAADE2YnRNYW5pZm9sZFJlc3VsdAAAsHcAAExGAAC0PAAAAAAAAKxGAACgAgAAoQIAAKICAACjAgAApAIAADMyYnRTcGhlcmVTcGhlcmVDb2xsaXNpb25BbGdvcml0aG0AALB3AACIRgAASDsAAAAAAAD8RgAApQIAAKYCAACnAgAAqAIAAKkCAAAzNGJ0U3BoZXJlVHJpYW5nbGVDb2xsaXNpb25BbGdvcml0aG0AAAAAsHcAANRGAABIOwAAAAAAADhHAABtAgAAqgIAAKsCAAAyMlNwaGVyZVRyaWFuZ2xlRGV0ZWN0b3IAAAAAsHcAABxHAAA8QQAAAAAAANxHAABBAgAArAIAAK0CAABlAQAAZgEAAGcBAACuAgAARQIAAK8CAACwAgAAbAEAALECAABJAgAASgIAAEsCAABxAQAAsgIAALMCAABOAgAAtAIAAFACAAC1AgAAtgIAAFMCAAC3AgAAuAIAALkCAAC6AgAAuwIAALwCAAC9AgAAvgIAADEwYnRCb3hTaGFwZQAAAACwdwAAzEcAABRTAAAAAIA/AACAvw=="),i(r,18442,"gD8AAIC/"),i(r,18474,"gD8AAIC/AAAAAAAAAAABAAAAAgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABAAAAAUAAAAGAAAAAQAAAAIAAAADAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAFAAAABgAAAAcAAAAHAAAAAAAAAMhIAAC/AgAAwAIAAMECAADCAgAAwwIAAMQCAADFAgAAMTRidFF1YW50aXplZEJ2aAAAAACIdwAAtEgAAAAAAABISQAAxgIAAMcCAADIAgAAZQEAAGYBAABnAQAAyQIAAMoCAADLAgAAzAIAAGwBAADNAgAAzgIAAM8CAADQAgAAcQEAANECAADSAgAA0wIAANQCAADVAgAAMjJidEJ2aFRyaWFuZ2xlTWVzaFNoYXBlAAAAALB3AAAsSQAAXFcAAAAAAADwSQAA1gIAANcCAADYAgAAWk4yMmJ0QnZoVHJpYW5nbGVNZXNoU2hhcGUxNHBlcmZvcm1SYXljYXN0RVAxOGJ0VHJpYW5nbGVDYWxsYmFja1JLOWJ0VmVjdG9yM1M0X0UyMU15Tm9kZU92ZXJsYXBDYWxsYmFjawAyMWJ0Tm9kZU92ZXJsYXBDYWxsYmFjawCIdwAA0EkAALB3AABoSQAA6EkAAAAAAACESgAA1gIAANkCAADaAgAAWk4yMmJ0QnZoVHJpYW5nbGVNZXNoU2hhcGUxN3BlcmZvcm1Db252ZXhjYXN0RVAxOGJ0VHJpYW5nbGVDYWxsYmFja1JLOWJ0VmVjdG9yM1M0X1M0X1M0X0UyMU15Tm9kZU92ZXJsYXBDYWxsYmFjawAAAACwdwAAEEoAAOhJAAAAAAAAFEsAANYCAADbAgAA3AIAAFpOSzIyYnRCdmhUcmlhbmdsZU1lc2hTaGFwZTE5cHJvY2Vzc0FsbFRyaWFuZ2xlc0VQMThidFRyaWFuZ2xlQ2FsbGJhY2tSSzlidFZlY3RvcjNTNF9FMjFNeU5vZGVPdmVybGFwQ2FsbGJhY2sAAACwdwAApEoAAOhJAAAAAAAAmEsAAN0CAADeAgAA3wIAAGUBAABmAQAAZwEAAOACAABFAgAA4QIAAOICAADjAgAA5AIAAEkCAADlAgAA5gIAAHEBAABMAgAA5wIAAE4CAADoAgAAUAIAAOkCAADqAgAAMTRidENhcHN1bGVTaGFwZQAAAACwdwAAhEsAACxNAAAxNmJ0Q29sbGlzaW9uU2hhcGUAAIh3AACkSwAAAAAAACRMAABiAQAA6wIAAGQBAABlAQAAZgEAAGcBAABoAQAAaQEAAGoBAABrAQAAbAEAAG0BAABuAQAAbwEAAHABAABxAQAAcgEAAHMBAAAxNWJ0Q29tcG91bmRTaGFwZQAAALB3AAAQTAAAuEsAAAAAAACkTAAA3QIAAOwCAADtAgAAZQEAAGYBAABnAQAA7gIAAEUCAADvAgAA8AIAAPECAABIAgAASQIAAPICAADzAgAAcQEAAPQCAAD1AgAATgIAAPYCAABQAgAA6QIAAOoCAAAxMWJ0Q29uZVNoYXBlAAAAsHcAAJRMAAAsTQAAAAAAACxNAADdAgAA9wIAAO0CAABlAQAAZgEAAGcBAABEAgAARQIAAE4BAABOAQAAbAEAAEgCAABJAgAASgIAAEsCAABxAQAATAIAAE4BAABOAgAATgEAAFACAADpAgAA6gIAADIxYnRDb252ZXhJbnRlcm5hbFNoYXBlALB3AAAUTQAArE0AAAAAAACsTQAA3QIAAPgCAABOAQAAZQEAAGYBAABnAQAATgEAAE4BAABOAQAATgEAAGwBAABOAQAATgEAAPkCAAD6AgAAcQEAAE4BAABOAQAATgIAAE4BAABOAQAATgEAAE4BAAAxM2J0Q29udmV4U2hhcGUAsHcAAJxNAAC4SwAAAAAAAFhOAABBAgAA+wIAAPwCAABlAQAAZgEAAGcBAAD9AgAA/gIAAP8CAAAAAwAAbAEAAEgCAABJAgAASgIAAEsCAABxAQAAAQMAAAIDAABOAgAAAwMAAFACAADpAgAA6gIAAFMCAAAEAwAABQMAAAYDAAAHAwAACAMAAAkDAAAKAwAAMjVidENvbnZleFRyaWFuZ2xlTWVzaFNoYXBlALB3AAA8TgAASFMAAAAAAACYTgAACwMAAAwDAAANAwAAMjZMb2NhbFN1cHBvcnRWZXJ0ZXhDYWxsYmFjawAAAACwdwAAeE4AAPBVAAAAAAAAIE8AAN0CAAAOAwAADwMAAGUBAABmAQAAZwEAABADAABFAgAAEQMAABIDAAATAwAAFAMAAEkCAAAVAwAAFgMAAHEBAAAXAwAAGAMAAE4CAAAZAwAAUAIAAOkCAADqAgAAGgMAADE1YnRDeWxpbmRlclNoYXBlAAAAsHcAAAxPAAAsTQAAAAAAAIxPAAAbAwAAHAMAAE4BAABlAQAAZgEAAGcBAABOAQAATgEAAE4BAABOAQAAbAEAAM0CAADOAgAA+QIAAPoCAABxAQAATgEAADE0YnRDb25jYXZlU2hhcGUAAAAAsHcAAHhPAAC4SwAAAAAAAPRPAAAdAwAAHgMAAB8DAABlAQAAZgEAAGcBAAAgAwAAIQMAACIDAAAjAwAAbAEAAM0CAADOAgAA+QIAAPoCAABxAQAAJAMAADEyYnRFbXB0eVNoYXBlAACwdwAA5E8AAIxPAAAAAAAAbFAAACUDAAAmAwAAJwMAAGUBAABmAQAAZwEAACgDAAApAwAAKgMAACsDAABsAQAAzQIAAM4CAAD5AgAA+gIAAHEBAAAsAwAALQMAADI1YnRIZWlnaHRmaWVsZFRlcnJhaW5TaGFwZQCwdwAAUFAAAIxPAAAAAAAAtFAAAC4DAAAvAwAAwQIAAMICAADDAgAAxAIAAMUCAAAwAwAAMTRidE9wdGltaXplZEJ2aAAAAACwdwAAoFAAAMhIAAAAAAAAOFEAAAsDAAAxAwAAMgMAAFpOMTRidE9wdGltaXplZEJ2aDVidWlsZEVQMjNidFN0cmlkaW5nTWVzaEludGVyZmFjZWJSSzlidFZlY3RvcjNTNF9FMjlRdWFudGl6ZWROb2RlVHJpYW5nbGVDYWxsYmFjawCwdwAA1FAAAPBVAAAAAAAAtFEAAAsDAAAzAwAANAMAAFpOMTRidE9wdGltaXplZEJ2aDVidWlsZEVQMjNidFN0cmlkaW5nTWVzaEludGVyZmFjZWJSSzlidFZlY3RvcjNTNF9FMjBOb2RlVHJpYW5nbGVDYWxsYmFjawAAsHcAAFhRAADwVQAAAAAAAOhRAAA1AwAANgMAADE4YnRDb252ZXhQb2x5aGVkcm9uAAAAAIh3AADQUQAAAAAAABRTAABBAgAANwMAAO0CAABlAQAAZgEAAGcBAABEAgAARQIAAP8CAABOAQAAbAEAAEgCAABJAgAASgIAAEsCAABxAQAATAIAADgDAABOAgAAOQMAAFACAADpAgAA6gIAAFMCAABOAQAATgEAAE4BAABOAQAATgEAAE4BAABOAQAAAAAAAEhTAABBAgAAOgMAAPwCAABlAQAAZgEAAGcBAAA7AwAARQIAAP8CAABOAQAAbAEAAEgCAABJAgAASgIAAEsCAABxAQAATAIAADgDAABOAgAAOQMAAFACAADpAgAA6gIAAFMCAABOAQAATgEAAE4BAABOAQAATgEAAE4BAABOAQAAMjNidFBvbHloZWRyYWxDb252ZXhTaGFwZQAAALB3AAD4UgAALE0AADM0YnRQb2x5aGVkcmFsQ29udmV4QWFiYkNhY2hpbmdTaGFwZQAAAACwdwAAIFMAABRTAAAAAAAAwFMAADwDAAA9AwAAPgMAAGUBAABmAQAAZwEAAD8DAABAAwAAQQMAAEIDAABsAQAAzQIAAM4CAABDAwAARAMAAHEBAABFAwAAMjhidFNjYWxlZEJ2aFRyaWFuZ2xlTWVzaFNoYXBlAACwdwAAoFMAAIxPAAAAAAAA/FMAAAECAABGAwAARwMAADI0YnRTY2FsZWRUcmlhbmdsZUNhbGxiYWNrAACwdwAA4FMAAMRVAAAAAAAAfFQAAN0CAABIAwAASQMAAGUBAABmAQAAZwEAAEQCAABFAgAASgMAAEsDAABsAQAATAMAAE0DAABKAgAASwIAAHEBAABOAwAATwMAAE4CAABQAwAAUAIAAOkCAADqAgAAMTNidFNwaGVyZVNoYXBlALB3AABsVAAALE0AAAAAAADsVAAAUQMAAFIDAABTAwAAZQEAAGYBAABnAQAAVAMAAFUDAABWAwAAVwMAAGwBAADNAgAAzgIAAFgDAABZAwAAcQEAAFoDAAAxOGJ0U3RhdGljUGxhbmVTaGFwZQAAAACwdwAA1FQAAIxPAAAAAAAAlFUAAEECAABbAwAAXAMAAGUBAABmAQAAZwEAADsDAABFAgAA/wIAAF0DAABsAQAASAIAAEkCAABKAgAASwIAAHEBAABMAgAAOAMAAE4CAAA5AwAAUAIAAOkCAADqAgAAUwIAAF4DAABfAwAAYAMAAGEDAABiAwAAYwMAAGQDAABlAwAAMTZidEJVX1NpbXBsZXgxdG80AACwdwAAgFUAAEhTAAABAAAAAwAAAAYAAAAxOGJ0VHJpYW5nbGVDYWxsYmFjawAAAACIdwAArFUAADMxYnRJbnRlcm5hbFRyaWFuZ2xlSW5kZXhDYWxsYmFjawAAAIh3AADMVQAAMjNidFN0cmlkaW5nTWVzaEludGVyZmFjZQAAAIh3AAD4VQAAAAAAAIBWAABmAwAAZwMAAGgDAABpAwAAagMAAGsDAABsAwAAbQMAAG4DAABvAwAAcAMAAHEDAAByAwAAcwMAAHQDAAAyNmJ0VHJpYW5nbGVJbmRleFZlcnRleEFycmF5AAAAALB3AABgVgAAFFYAAAAAAADkVgAAdQMAAHYDAABoAwAAaQMAAGoDAABrAwAAbAMAAG0DAAB3AwAAeAMAAHADAABxAwAAcgMAAHMDAAB0AwAAMTRidFRyaWFuZ2xlTWVzaAAAAACwdwAA0FYAAIBWAAAAAAAAXFcAAHkDAAB6AwAAyAIAAGUBAABmAQAAZwEAAHsDAADKAgAAywIAAHwDAABsAQAAzQIAAM4CAAD5AgAA+gIAAHEBAAB9AwAA0gIAANMCAAAxOWJ0VHJpYW5nbGVNZXNoU2hhcGUAAACwdwAARFcAAIxPAAAAAAAA5FcAAAsDAAB+AwAAfwMAAFpOSzE5YnRUcmlhbmdsZU1lc2hTaGFwZTE5cHJvY2Vzc0FsbFRyaWFuZ2xlc0VQMThidFRyaWFuZ2xlQ2FsbGJhY2tSSzlidFZlY3RvcjNTNF9FMTZGaWx0ZXJlZENhbGxiYWNrAAAAsHcAAHxXAADwVQAAAAAAABxYAAABAgAAgAMAAIEDAAAyMVN1cHBvcnRWZXJ0ZXhDYWxsYmFjawCwdwAABFgAAMRVAAAAAAAAXFgAAIIDAACDAwAAhAMAADI3YnRDb250aW51b3VzQ29udmV4Q29sbGlzaW9uAAAAsHcAADxYAAC0WAAAAAAAAJhYAAAsAgAAhQMAAIYDAACHAwAAiAMAADE2YnRQb2ludENvbGxlY3RvcgAAsHcAAIRYAAC0PAAAMTJidENvbnZleENhc3QAAIh3AACkWAAAAAAAAORYAACCAwAAiQMAAIoDAAAxNWJ0R2prQ29udmV4Q2FzdAAAALB3AADQWAAAtFgAAAEAAAACAAAAAAAAAAIAAAAAAAAAAQAAAAAAAABoWQAAjQMAAI4DAACPAwAAMzBidEdqa0VwYVBlbmV0cmF0aW9uRGVwdGhTb2x2ZXIAMzBidENvbnZleFBlbmV0cmF0aW9uRGVwdGhTb2x2ZXIAAACIdwAAPVkAALB3AAAcWQAAYFkAAAAAAACcWQAAbQIAAJADAACRAwAAMTdidEdqa1BhaXJEZXRlY3RvcgCwdwAAiFkAADxBAAAAAAAA4FkAAI0DAACSAwAAkwMAADMzYnRNaW5rb3dza2lQZW5ldHJhdGlvbkRlcHRoU29sdmVyALB3AAC8WQAAYFkAAAAAAAC0WgAALAIAAJQDAACVAwAAlgMAAJcDAABaTjMzYnRNaW5rb3dza2lQZW5ldHJhdGlvbkRlcHRoU29sdmVyMTJjYWxjUGVuRGVwdGhFUjIyYnRWb3Jvbm9pU2ltcGxleFNvbHZlclBLMTNidENvbnZleFNoYXBlUzRfUksxMWJ0VHJhbnNmb3JtUzdfUjlidFZlY3RvcjNTOV9TOV9QMTJidElEZWJ1Z0RyYXdFMjBidEludGVybWVkaWF0ZVJlc3VsdAAAsHcAAAhaAAC0PAAAAAAAAAxbAAABAgAAmAMAAAMCAABOAQAAAAAAADhbAAABAgAAmQMAAAsCAABOAQAAMjVidFRyaWFuZ2xlUmF5Y2FzdENhbGxiYWNrALB3AADwWgAAxFUAADI4YnRUcmlhbmdsZUNvbnZleGNhc3RDYWxsYmFjawAAsHcAABhbAADEVQAAAAAAAHRbAACCAwAAmgMAAJsDAAAyMmJ0U3Vic2ltcGxleENvbnZleENhc3QAAAAAsHcAAFhbAAC0WAAAAAAAAMhbAACcAwAAnQMAAJ4DAACfAwAAoAMAAKEDAACiAwAAowMAAKQDAAClAwAApgMAADE3YnRGaXhlZENvbnN0cmFpbnQAsHcAALRbAAAsXAAAAAAAACxcAACnAwAAqAMAAJ4DAACfAwAAoAMAAKEDAACiAwAAowMAAKQDAAClAwAApgMAADMwYnRHZW5lcmljNkRvZlNwcmluZzJDb25zdHJhaW50AAAAALB3AAAIXAAAGF4AAAEAAAACAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAACAAAAAgAAAAAAAADAXAAApwMAAKkDAACqAwAAnwMAAKsDAACsAwAAogMAAK0DAACuAwAArwMAALADAACxAwAAMTdidEhpbmdlQ29uc3RyYWludACwdwAArFwAABheAAAAAAAAIF0AAKcDAACyAwAAswMAAJ8DAAC0AwAAtQMAAKIDAAC2AwAAtwMAALgDAAC5AwAAugMAADIzYnRQb2ludDJQb2ludENvbnN0cmFpbnQAAACwdwAABF0AABheAAAAAAAArF0AAL4DAAC/AwAAwAMAAMEDAADCAwAAwwMAAMQDAADFAwAAxgMAAMcDAADIAwAAyQMAAMoDAAAzNWJ0U2VxdWVudGlhbEltcHVsc2VDb25zdHJhaW50U29sdmVyADE4YnRDb25zdHJhaW50U29sdmVyAACIdwAAjl0AALB3AABoXQAApF0AAAAAAAAYXgAApwMAAMwDAADNAwAAnwMAAE4BAABOAQAAogMAAE4BAABOAQAAzgMAAM8DAAAxN2J0VHlwZWRDb25zdHJhaW50ADEzYnRUeXBlZE9iamVjdACIdwAAAF4AAAx4AADsXQAAAAAAAAEAAAAQXgAAAgQAAAAAAABkXgAA0AMAANEDAADqAQAA6wEAANIDAADTAwAA1AMAADExYnRSaWdpZEJvZHkAAACwdwAAVF4AAHgzAAAAAAAApF4AANUDAADWAwAA1wMAANgDAAAyNWJ0U2ltdWxhdGlvbklzbGFuZE1hbmFnZXIAiHcAAIheAAAAAAAAqF8AANkDAADaAwAA8QEAAPIBAADzAQAA9AEAANsDAAD2AQAA9wEAANwDAADdAwAA+gEAAN4DAADfAwAA4AMAAOEDAADiAwAA4wMAAOQDAADlAwAA5gMAAOcDAADoAwAA6QMAAOoDAADrAwAA7AMAAO0DAADuAwAA7wMAAPADAADxAwAA8gMAAPMDAAD0AwAA9QMAAPYDAAD3AwAA+AMAAPkDAAD6AwAA+wMAAPwDAAD9AwAA/gMAAP8DAAAABAAAMjNidERpc2NyZXRlRHluYW1pY3NXb3JsZAAxNWJ0RHluYW1pY3NXb3JsZACwdwAAil8AANAzAACwdwAAcF8AAJxfAAAAAAAAHGAAAAEEAAACBAAAAwQAADI3SW5wbGFjZVNvbHZlcklzbGFuZENhbGxiYWNrAE4yNWJ0U2ltdWxhdGlvbklzbGFuZE1hbmFnZXIxNElzbGFuZENhbGxiYWNrRQCIdwAA5l8AALB3AADIXwAAFGAAAAAAAABoYAAAVgEAAAQEAAAFBAAABgQAADM0YnRDbG9zZXN0Tm90TWVDb252ZXhSZXN1bHRDYWxsYmFjawAAAACwdwAAQGAAAFh5AAAAAAAAWGEAAAcEAAAIBAAA8QEAAPIBAADzAQAA9AEAANsDAAD2AQAA9wEAANwDAADdAwAA+gEAAN4DAADfAwAA4AMAAOEDAADiAwAA4wMAAOQDAADlAwAA5gMAAOcDAADoAwAA6QMAAOoDAADrAwAA7AMAAO0DAADuAwAA7wMAAPADAADxAwAA8gMAAPMDAAD0AwAA9QMAAPYDAAD3AwAA+AMAAPkDAAD6AwAACQQAAPwDAAD9AwAACgQAAP8DAAAABAAATjJjYzIzY2NEaXNjcmV0ZUR5bmFtaWNzV29ybGRFAACwdwAAOGEAAKhfAAAAAAAAvGEAAAsEAAAMBAAADQQAAE4yY2MyM2NjT3ZlcmxhcEZpbHRlckNhbGxiYWNrRQAyM2J0T3ZlcmxhcEZpbHRlckNhbGxiYWNrAAAAAIh3AACXYQAAsHcAAHhhAAC0YQAAAAAAAPxhAAAOBAAADwQAABAEAAARBAAAEgQAADE5YnRHaG9zdFBhaXJDYWxsYmFjawAAALB3AADkYQAAEDEAAAAAAABMYgAAVgEAABMEAAAUBAAAFQQAAE4yY2MzNGNjTm90TWVDbG9zZXN0Q29udmV4UmVzdWx0Q2FsbGJhY2tFAAAAsHcAACBiAABYeQAAAAAAAMBiAAAWBAAAFwQAAOoBAADrAQAA7AEAAO0BAADuAQAAGAQAABkEAAAAAAAA6GIAABoEAAAbBAAA6gEAAOsBAADsAQAA7QEAAO4BAAAcBAAAHQQAADEzYnRHaG9zdE9iamVjdACwdwAAsGIAAHgzAAAyNGJ0UGFpckNhY2hpbmdHaG9zdE9iamVjdAAAsHcAAMxiAADAYgAAAAAAAIhjAAAfBAAAIAQAACEEAAAiBAAAIwQAAE4BAAAAAAAAtGMAAB8EAAAkBAAAIQQAACIEAAAjBAAAJQQAAAAAAADcYwAAHwQAACYEAAAhBAAAIgQAACMEAAAnBAAAMjFidENoYXJhY3RlckNvbnRyb2xsZXIAMTdidEFjdGlvbkludGVyZmFjZQCIdwAAbGMAALB3AABUYwAAgGMAADI4YnRDYXBzdWxlQ2hhcmFjdGVyQ29udHJvbGxlcgAAsHcAAJRjAACIYwAAMjRidEJveENoYXJhY3RlckNvbnRyb2xsZXIAALB3AADAYwAAiGMAAAAAAAAwZAAAVgEAACgEAABgAQAAKQQAADQzYnRLaW5lbWF0aWNDbG9zZXN0Tm90TWVDb252ZXhSZXN1bHRDYWxsYmFjawAAALB3AAAAZAAAWHkAAE5TdDNfXzIxMmJhc2ljX3N0cmluZ0loTlNfMTFjaGFyX3RyYWl0c0loRUVOU185YWxsb2NhdG9ySWhFRUVFAACIdwAAPGQAAE5TdDNfXzIxMmJhc2ljX3N0cmluZ0l3TlNfMTFjaGFyX3RyYWl0c0l3RUVOU185YWxsb2NhdG9ySXdFRUVFAACIdwAAhGQAAE5TdDNfXzIxMmJhc2ljX3N0cmluZ0lEc05TXzExY2hhcl90cmFpdHNJRHNFRU5TXzlhbGxvY2F0b3JJRHNFRUVFAAAAiHcAAMxkAABOU3QzX18yMTJiYXNpY19zdHJpbmdJRGlOU18xMWNoYXJfdHJhaXRzSURpRUVOU185YWxsb2NhdG9ySURpRUVFRQAAAIh3AAAYZQAATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJY0VFAACIdwAAZGUAAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SWFFRQAAiHcAAIxlAABOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0loRUUAAIh3AAC0ZQAATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJc0VFAACIdwAA3GUAAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SXRFRQAAiHcAAARmAABOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0lpRUUAAIh3AAAsZgAATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJakVFAACIdwAAVGYAAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SWxFRQAAiHcAAHxmAABOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0ltRUUAAIh3AACkZgAATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJeEVFAACIdwAAzGYAAE4xMGVtc2NyaXB0ZW4xMW1lbW9yeV92aWV3SXlFRQAAiHcAAPRmAABOMTBlbXNjcmlwdGVuMTFtZW1vcnlfdmlld0lmRUUAAIh3AAAcZwAATjEwZW1zY3JpcHRlbjExbWVtb3J5X3ZpZXdJZEVFAACIdwAARGcAANsPST/bD0m/5MsWQOTLFsAAAAAAAAAAgNsPSUDbD0nAAAAAADhj7T7aD0k/Xph7P9oPyT9pN6wxaCEiM7QPFDNoIaIzAwAAAAQAAAAEAAAABgAAAIP5ogBETm4A/CkVANFXJwDdNPUAYtvAADyZlQBBkEMAY1H+ALveqwC3YcUAOm4kANJNQgBJBuAACeouAByS0QDrHf4AKbEcAOg+pwD1NYIARLsuAJzphAC0JnAAQX5fANaROQBTgzkAnPQ5AItfhAAo+b0A+B87AN7/lwAPmAUAES/vAApaiwBtH20Az342AAnLJwBGT7cAnmY/AC3qXwC6J3UA5evHAD178QD3OQcAklKKAPtr6gAfsV8ACF2NADADVgB7/EYA8KtrACC8zwA29JoA46kdAF5hkQAIG+YAhZllAKAUXwCNQGgAgNj/ACdzTQAGBjEAylYVAMmocwB74mAAa4zAABnERwDNZ8MACejcAFmDKgCLdsQAphyWAESv3QAZV9EApT4FAAUH/wAzfj8AwjLoAJhP3gC7fTIAJj3DAB5r7wCf+F4ANR86AH/yygDxhx0AfJAhAGokfADVbvoAMC13ABU7QwC1FMYAwxmdAK3EwgAsTUEADABdAIZ9RgDjcS0Am8aaADNiAAC00nwAtKeXADdV1QDXPvYAoxAYAE12/ABknSoAcNerAGN8+AB6sFcAFxXnAMBJVgA71tkAp4Q4ACQjywDWincAWlQjAAAfuQDxChsAGc7fAJ8x/wBmHmoAmVdhAKz7RwB+f9gAImW3ADLoiQDmv2AA78TNAGw2CQBdP9QAFt7XAFg73gDem5IA0iIoACiG6ADiWE0AxsoyAAjjFgDgfcsAF8BQAPMdpwAY4FsALhM0AIMSYgCDSAEA9Y5bAK2wfwAe6fIASEpDABBn0wCq3dgArl9CAGphzgAKKKQA05m0AAam8gBcd38Ao8KDAGE8iACKc3gAr4xaAG/XvQAtpmMA9L/LAI2B7wAmwWcAVcpFAMrZNgAoqNIAwmGNABLJdwAEJhQAEkabAMRZxADIxUQATbKRAAAX8wDUQ60AKUnlAP3VEAAAvvwAHpTMAHDO7gATPvUA7PGAALPnwwDH+CgAkwWUAMFxPgAuCbMAC0XzAIgSnACrIHsALrWfAEeSwgB7Mi8ADFVtAHKnkABr5x8AMcuWAHkWSgBBeeIA9N+JAOiUlwDi5oQAmTGXAIjtawBfXzYAu/0OAEiatABnpGwAcXJCAI1dMgCfFbgAvOUJAI0xJQD3dDkAMAUcAA0MAQBLCGgALO5YAEeqkAB05wIAvdYkAPd9pgBuSHIAnxbvAI6UpgC0kfYA0VNRAM8K8gAgmDMA9Ut+ALJjaADdPl8AQF0DAIWJfwBVUikAN2TAAG3YEAAySDIAW0x1AE5x1ABFVG4ACwnBACr1aQAUZtUAJwedAF0EUAC0O9sA6nbFAIf5FwBJa30AHSe6AJZpKQDGzKwArRRUAJDiagCI2YkALHJQAASkvgB3B5QA8zBwAAD8JwDqcagAZsJJAGTgPQCX3YMAoz+XAEOU/QANhowAMUHeAJI5nQDdcIwAF7fnAAjfOwAVNysAXICgAFqAkwAQEZIAD+jYAGyArwDb/0sAOJAPAFkYdgBipRUAYcu7AMeJuQAQQL0A0vIEAEl1JwDrtvYA2yK7AAoUqgCJJi8AZIN2AAk7MwAOlBoAUTqqAB2jwgCv7a4AXCYSAG3CTQAtepwAwFaXAAM/gwAJ8PYAK0CMAG0xmQA5tAcADCAVANjDWwD1ksQAxq1LAE7KpQCnN80A5qk2AKuSlADdQmgAGWPeAHaM7wBoi1IA/Ns3AK6hqwDfFTEAAK6hAAz72gBkTWYA7QW3ACllMABXVr8AR/86AGr5uQB1vvMAKJPfAKuAMABmjPYABMsVAPoiBgDZ5B0APbOkAFcbjwA2zQkATkLpABO+pAAzI7UA8KoaAE9lqADSwaUACz8PAFt4zQAj+XYAe4sEAIkXcgDGplMAb27iAO/rAACbSlgAxNq3AKpmugB2z88A0QIdALHxLQCMmcEAw613AIZI2gD3XaAAxoD0AKzwLwDd7JoAP1y8ANDebQCQxx8AKtu2AKMlOgAAr5oArVOTALZXBAApLbQAS4B+ANoHpwB2qg4Ae1mhABYSKgDcty0A+uX9AInb/gCJvv0A5HZsAAap/AA+gHAAhW4VAP2H/wAoPgcAYWczACoYhgBNveoAs+evAI9tbgCVZzkAMb9bAITXSAAw3xYAxy1DACVhNQDJcM4AMMu4AL9s/QCkAKIABWzkAFrdoAAhb0cAYhLSALlchABwYUkAa1bgAJlSAQBQVTcAHtW3ADPxxAATbl8AXTDkAIUuqQAdssMAoTI2AAi3pADqsdQAFvchAI9p5AAn/3cADAOAAI1ALQBPzaAAIKWZALOi0wAvXQoAtPlCABHaywB9vtAAm9vBAKsXvQDKooEACGpcAC5VFwAnAFUAfxTwAOEHhgAUC2QAlkGNAIe+3gDa/SoAayW2AHuJNAAF8/4Aub+eAGhqTwBKKqgAT8RaAC34vADXWpgA9MeVAA1NjQAgOqYApFdfABQ/sQCAOJUAzCABAHHdhgDJ3rYAv2D1AE1lEQABB2sAjLCsALLA0ABRVUgAHvsOAJVywwCjBjsAwEA1AAbcewDgRcwATin6ANbKyADo80EAfGTeAJtk2ADZvjEApJfDAHdY1ABp48UA8NoTALo6PABGGEYAVXVfANK99QBuksYArC5dAA5E7QAcPkIAYcSHACn96QDn1vMAInzKAG+RNQAI4MUA/9eNAG5q4gCw/cYAkwjBAHxddABrrbIAzW6dAD5yewDGEWoA98+pAClz3wC1yboAtwBRAOKyDQB0uiQA5X1gAHTYigANFSwAgRgMAH5mlAABKRYAn3p2AP39vgBWRe8A2X42AOzZEwCLurkAxJf8ADGoJwDxbsMAlMU2ANioVgC0qLUAz8wOABKJLQBvVzQALFaJAJnO4wDWILkAa16qAD4qnAARX8wA/QtKAOH0+wCOO20A4oYsAOnUhAD8tKkA7+7RAC41yQAvOWEAOCFEABvZyACB/AoA+0pqAC8c2ABTtIQATpmMAFQizAAqVdwAwMbWAAsZlgAacLgAaZVkACZaYAA/Uu4AfxEPAPS1EQD8y/UANLwtADS87gDoXcwA3V5gAGeOmwCSM+8AyRe4AGFYmwDhV7wAUYPGANg+EADdcUgALRzdAK8YoQAhLEYAWfPXANl6mACeVMAAT4b6AFYG/ADlea4AiSI2ADitIgBnk9wAVeiqAIImOADK55sAUQ2kAJkzsQCp1w4AaQVIAGWy8AB/iKcAiEyXAPnRNgAhkrMAe4JKAJjPIQBAn9wA3EdVAOF0OgBn60IA/p3fAF7UXwB7Z6QAuqx6AFX2ogAriCMAQbpVAFluCAAhKoYAOUeDAInj5gDlntQASftAAP9W6QAcD8oAxVmKAJT6KwDTwcUAD8XPANtargBHxYYAhUNiACGGOwAseZQAEGGHACpMewCALBoAQ78SAIgmkAB4PIkAqMTkAOXbewDEOsIAJvTqAPdnigANkr8AZaMrAD2TsQC9fAsApFHcACfdYwBp4d0AmpQZAKgplQBozigACe20AESfIABOmMoAcIJjAH58IwAPuTIAp/WOABRW5wAh8QgAtZ0qAG9+TQClGVEAtfmrAILf1gCW3WEAFjYCAMQ6nwCDoqEAcu1tADmNegCCuKkAazJcAEYnWwAANO0A0gB3APz0VQABWU0A4HGA"),i(r,29331,"QPsh+T8AAAAALUR0PgAAAICYRvg8AAAAYFHMeDsAAACAgxvwOQAAAEAgJXo4AAAAgCKC4zYAAAAAHfNpNQAAAAAAAPA/dIUV07DZ7z8PiflsWLXvP1FbEtABk+8/e1F9PLhy7z+quWgxh1TvPzhidW56OO8/4d4f9Z0e7z8VtzEK/gbvP8upOjen8e4/IjQSTKbe7j8tiWFgCM7uPycqNtXav+4/gk+dViu07j8pVEjdB6vuP4VVOrB+pO4/zTt/Zp6g7j90X+zodZ/uP4cB63MUoe4/E85MmYml7j/boCpC5azuP+XFzbA3t+4/kPCjgpHE7j9dJT6yA9XuP63TWpmf6O4/R1778nb/7j+cUoXdmxnvP2mQ79wgN+8/h6T73BhY7z9fm3szl3zvP9qQpKKvpO8/QEVuW3bQ7z8AAAAAAADoQpQjkUv4aqw/88T6UM6/zj/WUgz/Qi7mPwAAAAAAADhD/oIrZUcVR0CUI5FL+Gq8PvPE+lDOvy4/1lIM/0Iulj++8/h57GH2PxkwllvG/t6/PYivSu1x9T+k/NQyaAvbv7AQ8PA5lfQ/e7cfCotB17+FA7iwlcnzP3vPbRrpndO/pWSIDBkN8z8xtvLzmx3Qv6COC3siXvI/8Ho7Gx18yb8/NBpKSrvxP588r5Pj+cK/uuWK8Fgj8T9cjXi/y2C5v6cAmUE/lfA/zl9Htp1vqr8AAAAAAADwPwAAAAAAAAAArEea/Yxg7j899SSfyjizP6BqAh+zpOw/upE4VKl2xD/m/GpXNiDrP9LkxEoLhM4/LaqhY9HC6T8cZcbwRQbUP+1BeAPmhug/+J8bLJyO2D9iSFP13GfnP8x7sU6k4Nw/C25JyRZ20j96xnWgaRnXv926p2wKx94/yPa+SEcV578ruCplRxX3P04xMF9fY3h4YWJpdjExNl9fc2hpbV90eXBlX2luZm9FAAAAALB3AABAdQAAjHgAAE4xMF9fY3h4YWJpdjExN19fY2xhc3NfdHlwZV9pbmZvRQAAALB3AABwdQAAZHUAAE4xMF9fY3h4YWJpdjExN19fcGJhc2VfdHlwZV9pbmZvRQAAALB3AACgdQAAZHUAAE4xMF9fY3h4YWJpdjExOV9fcG9pbnRlcl90eXBlX2luZm9FALB3AADQdQAAxHUAAE4xMF9fY3h4YWJpdjEyMF9fZnVuY3Rpb25fdHlwZV9pbmZvRQAAAACwdwAAAHYAAGR1AABOMTBfX2N4eGFiaXYxMjlfX3BvaW50ZXJfdG9fbWVtYmVyX3R5cGVfaW5mb0UAAACwdwAANHYAAMR1AAAAAAAAtHYAACsEAAAsBAAALQQAAC4EAAAvBAAATjEwX19jeHhhYml2MTIzX19mdW5kYW1lbnRhbF90eXBlX2luZm9FALB3AACMdgAAZHUAAHYAAAB4dgAAwHYAAERuAAB4dgAAzHYAAGIAAAB4dgAA2HYAAGMAAAB4dgAA5HYAAGgAAAB4dgAA8HYAAGEAAAB4dgAA/HYAAHMAAAB4dgAACHcAAHQAAAB4dgAAFHcAAGkAAAB4dgAAIHcAAGoAAAB4dgAALHcAAGwAAAB4dgAAOHcAAG0AAAB4dgAARHcAAHgAAAB4dgAAUHcAAHkAAAB4dgAAXHcAAGYAAAB4dgAAaHcAAGQAAAB4dgAAdHcAAAAAAACUdQAAKwQAADAEAAAtBAAALgQAADEEAAAyBAAAMwQAADQEAAAAAAAA+HcAACsEAAA1BAAALQQAAC4EAAAxBAAANgQAADcEAAA4BAAATjEwX19jeHhhYml2MTIwX19zaV9jbGFzc190eXBlX2luZm9FAAAAALB3AADQdwAAlHUAAAAAAABUeAAAKwQAADkEAAAtBAAALgQAADEEAAA6BAAAOwQAADwEAABOMTBfX2N4eGFiaXYxMjFfX3ZtaV9jbGFzc190eXBlX2luZm9FAAAAsHcAACx4AACUdQAAAAAAAPR1AAArBAAAPQQAAC0EAAAuBAAAPgQAAFN0OXR5cGVfaW5mbwAAAACIdwAAfHg="),i(r,30884,"zHgAAEgBAABJAQAASgEAAEsBAACIdwAAwykAALB3AACUKQAAuHgAALB3AAByKQAAwHgAAAAAAAC4eAAASAEAAEwBAABNAQAATgEAAAAAAAAUeQAATwEAAFABAABRAQAAUgEAALB3AAANKgAAuHgAALB3AADrKQAACHkAAAAAAAAIeQAAUwEAAFQBAABNAQAAVQEAAAAAAABkeQAAVgEAAFcBAABYAQAAWQEAAIh3AACTKgAAsHcAAGEqAABQeQAAsHcAADwqAABYeQAAAAAAAJR5AABaAQAAWwEAAFwBAABdAQAAsHcAAOMqAABQeQAAsHcAAL4qAACIeQAAAAAAAIh5AABeAQAAXwEAAGABAABhAQAAAAAAAAh6AABiAQAAYwEAAGQBAABlAQAAZgEAAGcBAABoAQAAaQEAAGoBAABrAQAAbAEAAG0BAABuAQAAbwEAAHABAABxAQAAcgEAAHMBAACwdwAAFSsAACRMAACIdwAALCsAAIh3AABKKwAAsHcAADwrAAAcegAAaHgAAFkrAAAAAAAAJHoAAGh4AABoKwAAAQAAACR6AADEdgAAWHoAAGh4AACAKwAAAAAAABx6"),i(r,31344,"xHYAADB6AAAkdwAAJHcAACR3AACIdwAA1isAAAx4AACwKwAAAAAAAAIAAAAkegAAAgAAAIR6AAACiAAAsHcAAJsrAACMegAAaHgAAPsrAAAAAAAArHoAAGh4AAARLAAAAQAAAKx6AADEdgAArHoAALh6AADoegAAiHcAACgsAAAAAAAArHoAAHQBAAB1AQAAdgEAAHcBAAB4AQAAeQEAAHoBAAB7AQAAfAEAAH0BAAB+AQAAfwEAAIABAACBAQAAggEAAIMBAACEAQAAhQEAAIYBAACHAQAAiAEAAIkBAACKAQAAiwEAAIwBAACNAQAAjgEAAI8BAAAAAAAAjHoAAHQBAACQAQAAdgEAAHcBAAB4AQAAeQEAAHoBAAB7AQAAfAEAAH0BAAB+AQAAfwEAAIABAACBAQAAggEAAIMBAACEAQAAhQEAAIYBAACHAQAAiAEAAIkBAACKAQAAiwEAAIwBAACRAQAAkgEAAE4BAADEdg=="),i(r,31728,"xHYAACR3AAAkdwAAJHcAAOh6AAAMfAAA6HoAAIh3AAA/LAAAiHcAAJssAACwdwAAgywAABR8AABoeAAAtywAAAAAAAAcfAAAaHgAANAsAAABAAAAHHw="),i(r,31824,"xHYAACh8AAAkdwAAJHcAAAx4AAAPLQAAAAAAAAIAAAAcfAAAAgAAAIR6AAACBAAAsHcAAPAsAABgfAAAaHgAAD8tAAAAAAAAgHwAAGh4AABfLQAAAQAAAIB8AADEdgAAgHwAAIx8AADoegAAAAAAAIB8AACTAQAAlAEAAJUBAACWAQAAlwEAAAAAAABgfAAAkwEAAJQBAACVAQAAmAEAAE4BAADEdgAAJHcAACR3AACwdwAAgC0AABR6AABoeAAAlS0AAAAAAAAAfQAAaHgAAKstAAABAAAAAH0AAMR2AAAMfQAAJHcAAAx4AADeLQAAAAAAAAIAAAAAfQAAAgAAAIR6AAACSAAAsHcAAMctAAA4fQAAaHgAAAsuAAAAAAAAWH0AAGh4AAAjLgAAAQAAAFh9AADEdgAAWH0AAGR9AADoegAAAAAAAFh9AACZAQAAmgEAAJsBAACcAQAAnQEAAAAAAAA4fQAAmQEAAJ4BAACbAQAAnAEAAE4BAADEdgAAJHcAACR3AAAkdwAAxHYAACR3AABsdwAAJHcAAMR2AAAkdwAAbHcAAMR2AAAkdwAAJHc="),i(r,32272,"JHcAAGx3AABsdwAAbHcAAMR2AAAkdwAAbHcAAGx3AABsdw=="),i(r,32320,"JHcAAGx3AABsdwAAbHcAAGx3"),i(r,32352,"xHYAACR3AABsdwAAbHcAAGx3AABsdwAAJHcAACR3AAAkdwAAJHc="),i(r,32400,"xHYAACR3AAAkdwAAJHcAACR3AAAkdwAAJHcAACR3AAAkdw=="),i(r,32448,"xHYAACR3AABsdwAAbHcAAGx3AABsdwAAbHcAAMR2AAAkdwAA3HY="),i(r,32496,"xHYAACR3AABsdwAAbHcAACR3AAAkdwAAJHcAACR3AAAkdwAAJHc="),i(r,32544,"xHYAACR3AAAkdwAAbHcAAGx3"),i(r,32576,"xHYAACR3AAAkdwAA3HYAAMR2AAAkdwAAJHcAAGx3AADcdgAAJHc="),i(r,32624,"xHYAACR3AABsdwAAJHcAAMR2AAAkdwAAJHcAACR3AAAkdwAAJHcAAGx3AAAAAAAAxHYAACR3AABsdwAAbHcAACR3AAAkdwAAbHcAAGx3AAAkdwAAJHcAAGx3AAAAAAAAJHcAACR3AAAkdwAAJHcAAGx3AABsdwAAbHcAAAAAAADEdgAAJHcAACR3AAAkdwAAJHcAANx2"),i(r,32784,"JHcAACR3AADcdgAA3HYAAMR2AAAkdwAAJHcAAGx3AABsdwAAbHc="),i(r,32832,"JHcAACR3AABsdwAAbHcAAGx3"),i(r,32864,"xHYAACR3AAAkdwAAJHcAANx2AAAkdwAAbHcAACR3AADEdgAAJHcAACR3AAAwdwAAMHc="),i(r,32928,"xHYAACR3AAAkdwAAJHcAACR3AAAkdwAAbHcAAAAAAAAkdwAAJHcAACR3AAAkdwAAxHYAACR3AABsdwAAJHcAAGx3"),i(r,33008,"xHYAACR3AAAkdwAAJHcAADB3AADcdg=="),i(r,33040,"JHcAACR3AAAkdwAAbHcAAGx3"),i(r,33072,"JHcAAGx3AABsdwAAbHcAACR3AAAkdwAAJHcAAGx3AABsdw=="),i(r,33120,"JHcAAGx3AABsdwAAbHcAACR3AAAkdwAAJHcAAGx3AABsdwAAbHcAAJ8BAACgAQAAoQEAAKIBAAC9AQAAvgEAAG8SgzoK16M8AQEAAAAAAEBgjgE=");var wn,Zn=(wn=[null,function(){o[8316]=30944},function(){_r(33360)},function(){ff(33616)},Bn,function(){cr(33820)},di,Wi,function(A,r){r|=0;var f=0;f=o[(A|=0)>>2],r=((A=o[A+4>>2])>>1)+r|0,1&A&&(f=o[f+o[r>>2]>>2]),Zn[0|f](r)},function(A,r,f,e,i){r|=0,f|=0,e|=0,i|=0;var n=0;n=o[(A|=0)>>2],r=((A=o[A+4>>2])>>1)+r|0,1&A&&(n=o[n+o[r>>2]>>2]),Zn[0|n](r,f,e,i)},di,en,en,Wi,function(A){a[136+(A|=0)|0]=1},Ni,function(A){var r,f;return A|=0,o[8488]=o[8488]+1,r=0|Zn[o[8290]](144,16),o[r+8>>2]=1065353216,o[r+12>>2]=1065353216,o[r+4>>2]=0,o[r+104>>2]=1065353216,o[r+108>>2]=1065353216,o[r+96>>2]=0,o[r+100>>2]=0,o[r+88>>2]=1065353216,o[r+92>>2]=0,o[r+80>>2]=0,o[r+84>>2]=0,o[r+72>>2]=1065353216,o[r+76>>2]=1065353216,o[(f=r- -64|0)>>2]=0,o[f+4>>2]=0,o[r+56>>2]=1065353216,o[r+60>>2]=0,o[r+48>>2]=1065353216,o[r+52>>2]=0,o[r+40>>2]=0,o[r+44>>2]=1065353216,o[r+32>>2]=0,o[r+36>>2]=0,o[r+24>>2]=0,o[r+28>>2]=1065353216,o[r+16>>2]=1065353216,o[r+20>>2]=0,o[r+112>>2]=0,o[r+116>>2]=0,o[r+120>>2]=0,o[r+124>>2]=0,o[r+128>>2]=0,o[r+132>>2]=0,a[r+136|0]=0,o[r+140>>2]=o[A>>2],o[A>>2]=0,o[r>>2]=31480,0|r},He,function(A,r,f){var e,i;f|=0,e=A|=0,i=0|x(0|(a[11+(r|=0)|0]<0?o[r>>2]:r),31404,o[f>>2]),o[e>>2]=i},function(A,r,f){A|=0,f|=0;var e,i,n=0,t=0,c=0,b=0;if(S=e=S-32|0,(i=o[(r|=0)>>2])>>>0<2147483632)return i>>>0<=10?(a[e+27|0]=i,n=e+16|0):(n=xe(t=1+(15|i)|0),o[e+24>>2]=-2147483648|t,o[e+16>>2]=n,o[e+20>>2]=i),c=pr(n,r+4|0,i)+i|0,b=0,a[0|c]=b,o[e+12>>2]=f,Zn[0|A](e+28|0,e+16|0,e+12|0),I(o[e+28>>2]),A=o[e+28>>2],V(0|A),V(o[e+12>>2]),a[e+27|0]<0&&DA(o[e+16>>2]),S=e+32|0,0|A;J(),d()},ki,Wi,function(A,r,f,e){r|=0,f|=0,e|=0;var i=0;i=o[(A|=0)>>2],r=((A=o[A+4>>2])>>1)+r|0,1&A&&(i=o[i+o[r>>2]>>2]),Zn[0|i](r,f,e)},ki,en,en,Wi,function(A){a[4+(A|=0)|0]=1},Ni,function(A){var r;return A|=0,r=xe(12),a[r+4|0]=0,o[r+8>>2]=o[A>>2],o[A>>2]=0,o[r>>2]=31940,0|r},He,function(A,r,f){var e,i;f|=0,e=A|=0,i=0|x(0|(a[11+(r|=0)|0]<0?o[r>>2]:r),31872,o[f>>2]),o[e>>2]=i},di,Wi,function(A,r,f){r|=0,f|=0;var e=0;e=o[(A|=0)>>2],r=((A=o[A+4>>2])>>1)+r|0,1&A&&(e=o[e+o[r>>2]>>2]),Zn[0|e](r,f)},di,en,en,Wi,function(A){a[72+(A|=0)|0]=1},Ni,function(A){var r;return A|=0,r=xe(80),a[r+72|0]=0,o[r+4>>2]=-1,o[r+76>>2]=o[A>>2],o[A>>2]=0,o[r>>2]=32156,0|r},He,function(A,r,f){var e,i;f|=0,e=A|=0,i=0|x(0|(a[11+(r|=0)|0]<0?o[r>>2]:r),32088,o[f>>2]),o[e>>2]=i},Pi,Bi,vn,function(A,r){r|=0,Zn[0|(A|=0)](r)},Ci,function(A,r){return r|=0,m(m(Zn[0|(A|=0)](r)))},function(A,r){A|=0,r=m(r),w[A>>2]=r},function(A,r,f){A|=0,r|=0,f=m(f),Zn[0|A](r,f)},function(A,r){A|=0;A:{r:{f:switch(0|(r|=0)){case 0:if(!A)break r;return void(A&&(o[8489]=o[8489]+1,Zn[o[8291]](A)));case 1:case 2:if(!A)break r;return void DA(A);case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 6:if(!A)break r;break A;case 14:break f;default:break r}A&&Zn[o[o[A>>2]+4>>2]](A)}return}Zn[o[o[A>>2]+4>>2]](A)},vi,function(A,r,f){var e;return A=m(A),r=m(r),f=m(f),o[8488]=o[8488]+1,e=0|Zn[o[8290]](16,16),o[e+12>>2]=0,w[e+8>>2]=f,w[e+4>>2]=r,w[e>>2]=A,0|e},function(A,r,f,e){return A|=0,r=m(r),f=m(f),e=m(e),0|Zn[0|A](r,f,e)},Ci,Yi,Vi,function(A,r,f,e){A|=0,r=m(r),f=m(f),e=m(e),o[A+12>>2]=0,w[A+8>>2]=e,w[A+4>>2]=f,w[A>>2]=r},function(A,r,f,e,i){A|=0,r|=0,f=m(f),e=m(e),i=m(i),Zn[0|A](r,f,e,i)},function(A,r,f,e){var i;return A=m(A),r=m(r),f=m(f),e=m(e),i=xe(16),w[i+12>>2]=e,w[i+8>>2]=f,w[i+4>>2]=r,w[i>>2]=A,0|i},function(A,r,f,e,i){return A|=0,r=m(r),f=m(f),e=m(e),i=m(i),0|Zn[0|A](r,f,e,i)},Ci,Yi,Vi,function(A){return m(w[12+(A|=0)>>2])},je,function(A,r,f,e,i,n){A|=0,r|=0,f=m(f),e=m(e),i=m(i),n=m(n),Zn[0|A](r,f,e,i,n)},function(){var A;return A=xe(64),o[A+4>>2]=0,o[A+8>>2]=0,o[A>>2]=1065353216,o[A+12>>2]=0,o[A+16>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+20>>2]=1065353216,o[A+32>>2]=0,o[A+36>>2]=0,o[A+44>>2]=0,o[A+48>>2]=0,o[A+40>>2]=1065353216,o[A+52>>2]=0,o[A+56>>2]=0,o[A+60>>2]=0,0|A},function(A){return 0|Zn[0|(A|=0)]()},function(A){o[4+(A|=0)>>2]=0,o[A+8>>2]=0,o[A>>2]=1065353216,o[A+12>>2]=0,o[A+16>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[A+20>>2]=1065353216,o[A+32>>2]=0,o[A+36>>2]=0,o[A+44>>2]=0,o[A+48>>2]=0,o[A+40>>2]=1065353216,o[A+52>>2]=0,o[A+56>>2]=0,o[A+60>>2]=0},function(A,r){A|=0,r|=0;var f=m(0),e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0);e=w[r+12>>2],t=w[r+8>>2],f=w[r>>2],n=w[r+4>>2],o[A+44>>2]=0,o[A+28>>2]=0,o[A+12>>2]=0,i=m(m(2)/m(m(e*e)+m(m(t*t)+m(m(f*f)+m(n*n))))),c=m(t*i),a=m(n*c),u=m(f*i),l=m(e*u),w[A+36>>2]=a+l,s=m(f*c),i=m(n*i),b=m(e*i),w[A+32>>2]=s-b,w[A+24>>2]=a-l,a=m(f*i),e=m(e*c),w[A+16>>2]=a+e,w[A+8>>2]=s+b,w[A+4>>2]=a-e,f=m(f*u),e=m(n*i),w[A+40>>2]=m(1)-m(f+e),b=f,f=m(t*c),w[A+20>>2]=m(1)-m(b+f),w[A>>2]=m(1)-m(e+f)},rn,function(A,r){return rf(A|=0,r|=0),0|r},function(A,r,f){return r|=0,f|=0,0|Zn[0|(A|=0)](r,f)},function(A,r){return rf(A|=0,r|=0),A+48|0},li,function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+12>>2]](A,r)},function(A,r,f){var e;r|=0,f|=0,o[4+(A|=0)>>2]=r,r=o[f+12>>2],o[A+16>>2]=o[f+8>>2],o[A+20>>2]=r,r=o[f+4>>2],o[A+8>>2]=o[f>>2],o[A+12>>2]=r,r=o[f+28>>2],o[A+32>>2]=o[f+24>>2],o[A+36>>2]=r,r=o[f+20>>2],o[A+24>>2]=o[f+16>>2],o[A+28>>2]=r,r=o[f+36>>2],o[A+40>>2]=o[f+32>>2],o[A+44>>2]=r,r=o[f+44>>2],o[A+48>>2]=o[f+40>>2],o[A+52>>2]=r,e=o[f+60>>2],o[(r=A- -64|0)>>2]=o[f+56>>2],o[r+4>>2]=e,r=o[f+52>>2],o[A+56>>2]=o[f+48>>2],o[A+60>>2]=r},ti,Ui,function(A,r){return r|=0,o[o[12+(A|=0)>>2]+(r<<2)>>2]},function(A,r){return r|=0,o[12+(A|=0)>>2]+(r<<4)|0},function(){var A,r=0,f=0,e=0,i=0;return S=A=S-16|0,v[35848]||(o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,S=r=S-144|0,f=Qr(35172),o[f>>2]=24120,a[f+560|0]=1,o[f+556>>2]=0,o[f+548>>2]=0,o[f+552>>2]=0,o[r+72>>2]=0,o[r+4>>2]=0,w[r>>2]=0,e=o[A+12>>2],o[r+84>>2]=o[A+8>>2],o[r+88>>2]=e,i=o[A>>2],e=o[A+4>>2],o[r+20>>2]=0,o[r+24>>2]=0,o[r+12>>2]=0,o[r+16>>2]=0,o[r+28>>2]=1065353216,o[r+40>>2]=0,o[r+44>>2]=0,o[r+32>>2]=0,o[r+36>>2]=0,o[r+48>>2]=1065353216,o[r+52>>2]=0,o[r+56>>2]=0,o[r+60>>2]=0,o[r+64>>2]=0,o[r+68>>2]=0,o[r+76>>2]=i,o[r+80>>2]=e,o[r+136>>2]=1008981770,o[r+140>>2]=1008981770,o[r+128>>2]=1000593162,o[r+132>>2]=1008981770,a[r+124|0]=0,o[r+116>>2]=1061997773,o[r+120>>2]=1065353216,o[r+108>>2]=0,o[r+112>>2]=0,o[r+100>>2]=1056964608,o[r+104>>2]=0,o[r+92>>2]=0,o[r+96>>2]=0,o[r+8>>2]=1065353216,RA(f,r),S=r+144|0,a[35848]=1),o[A+8>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=0,Nf(35172,m(0),A),S=A+16|0,35172},function(A){return m(w[40+(A|=0)>>2])},function(A,r){A|=0,r=m(r),w[A+40>>2]=r},function(A,r){A|=0,r=m(r),w[A+16>>2]=r},function(A,r,f,e){return A|=0,r|=0,f|=0,e|=0,o[8488]=o[8488]+1,A=ne(0|Zn[o[8290]](768,16),4,A,r),o[A>>2]=23676,r=o[f+12>>2],o[A+560>>2]=o[f+8>>2],o[A+564>>2]=r,r=o[f+4>>2],o[A+552>>2]=o[f>>2],o[A+556>>2]=r,r=o[f+28>>2],o[A+576>>2]=o[f+24>>2],o[A+580>>2]=r,r=o[f+20>>2],o[A+568>>2]=o[f+16>>2],o[A+572>>2]=r,r=o[f+44>>2],o[A+592>>2]=o[f+40>>2],o[A+596>>2]=r,r=o[f+36>>2],o[A+584>>2]=o[f+32>>2],o[A+588>>2]=r,r=o[f+60>>2],o[A+608>>2]=o[f+56>>2],o[A+612>>2]=r,r=o[f+52>>2],o[A+600>>2]=o[f+48>>2],o[A+604>>2]=r,r=o[e+12>>2],o[A+624>>2]=o[e+8>>2],o[A+628>>2]=r,r=o[e+4>>2],o[A+616>>2]=o[e>>2],o[A+620>>2]=r,r=o[e+20>>2],o[A+632>>2]=o[e+16>>2],o[A+636>>2]=r,r=o[e+28>>2],o[A+640>>2]=o[e+24>>2],o[A+644>>2]=r,r=o[e+36>>2],o[A+648>>2]=o[e+32>>2],o[A+652>>2]=r,r=o[e+44>>2],o[A+656>>2]=o[e+40>>2],o[A+660>>2]=r,r=o[e+52>>2],o[A+664>>2]=o[e+48>>2],o[A+668>>2]=r,r=o[e+60>>2],o[A+672>>2]=o[e+56>>2],o[A+676>>2]=r,o[A+688>>2]=0,o[A+692>>2]=-1082130432,o[A+696>>2]=1063675494,o[A+700>>2]=1050253722,o[A+704>>2]=1065353216,o[A+708>>2]=0,o[A+712>>2]=0,a[A+716|0]=0,a[A+740|0]=0,o[A+736>>2]=16777216,o[A+764>>2]=0,o[A+756>>2]=0,o[A+760>>2]=0,o[A+748>>2]=0,o[A+752>>2]=0,w[A+732>>2]=1,0|A},function(A,r,f,e,i){return r|=0,f|=0,e|=0,i|=0,0|Zn[0|(A|=0)](r,f,e,i)},function(A,r,f){A|=0,f|=0;var e=0;e=o[4+(r|=0)>>2],o[A+552>>2]=o[r>>2],o[A+556>>2]=e,e=o[r+12>>2],o[A+560>>2]=o[r+8>>2],o[A+564>>2]=e,e=o[r+28>>2],o[A+576>>2]=o[r+24>>2],o[A+580>>2]=e,e=o[r+20>>2],o[A+568>>2]=o[r+16>>2],o[A+572>>2]=e,e=o[r+44>>2],o[A+592>>2]=o[r+40>>2],o[A+596>>2]=e,e=o[r+36>>2],o[A+584>>2]=o[r+32>>2],o[A+588>>2]=e,e=o[r+60>>2],o[A+608>>2]=o[r+56>>2],o[A+612>>2]=e,e=o[r+52>>2],o[A+600>>2]=o[r+48>>2],o[A+604>>2]=e,r=o[f+12>>2],o[A+624>>2]=o[f+8>>2],o[A+628>>2]=r,r=o[f+4>>2],o[A+616>>2]=o[f>>2],o[A+620>>2]=r,r=o[f+20>>2],o[A+632>>2]=o[f+16>>2],o[A+636>>2]=r,r=o[f+28>>2],o[A+640>>2]=o[f+24>>2],o[A+644>>2]=r,r=o[f+36>>2],o[A+648>>2]=o[f+32>>2],o[A+652>>2]=r,r=o[f+44>>2],o[A+656>>2]=o[f+40>>2],o[A+660>>2]=r,r=o[f+60>>2],o[A+672>>2]=o[f+56>>2],o[A+676>>2]=r,r=o[f+52>>2],o[A+664>>2]=o[f+48>>2],o[A+668>>2]=r,Zn[o[o[A>>2]+8>>2]](A)},function(A,r,f,e,i,n){A|=0,r=m(r),f=m(f),e=m(e),i=m(i),n=m(n),f=m(m(f-r)*m(.5)),w[A+692>>2]=f,(r=af(m(f+r)))m(3.1415927410125732)&&(r=m(r+m(-6.2831854820251465))),w[A+704>>2]=n,w[A+700>>2]=i,w[A+696>>2]=e,w[A+688>>2]=r},function(A,r,f,e,i,n,a){A|=0,r|=0,f=m(f),e=m(e),i=m(i),n=m(n),a=m(a),Zn[0|A](r,f,e,i,n,a)},function(A,r){r|=0,a[737+(A|=0)|0]=r},vi,function(A,r){r|=0,a[736+(A|=0)|0]=r},function(A,r){A|=0,r=m(r),w[A+684>>2]=r},function(A,r,f){A|=0,r=m(r),f=m(f);var e,i,n,a,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0);if(S=n=S-16|0,w[n+12>>2]=r,(t=w[A+692>>2])>m(0)&&(c=w[A+688>>2],(r=af(m(w[n+12>>2]-c)))m(3.1415927410125732)&&(r=m(r+m(-6.2831854820251465))),!(!(m(-t)>r)&r<=t))){A:if(r>m(0)){if((r=af(m(t+c)))m(3.1415927410125732)))break A;r=m(r+m(-6.2831854820251465))}else(r=af(m(c-t)))m(3.1415927410125732)&&(r=m(r+m(-6.2831854820251465)));w[n+12>>2]=r}e=o[A+32>>2],r=w[A+652>>2],t=w[A+620>>2],c=w[A+636>>2],k=m(m(w[e+44>>2]*r)+m(m(w[e+36>>2]*t)+m(c*w[e+40>>2]))),i=o[A+28>>2],d=w[i+44>>2],b=w[A+584>>2],v=w[i+36>>2],u=w[A+552>>2],l=w[A+568>>2],h=w[i+40>>2],W=m(k*m(m(d*b)+m(m(v*u)+m(l*h)))),B=m(m(w[e+12>>2]*r)+m(m(w[e+4>>2]*t)+m(c*w[e+8>>2]))),Z=w[i+12>>2],G=w[i+4>>2],Q=w[i+8>>2],N=m(B*m(m(Z*b)+m(m(G*u)+m(l*Q)))),E=w[i+28>>2],s=m(E*b),b=w[i+20>>2],p=m(b*u),u=w[i+24>>2],s=m(s+m(p+m(l*u))),l=m(m(w[e+28>>2]*r)+m(m(w[e+20>>2]*t)+m(c*w[e+24>>2]))),r=w[A+588>>2],t=w[A+556>>2],c=w[A+572>>2],a=A,F=m(m(w[n+12>>2]-m(zr(m(W+m(N+m(s*l))),m(m(k*m(m(d*r)+m(m(v*t)+m(h*c))))+m(m(B*m(m(Z*r)+m(m(G*t)+m(Q*c))))+m(m(m(E*r)+m(m(b*t)+m(u*c)))*l))))*w[A+732>>2]))/f),w[a+680>>2]=F,S=n+16|0},function(A,r,f,e){A|=0,r|=0,f=m(f),e=m(e),Zn[0|A](r,f,e)},function(A,r){A|=0,r=m(r),w[A+680>>2]=r},function(A,r,f,e){return A|=0,r|=0,f|=0,e|=0,o[8488]=o[8488]+1,A=ne(0|Zn[o[8290]](360,16),3,A,r),o[A>>2]=23764,r=o[f+4>>2],o[A+300>>2]=o[f>>2],o[A+304>>2]=r,r=o[f+12>>2],o[A+308>>2]=o[f+8>>2],o[A+312>>2]=r,r=o[e+4>>2],o[A+316>>2]=o[e>>2],o[A+320>>2]=r,r=o[e+12>>2],o[A+324>>2]=o[e+8>>2],o[A+328>>2]=r,o[A+356>>2]=0,o[A+348>>2]=1050253722,o[A+352>>2]=1065353216,a[A+344|0]=0,o[A+332>>2]=0,0|A},function(A,r){A|=0;var f=0;f=o[4+(r|=0)>>2],o[A+300>>2]=o[r>>2],o[A+304>>2]=f,f=o[r+12>>2],o[A+308>>2]=o[r+8>>2],o[A+312>>2]=f},function(A,r){A|=0;var f=0;f=o[4+(r|=0)>>2],o[A+316>>2]=o[r>>2],o[A+320>>2]=f,f=o[r+12>>2],o[A+324>>2]=o[r+8>>2],o[A+328>>2]=f},function(A,r,f,e){return A|=0,r|=0,f|=0,e|=0,o[8488]=o[8488]+1,A=VA(0|Zn[o[8290]](1460,16),A,r,f,e,0),o[A>>2]=23432,o[A+968>>2]=0,o[A+972>>2]=0,o[A+680>>2]=0,o[A+684>>2]=0,o[(r=A+1144|0)>>2]=0,o[r+4>>2]=0,o[(r=A+1056|0)>>2]=0,o[r+4>>2]=0,o[A+688>>2]=0,o[A+692>>2]=0,o[A+696>>2]=0,o[A+700>>2]=0,o[A+704>>2]=0,o[A+708>>2]=0,0|A},Ur,function(A,r,f,e,i){return A|=0,r|=0,f|=0,e|=0,i|=0,o[8488]=o[8488]+1,0|VA(0|Zn[o[8290]](1460,16),A,r,f,e,i)},function(A,r,f,e,i,n){return r|=0,f|=0,e|=0,i|=0,n|=0,0|Zn[0|(A|=0)](r,f,e,i,n)},Ur,function(A,r,f,e){if(A|=0,r|=0,f=m(f),e=m(e),(0|r)<=2)return w[696+(A=(r<<2)+A|0)>>2]=e,void(w[A+680>>2]=f);(f=af(f))m(3.1415927410125732)&&(f=m(f+m(-6.2831854820251465))),(e=af(e))m(3.1415927410125732)&&(e=m(e+m(-6.2831854820251465))),A=G(r,88)+A|0,w[A+708>>2]=e,w[A+704>>2]=f},function(A,r,f,e,i){A|=0,r|=0,f|=0,e=m(e),i=m(i),Zn[0|A](r,f,e,i)},function(A,r,f){A|=0,f|=0,(0|(r|=0))<=2?a[798+(A+r|0)|0]=f:a[752+(G(r,88)+A|0)|0]=f},ti,function(A,r,f){A|=0,r|=0,f=m(f),(0|r)<=2?(w[140+((A=A+680|0)+(r<<2)|0)>>2]=f,a[156+(A+r|0)|0]=1):(A=G(r,88)+A|0,a[A+760|0]=1,w[A+756>>2]=f)},function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e),Zn[0|A](r,f,e)},function(A,r,f){A|=0,r|=0,f=m(f),(0|r)<=2?(w[160+((A=A+680|0)+(r<<2)|0)>>2]=f,a[176+(A+r|0)|0]=1):(A=G(r,88)+A|0,a[A+768|0]=1,w[A+764>>2]=f)},function(A,r,f){A|=0,r|=0,f=m(f),w[712+((0|r)<3?(r<<2)+A|0:G(r,88)+A|0)>>2]=f},function(A,r,f){A|=0,r|=0,f=m(f),w[((0|r)<3?860+((r<<2)+A|0):772+(G(r,88)+A|0))>>2]=f},function(A,r,f){A|=0,f|=0,(0|(r|=0))<=2?a[792+(A+r|0)|0]=f:a[732+(G(r,88)+A|0)|0]=f},function(A,r,f){A|=0,r|=0,f=m(f),w[((0|r)<3?892+((r<<2)+A|0):740+(G(r,88)+A|0))>>2]=f},function(A,r,f){A|=0,r|=0,f=m(f),w[((0|r)<3?876+((r<<2)+A|0):736+(G(r,88)+A|0))>>2]=f},function(A,r,f){A|=0,f|=0,(0|(r|=0))<=2?a[795+(A+r|0)|0]=f:a[744+(G(r,88)+A|0)|0]=f},function(A,r,f){A|=0,r|=0,f=m(f);var e=m(0);(0|r)<=2?w[804+((r<<2)+A|0)>>2]=f:(A=G(r,88)+A|0,f=m(f+m(3.1415927410125732)),f=m(m(m(W(m(f/m(6.2831854820251465))))*m(-6.2831854820251465))+f),e=m(0),f>=m(6.2831854820251465)||(e=f,f>2]=e+m(-3.1415927410125732))},function(A){return 31==o[4+(A|=0)>>2]|0},Bi,function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+24>>2]](A,r)},function(A,r,f){A|=0,r=m(r),f|=0,Zn[o[o[A>>2]+32>>2]](A,r,f)},function(A,r,f,e){A|=0,r|=0,f=m(f),e|=0,Zn[0|A](r,f,e)},qe,Ai,function(A,r){A|=0,r=m(r),Zn[o[o[A>>2]+44>>2]](A,r)},Fi,function(A,r){r|=0,o[8+(A|=0)>>2]=r},function(){return v[33816]||(o[8447]=0,o[8448]=0,o[8445]=35,o[8446]=0,o[8449]=0,o[8444]=20276,o[8445]=27,o[8444]=20384,a[33816]=1),33776},$i,function(A){return A|=0,o[8488]=o[8488]+1,0|tf(0|Zn[o[8290]](64,16),A)},function(A,r){A|=0,r|=0;var f,e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0);e=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(Zn[o[o[A>>2]+48>>2]](A)),n=m(Zn[o[o[A>>2]+48>>2]](A)),a=w[r>>2],t=w[r+4>>2],c=w[r+8>>2],o[A+48>>2]=0,w[A+44>>2]=m(c*w[A+28>>2])-n,w[A+40>>2]=m(t*w[A+24>>2])-i,w[A+36>>2]=m(a*w[A+20>>2])-e,f=(e=w[r>>2])<(i=w[r+4>>2]),e=m(w[((w[r+8>>2]>(f?e:i)?!f:2)<<2)+r>>2]*m(.10000000149011612)),m(Zn[o[o[A>>2]+48>>2]](A))>e&&Zn[o[o[A>>2]+44>>2]](A,e)},function(A){var r;return A=m(A),o[8488]=o[8488]+1,r=ae(0|Zn[o[8290]](60,16)),o[r+32>>2]=0,o[r+36>>2]=0,o[r+20>>2]=1065353216,o[r+24>>2]=1065353216,o[r+4>>2]=8,o[r>>2]=21520,o[r+56>>2]=0,w[r+52>>2]=A,o[r+28>>2]=1065353216,o[r+40>>2]=0,o[r+44>>2]=0,o[r+48>>2]=0,w[r+36>>2]=A,0|r},function(A,r){return A|=0,r=m(r),0|Zn[0|A](r)},function(A,r){A|=0,r=m(r),w[A+52>>2]=r,w[A+36>>2]=r},function(A){A|=0;var r,f,e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);return o[8488]=o[8488]+1,r=ae(0|Zn[o[8290]](64,16)),o[r+60>>2]=1,o[r>>2]=20140,i=w[A>>2],n=w[A+4>>2],e=w[A+8>>2],o[r+48>>2]=0,a=m(e*w[r+28>>2]),e=w[r+52>>2],w[r+44>>2]=a-e,w[r+40>>2]=m(n*w[r+24>>2])-e,w[r+36>>2]=m(i*w[r+20>>2])-e,n=e,f=(e=w[A>>2])<(i=w[A+4>>2]),n>(e=m(w[((w[A+8>>2]>(f?e:i)?!f:2)<<2)+A>>2]*m(.10000000149011612)))&&(i=w[r+52>>2],n=m(Zn[o[o[r>>2]+48>>2]](r)),a=m(Zn[o[o[r>>2]+48>>2]](r)),w[r+52>>2]=e,e=w[r+44>>2],t=w[r+36>>2],c=w[r+40>>2],b=m(Zn[o[o[r>>2]+48>>2]](r)),u=m(Zn[o[o[r>>2]+48>>2]](r)),l=m(Zn[o[o[r>>2]+48>>2]](r)),o[r+48>>2]=0,w[r+40>>2]=m(n+c)-u,w[r+36>>2]=m(i+t)-b,w[r+44>>2]=m(a+e)-l),o[r+4>>2]=13,0|r},function(A,r,f,e){A|=0,r=m(r),f=m(f),e|=0;var i=m(0),n=m(0);o[A+20>>2]=1065353216,o[A+24>>2]=1065353216,o[A+60>>2]=e,o[A+28>>2]=1065353216,o[A+32>>2]=0,n=r,i=f;A:{switch(0|e){case 0:n=f,i=r;break A;case 1:break A}i=r,r=f}w[A+36>>2]=n,o[A+48>>2]=0,w[A+44>>2]=r,w[A+40>>2]=i,r=m(Zn[o[o[A>>2]+48>>2]](A)),f=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(Zn[o[o[A>>2]+48>>2]](A)),w[A+36>>2]=w[A+36>>2]-r,w[A+40>>2]=w[A+40>>2]-f,w[A+44>>2]=w[A+44>>2]-i},function(A,r,f,e,i){A|=0,r|=0,f=m(f),e=m(e),i|=0,Zn[0|A](r,f,e,i)},function(A,r){return A=m(A),r=m(r),o[8488]=o[8488]+1,0|Ve(0|Zn[o[8290]](64,16),A,r)},function(A,r,f){return A|=0,r=m(r),f=m(f),0|Zn[0|A](r,f)},function(A,r,f,e){A|=0,r=m(r),f=m(f),e|=0;var i=m(0),n=m(0);o[A+20>>2]=1065353216,o[A+24>>2]=1065353216,o[A+60>>2]=e,o[A+28>>2]=1065353216,o[A+32>>2]=0,n=r,i=f;A:{switch(0|e){case 0:n=f,i=r;break A;case 1:break A}i=r,r=f}w[A+36>>2]=n,o[A+48>>2]=0,w[A+44>>2]=r,w[A+40>>2]=i,w[A+52>>2]=w[(A+36|0)+((e+2|0)%3<<2)>>2]},function(A,r){var f;return A=m(A),r=m(r),o[8488]=o[8488]+1,f=ae(0|Zn[o[8290]](84,16)),w[f+68>>2]=r,w[f+64>>2]=A,o[f>>2]=19512,o[f+72>>2]=0,o[f+76>>2]=1,o[f+4>>2]=11,w[f+36>>2]=A,o[f+80>>2]=2,w[f+44>>2]=A,w[f+40>>2]=r,w[f+60>>2]=A/m(N(m(m(A*A)+m(r*r)))),0|f},function(A,r){A|=0,r=m(r),w[A+64>>2]=r},function(A,r){A|=0,r=m(r),w[A+68>>2]=r},function(A,r){A|=0;var f=0,e=0;A:{switch(0|(r|=0)){default:e=o[A+76>>2],f=o[A+72>>2],r=o[A+80>>2];break A;case 0:o[A+72>>2]=1,o[A+76>>2]=0,o[A+80>>2]=2,f=1,r=2;break A;case 1:o[A+72>>2]=0,o[A+76>>2]=1,o[A+80>>2]=2,e=1,r=2;break A;case 2:}o[A+72>>2]=0,o[A+76>>2]=2,o[A+80>>2]=1,e=2,r=1}w[(f<<2)+(f=A+36|0)>>2]=w[A+64>>2],w[f+(e<<2)>>2]=w[A+68>>2],w[f+(r<<2)>>2]=w[A+64>>2]},function(A,r){A|=0,r=m(r);var f,e=m(0),i=m(0),n=m(0),a=m(0);return o[8488]=o[8488]+1,f=0|Zn[o[8290]](92,16),o[f+12>>2]=0,o[f+16>>2]=0,o[f+4>>2]=35,o[f+8>>2]=0,o[f+20>>2]=0,o[f>>2]=20276,o[f>>2]=21648,e=w[A+8>>2],i=w[A>>2],n=w[A+4>>2],a=w[A+12>>2],o[f+84>>2]=1065353216,o[f+88>>2]=0,o[f+76>>2]=1065353216,o[f+80>>2]=1065353216,w[f+72>>2]=r,w[f+68>>2]=a,o[f+4>>2]=28,r=m(m(1)/m(N(m(m(e*e)+m(m(i*i)+m(n*n)))))),w[f- -64>>2]=e*r,w[f+60>>2]=n*r,w[f+56>>2]=i*r,0|f},function(A,r,f){return A|=0,r|=0,f=m(f),0|Zn[0|A](r,f)},function(A){return 56+(A|=0)|0},function(A,r){A|=0,r=m(r),w[A+72>>2]=r},function(A,r,f,e,i,n){A|=0,r|=0,f|=0,e=m(e),i=m(i),n=m(n);var t,c=m(0);return o[8488]=o[8488]+1,t=0|Zn[o[8290]](132,16),o[t+12>>2]=0,o[t+16>>2]=0,o[t+4>>2]=35,o[t+8>>2]=0,o[t+20>>2]=0,o[t>>2]=20276,o[t>>2]=20488,o[t+116>>2]=1065353216,o[t+120>>2]=1065353216,o[t+112>>2]=1,a[t+109|0]=0,a[t+110|0]=0,a[t+108|0]=0,o[t+104>>2]=0,o[t+100>>2]=f,w[t+96>>2]=e,w[t+84>>2]=n,w[t+80>>2]=i,o[t+76>>2]=r,o[t+72>>2]=A,o[t+4>>2]=24,o[t+124>>2]=1065353216,o[t+128>>2]=0,e=m(r-1|0),w[t+92>>2]=e,c=m(A-1|0),w[t+88>>2]=c,w[t+40>>2]=c,o[t+24>>2]=0,o[t+52>>2]=0,w[t+48>>2]=e,w[t+44>>2]=n,o[t+32>>2]=0,o[t+36>>2]=0,w[t+28>>2]=i,o[t+68>>2]=0,w[t- -64>>2]=m(e+m(0))*m(.5),w[t+60>>2]=m(i+n)*m(.5),w[t+56>>2]=m(c+m(0))*m(.5),0|t},function(A,r,f,e,i,n,a){return A|=0,r|=0,f|=0,e|=0,i=m(i),n=m(n),a=m(a),0|Zn[0|A](r,f,e,i,n,a)},function(){var A,r,f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0;if(o[8488]=o[8488]+1,A=0|Zn[o[8290]](172,16),o[A+4>>2]=1065353216,o[A+8>>2]=1065353216,o[A+48>>2]=0,a[A+36|0]=1,o[A+12>>2]=1065353216,o[A+16>>2]=0,o[A+32>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,a[A+100|0]=1,o[A>>2]=22164,o[A+96>>2]=0,a[A+120|0]=1,o[A+88>>2]=0,o[A+92>>2]=0,o[A+116>>2]=0,a[A+140|0]=1,o[A+108>>2]=0,o[A+112>>2]=0,o[A+136>>2]=0,a[A+160|0]=1,o[A+128>>2]=0,o[A+132>>2]=0,o[A+168>>2]=0,a[A+164|0]=1,o[A+148>>2]=0,o[A+152>>2]=0,o[A+156>>2]=0,a[A+165|0]=1,o[8488]=o[8488]+1,t=0|Zn[o[8290]](32,16),!((0|(r=o[A+24>>2]))<=0)){if(1!=(0|r))for(u=-2&r;e=t+(n=i<<5)|0,f=o[A+32>>2]+n|0,c=o[f+4>>2],o[e>>2]=o[f>>2],o[e+4>>2]=c,c=o[f+28>>2],o[e+24>>2]=o[f+24>>2],o[e+28>>2]=c,c=o[f+20>>2],o[e+16>>2]=o[f+16>>2],o[e+20>>2]=c,c=o[f+12>>2],o[e+8>>2]=o[f+8>>2],o[e+12>>2]=c,e=(f=32|n)+t|0,f=f+o[A+32>>2]|0,n=o[f+4>>2],o[e>>2]=o[f>>2],o[e+4>>2]=n,n=o[f+12>>2],o[e+8>>2]=o[f+8>>2],o[e+12>>2]=n,n=o[f+20>>2],o[e+16>>2]=o[f+16>>2],o[e+20>>2]=n,n=o[f+28>>2],o[e+24>>2]=o[f+24>>2],o[e+28>>2]=n,i=i+2|0,(0|(b=b+2|0))!=(0|u););1&r&&(i=(f=i<<5)+t|0,f=f+o[A+32>>2]|0,e=o[f+4>>2],o[i>>2]=o[f>>2],o[i+4>>2]=e,e=o[f+28>>2],o[i+24>>2]=o[f+24>>2],o[i+28>>2]=e,e=o[f+20>>2],o[i+16>>2]=o[f+16>>2],o[i+20>>2]=e,e=o[f+12>>2],o[i+8>>2]=o[f+8>>2],o[i+12>>2]=e)}return!(f=o[A+32>>2])||!f|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+32>>2]=t,a[A+36|0]=1,o[A+28>>2]=1,f=t+(o[A+24>>2]<<5)|0,o[f+24>>2]=2,o[f+28>>2]=0,o[f+16>>2]=0,o[f+20>>2]=16,o[f+8>>2]=12,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,o[A+24>>2]=o[A+24>>2]+1,e=v[A+164|0],t=o[(e?A+128:A+148)>>2],f=o[A+32>>2],o[f+24>>2]=e?2:3,o[f+4>>2]=0,i=12,o[f+8>>2]=e?12:6,o[f>>2]=(0|t)/3,v[A+165|0]?(i=16,e=o[A+88>>2]):e=o[A+108>>2]/3|0,o[f+20>>2]=i,o[f+16>>2]=0,o[f+12>>2]=e,0|A},function(A,r,f,e,i){var n;r|=0,f|=0,e|=0,i|=0,n=o[32+(A|=0)>>2],o[n>>2]=o[n>>2]+1,sr(A,GA(A,r,i)),sr(A,GA(A,f,i)),sr(A,GA(A,e,i))},Oe,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=0,t=0;return o[8488]=o[8488]+1,i=0|Zn[o[8290]](84,16),S=e=S-48|0,o[i+12>>2]=0,o[i+16>>2]=0,o[i+4>>2]=35,o[i+8>>2]=0,o[i+20>>2]=0,o[i>>2]=20276,o[i+56>>2]=A,o[i>>2]=22264,o[i+4>>2]=21,0|Zn[o[o[A>>2]+40>>2]](A)?Zn[o[o[A>>2]+48>>2]](A,i+24|0,i+40|0):(o[e+44>>2]=0,o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=1065353216,t=e+16|0,A=e+32|0,Zn[o[o[i>>2]+68>>2]](t,i,A),w[i+40>>2]=w[e+16>>2]+w[i+20>>2],o[e+32>>2]=-1082130432,Zn[o[o[i>>2]+68>>2]](e,i,A),n=o[e+12>>2],o[e+24>>2]=o[e+8>>2],o[e+28>>2]=n,n=o[e+4>>2],o[e+16>>2]=o[e>>2],o[e+20>>2]=n,w[i+24>>2]=w[e+16>>2]-w[i+20>>2],o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+36>>2]=1065353216,Zn[o[o[i>>2]+68>>2]](t,i,A),w[i+44>>2]=w[e+20>>2]+w[i+20>>2],o[e+36>>2]=-1082130432,Zn[o[o[i>>2]+68>>2]](e,i,A),n=o[e+12>>2],o[e+24>>2]=o[e+8>>2],o[e+28>>2]=n,n=o[e+4>>2],o[e+16>>2]=o[e>>2],o[e+20>>2]=n,w[i+28>>2]=w[e+20>>2]-w[i+20>>2],o[e+40>>2]=0,o[e+44>>2]=0,o[e+40>>2]=1065353216,o[e+32>>2]=0,o[e+36>>2]=0,Zn[o[o[i>>2]+68>>2]](t,i,A),w[i+48>>2]=w[e+24>>2]+w[i+20>>2],o[e+40>>2]=-1082130432,Zn[o[o[i>>2]+68>>2]](e,i,A),A=o[e+12>>2],o[e+24>>2]=o[e+8>>2],o[e+28>>2]=A,A=o[e+4>>2],o[e+16>>2]=o[e>>2],o[e+20>>2]=A,w[i+32>>2]=w[e+24>>2]-w[i+20>>2]),S=e+48|0,a[i+69|0]=0,a[i+68|0]=r,o[i+60>>2]=0,o[i+64>>2]=0,o[i>>2]=18648,o[i+4>>2]=21,f&&(o[8488]=o[8488]+1,A=Gi(0|Zn[o[8290]](172,16)),o[i+60>>2]=A,lA(A,o[i+56>>2],v[i+68|0],i+24|0,i+40|0),a[i+69|0]=1),0|i},fi,Ji,function(A,r,f,e,i){var n;A|=0,r|=0,f=m(f),e=m(e),i=m(i),S=n=S-16|0,o[n+12>>2]=0,w[n+8>>2]=i,w[n+4>>2]=e,w[n>>2]=f,a[A+69|0]=0,o[A+60>>2]=r,r=0|Zn[o[o[A>>2]+28>>2]](A),f=m(w[r+8>>2]-w[n+8>>2]),e=m(f*f),f=m(w[r>>2]-w[n>>2]),i=m(f*f),f=m(w[r+4>>2]-w[n+4>>2]),m(e+m(i+m(f*f)))>m(1.1920928955078125e-7)&&Nr(A,n),S=n+16|0},function(A,r,f,e,i,n){A|=0,r|=0,f|=0,e=m(e),i=m(i),n=m(n),Zn[0|A](r,f,e,i,n)},function(A,r,f,e){A|=0,r=m(r),f=m(f),e=m(e);var i,n,a=0;return S=n=S-16|0,o[8488]=o[8488]+1,i=0|Zn[o[8290]](44,16),o[n+12>>2]=0,w[n+8>>2]=e,w[n+4>>2]=f,w[n>>2]=r,o[i+12>>2]=0,o[i+16>>2]=0,o[i+4>>2]=35,o[i+8>>2]=0,o[i+20>>2]=0,o[i>>2]=20276,o[i>>2]=21340,a=o[n+4>>2],o[i+24>>2]=o[n>>2],o[i+28>>2]=a,a=o[n+12>>2],o[i+32>>2]=o[n+8>>2],o[i+36>>2]=a,o[i+40>>2]=A,o[i+4>>2]=22,S=n+16|0,0|i},function(A,r,f,e,i){return A|=0,r|=0,f=m(f),e=m(e),i=m(i),0|Zn[0|A](r,f,e,i)},function(A){var r;return A|=0,o[8488]=o[8488]+1,r=Ae(0|Zn[o[8290]](104,16)),o[r+100>>2]=A,o[r>>2]=19904,o[r+4>>2]=3,vf(r),0|r},function(){var A;return o[8488]=o[8488]+1,A=Ae(0|Zn[o[8290]](168,16)),o[A+100>>2]=0,o[A>>2]=21760,o[A+4>>2]=2,0|A},function(A,r){r|=0;var f=0,e=0;f=o[100+(A|=0)>>2],o[A+100>>2]=f+1,e=o[r+12>>2],o[112+(f=(f<<4)+A|0)>>2]=o[r+8>>2],o[f+116>>2]=e,e=o[r+4>>2],o[f+104>>2]=o[r>>2],o[f+108>>2]=e,vf(A)},function(){var A,r=0,f=0,e=0,i=0,n=0;if(o[8488]=o[8488]+1,A=Af(0|Zn[o[8290]](100,16),0,100),o[(r=A)+12>>2]=0,o[r+16>>2]=0,o[r+4>>2]=31,o[r+8>>2]=0,o[r+80>>2]=0,o[r+84>>2]=1065353216,o[r+72>>2]=0,o[r+76>>2]=1,o[r+56>>2]=-581039253,o[r+60>>2]=-581039253,o[r+40>>2]=1566444395,o[r+44>>2]=1566444395,a[r+36|0]=1,o[r>>2]=19400,o[r+32>>2]=0,o[r+96>>2]=0,o[r+88>>2]=1065353216,o[r+92>>2]=1065353216,o[(r=r- -64|0)>>2]=-581039253,o[r+4>>2]=0,o[A+48>>2]=1566444395,o[A+52>>2]=0,o[A+24>>2]=0,o[A+28>>2]=0,o[8488]=o[8488]+1,r=0|Zn[o[8290]](40,16),o[r+16>>2]=0,o[r+8>>2]=-1,o[r+12>>2]=0,o[r>>2]=0,o[r+4>>2]=0,o[r+32>>2]=0,a[r+36|0]=1,o[r+24>>2]=0,o[r+28>>2]=0,o[A+72>>2]=r,o[A+28>>2]<0){if((0|(n=o[A+24>>2]))>0)for(;f=(r=G(i,80))+o[A+32>>2]|0,e=o[f+4>>2],o[r>>2]=o[f>>2],o[r+4>>2]=e,e=o[f+12>>2],o[r+8>>2]=o[f+8>>2],o[r+12>>2]=e,e=o[f+28>>2],o[r+24>>2]=o[f+24>>2],o[r+28>>2]=e,e=o[f+20>>2],o[r+16>>2]=o[f+16>>2],o[r+20>>2]=e,e=o[f+44>>2],o[r+40>>2]=o[f+40>>2],o[r+44>>2]=e,e=o[f+36>>2],o[r+32>>2]=o[f+32>>2],o[r+36>>2]=e,e=o[f+60>>2],o[r+56>>2]=o[f+56>>2],o[r+60>>2]=e,e=o[f+52>>2],o[r+48>>2]=o[f+48>>2],o[r+52>>2]=e,e=o[f+68>>2],o[r+64>>2]=o[f+64>>2],o[r+68>>2]=e,e=o[f+76>>2],o[r+72>>2]=o[f+72>>2],o[r+76>>2]=e,(0|n)!=(0|(i=i+1|0)););!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+28>>2]=0}return o[A>>2]=31168,0|A},Mi,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=0,t=0,c=0,b=m(0),u=0,l=0,s=0,k=0,d=m(0);if(S=e=S-128|0,o[A+76>>2]=o[A+76>>2]+1,n=o[r+12>>2],o[e+72>>2]=o[r+8>>2],o[e+76>>2]=n,n=o[r+4>>2],o[e+64>>2]=o[r>>2],o[e+68>>2]=n,n=o[r+28>>2],o[e+88>>2]=o[r+24>>2],o[e+92>>2]=n,n=o[r+20>>2],o[e+80>>2]=o[r+16>>2],o[e+84>>2]=n,n=o[r+44>>2],o[e+104>>2]=o[r+40>>2],o[e+108>>2]=n,n=o[r+36>>2],o[e+96>>2]=o[r+32>>2],o[e+100>>2]=n,n=o[r+60>>2],o[e+120>>2]=o[r+56>>2],o[e+124>>2]=n,n=o[r+52>>2],o[e+112>>2]=o[r+48>>2],o[e+116>>2]=n,i=o[f+4>>2],d=m(Zn[o[o[f>>2]+48>>2]](f)),Zn[o[o[f>>2]+8>>2]](f,r,e+48|0,e+32|0),(b=w[e+48>>2])>2]&&(w[A+40>>2]=b),(b=w[e+32>>2])>w[A+56>>2]&&(w[A+56>>2]=b),(b=w[e+52>>2])>2]&&(w[A+44>>2]=b),(b=w[e+36>>2])>w[A+60>>2]&&(w[A+60>>2]=b),(b=w[e+56>>2])>2]&&(w[A+48>>2]=b),(b=w[e+40>>2])>w[A- -64>>2]&&(w[A+64>>2]=b),(r=o[A+72>>2])?(n=o[e+60>>2],o[e+8>>2]=o[e+56>>2],o[e+12>>2]=n,n=o[e+44>>2],o[e+24>>2]=o[e+40>>2],o[e+28>>2]=n,n=o[e+36>>2],o[e+16>>2]=o[e+32>>2],o[e+20>>2]=n,n=o[e+52>>2],o[e>>2]=o[e+48>>2],o[e+4>>2]=n,r=Gf(r,e,o[A+24>>2])):r=0,(0|(u=o[A+24>>2]))==o[A+28>>2]&&!((0|(l=u?u<<1:1))<=(0|u))){if(l&&(o[8488]=o[8488]+1,k=0|Zn[o[8290]](G(l,80),16),u=o[A+24>>2]),(0|u)>0)for(;t=(n=G(s,80))+k|0,n=n+o[A+32>>2]|0,c=o[n+4>>2],o[t>>2]=o[n>>2],o[t+4>>2]=c,c=o[n+12>>2],o[t+8>>2]=o[n+8>>2],o[t+12>>2]=c,c=o[n+28>>2],o[t+24>>2]=o[n+24>>2],o[t+28>>2]=c,c=o[n+20>>2],o[t+16>>2]=o[n+16>>2],o[t+20>>2]=c,c=o[n+44>>2],o[t+40>>2]=o[n+40>>2],o[t+44>>2]=c,c=o[n+36>>2],o[t+32>>2]=o[n+32>>2],o[t+36>>2]=c,c=o[n+60>>2],o[t+56>>2]=o[n+56>>2],o[t+60>>2]=c,c=o[n+52>>2],o[t+48>>2]=o[n+48>>2],o[t+52>>2]=c,c=o[n+68>>2],o[t+64>>2]=o[n+64>>2],o[t+68>>2]=c,c=o[n+76>>2],o[t+72>>2]=o[n+72>>2],o[t+76>>2]=c,(0|(s=s+1|0))!=(0|u););!(n=o[A+32>>2])||!n|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](n)),o[A+32>>2]=k,a[A+36|0]=1,o[A+28>>2]=l,u=o[A+24>>2]}t=o[e+68>>2],n=o[A+32>>2]+G(u,80)|0,o[n>>2]=o[e+64>>2],o[n+4>>2]=t,t=o[e+76>>2],o[n+8>>2]=o[e+72>>2],o[n+12>>2]=t,t=o[e+92>>2],o[n+24>>2]=o[e+88>>2],o[n+28>>2]=t,t=o[e+84>>2],o[n+16>>2]=o[e+80>>2],o[n+20>>2]=t,t=o[e+100>>2],o[n+32>>2]=o[e+96>>2],o[n+36>>2]=t,t=o[e+108>>2],o[n+40>>2]=o[e+104>>2],o[n+44>>2]=t,t=o[e+116>>2],o[n+48>>2]=o[e+112>>2],o[n+52>>2]=t,t=o[e+124>>2],o[n+56>>2]=o[e+120>>2],o[n+60>>2]=t,o[n+64>>2]=f,o[n+68>>2]=i,w[n+72>>2]=d,o[n+76>>2]=r,o[A+24>>2]=o[A+24>>2]+1,S=e+128|0},function(A,r){return r|=0,o[64+(o[32+(A|=0)>>2]+G(r,80)|0)>>2]},ui,function(A,r,f,e){r|=0,f|=0,e|=0;var i=0,n=0,a=0;a=o[32+(A|=0)>>2],i=o[A+24>>2];A:{for(;;){if((0|i)<=0)break A;if(o[64+(a+G(i=i-1|0,80)|0)>>2]==(0|r))break}S=r=S+-64|0,n=o[f+4>>2],i=(a=G(i,80))+o[A+32>>2]|0,o[i>>2]=o[f>>2],o[i+4>>2]=n,n=o[f+12>>2],o[i+8>>2]=o[f+8>>2],o[i+12>>2]=n,n=o[f+28>>2],o[i+24>>2]=o[f+24>>2],o[i+28>>2]=n,n=o[f+20>>2],o[i+16>>2]=o[f+16>>2],o[i+20>>2]=n,n=o[f+44>>2],o[i+40>>2]=o[f+40>>2],o[i+44>>2]=n,n=o[f+36>>2],o[i+32>>2]=o[f+32>>2],o[i+36>>2]=n,n=o[f+60>>2],o[i+56>>2]=o[f+56>>2],o[i+60>>2]=n,n=o[f+52>>2],o[i+48>>2]=o[f+48>>2],o[i+52>>2]=n,o[A+72>>2]&&(i=o[64+(a+o[A+32>>2]|0)>>2],Zn[o[o[i>>2]+8>>2]](i,f,r+48|0,r+32|0),f=o[r+60>>2],o[r+8>>2]=o[r+56>>2],o[r+12>>2]=f,f=o[r+44>>2],o[r+24>>2]=o[r+40>>2],o[r+28>>2]=f,f=o[r+36>>2],o[r+16>>2]=o[r+32>>2],o[r+20>>2]=f,f=o[r+52>>2],o[r>>2]=o[r+48>>2],o[r+4>>2]=f,Xf(o[A+72>>2],o[76+(a+o[A+32>>2]|0)>>2],r)),e&&Zn[o[o[A>>2]+68>>2]](A),S=r- -64|0}},Ai,function(){return o[8488]=o[8488]+1,0|Qr(0|Zn[o[8290]](324,16))},function(A){return o[192+(A|=0)>>2]},li,function(A,r){r|=0,w[184+(A|=0)>>2]=0|r},function(A){return 2==o[220+(A|=0)>>2]|0},function(A){return o[220+(A|=0)>>2]},function(A,r){r|=0,o[220+(A|=0)>>2]=r},function(A,r){ze(A|=0,r|=0)},function(A){return 2!=(0|(A=o[220+(A|=0)>>2]))&5!=(0|A)},function(A){return(2&v[204+(A|=0)|0])>>>1|0},function(A){return 1&o[204+(A|=0)>>2]},function(A){return 0|!!(3&v[204+(A|=0)|0])},fn,function(A,r){r|=0,o[204+(A|=0)>>2]=r},gi,function(A,r){A|=0,r=m(r),w[A+276>>2]=r},function(A,r){A|=0,r=m(r),w[A+272>>2]=r},function(A,r){r|=0,o[264+(A|=0)>>2]=r},function(A){return o[264+(A|=0)>>2]},function(A,r,f,e,i){A|=0,r=m(r),f=m(f),e=m(e),i=m(i),w[A+232>>2]=r,w[A+236>>2]=e,w[A+228>>2]=f,w[A+240>>2]=i,o[A+304>>2]=o[A+304>>2]+4},function(A,r,f){r|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;e=o[288+(A|=0)>>2];A:{if(f){if(o[A+292>>2]==(0|e)&&!((0|(c=e?e<<1:1))<=(0|e))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),e=o[A+288>>2]),!((0|e)<=0)){if(f=0,e>>>0>=4)for(b=-4&e;o[(i=f<<2)+n>>2]=o[i+o[A+296>>2]>>2],o[(t=4|i)+n>>2]=o[t+o[A+296>>2]>>2],o[(t=8|i)+n>>2]=o[t+o[A+296>>2]>>2],o[(i|=12)+n>>2]=o[i+o[A+296>>2]>>2],f=f+4|0,(0|b)!=(0|(u=u+4|0)););if(i=3&e)for(;o[(b=f<<2)+n>>2]=o[b+o[A+296>>2]>>2],f=f+1|0,(0|i)!=(0|(l=l+1|0)););}!(f=o[A+296>>2])|!v[A+300|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),e=o[A+288>>2]),o[A+296>>2]=n,a[A+300|0]=1,o[A+292>>2]=c}o[o[A+296>>2]+(e<<2)>>2]=r,e=e+1|0}else{if((0|e)<=0)break A;for(n=o[A+296>>2],f=0;;){if(o[(i=n+(f<<2)|0)>>2]!=(0|r)){if((0|e)!=(0|(f=f+1|0)))continue;break A}break}if((0|f)>=(0|e))break A;f=(e=e-1|0)<<2,o[i>>2]=o[f+n>>2],o[f+o[A+296>>2]>>2]=r}o[A+288>>2]=e}o[A+280>>2]=(0|e)>0},function(A,r){var f;return A=m(A),r|=0,S=f=S-144|0,v[33816]||(o[8447]=0,o[8448]=0,o[8445]=35,o[8446]=0,o[8449]=0,o[8444]=20276,o[8445]=27,o[8444]=20384,a[33816]=1),o[f+88>>2]=0,o[f+92>>2]=0,o[f+12>>2]=0,o[f+16>>2]=0,o[f+20>>2]=0,o[f+24>>2]=0,w[f>>2]=A,A=A==m(0)?m(0):m(1.6666666269302368),w[f+84>>2]=A,w[f+80>>2]=A,o[f+136>>2]=1008981770,o[f+140>>2]=1008981770,o[f+128>>2]=1000593162,o[f+132>>2]=1008981770,a[f+124|0]=0,o[f+120>>2]=1065353216,o[f+112>>2]=0,o[f+116>>2]=1061997773,o[f+104>>2]=0,o[f+108>>2]=0,o[f+96>>2]=0,o[f+100>>2]=1056964608,o[f+4>>2]=r,o[f+8>>2]=1065353216,o[f+72>>2]=33776,w[f+76>>2]=A,o[f+32>>2]=0,o[f+36>>2]=0,o[f+28>>2]=1065353216,o[f+40>>2]=0,o[f+44>>2]=0,o[f+48>>2]=1065353216,o[f+52>>2]=0,o[f+56>>2]=0,o[f+60>>2]=0,o[f+64>>2]=0,o[f+68>>2]=0,o[8488]=o[8488]+1,r=Qr(0|Zn[o[8290]](676,16)),o[r>>2]=24120,a[r+560|0]=1,o[r+556>>2]=0,o[r+548>>2]=0,o[r+552>>2]=0,RA(r,f),S=f+144|0,0|r},function(A,r,f){return A|=0,r=m(r),f|=0,0|Zn[0|A](r,f)},function(A){return o[564+(A|=0)>>2]},function(A,r){r|=0,o[564+(A|=0)>>2]=r},function(A,r){Of(A|=0,r|=0)},function(A,r,f){A|=0,r=m(r),f=m(f),w[A+508>>2]=fm(1)?m(1):f,w[A+504>>2]=rm(1)?m(1):r},function(A,r){var f,e;A|=0,r=m(r),S=f=S-16|0,o[f+8>>2]=1070945621,o[f+12>>2]=0,o[f>>2]=1070945621,o[f+4>>2]=1070945621,e=o[A+192>>2];A:if(le(0|Zn[o[o[e>>2]+36>>2]](e),1038))if(31!=o[e+4>>2])Zn[o[o[e>>2]+32>>2]](e,r,f);else{if(o[e+24>>2]<=0)break A;Zn[o[o[e>>2]+32>>2]](e,r,f)}Nf(A,r,f),S=f+16|0},function(A,r,f){Nf(A|=0,r=m(r),f|=0)},function(A,r){A|=0,r|=0;var f=0,e=m(0);f=o[r+4>>2],o[A+408>>2]=o[r>>2],o[A+412>>2]=f,f=o[r+12>>2],o[A+416>>2]=o[r+8>>2],o[A+420>>2]=f,o[A+632>>2]=0,e=w[A+404>>2],w[A+624>>2]=e*w[A+412>>2],w[A+620>>2]=e*w[A+408>>2],w[A+628>>2]=e*w[A+416>>2]},function(A,r){r|=0;var f=0;o[304+(A|=0)>>2]=o[A+304>>2]+1,f=o[r+4>>2],o[A+604>>2]=o[r>>2],o[A+608>>2]=f,f=o[r+12>>2],o[A+612>>2]=o[r+8>>2],o[A+616>>2]=f},function(A,r){r|=0;var f=0;o[304+(A|=0)>>2]=o[A+304>>2]+1,f=o[r+4>>2],o[A+372>>2]=o[r>>2],o[A+376>>2]=f,f=o[r+12>>2],o[A+380>>2]=o[r+8>>2],o[A+384>>2]=f},function(A){return 372+(A|=0)|0},function(A,r){r|=0;var f=0;o[304+(A|=0)>>2]=o[A+304>>2]+1,f=o[r+4>>2],o[A+388>>2]=o[r>>2],o[A+392>>2]=f,f=o[r+12>>2],o[A+396>>2]=o[r+8>>2],o[A+400>>2]=f},function(A){return 388+(A|=0)|0},function(A){o[372+(A|=0)>>2]=0,o[A+376>>2]=0,o[A+472>>2]=0,o[A+476>>2]=0,o[A+396>>2]=0,o[A+400>>2]=0,o[A+388>>2]=0,o[A+392>>2]=0,o[A+380>>2]=0,o[A+384>>2]=0,o[A+480>>2]=0,o[A+484>>2]=0,o[A+488>>2]=0,o[A+492>>2]=0,o[A+496>>2]=0,o[A+500>>2]=0},function(A){o[472+(A|=0)>>2]=0,o[A+476>>2]=0,o[A+496>>2]=0,o[A+500>>2]=0,o[A+488>>2]=0,o[A+492>>2]=0,o[A+480>>2]=0,o[A+484>>2]=0},function(A){A|=0;var r,f=m(0),e=0;return r=o[A+220>>2],v[35849]|4==(0|r)||(f=w[8299])!=m(0)&&(e=1,2!=(-2&r)&&(e=w[A+224>>2]>f)),0|e},function(A,r,f){A|=0,r=m(r),f=m(f),w[A+536>>2]=f,w[A+532>>2]=r},function(A){return m(w[532+(A|=0)>>2])},function(A){return o[540+(A|=0)>>2]},function(A,r){A|=0,r|=0;var f=m(0),e=m(0);f=w[r+8>>2],e=w[r+4>>2],w[A+488>>2]=m(w[r>>2]*w[A+604>>2])+w[A+488>>2],w[A+492>>2]=m(e*w[A+608>>2])+w[A+492>>2],w[A+496>>2]=m(f*w[A+612>>2])+w[A+496>>2]},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),o=m(0),c=m(0),b=m(0);a=w[r+8>>2],e=w[r+4>>2],i=w[A+408>>2],w[A+472>>2]=m(w[r>>2]*i)+w[A+472>>2],t=e,e=w[A+412>>2],w[A+476>>2]=m(t*e)+w[A+476>>2],n=w[A+416>>2],w[A+480>>2]=m(a*n)+w[A+480>>2],b=w[r>>2],a=w[f>>2],o=w[f+4>>2],n=m(n*w[r+8>>2]),e=m(e*w[r+4>>2]),c=w[f+8>>2],w[A+488>>2]=m(m(m(o*n)-m(e*c))*w[A+604>>2])+w[A+488>>2],t=w[A+612>>2],i=m(i*b),w[A+492>>2]=m(m(m(c*i)-m(n*a))*w[A+608>>2])+w[A+492>>2],w[A+496>>2]=m(t*m(m(a*e)-m(i*o)))+w[A+496>>2]},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),o=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0);(a=w[A+404>>2])!=m(0)&&(i=w[r+8>>2],e=w[r+4>>2],t=w[A+408>>2],w[A+372>>2]=m(a*m(w[r>>2]*t))+w[A+372>>2],n=e,e=w[A+412>>2],w[A+376>>2]=m(a*m(n*e))+w[A+376>>2],n=i,i=w[A+416>>2],w[A+380>>2]=m(a*m(n*i))+w[A+380>>2],c=w[A+612>>2],b=w[A+364>>2],u=w[A+356>>2],l=w[A+360>>2],s=w[A+608>>2],k=w[A+348>>2],d=w[A+340>>2],v=w[A+344>>2],o=w[f>>2],e=m(e*w[r+4>>2]),t=m(t*w[r>>2]),n=w[f+4>>2],a=m(m(o*e)-m(t*n)),h=n,n=m(i*w[r+8>>2]),i=e,e=w[f+8>>2],i=m(m(h*n)-m(i*e)),e=m(m(e*t)-m(n*o)),w[A+388>>2]=m(m(m(w[A+332>>2]*a)+m(m(w[A+324>>2]*i)+m(w[A+328>>2]*e)))*w[A+604>>2])+w[A+388>>2],w[A+392>>2]=m(s*m(m(k*a)+m(m(d*i)+m(e*v))))+w[A+392>>2],w[A+396>>2]=m(c*m(m(b*a)+m(m(u*i)+m(e*l))))+w[A+396>>2])},function(A,r){r|=0,A=o[540+(A|=0)>>2],Zn[o[o[A>>2]+8>>2]](A,r)},function(){var A;return S=A=S-32|0,v[33908]||(o[A+24>>2]=0,o[A+28>>2]=1,o[A+16>>2]=4096,o[A+20>>2]=4096,o[A+8>>2]=0,o[A+12>>2]=0,TA(A+8|0),a[33908]=1),S=A+32|0,33820},function(){var A,r,f=0,e=0,i=0,n=0,t=0,c=0;for(S=r=S-32|0,A=xe(10448),v[33908]||(o[r+24>>2]=0,o[r+28>>2]=1,o[r+16>>2]=4096,o[r+20>>2]=4096,o[r+8>>2]=0,o[r+12>>2]=0,TA(r+8|0),a[33908]=1),o[A+4>>2]=2,o[A+10444>>2]=33820,o[A+64>>2]=469,a[A+24|0]=1,o[A>>2]=12960,o[A+20>>2]=0,o[A+60>>2]=0,o[A+28>>2]=17976,o[A+12>>2]=0,o[A+16>>2]=0,t=A,c=0|Zn[o[o[8455]+12>>2]](33820),o[t+68>>2]=c,t=A,c=0|Zn[o[o[8455]+8>>2]](33820),o[t+72>>2]=c;;){for(f=0;i=(G(e,144)+A|0)+(f<<2)|0,n=o[A+10444>>2],t=i,c=0|Zn[o[o[n>>2]+16>>2]](n,e,f),o[t+76>>2]=c,n=i+5260|0,i=o[A+10444>>2],t=n,c=0|Zn[o[o[i>>2]+20>>2]](i,e,f),o[t>>2]=c,36!=(0|(f=f+1|0)););if(36==(0|(e=e+1|0)))break}return S=r+32|0,0|A},function(A){return 0|Zn[o[o[(A|=0)>>2]+36>>2]](A)},function(A,r){return r|=0,0|Zn[o[o[(A|=0)>>2]+40>>2]](A,r)},function(A){return o[200+(A|=0)>>2]},gi,function(A){return o[108+(A|=0)>>2]},function(A){return o[112+(A|=0)>>2]},function(A){return o[836+(A|=0)>>2]},function(A){return o[840+(A|=0)>>2]},function(A){return o[844+(A|=0)>>2]},function(A,r){return A|=0,4+(G(r|=0,208)+A|0)|0},en,function(A){return 16+(A|=0)|0},rn,function(A){return 32+(A|=0)|0},function(A){return(A|=0)- -64|0},function(){var A,r,f=0,e=0,i=0,n=0,t=0,c=0;A=xe(176),S=r=S-32|0,o[A>>2]=12040,o[16+(f=A+4|0)>>2]=0,o[f+8>>2]=-1,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,o[f+32>>2]=0,a[f+36|0]=1,o[f+24>>2]=0,o[f+28>>2]=0,o[16+(f=A+44|0)>>2]=0,o[f+8>>2]=-1,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,o[f+32>>2]=0,a[f+36|0]=1,o[f+24>>2]=0,o[f+28>>2]=0,o[A+168>>2]=0,e=1,a[A+172|0]=1,o[A+160>>2]=0,o[A+164>>2]=0,a[A+153|0]=0,a[A+154|0]=1,a[A+152|0]=1,o[A+124>>2]=0,o[A+100>>2]=0,o[A+104>>2]=0,o[A+136>>2]=0,o[A+128>>2]=0,o[A+132>>2]=0,o[A+116>>2]=10,o[A+120>>2]=1,o[A+108>>2]=1,o[A+112>>2]=0,o[8488]=o[8488]+1,i=hf(0|Zn[o[8290]](72,16)),f=o[A+160>>2],o[A+148>>2]=0,o[A+96>>2]=i,o[A+140>>2]=0,o[A+144>>2]=0,o[A+84>>2]=0,o[A+88>>2]=0,o[A+92>>2]=0,o[r+24>>2]=0,a[r+28|0]=1,o[r+16>>2]=0,o[r+20>>2]=0;A:{if((0|f)>=2)for(;;)if(i=o[A+168>>2]+G(e,20)|0,!(n=o[i+12>>2])||!n|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](n)),a[i+16|0]=1,o[i+12>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,(0|(e=e+1|0))==(0|f))break A;if(1!=(0|f)){if(e=0,o[A+164>>2]<=0){if(o[8488]=o[8488]+1,n=0|Zn[o[8290]](20,16),!((0|(i=o[A+160>>2]))<=0)){for(;Br((t=G(e,20))+n|0,t+o[A+168>>2]|0),(0|i)!=(0|(e=e+1|0)););if(!((0|(c=o[A+160>>2]))<=0))for(e=0;i=o[A+168>>2]+G(e,20)|0,!(t=o[i+12>>2])||!t|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](t)),a[i+16|0]=1,o[i+12>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,(0|c)!=(0|(e=e+1|0)););}!(e=o[A+168>>2])||!e|!v[A+172|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+168>>2]=n,a[A+172|0]=1,o[A+164>>2]=1}for(;e=f,Br(o[A+168>>2]+G(f,20)|0,r+12|0),f=f+1|0,e;);}}return o[A+160>>2]=1,!(f=o[r+24>>2])||!f|!v[r+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),S=r+32|0,0|A},function(){return o[8488]=o[8488]+1,0|lf(0|Zn[o[8290]](236,16))},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+36>>2]](A,r,f,e)},Ai,function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+40>>2]](A,r)},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+32>>2]](A,r,f,e)},function(A,r,f,e,i,n){EA(A|=0,r|=0,f|=0,e|=0,i|=0,n=m(n))},function(A,r,f,e,i,n,a){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,a=m(a),Zn[0|A](r,f,e,i,n,a)},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+16>>2]](A,r)},function(A){Zn[o[o[(A|=0)>>2]+24>>2]](A)},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=0,c=0;return S=i=S-32|0,o[8488]=o[8488]+1,e=0|Zn[o[8290]](348,16),v[33908]||(o[i+24>>2]=0,o[i+28>>2]=1,o[i+16>>2]=4096,o[i+20>>2]=4096,o[i+8>>2]=0,o[i+12>>2]=0,TA(i+8|0),a[33908]=1),a[e+76|0]=1,o[e+72>>2]=0,o[e+68>>2]=r,o[(r=e)+28>>2]=0,o[r+32>>2]=0,o[r+24>>2]=A,a[r+20|0]=1,o[r>>2]=13192,o[r+16>>2]=0,o[r- -64>>2]=0,a[r+60|0]=0,o[r+56>>2]=1025758986,a[r+54|0]=1,t[r+52>>1]=256,o[r+48>>2]=0,a[r+44|0]=1,o[r+36>>2]=1,o[r+40>>2]=1065353216,o[r+8>>2]=0,o[r+12>>2]=0,o[r+92>>2]=1058642330,o[r+96>>2]=1065353216,o[r+88>>2]=0,o[r+80>>2]=0,o[r+84>>2]=0,o[r>>2]=24244,o[r+100>>2]=1050253722,o[r+104>>2]=1015580809,o[r+132>>2]=0,o[r+136>>2]=1045220557,o[r+124>>2]=1045220557,o[r+128>>2]=1045220557,o[r+108>>2]=0,o[r+112>>2]=10,o[r+184>>2]=0,o[r+188>>2]=1045220557,o[r+176>>2]=1120403456,o[r+180>>2]=1900671690,o[r+172>>2]=128,o[r+164>>2]=260,o[r+168>>2]=2,o[r+156>>2]=0,o[r+160>>2]=1062836634,o[r+148>>2]=-1121724662,o[r+152>>2]=1036831949,o[r+140>>2]=0,o[r+144>>2]=1,o[r+116>>2]=1101004800,o[r+120>>2]=1065353216,a[r+208|0]=1,o[r+204>>2]=0,a[r+240|0]=1,o[r+216>>2]=f,o[r+212>>2]=0,o[r+196>>2]=0,o[r+200>>2]=0,o[r+236>>2]=0,o[r+228>>2]=0,o[r+232>>2]=0,a[r+260|0]=1,t[r+290>>1]=0,o[r+256>>2]=0,o[r+264>>2]=0,o[r+268>>2]=-1054867456,o[r+248>>2]=0,o[r+252>>2]=0,o[r+272>>2]=0,o[r+276>>2]=0,o[r+280>>2]=0,o[r+284>>2]=0,a[r+308|0]=1,o[r+312>>2]=0,o[r+304>>2]=0,o[r+296>>2]=0,o[r+300>>2]=0,a[r+336|0]=1,a[r+316|0]=1,o[r+324>>2]=0,o[r+328>>2]=0,o[r+332>>2]=0,o[r+340>>2]=0,f?f=0:(o[8488]=o[8488]+1,n=e,c=lf(0|Zn[o[8290]](236,16)),o[n+216>>2]=c,f=1),a[r+289|0]=f,o[8488]=o[8488]+1,r=0|Zn[o[8290]](68,16),o[r>>2]=24184,o[r+16>>2]=0,a[r+20|0]=1,o[r+8>>2]=0,o[r+12>>2]=0,o[r+36>>2]=0,a[r+40|0]=1,a[r+60|0]=1,o[r+28>>2]=0,o[r+32>>2]=0,o[r+56>>2]=0,a[r+64|0]=1,o[r+48>>2]=0,o[r+52>>2]=0,a[e+288|0]=1,o[e+220>>2]=r,o[8488]=o[8488]+1,r=0|Zn[o[8290]](88,16),f=o[e+216>>2],a[r+44|0]=1,o[r+24>>2]=A,o[r+20>>2]=0,o[r+12>>2]=0,o[r+16>>2]=0,o[r+8>>2]=f,o[r+4>>2]=0,o[r>>2]=24508,o[r+40>>2]=0,a[r- -64|0]=1,o[r+32>>2]=0,o[r+36>>2]=0,o[r+60>>2]=0,a[r+84|0]=1,o[r+52>>2]=0,o[r+56>>2]=0,o[r+80>>2]=0,o[r+72>>2]=0,o[r+76>>2]=0,o[e+212>>2]=r,o[e+344>>2]=24940,o[e>>2]=24700,o[e+56>>2]=1008981770,A=o[e+68>>2],A=0|Zn[o[o[A>>2]+36>>2]](A),Zn[o[o[A>>2]+44>>2]](A,e+344|0),A=o[e+68>>2],A=0|Zn[o[o[A>>2]+36>>2]](A),r=xe(4),o[r>>2]=25040,Zn[o[o[A>>2]+60>>2]](A,r),S=i+32|0,0|e},fi,function(A,r){r|=0,a[35849]=1^r},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+72>>2]](A,r)},function(A,r,f,e){A|=0,r=m(r),f|=0,e=m(e),Zn[o[o[A>>2]+52>>2]](A,r,f,e)},function(A,r,f,e,i){A|=0,r|=0,f=m(f),e|=0,i=m(i),Zn[0|A](r,f,e,i)},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+88>>2]](A,r,f,e)},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+92>>2]](A,r)},function(A,r,f){r|=0,f|=0,Zn[o[o[(A|=0)>>2]+56>>2]](A,r,f)},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+60>>2]](A,r)},ui,bi,function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+52>>2]](A,r)},function(A){return 0|Zn[o[o[(A|=0)>>2]+56>>2]](A)},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+8>>2]=e,w[i+4>>2]=f,w[i>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+24>>2]=e,w[i+20>>2]=f,w[i+16>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+40>>2]=e,w[i+36>>2]=f,w[i+32>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+56>>2]=e,w[i+52>>2]=f,w[i+48>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+72>>2]=e,w[i+68>>2]=f,w[i+64>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+88>>2]=e,w[i+84>>2]=f,w[i+80>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+104>>2]=e,w[i+100>>2]=f,w[i+96>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A,r,f,e){var i;A|=0,r=m(r),f=m(f),e=m(e),S=i=S-128|0,Zn[o[o[A>>2]+8>>2]](i,A),w[i+120>>2]=e,w[i+116>>2]=f,w[i+112>>2]=r,Zn[o[o[A>>2]+12>>2]](A,i),S=i+128|0},function(A){return 0!=o[8+(A|=0)>>2]|0},function(A){return 0!=o[16+(A|=0)>>2]|0},function(){var A,r=0;return S=A=S-32|0,v[33516]||(o[8344]=0,o[8341]=1065353216,o[8342]=0,a[33396]=1,o[8340]=31016,o[8348]=0,o[8346]=0,o[8347]=0,r=o[A+20>>2],o[8350]=o[A+16>>2],o[8351]=r,r=o[A+28>>2],o[8352]=o[A+24>>2],o[8353]=r,r=o[A+4>>2],o[8354]=o[A>>2],o[8355]=r,r=o[A+12>>2],o[8356]=o[A+8>>2],o[8357]=r,a[33448]=1,o[8361]=0,a[33468]=1,o[8359]=0,o[8360]=0,o[8366]=0,o[8364]=0,o[8365]=0,a[33488]=1,o[8371]=0,o[8369]=0,o[8370]=0,a[33508]=1,o[8340]=30968,o[8376]=0,a[33512]=1,o[8374]=0,o[8375]=0,o[8343]=-1,a[33516]=1),S=A+32|0,33360},Fi,function(A,r,f,e,i){A|=0,f|=0,e|=0,i|=0;var n=0;if(n=o[4+(r|=0)>>2],o[A+40>>2]=o[r>>2],o[A+44>>2]=n,n=o[r+12>>2],o[A+48>>2]=o[r+8>>2],o[A+52>>2]=n,r=o[f+4>>2],o[A+56>>2]=o[f>>2],o[A+60>>2]=r,n=o[f+12>>2],o[(r=A- -64|0)>>2]=o[f+8>>2],o[r+4>>2]=n,a[A+152|0]=i,o[A+12>>2]=e,o[A+4>>2]=1065353216,o[A+8>>2]=0,(0|(f=o[A+136>>2]))<0&&(r=o[A+144>>2],o[A+140>>2]<0&&(!r||!r|!v[A+148|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+148|0]=1,o[A+140>>2]=0,o[A+144>>2]=0,r=0),Af((e=r)+(r=f<<2)|0,0,0-r|0)),o[A+136>>2]=0,(0|(f=o[A+116>>2]))<0&&(r=o[A+124>>2],o[A+120>>2]<0&&(!r||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+128|0]=1,o[A+120>>2]=0,o[A+124>>2]=0,r=0),Af((e=r)+(r=f<<2)|0,0,0-r|0)),o[A+116>>2]=0,!((0|(f=o[A+24>>2]))>=0)){if(o[A+28>>2]<0&&(!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+36|0]=1,o[A+28>>2]=0,o[A+32>>2]=0),e=0,i=0-(r=f)&3)for(;o[o[A+32>>2]+(r<<2)>>2]=0,r=r+1|0,(0|i)!=(0|(e=e+1|0)););if(!(f>>>0>4294967292))for(;o[(f=r<<2)+o[A+32>>2]>>2]=0,o[4+(f+o[A+32>>2]|0)>>2]=0,o[8+(f+o[A+32>>2]|0)>>2]=0,o[12+(f+o[A+32>>2]|0)>>2]=0,r=r+4|0;);}o[A+24>>2]=0,(o[A+96>>2]&o[A+100>>2])<0&&(!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+108|0]=1,o[A+100>>2]=0,o[A+104>>2]=0),o[A+96>>2]=0,(o[A+76>>2]&o[A+80>>2])<0&&(!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+88|0]=1,o[A+80>>2]=0,o[A+84>>2]=0),o[A+76>>2]=0},Oe,_i,An,Oi,Yi,function(){return v[33356]||(o[8317]=1065353216,o[8318]=0,a[33352]=1,o[8337]=0,o[8316]=30888,o[8319]=-1,o[8320]=0,a[33356]=1),33264},Fi,function(A,r,f,e,i){A|=0,f|=0,e|=0,i|=0;var n=0;n=o[4+(r|=0)>>2],o[A+20>>2]=o[r>>2],o[A+24>>2]=n,n=o[r+12>>2],o[A+28>>2]=o[r+8>>2],o[A+32>>2]=n,r=o[f+4>>2],o[A+36>>2]=o[f>>2],o[A+40>>2]=r,r=o[f+12>>2],o[A+44>>2]=o[f+8>>2],o[A+48>>2]=r,a[A+88|0]=i,o[A+12>>2]=e,o[A+4>>2]=1065353216,o[A+8>>2]=0},qi,Ki,Hi,function(){var A,r=0;return S=A=S-32|0,v[33772]||(o[8407]=-1,o[8408]=0,o[8405]=1065353216,o[8406]=1,a[33652]=1,o[8404]=31144,o[8412]=0,o[8410]=0,o[8411]=0,r=o[A+20>>2],o[8414]=o[A+16>>2],o[8415]=r,r=o[A+28>>2],o[8416]=o[A+24>>2],o[8417]=r,r=o[A+4>>2],o[8418]=o[A>>2],o[8419]=r,r=o[A+12>>2],o[8420]=o[A+8>>2],o[8421]=r,a[33704]=1,o[8425]=0,a[33724]=1,o[8423]=0,o[8424]=0,o[8430]=0,o[8428]=0,o[8429]=0,a[33744]=1,o[8435]=0,o[8433]=0,o[8434]=0,a[33764]=1,o[8404]=31096,o[8440]=0,a[33768]=1,o[8438]=0,o[8439]=0,o[8406]=-1,a[33772]=1),S=A+32|0,33616},function(A,r,f,e,i){A|=0,f|=0,e|=0,i|=0;var n=0;if(n=o[4+(r|=0)>>2],o[A+40>>2]=o[r>>2],o[A+44>>2]=n,n=o[r+12>>2],o[A+48>>2]=o[r+8>>2],o[A+52>>2]=n,r=o[f+4>>2],o[A+56>>2]=o[f>>2],o[A+60>>2]=r,n=o[f+12>>2],o[(r=A- -64|0)>>2]=o[f+8>>2],o[r+4>>2]=n,a[A+152|0]=i,o[A+12>>2]=e,o[A+4>>2]=1065353216,(0|(f=o[A+136>>2]))<0&&(r=o[A+144>>2],o[A+140>>2]<0&&(!r||!r|!v[A+148|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+148|0]=1,o[A+140>>2]=0,o[A+144>>2]=0,r=0),Af((e=r)+(r=f<<2)|0,0,0-r|0)),o[A+136>>2]=0,(0|(f=o[A+116>>2]))<0&&(r=o[A+124>>2],o[A+120>>2]<0&&(!r||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+128|0]=1,o[A+120>>2]=0,o[A+124>>2]=0,r=0),Af((e=r)+(r=f<<2)|0,0,0-r|0)),o[A+116>>2]=0,!((0|(f=o[A+24>>2]))>=0)){if(o[A+28>>2]<0&&(!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+36|0]=1,o[A+28>>2]=0,o[A+32>>2]=0),e=0,i=0-(r=f)&3)for(;o[o[A+32>>2]+(r<<2)>>2]=0,r=r+1|0,(0|i)!=(0|(e=e+1|0)););if(!(f>>>0>4294967292))for(;o[(f=r<<2)+o[A+32>>2]>>2]=0,o[4+(f+o[A+32>>2]|0)>>2]=0,o[8+(f+o[A+32>>2]|0)>>2]=0,o[12+(f+o[A+32>>2]|0)>>2]=0,r=r+4|0;);}o[A+24>>2]=0,(o[A+96>>2]&o[A+100>>2])<0&&(!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+108|0]=1,o[A+100>>2]=0,o[A+104>>2]=0),o[A+96>>2]=0,(o[A+76>>2]&o[A+80>>2])<0&&(!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+88|0]=1,o[A+80>>2]=0,o[A+84>>2]=0),o[A+76>>2]=0},_i,An,Oi,Yi,function(){return v[33612]||(o[8383]=-1,o[8384]=0,o[8381]=1065353216,o[8382]=-1,a[33608]=1,o[8401]=0,o[8380]=31040,a[33612]=1),33520},function(A,r,f,e,i){A|=0,f|=0,e|=0,i|=0;var n=0;n=o[4+(r|=0)>>2],o[A+20>>2]=o[r>>2],o[A+24>>2]=n,n=o[r+12>>2],o[A+28>>2]=o[r+8>>2],o[A+32>>2]=n,r=o[f+4>>2],o[A+36>>2]=o[f>>2],o[A+40>>2]=r,r=o[f+12>>2],o[A+44>>2]=o[f+8>>2],o[A+48>>2]=r,a[A+88|0]=i,o[A+12>>2]=e,o[A+16>>2]=0,o[A+4>>2]=1065353216},qi,Ki,Hi,Yi,function(){var A;return A=xe(16),o[A+8>>2]=1036831949,o[A+12>>2]=1036831949,o[A>>2]=1036831949,o[A+4>>2]=1058642330,0|A},je,Ui,ji,fn,Si,$i,Ri,Di,Ji,function(A,r,f,e){A|=0,r|=0,f=m(f),e=m(e);var i,n=0;return S=i=S-16|0,n=o[r+12>>2],o[i+8>>2]=o[r+8>>2],o[i+12>>2]=n,n=o[r+4>>2],o[i>>2]=o[r>>2],o[i+4>>2]=n,e=m(Zn[o[o[A>>2]+20>>2]](A)),a[A+65|0]=0,w[A+16>>2]=e,e=w[A+36>>2],w[A+36>>2]=e>m(.009999999776482582)?e:m(.009999999776482582),r=o[A+4>>2],n=o[r+56>>2],o[A+136>>2]=o[r+52>>2],o[A+140>>2]=n,n=o[r+64>>2],o[A+144>>2]=o[r+60>>2],o[A+148>>2]=n,r=fr(A,i,f),v[A+60|0]&&(a[A+61|0]=1,n=o[A+148>>2],r=o[A+4>>2],o[r+60>>2]=o[A+144>>2],o[r+64>>2]=n,n=o[A+140>>2],o[r+52>>2]=o[A+136>>2],o[r+56>>2]=n,r=fr(A,i,f),a[A+61|0]=0),v[A+65|0]&&(!(4&r)|1!=(0|Zn[o[o[A>>2]+16>>2]](A))||(a[A+64|0]=1,fr(A,i,f),a[A+64|0]=0)),o[A+132>>2]=r,S=i+16|0,0|r},function(A,r,f,e,i){return A|=0,r|=0,f|=0,e=m(e),i=m(i),0|Zn[0|A](r,f,e,i)},function(A){return o[4+(A|=0)>>2]+52|0},function(A,r){A|=0,r=m(r),w[A+36>>2]=r},function(A,r){A|=0,r=m(r),w[A+32>>2]=r},function(A,r){A|=0,r=m(r),w[A+28>>2]=r},function(A,r){r|=0,a[62+(A|=0)|0]=r},function(A,r){r|=0,a[63+(A|=0)|0]=r},function(A,r,f,e,i,n,a,t){A=m(A),r=m(r),f=m(f),e|=0,i|=0,n|=0,a=m(a),t=m(t);var c,b=0;return c=xe(60),w[c+8>>2]=f,w[c+4>>2]=r,w[c>>2]=A,o[c+44>>2]=1,b=o[e+4>>2],o[c+12>>2]=o[e>>2],o[c+16>>2]=b,b=o[e+12>>2],o[c+20>>2]=o[e+8>>2],o[c+24>>2]=b,e=o[i+4>>2],o[c+28>>2]=o[i>>2],o[c+32>>2]=e,e=o[i+12>>2],o[c+36>>2]=o[i+8>>2],o[c+40>>2]=e,w[c+56>>2]=t,w[c+52>>2]=a,o[c+48>>2]=n,0|c},function(A,r,f,e,i,n,a,t,o){return A|=0,r=m(r),f=m(f),e=m(e),i|=0,n|=0,a|=0,t=m(t),o=m(o),0|Zn[0|A](r,f,e,i,n,a,t,o)},function(A,r,f){var e;return A|=0,r|=0,f|=0,e=xe(160),a[e+108|0]=0,o[e+104>>2]=0,a[e+65|0]=0,a[e+61|0]=0,a[e+62|0]=1,a[e+63|0]=1,a[e+64|0]=0,o[e+20>>2]=0,o[e+4>>2]=0,o[e+8>>2]=0,o[e+24>>2]=f,o[e+12>>2]=A,a[e+128|0]=1,o[e>>2]=25340,o[e+124>>2]=0,o[e+116>>2]=0,o[e+120>>2]=0,o[e+56>>2]=o[r+44>>2],A=o[r+16>>2],o[e+40>>2]=o[r+12>>2],o[e+44>>2]=A,A=o[r+24>>2],o[e+48>>2]=o[r+20>>2],o[e+52>>2]=A,w[e+32>>2]=w[r+4>>2],w[e+36>>2]=w[r+8>>2],w[e+28>>2]=w[r>>2],A=o[r+48>>2],o[e+132>>2]=0,o[e+20>>2]=A,o[e>>2]=25372,w[e+152>>2]=w[r+52>>2],w[e+156>>2]=w[r+56>>2],o[8488]=o[8488]+1,A=ce(0|Zn[o[8290]](348,16)),o[e+4>>2]=A,o[A+204>>2]=4,f=o[r+32>>2],o[A+52>>2]=o[r+28>>2],o[A+56>>2]=f,f=o[r+40>>2],o[A+60>>2]=o[r+36>>2],o[A+64>>2]=f,o[o[e+4>>2]+256>>2]=e,Mr(e),o[o[e+4>>2]+256>>2]=-1,0|e},function(A,r){A|=0,r=m(r),w[A+152>>2]=r,Mr(A)},function(A,r){A|=0,r=m(r),w[A+156>>2]=r,Mr(A)},function(A,r,f,e,i,n,a,t,c){A=m(A),r=m(r),f=m(f),e|=0,i|=0,n|=0,a=m(a),t=m(t),c=m(c);var b,u=0;return b=xe(64),w[b+8>>2]=f,w[b+4>>2]=r,w[b>>2]=A,o[b+44>>2]=0,u=o[e+4>>2],o[b+12>>2]=o[e>>2],o[b+16>>2]=u,u=o[e+12>>2],o[b+20>>2]=o[e+8>>2],o[b+24>>2]=u,e=o[i+4>>2],o[b+28>>2]=o[i>>2],o[b+32>>2]=e,e=o[i+12>>2],o[b+36>>2]=o[i+8>>2],o[b+40>>2]=e,w[b+60>>2]=c,w[b+56>>2]=t,w[b+52>>2]=a,o[b+48>>2]=n,0|b},function(A,r,f,e,i,n,a,t,o,c){return A|=0,r=m(r),f=m(f),e=m(e),i|=0,n|=0,a|=0,t=m(t),o=m(o),c=m(c),0|Zn[0|A](r,f,e,i,n,a,t,o,c)},function(A,r,f){var e;return A|=0,r|=0,f|=0,e=xe(164),a[e+108|0]=0,o[e+104>>2]=0,a[e+65|0]=0,a[e+61|0]=0,a[e+62|0]=1,a[e+63|0]=1,a[e+64|0]=0,o[e+20>>2]=0,o[e+4>>2]=0,o[e+8>>2]=0,o[e+24>>2]=f,o[e+12>>2]=A,a[e+128|0]=1,o[e>>2]=25340,o[e+124>>2]=0,o[e+116>>2]=0,o[e+120>>2]=0,o[e+56>>2]=o[r+44>>2],A=o[r+16>>2],o[e+40>>2]=o[r+12>>2],o[e+44>>2]=A,A=o[r+24>>2],o[e+48>>2]=o[r+20>>2],o[e+52>>2]=A,w[e+32>>2]=w[r+4>>2],w[e+36>>2]=w[r+8>>2],w[e+28>>2]=w[r>>2],A=o[r+48>>2],o[e+132>>2]=0,o[e+20>>2]=A,o[e>>2]=25404,w[e+156>>2]=w[r+56>>2],w[e+152>>2]=w[r+52>>2],w[e+160>>2]=w[r+60>>2],o[8488]=o[8488]+1,A=ce(0|Zn[o[8290]](348,16)),o[e+4>>2]=A,o[A+204>>2]=4,f=o[r+32>>2],o[A+52>>2]=o[r+28>>2],o[A+56>>2]=f,f=o[r+40>>2],o[A+60>>2]=o[r+36>>2],o[A+64>>2]=f,o[o[e+4>>2]+256>>2]=e,cf(e),0|e},function(A,r){A|=0,r=m(r),w[A+152>>2]=r,cf(A)},function(A,r){A|=0,r=m(r),w[A+156>>2]=r,cf(A)},function(A,r){A|=0,r=m(r),w[A+160>>2]=r,cf(A)},function(){a[33263]<0&&DA(o[8313]),a[33251]<0&&DA(o[8310]),a[33239]<0&&DA(o[8307]),a[33227]<0&&DA(o[8304])},tA,function(A){return o[(A|=0)>>2]=30944,0|A},vn,function(A,r){A|=0;var f,e=0;return f=o[(r|=0)>>2],!(o[A+12>>2]&o[r+4>>2])|-1==o[f+256>>2]||(e=1,v[A+88|0]||(e=!(4&v[f+204|0]))),0|e},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=0,t=m(0),c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0);return e=o[r>>2],a=o[e+192>>2],31==o[a+4>>2]&&(c=o[r+4>>2])&&(a=o[64+(o[a+32>>2]+G(o[c>>2],80)|0)>>2]),o[A+84>>2]=o[a+8>>2],i=w[r+24>>2],o[A+8>>2]=e,w[A+4>>2]=i,f?(f=o[r+12>>2],o[A+52>>2]=o[r+8>>2],o[A+56>>2]=f,f=o[r+20>>2],o[A+60>>2]=o[r+16>>2],o[A+64>>2]=f):(b=w[e+8>>2],u=w[e+12>>2],l=w[e+20>>2],s=w[e+24>>2],k=w[e+28>>2],d=w[e+36>>2],v=w[e+40>>2],i=w[r+12>>2],h=w[e+44>>2],n=w[r+16>>2],B=w[e+4>>2],t=w[r+8>>2],o[A- -64>>2]=0,w[A+60>>2]=m(h*n)+m(m(d*t)+m(i*v)),w[A+56>>2]=m(k*n)+m(m(l*t)+m(i*s)),w[A+52>>2]=m(u*n)+m(m(B*t)+m(b*i))),i=w[r+24>>2],n=m(m(1)-i),w[A+68>>2]=m(n*w[A+20>>2])+m(i*w[A+36>>2]),w[A+72>>2]=m(n*w[A+24>>2])+m(i*w[A+40>>2]),w[A+76>>2]=m(n*w[A+28>>2])+m(i*w[A+44>>2]),m(w[r+24>>2])},hn,function(A,r){return r|=0,(A=o[12+(A|=0)>>2])&o[r+4>>2]?0|!!(A&o[r+8>>2]):0},function(){J(),d()},_r,function(A){DA(_r(A|=0))},function(A,r){A|=0;var f,e=0;return f=o[(r|=0)>>2],!(o[A+12>>2]&o[r+4>>2])|-1==o[f+256>>2]||(e=1,v[A+152|0]||(e=!(4&v[f+204|0]))),0|e},function(A,r,f){A|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;A:{r:{f:{e:{i:{n:{a:{if(e=o[o[(r|=0)>>2]+192>>2],31==o[e+4>>2]&&(n=o[r+4>>2])){if(d=o[o[64+(o[e+32>>2]+G(o[n>>2],80)|0)>>2]+8>>2],(0|(e=o[A+136>>2]))!=o[A+140>>2])break A;if((0|(u=e?e<<1:1))<=(0|e))break A;if(u&&(o[8488]=o[8488]+1,t=0|Zn[o[8290]](u<<2,16),e=o[A+136>>2]),n=o[A+144>>2],(0|e)<=0)break a;if(e>>>0>=4)for(k=-4&e;o[(i=c<<2)+t>>2]=o[n+i>>2],o[(b=4|i)+t>>2]=o[n+b>>2],o[(b=8|i)+t>>2]=o[n+b>>2],o[(i|=12)+t>>2]=o[n+i>>2],c=c+4|0,(0|k)!=(0|(l=l+4|0)););if(!(e&=3))break f;for(;o[(i=c<<2)+t>>2]=o[n+i>>2],c=c+1|0,(0|e)!=(0|(s=s+1|0)););break f}if(d=o[e+8>>2],(0|(e=o[A+136>>2]))!=o[A+140>>2])break A;if((0|(u=e?e<<1:1))<=(0|e))break A;if(u&&(o[8488]=o[8488]+1,t=0|Zn[o[8290]](u<<2,16),e=o[A+136>>2]),n=o[A+144>>2],(0|e)<=0)break n;if(e>>>0>=4)for(k=-4&e;o[(i=c<<2)+t>>2]=o[n+i>>2],o[(b=4|i)+t>>2]=o[n+b>>2],o[(b=8|i)+t>>2]=o[n+b>>2],o[(i|=12)+t>>2]=o[n+i>>2],c=c+4|0,(0|k)!=(0|(l=l+4|0)););if(!(e&=3))break i;for(;o[(i=c<<2)+t>>2]=o[n+i>>2],c=c+1|0,(0|e)!=(0|(s=s+1|0)););break i}if(n)break f;break r}if(!n)break e}n&&v[A+148|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),e=o[A+136>>2]}o[A+144>>2]=t,o[A+140>>2]=u,a[A+148|0]=1;break A}n&&v[A+148|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),e=o[A+136>>2]}o[A+144>>2]=t,o[A+140>>2]=u,a[A+148|0]=1}return o[o[A+144>>2]+(e<<2)>>2]=d,o[A+136>>2]=o[A+136>>2]+1,m(QA(A,r,f))},function(A){var r=0;return o[(A|=0)>>2]=31016,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,o[A>>2]=30944,0|A},function(A){var r=0;o[(A|=0)>>2]=31016,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),DA(A)},QA,en,vn,function(A,r){r|=0;var f=0;return o[12+(A|=0)>>2]&o[r+4>>2]?(f=1,v[A+88|0]||(A=o[r>>2])&&(f=!(4&v[A+204|0])),0|f):0},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0);return o[A+84>>2]=o[o[o[r+4>>2]+8>>2]+8>>2],w[A+4>>2]=w[r+40>>2],e=o[r>>2],o[A+16>>2]=e,f?(f=o[r+12>>2],o[A+52>>2]=o[r+8>>2],o[A+56>>2]=f,f=o[r+20>>2],o[A+60>>2]=o[r+16>>2],o[A+64>>2]=f):(t=w[e+8>>2],c=w[e+12>>2],b=w[e+20>>2],u=w[e+24>>2],l=w[e+28>>2],s=w[e+36>>2],k=w[e+40>>2],i=w[r+12>>2],d=w[e+44>>2],n=w[r+16>>2],v=w[e+4>>2],a=w[r+8>>2],o[A- -64>>2]=0,w[A+60>>2]=m(d*n)+m(m(s*a)+m(i*k)),w[A+56>>2]=m(l*n)+m(m(b*a)+m(i*u)),w[A+52>>2]=m(c*n)+m(m(v*a)+m(t*i))),f=o[r+28>>2],o[A+68>>2]=o[r+24>>2],o[A+72>>2]=f,f=o[r+36>>2],o[A+76>>2]=o[r+32>>2],o[A+80>>2]=f,m(w[r+40>>2])},ff,function(A){DA(ff(A|=0))},function(A,r){r|=0;var f=0;return o[12+(A|=0)>>2]&o[r+4>>2]?(f=1,v[A+152|0]||(A=o[r>>2])&&(f=!(4&v[A+204|0])),0|f):0},function(A,r,f){A|=0,f|=0;var e,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(e=o[o[o[4+(r|=0)>>2]+8>>2]+8>>2],(0|(i=o[A+136>>2]))==o[A+140>>2]&&!((0|(l=i?i<<1:1))<=(0|i))){l&&(o[8488]=o[8488]+1,c=0|Zn[o[8290]](l<<2,16),i=o[A+136>>2]),t=o[A+144>>2];A:{r:if((0|i)>0){if(i>>>0>=4)for(d=-4&i;o[(n=b<<2)+c>>2]=o[t+n>>2],o[(u=4|n)+c>>2]=o[t+u>>2],o[(u=8|n)+c>>2]=o[t+u>>2],o[(n|=12)+c>>2]=o[t+n>>2],b=b+4|0,(0|(s=s+4|0))!=(0|d););if(!(i&=3))break r;for(;o[(n=b<<2)+c>>2]=o[t+n>>2],b=b+1|0,(0|i)!=(0|(k=k+1|0)););}else if(!t)break A;t&&v[A+148|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](t)),i=o[A+136>>2]}o[A+144>>2]=c,o[A+140>>2]=l,a[A+148|0]=1}return o[o[A+144>>2]+(i<<2)>>2]=e,o[A+136>>2]=o[A+136>>2]+1,m(WA(A,r,f))},function(A){var r=0;return o[(A|=0)>>2]=31144,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+32>>2]=0,a[A+36|0]=1,o[A+24>>2]=0,o[A+28>>2]=0,0|A},function(A){var r=0;o[(A|=0)>>2]=31144,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,!(r=o[A+104>>2])||!r|!v[A+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+104>>2]=0,a[A+108|0]=1,o[A+96>>2]=0,o[A+100>>2]=0,!(r=o[A+84>>2])||!r|!v[A+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+84>>2]=0,a[A+88|0]=1,o[A+76>>2]=0,o[A+80>>2]=0,!(r=o[A+32>>2])||!r|!v[A+36|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),DA(A)},function(A,r){return r|=0,o[12+(A|=0)>>2]&o[r+4>>2]?0|!!(o[r+8>>2]&o[A+8>>2]):0},WA,_f,function(A){(A=_f(A|=0))&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0);o[A+24>>2]?(a=w[A- -64>>2],i=w[A+48>>2],t=m(m(a+i)*m(.5)),n=w[A+60>>2],u=w[A+44>>2],c=m(m(n+u)*m(.5)),l=m(m(a-i)*m(.5)),E=m(m(n-u)*m(.5)),i=w[A+56>>2],n=w[A+40>>2],a=m(m(i+n)*m(.5)),i=m(m(i-n)*m(.5))):i=m(0),W=m(Zn[o[o[A>>2]+48>>2]](A)),N=m(Zn[o[o[A>>2]+48>>2]](A)),v=m(Zn[o[o[A>>2]+48>>2]](A)),p=w[r+52>>2],n=w[r+20>>2],u=w[r+24>>2],d=w[r+56>>2],s=w[r+36>>2],b=w[r+40>>2],F=w[r+48>>2],h=w[r+8>>2],B=w[r>>2],Z=w[r+4>>2],G=w[r+16>>2],k=w[r+32>>2],o[f+12>>2]=0,d=m(d+m(m(t*b)+m(m(a*k)+m(c*s)))),l=m(l+v),v=m(l*m(Q(b))),i=m(i+W),b=m(E+N),s=m(v+m(m(i*m(Q(k)))+m(b*m(Q(s))))),w[f+8>>2]=d-s,k=m(p+m(m(t*u)+m(m(a*G)+m(c*n)))),n=m(m(l*m(Q(u)))+m(m(i*m(Q(G)))+m(b*m(Q(n))))),w[f+4>>2]=k-n,t=m(F+m(m(t*h)+m(m(a*B)+m(c*Z)))),c=m(m(l*m(Q(h)))+m(m(i*m(Q(B)))+m(b*m(Q(Z))))),w[f>>2]=t-c,o[e+12>>2]=0,w[e+8>>2]=s+d,w[e+4>>2]=n+k,w[e>>2]=c+t},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);S=e=S-96|0,o[e+44>>2]=0,o[e+48>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+52>>2]=1065353216,o[(i=e- -64|0)>>2]=0,o[i+4>>2]=0,o[e+76>>2]=0,o[e+80>>2]=0,o[e+72>>2]=1065353216,o[e+84>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=1065353216,Zn[o[o[A>>2]+8>>2]](A,e+32|0,e+16|0,e),t=w[e+8>>2],c=w[e+24>>2],n=m(t-c),s=m(n*n),n=w[e>>2],b=w[e+16>>2],a=m(n-b),k=m(a*a),a=w[e+4>>2],u=w[e+20>>2],l=m(a-u),w[f>>2]=m(N(m(s+m(k+m(l*l)))))*m(.5),o[r+12>>2]=0,w[r+8>>2]=m(t+c)*m(.5),w[r+4>>2]=m(a+u)*m(.5),w[r>>2]=m(n+b)*m(.5),S=e+96|0},function(A){A|=0;var r,f=m(0),e=m(0),i=m(0);return S=r=S-32|0,Zn[o[o[A>>2]+12>>2]](A,r+16|0,r+12|0),S=r+32|0,f=w[r+24>>2],e=m(f*f),f=w[r+16>>2],i=m(f*f),f=w[r+20>>2],m(m(w[r+12>>2]+m(N(m(e+m(i+m(f*f)))))))},function(A,r){return A|=0,r=m(r),m(m(m(Zn[o[o[A>>2]+16>>2]](A))*r))},function(A,r){A|=0,r|=0;var f,e=0,i=0,n=0,a=0,t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);if(S=f=S-144|0,o[A+24>>2]>0)for(n=f- -64|0;e=(a=G(t,80))+o[A+32>>2]|0,i=o[e+12>>2],o[f+24>>2]=o[e+8>>2],o[f+28>>2]=i,i=o[e+4>>2],o[f+16>>2]=o[e>>2],o[f+20>>2]=i,i=o[e+28>>2],o[f+40>>2]=o[e+24>>2],o[f+44>>2]=i,i=o[e+20>>2],o[f+32>>2]=o[e+16>>2],o[f+36>>2]=i,i=o[e+44>>2],o[f+56>>2]=o[e+40>>2],o[f+60>>2]=i,i=o[e+36>>2],o[f+48>>2]=o[e+32>>2],o[f+52>>2]=i,i=o[e+60>>2],o[n+8>>2]=o[e+56>>2],o[n+12>>2]=i,i=o[e+52>>2],o[n>>2]=o[e+48>>2],o[n+4>>2]=i,e=o[e+64>>2],e=0|Zn[o[o[e>>2]+28>>2]](e),i=o[e+12>>2],o[f+8>>2]=o[e+8>>2],o[f+12>>2]=i,i=o[e+4>>2],o[f>>2]=o[e>>2],o[f+4>>2]=i,c=w[A+88>>2],b=w[r+4>>2],u=w[A+84>>2],l=w[r>>2],w[f+8>>2]=m(w[f+8>>2]*w[r+8>>2])/w[A+92>>2],o[f+12>>2]=0,w[f>>2]=m(l*w[f>>2])/u,w[f+4>>2]=m(b*w[f+4>>2])/c,e=o[64+(o[A+32>>2]+a|0)>>2],Zn[o[o[e>>2]+24>>2]](e,f),c=w[A+84>>2],b=w[r>>2],u=w[A+88>>2],l=w[r+4>>2],s=w[A+92>>2],k=w[r+8>>2],o[f+76>>2]=0,w[f+72>>2]=m(k*w[f+72>>2])/s,w[f+68>>2]=m(l*w[f+68>>2])/u,w[f+64>>2]=m(b*w[f+64>>2])/c,i=o[f+20>>2],e=o[A+32>>2]+a|0,o[e>>2]=o[f+16>>2],o[e+4>>2]=i,i=o[f+28>>2],o[e+8>>2]=o[f+24>>2],o[e+12>>2]=i,i=o[f+44>>2],o[e+24>>2]=o[f+40>>2],o[e+28>>2]=i,i=o[f+36>>2],o[e+16>>2]=o[f+32>>2],o[e+20>>2]=i,i=o[f+60>>2],o[e+40>>2]=o[f+56>>2],o[e+44>>2]=i,i=o[f+52>>2],o[e+32>>2]=o[f+48>>2],o[e+36>>2]=i,i=o[n+12>>2],o[e+56>>2]=o[n+8>>2],o[e+60>>2]=i,i=o[n+4>>2],o[e+48>>2]=o[n>>2],o[e+52>>2]=i,o[A+72>>2]&&(e=o[64+(o[A+32>>2]+a|0)>>2],Zn[o[o[e>>2]+8>>2]](e,f+16|0,f+128|0,f+112|0),e=o[f+140>>2],o[f+88>>2]=o[f+136>>2],o[f+92>>2]=e,e=o[f+132>>2],o[f+80>>2]=o[f+128>>2],o[f+84>>2]=e,e=o[f+124>>2],o[f+104>>2]=o[f+120>>2],o[f+108>>2]=e,e=o[f+116>>2],o[f+96>>2]=o[f+112>>2],o[f+100>>2]=e,Xf(o[A+72>>2],o[76+(o[A+32>>2]+a|0)>>2],f+80|0)),(0|(t=t+1|0))>2];);e=o[r+4>>2],o[A+84>>2]=o[r>>2],o[A+88>>2]=e,e=o[r+12>>2],o[A+92>>2]=o[r+8>>2],o[A+96>>2]=e,Zn[o[o[A>>2]+68>>2]](A),S=f+144|0},function(A){return 84+(A|=0)|0},function(A,r,f){A|=0,r=m(r),f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0);S=e=S-96|0,o[e+44>>2]=0,o[e+48>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+52>>2]=1065353216,o[(i=e- -64|0)>>2]=0,o[i+4>>2]=0,o[e+76>>2]=0,o[e+80>>2]=0,o[e+72>>2]=1065353216,o[e+84>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=1065353216,Zn[o[o[A>>2]+8>>2]](A,e+32|0,e+16|0,e),n=w[e+24>>2],c=w[e+8>>2],r=m(r/m(12)),a=m(m(w[e>>2]-w[e+16>>2])*m(.5)),a=m(a+a),a=m(a*a),t=m(m(w[e+4>>2]-w[e+20>>2])*m(.5)),t=m(t+t),t=m(t*t),w[f+8>>2]=r*m(a+t),n=m(m(c-n)*m(.5)),n=m(n+n),n=m(n*n),w[f+4>>2]=r*m(a+n),w[f>>2]=r*m(t+n),S=e+96|0},function(){return 7871},function(A){o[8+(A|=0)>>2]=1065353216,o[A+12>>2]=0,o[A>>2]=1065353216,o[A+4>>2]=1065353216},function(A,r){A|=0,r=m(r),w[A+80>>2]=r},function(A){return m(w[80+(A|=0)>>2])},function(){return 24},function(A,r,f){var e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(te(A|=0,r|=0,f|=0),w[r+20>>2]=w[A+80>>2],e=o[A+24>>2],o[r+12>>2]=0,o[r+16>>2]=e,e){if(a=0|Zn[o[o[f>>2]+16>>2]](f,76,e),e=o[a+8>>2],b=r,u=0|Zn[o[o[f>>2]+28>>2]](f,e),o[b+12>>2]=u,o[r+16>>2]>0)for(n=o[A+32>>2];n=(i=G(t,80))+n|0,w[e+72>>2]=w[n+72>>2],b=e,u=0|Zn[o[o[f>>2]+28>>2]](f,o[n+64>>2]),o[b+64>>2]=u,0|Zn[o[o[f>>2]+24>>2]](f,o[64+(i+o[A+32>>2]|0)>>2])||(n=o[64+(i+o[A+32>>2]|0)>>2],u=f,l=0|Zn[o[o[n>>2]+52>>2]](n),s=1,b=o[o[f>>2]+16>>2],n=0|Zn[b](0|u,0|l,0|s),c=o[64+(i+o[A+32>>2]|0)>>2],s=f,l=n,u=0|Zn[o[o[c>>2]+56>>2]](c,o[n+8>>2],f),k=1346455635,d=o[64+(i+o[A+32>>2]|0)>>2],b=o[o[f>>2]+20>>2],Zn[b](0|s,0|l,0|u,0|k,0|d)),i=i+(n=o[A+32>>2])|0,o[e+68>>2]=o[i+68>>2],w[e>>2]=w[i>>2],w[e+4>>2]=w[i+4>>2],w[e+8>>2]=w[i+8>>2],w[e+12>>2]=w[i+12>>2],w[e+16>>2]=w[i+16>>2],w[e+20>>2]=w[i+20>>2],w[e+24>>2]=w[i+24>>2],w[e+28>>2]=w[i+28>>2],w[e+32>>2]=w[i+32>>2],w[e+36>>2]=w[i+36>>2],w[e+40>>2]=w[i+40>>2],w[e+44>>2]=w[i+44>>2],w[e+48>>2]=w[i+48>>2],w[e+52>>2]=w[i+52>>2],w[e+56>>2]=w[i+56>>2],w[e+60>>2]=w[i+60>>2],e=e+76|0,(0|(t=t+1|0))>2];);Zn[o[o[f>>2]+20>>2]](f,a,9214,1497453121,o[a+8>>2])}return 9100},function(A,r){var f,e,i=0,n=0,a=0,t=0;n=r|=0,a=0|Zn[o[o[(A|=0)>>2]+52>>2]](A),t=1,i=o[o[r>>2]+16>>2],e=0|Zn[i](0|n,0|a,0|t),t=r,a=e,n=0|Zn[o[o[A>>2]+56>>2]](A,o[e+8>>2],r),f=A,i=o[o[r>>2]+20>>2],Zn[i](0|t,0|a,0|n,1346455635,0|f)},function(A,r){r|=0;var f,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(S=f=S-80|0,o[76+(A|=0)>>2]=o[A+76>>2]+1,(0|(i=o[A+24>>2]))>0)for(a=f- -64|0,t=f+48|0,c=f+32|0,b=f+16|0,l=i;u=o[A+32>>2],k=G(s=l-1|0,80),o[64+(e=u+k|0)>>2]==(0|r)&&(o[A+76>>2]=o[A+76>>2]+1,(n=o[A+72>>2])&&(Ie(n,o[e+76>>2]),u=o[A+32>>2],i=o[A+24>>2]),d=o[4+(n=8+(e=u+k|0)|0)>>2],o[f+8>>2]=o[n>>2],o[f+12>>2]=d,n=o[e+4>>2],o[f>>2]=o[e>>2],o[f+4>>2]=n,n=o[e+28>>2],o[b+8>>2]=o[e+24>>2],o[b+12>>2]=n,n=o[e+20>>2],o[b>>2]=o[e+16>>2],o[b+4>>2]=n,n=o[e+44>>2],o[c+8>>2]=o[e+40>>2],o[c+12>>2]=n,n=o[e+36>>2],o[c>>2]=o[e+32>>2],o[c+4>>2]=n,n=o[e+60>>2],o[t+8>>2]=o[e+56>>2],o[t+12>>2]=n,n=o[e+52>>2],o[t>>2]=o[e+48>>2],o[t+4>>2]=n,n=o[e+76>>2],o[a+8>>2]=o[e+72>>2],o[a+12>>2]=n,n=o[e+68>>2],o[a>>2]=o[e+64>>2],o[a+4>>2]=n,n=u,u=G(i,80)-80|0,n=o[4+(i=n+u|0)>>2],o[e>>2]=o[i>>2],o[e+4>>2]=n,n=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=n,n=o[i+20>>2],o[e+16>>2]=o[i+16>>2],o[e+20>>2]=n,n=o[i+28>>2],o[e+24>>2]=o[i+24>>2],o[e+28>>2]=n,n=o[i+36>>2],o[e+32>>2]=o[i+32>>2],o[e+36>>2]=n,n=o[i+44>>2],o[e+40>>2]=o[i+40>>2],o[e+44>>2]=n,n=o[i+60>>2],o[e+56>>2]=o[i+56>>2],o[e+60>>2]=n,n=o[i+52>>2],o[e+48>>2]=o[i+48>>2],o[e+52>>2]=n,n=o[i+68>>2],o[e+64>>2]=o[i+64>>2],o[e+68>>2]=n,n=o[i+76>>2],o[e+72>>2]=o[i+72>>2],o[e+76>>2]=n,i=o[f+4>>2],e=u+o[A+32>>2]|0,o[e>>2]=o[f>>2],o[e+4>>2]=i,i=o[f+12>>2],o[e+8>>2]=o[f+8>>2],o[e+12>>2]=i,i=o[b+4>>2],o[e+16>>2]=o[b>>2],o[e+20>>2]=i,i=o[b+12>>2],o[e+24>>2]=o[b+8>>2],o[e+28>>2]=i,i=o[c+12>>2],o[e+40>>2]=o[c+8>>2],o[e+44>>2]=i,i=o[c+4>>2],o[e+32>>2]=o[c>>2],o[e+36>>2]=i,i=o[t+4>>2],o[e+48>>2]=o[t>>2],o[e+52>>2]=i,i=o[t+12>>2],o[e+56>>2]=o[t+8>>2],o[e+60>>2]=i,i=o[a+4>>2],o[e+64>>2]=o[a>>2],o[e+68>>2]=i,i=o[a+12>>2],o[e+72>>2]=o[a+8>>2],o[e+76>>2]=i,o[A+72>>2]&&(o[o[76+(o[A+32>>2]+k|0)>>2]+36>>2]=s),i=o[A+24>>2]-1|0,o[A+24>>2]=i),e=l>>>0>1,l=s,e;);Zn[o[o[A>>2]+68>>2]](A),S=f+80|0},function(A){A|=0;var r,f=m(0),e=0,i=0,n=0;if(S=r=S-32|0,o[A+56>>2]=-581039253,o[A+60>>2]=-581039253,o[A+40>>2]=1566444395,o[A+44>>2]=1566444395,o[(e=A- -64|0)>>2]=-581039253,o[e+4>>2]=0,o[A+48>>2]=1566444395,o[A+52>>2]=0,o[A+24>>2]>0)for(;e=o[A+32>>2]+G(i,80)|0,n=o[e+64>>2],Zn[o[o[n>>2]+8>>2]](n,e,r+16|0,r),(f=w[r+16>>2])>2]&&(w[A+40>>2]=f),(f=w[r>>2])>w[A+56>>2]&&(w[A+56>>2]=f),(f=w[r+20>>2])>2]&&(w[A+44>>2]=f),(f=w[r+4>>2])>w[A+60>>2]&&(w[A+60>>2]=f),(f=w[r+24>>2])>2]&&(w[A+48>>2]=f),(f=w[r+8>>2])>w[A+64>>2]&&(w[A+64>>2]=f),(0|(i=i+1|0))>2];);S=r+32|0},function(A){var r=0,f=0;return o[(A|=0)>>2]=31600,v[A+136|0]&&(r=o[A+140>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+140>>2]),0|A},function(A){var r=0,f=0;o[(A|=0)>>2]=31600,v[A+136|0]&&(r=o[A+140>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+140>>2]),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r){pr(A|=0,8+(r|=0)|0,128)},function(A,r){pr(8+(A|=0)|0,r|=0,128)},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+108>>2]](A,r,f,e)},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+16>>2]](A,r,f,e)},function(A,r,f,e){A|=0,r=m(r),f|=0,e|=0;var i,n=0,a=m(0);S=i=S+-64|0,n=o[f+60>>2],o[i+56>>2]=o[f+56>>2],o[i+60>>2]=n,n=o[f+52>>2],o[i+48>>2]=o[f+48>>2],o[i+52>>2]=n,w[i+32>>2]=w[f+4>>2],w[i+36>>2]=w[f+20>>2],a=w[f+36>>2],o[i+44>>2]=0,w[i+40>>2]=a,w[i+16>>2]=w[f>>2],w[i+20>>2]=w[f+16>>2],a=w[f+32>>2],o[i+28>>2]=0,w[i+24>>2]=a,f=i+48|0,n=i+32|0,Zn[o[o[A>>2]+72>>2]](A,f,n,i+16|0,r,m(-1.5707963705062866),m(1.5707963705062866),m(-1.5707963705062866),m(1.5707963705062866),e,m(30),0),o[i+12>>2]=0,w[i+8>>2]=-w[i+24>>2],w[i+4>>2]=-w[i+20>>2],w[i>>2]=-w[i+16>>2],Zn[o[o[A>>2]+72>>2]](A,f,n,i,r,m(-1.5707963705062866),m(1.5707963705062866),m(-1.5707963705062866),m(1.5707963705062866),e,m(30),0),S=i- -64|0},function(A,r,f,e){A|=0,r|=0,f=m(f),e|=0;var i,n=0;S=i=S+-64|0,o[i+12>>2]=0,o[i+16>>2]=0,o[i+24>>2]=0,o[i+28>>2]=0,o[i+20>>2]=1065353216,o[i+32>>2]=0,o[i+36>>2]=0,o[i+40>>2]=1065353216,o[i+44>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,o[i>>2]=1065353216,n=o[r+12>>2],o[i+56>>2]=o[r+8>>2],o[i+60>>2]=n,n=o[r+4>>2],o[i+48>>2]=o[r>>2],o[i+52>>2]=n,Zn[o[o[A>>2]+24>>2]](A,f,i,e),S=i- -64|0},function(A,r,f,e,i,n,a,t,c){A|=0,r|=0,f|=0,e|=0,t|=0,c=m(c),Zn[o[o[A>>2]+36>>2]](A,r,f,e,t,c)},function(A,r,f,e,i){r|=0,f|=0,e|=0,i|=0,Zn[o[o[(A|=0)>>2]+16>>2]](A,r,f,i),Zn[o[o[A>>2]+16>>2]](A,f,e,i),Zn[o[o[A>>2]+16>>2]](A,e,r,i)},function(A,r,f,e,i,n){A|=0,r|=0,f|=0,e=m(e),i|=0,n|=0;var a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);S=i=S-16|0,a=w[r>>2],t=w[f>>2],c=w[r+4>>2],b=w[f+4>>2],u=w[r+8>>2],l=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=u+m(l*e),w[i+4>>2]=c+m(b*e),w[i>>2]=a+m(t*e),Zn[o[o[A>>2]+16>>2]](A,r,i,n),e=w[r>>2],a=w[f>>2],t=w[r+4>>2],c=w[f+4>>2],b=w[r+8>>2],u=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=b+m(u*m(.009999999776482582)),w[i+4>>2]=t+m(c*m(.009999999776482582)),w[i>>2]=e+m(a*m(.009999999776482582)),Zn[o[o[A>>2]+16>>2]](A,r,i,n),S=i+16|0},dn,zi,function(A,r){r|=0,o[4+(A|=0)>>2]=r},Ui,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);S=i=S-32|0,c=w[r>>2],n=w[f>>2],b=w[r+4>>2],a=w[f+4>>2],u=w[r+8>>2],t=w[f+8>>2],o[i+28>>2]=0,o[i+12>>2]=0,l=m(m(t+u)*m(.5)),t=m(m(t-u)*m(.5)),u=m(l+t),w[i+24>>2]=u,s=m(m(a+b)*m(.5)),a=m(m(a-b)*m(.5)),b=m(s+a),w[i+20>>2]=b,k=m(m(n+c)*m(.5)),n=m(m(n-c)*m(.5)),c=m(k+n),w[i+16>>2]=c,w[i+8>>2]=u,w[i+4>>2]=b,n=m(k-n),w[i>>2]=n,r=i+16|0,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=u,w[i+20>>2]=b,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=u,a=m(s-a),w[i+4>>2]=a,w[i>>2]=n,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=u,w[i+20>>2]=a,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,t=m(l-t),w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=n,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=a,w[i+16>>2]=c,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=n,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=a,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=b,w[i>>2]=n,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=b,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=u,w[i+4>>2]=b,w[i>>2]=n,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=b,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=b,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=b,w[i+16>>2]=c,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=t,w[i+20>>2]=a,w[i+16>>2]=c,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=u,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=u,w[i+20>>2]=a,w[i+16>>2]=n,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=u,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=u,w[i+20>>2]=a,w[i+16>>2]=c,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=u,w[i+4>>2]=b,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),w[i+24>>2]=u,w[i+20>>2]=b,w[i+16>>2]=c,o[i+28>>2]=0,o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=b,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,r,i,e),S=i+32|0},function(A,r,f){A|=0,r|=0,f=m(f);var e,i,n=0,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0);S=e=S-48|0,n=o[r+60>>2],o[e+40>>2]=o[r+56>>2],o[e+44>>2]=n,n=o[r+52>>2],o[e+32>>2]=o[r+48>>2],o[e+36>>2]=n,a=w[r+24>>2],t=w[r+20>>2],c=w[r+40>>2],b=w[r+36>>2],u=w[r+8>>2],l=w[r>>2],s=w[r+4>>2],k=w[r+16>>2],d=w[r+32>>2],o[e+28>>2]=0,w[e+24>>2]=m(m(c*m(0))+m(m(d*f)+m(b*m(0))))+w[e+40>>2],w[e+20>>2]=m(m(a*m(0))+m(m(k*f)+m(t*m(0))))+w[e+36>>2],w[e+16>>2]=m(m(u*m(0))+m(m(l*f)+m(s*m(0))))+w[e+32>>2],o[e+8>>2]=1050253722,o[e+12>>2]=0,o[e>>2]=1065353216,o[e+4>>2]=1050253722,n=e+32|0,i=e+16|0,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[r+24>>2],t=w[r+20>>2],c=w[r+40>>2],b=w[r+36>>2],u=w[r+8>>2],l=w[r>>2],s=w[r+4>>2],k=w[r+16>>2],d=w[r+32>>2],o[e+28>>2]=0,w[e+24>>2]=m(m(c*m(0))+m(m(d*m(0))+m(b*f)))+w[e+40>>2],w[e+20>>2]=m(m(a*m(0))+m(m(k*m(0))+m(t*f)))+w[e+36>>2],w[e+16>>2]=m(m(u*m(0))+m(m(l*m(0))+m(s*f)))+w[e+32>>2],o[e+8>>2]=1050253722,o[e+12>>2]=0,o[e>>2]=1050253722,o[e+4>>2]=1065353216,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[r+24>>2],t=w[r+20>>2],c=w[r+40>>2],b=w[r+36>>2],u=w[r+8>>2],l=w[r>>2],s=w[r+4>>2],k=w[r+16>>2],d=w[r+32>>2],o[e+28>>2]=0,w[e+24>>2]=m(m(c*f)+m(m(d*m(0))+m(b*m(0))))+w[e+40>>2],w[e+20>>2]=m(m(a*f)+m(m(k*m(0))+m(t*m(0))))+w[e+36>>2],w[e+16>>2]=m(m(u*f)+m(m(l*m(0))+m(s*m(0))))+w[e+32>>2],o[e+8>>2]=1065353216,o[e+12>>2]=0,o[e>>2]=1050253722,o[e+4>>2]=1050253722,Zn[o[o[A>>2]+16>>2]](A,n,i,e),S=e+48|0},function(A,r,f,e,i,n,a,t,c,b,u){A|=0,r|=0,f|=0,e|=0,i=m(i),n=m(n),a=m(a),t=m(t),c|=0,b|=0,u=m(u);var l,s,k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=0,E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0);if(S=l=S-32|0,E=w[f+8>>2],d=w[e+8>>2],h=w[f>>2],v=w[e+4>>2],B=w[e>>2],W=w[f+4>>2],N=w[r>>2],F=w[r+4>>2],k=w[r+8>>2],o[l+28>>2]=0,Z=Kr(a),p=m(m(m(h*v)-m(B*W))*n),R=k,k=$r(a),w[l+24>>2]=m(Z*p)+m(R+m(k*m(d*i))),h=m(m(m(E*B)-m(d*h))*n),w[l+20>>2]=m(F+m(k*m(v*i)))+m(Z*h),d=m(m(m(W*d)-m(v*E))*n),w[l+16>>2]=m(Z*d)+m(N+m(k*m(B*i))),v=m(t-a),n=m(Q(m(v/m(u*m(.01745329238474369))))),f=m(Q(n))>2]+16>>2]](A,r,l+16|0,c),(0|(s=f>>>0<=1?1:f))>0)for(u=m(0|s),f=1;B=w[e+8>>2],n=$r(t=m(m(m(v*m(0|f))/u)+a)),E=w[r+8>>2],t=Kr(t),W=w[r>>2],Z=w[e>>2],k=w[r+4>>2],N=w[e+4>>2],w[l+8>>2]=m(p*t)+m(E+m(n*m(B*i))),o[l+12>>2]=0,w[l+4>>2]=m(h*t)+m(k+m(n*m(N*i))),w[l>>2]=m(d*t)+m(W+m(n*m(Z*i))),Zn[o[o[A>>2]+16>>2]](A,l+16|0,l,c),G=o[l+12>>2],o[l+24>>2]=o[l+8>>2],o[l+28>>2]=G,G=o[l+4>>2],o[l+16>>2]=o[l>>2],o[l+20>>2]=G,G=(0|f)==(0|s),f=f+1|0,!G;);b&&Zn[o[o[A>>2]+16>>2]](A,r,l+16|0,c),S=l+32|0},function(A,r,f,e,i,n,a,t,c,b,u,l){A|=0,r|=0,f|=0,e|=0,i=m(i),n=m(n),a=m(a),t=m(t),c=m(c),b|=0,u=m(u),l|=0;var s,k,d,v,h,B=0,Z=0,G=m(0),E=m(0),W=m(0),N=0,p=0,F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=m(0),C=m(0),J=m(0),x=m(0),y=0,M=m(0),H=0,I=0,T=m(0),U=0,j=m(0),z=m(0),P=m(0),O=0,L=0,$=0,K=m(0);for(S=s=S-2416|0,F=w[r>>2],D=w[f>>2],R=w[r+4>>2],J=w[f+4>>2],Y=w[r+8>>2],x=w[f+8>>2],o[s+44>>2]=0,E=m(x*i),w[s+40>>2]=Y+E,W=m(J*i),w[s+36>>2]=R+W,V=m(D*i),w[s+32>>2]=F+V,o[s+28>>2]=0,w[s+24>>2]=Y-E,w[s+20>>2]=R-W,w[s+16>>2]=F-V,G=m(u*m(.01745329238474369)),u=m(G+m(-1.5707963705062866)),V=(I=n<=m(-1.5707963705062866))?u:n,n=m(m(1.5707963705062866)-G),V>(a=(y=a>=m(1.5707963705062866))?n:a)&&(y=1,I=1,V=u,a=n),E=w[e>>2],W=w[e+4>>2],u=w[e+8>>2],T=(B=t>c)?m(G+m(-3.1415927410125732)):t,g=m((B?m(3.1415927410125732):c)-T),n=m(g/G),N=m(Q(n))=m(6.2831854820251465),B=1^l,a=m(a-V),n=m(a/G),N=m(Q(n))>2],R=w[r>>2],Y=w[e>>2],E=w[f+4>>2],W=w[r+4>>2],u=w[e+4>>2],c=w[f+8>>2],t=w[r+8>>2],a=w[e+8>>2],o[Z+12>>2]=0,n=m(m(m(0|X)*J)+V),M=m($r(n)*i),G=m(M*g),K=a,a=m(M*x),C=m(Kr(n)*i),w[Z+8>>2]=m(m(j*G)+m(t+m(K*a)))+m(c*C),w[Z+4>>2]=m(m(z*G)+m(W+m(a*u)))+m(C*E),w[Z>>2]=m(m(P*G)+m(R+m(a*Y)))+m(C*F),O=(U=(0|X)==(0|v))&I,X|y&&Zn[o[o[A>>2]+16>>2]](A,X?N:s+16|0,Z,b),B=o[Z+12>>2],o[s+8>>2]=o[Z+8>>2],o[s+12>>2]=B,B=o[Z+4>>2],o[s>>2]=o[Z>>2],o[s+4>>2]=B,O&&Zn[o[o[A>>2]+16>>2]](A,s+32|0,Z,b),!(L=!X|U)|h||Zn[o[o[A>>2]+16>>2]](A,r,Z,b),B=1;;){F=w[f>>2],R=w[r>>2],Y=w[e>>2],E=w[f+4>>2],W=w[r+4>>2],u=w[e+4>>2],c=w[f+8>>2],t=w[r+8>>2],a=w[e+8>>2],o[12+(p=($=B<<4)+Z|0)>>2]=0,H=B,n=m(m(m(0|B)*D)+T),G=m(M*Kr(n)),n=m(M*$r(n)),w[p+8>>2]=m(m(j*G)+m(t+m(a*n)))+m(C*c),w[p+4>>2]=m(m(z*G)+m(W+m(n*u)))+m(C*E),w[p>>2]=m(m(P*G)+m(R+m(n*Y)))+m(C*F);A:{if(X)B=N+$|0;else if(B=s+16|0,!y)break A;Zn[o[o[A>>2]+16>>2]](A,B,p,b)}Zn[o[o[A>>2]+16>>2]](A,p-16|0,p,b),O&&Zn[o[o[A>>2]+16>>2]](A,s+32|0,p,b);A:if(l){r:{if(d){if(B=s,(0|H)==(0|k))break r;break A}if(B=r,!((0|H)==(0|k)&L))break A}Zn[o[o[A>>2]+16>>2]](A,B,p,b)}if(B=H+1|0,(0|H)==(0|k))break}if(X=X+1|0,B=Z,Z=N,U)break}S=s+2416|0},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,a=m(0),t=m(0),c=m(0);S=i=S-32|0,w[i+16>>2]=w[r>>2],a=w[r+4>>2],w[i+20>>2]=a,t=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,c=w[f>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=c,n=i+16|0,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[f>>2],w[i+16>>2]=a,w[i+20>>2]=w[r+4>>2],t=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,w[i>>2]=a,a=w[f+4>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,Zn[o[o[A>>2]+16>>2]](A,n,i,e),w[i+16>>2]=w[f>>2],a=w[f+4>>2],w[i+20>>2]=a,t=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,c=w[r>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[r>>2],w[i+16>>2]=a,w[i+20>>2]=w[f+4>>2],t=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,w[i>>2]=a,a=w[r+4>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,Zn[o[o[A>>2]+16>>2]](A,n,i,e),t=w[r>>2],w[i+16>>2]=t,a=w[r+4>>2],w[i+20>>2]=a,c=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=c,w[i+4>>2]=a,w[i>>2]=t,t=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=t,Zn[o[o[A>>2]+16>>2]](A,n,i,e),t=w[f>>2],w[i+16>>2]=t,a=w[r+4>>2],w[i+20>>2]=a,c=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=c,w[i+4>>2]=a,w[i>>2]=t,t=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=t,Zn[o[o[A>>2]+16>>2]](A,n,i,e),t=w[f>>2],w[i+16>>2]=t,a=w[f+4>>2],w[i+20>>2]=a,c=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=c,w[i+4>>2]=a,w[i>>2]=t,t=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=t,Zn[o[o[A>>2]+16>>2]](A,n,i,e),t=w[r>>2],w[i+16>>2]=t,a=w[f+4>>2],w[i+20>>2]=a,c=w[r+8>>2],o[i+28>>2]=0,w[i+24>>2]=c,w[i+4>>2]=a,w[i>>2]=t,t=w[f+8>>2],o[i+12>>2]=0,w[i+8>>2]=t,Zn[o[o[A>>2]+16>>2]](A,n,i,e),w[i+16>>2]=w[r>>2],a=w[r+4>>2],w[i+20>>2]=a,t=w[f+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,c=w[f>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[f>>2],w[i+16>>2]=a,w[i+20>>2]=w[r+4>>2],t=w[f+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,w[i>>2]=a,a=w[f+4>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,Zn[o[o[A>>2]+16>>2]](A,n,i,e),w[i+16>>2]=w[f>>2],a=w[f+4>>2],w[i+20>>2]=a,t=w[f+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,c=w[r>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,w[i>>2]=c,Zn[o[o[A>>2]+16>>2]](A,n,i,e),a=w[r>>2],w[i+16>>2]=a,w[i+20>>2]=w[f+4>>2],t=w[f+8>>2],o[i+28>>2]=0,w[i+24>>2]=t,w[i>>2]=a,a=w[r+4>>2],o[i+12>>2]=0,w[i+8>>2]=t,w[i+4>>2]=a,Zn[o[o[A>>2]+16>>2]](A,n,i,e),S=i+32|0},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,a,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0);S=n=S-32|0,v=w[e+52>>2],b=w[e+24>>2],u=w[e+20>>2],h=w[e+56>>2],l=w[e+40>>2],B=w[e+36>>2],Z=w[e+16>>2],G=w[e+32>>2],Q=w[e+48>>2],s=w[e+8>>2],t=w[r+8>>2],E=w[e>>2],c=w[r>>2],d=w[e+4>>2],k=w[r+4>>2],o[n+28>>2]=0,s=m(t*s),d=m(k*d),w[n+16>>2]=Q+m(s+m(m(c*E)+d)),l=m(t*l),B=m(k*B),w[n+24>>2]=h+m(l+m(m(c*G)+B)),b=m(t*b),t=m(c*Z),c=m(k*u),w[n+20>>2]=v+m(b+m(t+c)),t=w[f>>2],o[n+12>>2]=0,w[n+8>>2]=h+m(l+m(m(t*G)+B)),w[n+4>>2]=v+m(b+m(m(t*Z)+c)),w[n>>2]=Q+m(s+m(m(t*E)+d)),a=n+16|0,Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],h=w[e+20>>2],Z=w[e+56>>2],u=w[e+40>>2],G=w[e+36>>2],Q=w[e+48>>2],l=w[e+8>>2],B=w[e>>2],E=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[f>>2],k=w[r+4>>2],o[n+28>>2]=0,u=m(t*u),d=m(c*d),w[n+24>>2]=Z+m(u+m(d+m(k*G))),b=m(t*b),s=m(c*s),w[n+20>>2]=v+m(b+m(s+m(k*h))),l=m(t*l),c=m(c*B),w[n+16>>2]=Q+m(l+m(c+m(k*E))),t=w[f+4>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(u+m(d+m(G*t))),w[n+4>>2]=v+m(b+m(s+m(h*t))),w[n>>2]=Q+m(l+m(c+m(E*t))),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],u=w[e+20>>2],h=w[e+56>>2],l=w[e+40>>2],B=w[e+36>>2],Z=w[e+48>>2],s=w[e+8>>2],G=w[e>>2],d=w[e+4>>2],Q=w[e+16>>2],t=w[r+8>>2],E=w[e+32>>2],c=w[f>>2],k=w[f+4>>2],o[n+28>>2]=0,l=m(t*l),B=m(k*B),w[n+24>>2]=h+m(l+m(m(c*E)+B)),b=m(t*b),u=m(k*u),w[n+20>>2]=v+m(b+m(m(c*Q)+u)),s=m(t*s),t=m(c*G),c=m(k*d),w[n+16>>2]=Z+m(s+m(t+c)),t=w[r>>2],o[n+12>>2]=0,w[n+8>>2]=h+m(l+m(m(t*E)+B)),w[n+4>>2]=v+m(b+m(m(t*Q)+u)),w[n>>2]=Z+m(s+m(m(t*G)+c)),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],h=w[e+20>>2],Z=w[e+56>>2],u=w[e+40>>2],G=w[e+36>>2],Q=w[e+48>>2],l=w[e+8>>2],B=w[e>>2],E=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[r>>2],k=w[f+4>>2],o[n+28>>2]=0,u=m(t*u),d=m(c*d),w[n+24>>2]=Z+m(u+m(d+m(k*G))),b=m(t*b),s=m(c*s),w[n+20>>2]=v+m(b+m(s+m(k*h))),l=m(t*l),c=m(c*B),w[n+16>>2]=Q+m(l+m(c+m(k*E))),t=w[r+4>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(u+m(d+m(G*t))),w[n+4>>2]=v+m(b+m(s+m(h*t))),w[n>>2]=Q+m(l+m(c+m(E*t))),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],h=w[e+24>>2],b=w[e+20>>2],Z=w[e+56>>2],G=w[e+40>>2],u=w[e+36>>2],Q=w[e+48>>2],E=w[e+8>>2],l=w[e>>2],B=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[r>>2],k=w[r+4>>2],o[n+28>>2]=0,u=m(m(c*d)+m(k*u)),w[n+24>>2]=Z+m(m(t*G)+u),b=m(m(c*s)+m(k*b)),w[n+20>>2]=v+m(m(t*h)+b),c=m(m(c*l)+m(k*B)),w[n+16>>2]=Q+m(m(t*E)+c),t=w[f+8>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(m(t*G)+u),w[n+4>>2]=v+m(m(t*h)+b),w[n>>2]=Q+m(m(t*E)+c),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],h=w[e+24>>2],b=w[e+20>>2],Z=w[e+56>>2],G=w[e+40>>2],u=w[e+36>>2],Q=w[e+48>>2],E=w[e+8>>2],l=w[e>>2],B=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[f>>2],k=w[r+4>>2],o[n+28>>2]=0,u=m(m(c*d)+m(k*u)),w[n+24>>2]=Z+m(m(t*G)+u),b=m(m(c*s)+m(k*b)),w[n+20>>2]=v+m(m(t*h)+b),c=m(m(c*l)+m(k*B)),w[n+16>>2]=Q+m(m(t*E)+c),t=w[f+8>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(m(t*G)+u),w[n+4>>2]=v+m(m(t*h)+b),w[n>>2]=Q+m(m(t*E)+c),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],h=w[e+24>>2],b=w[e+20>>2],Z=w[e+56>>2],G=w[e+40>>2],u=w[e+36>>2],Q=w[e+48>>2],E=w[e+8>>2],l=w[e>>2],B=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[f>>2],k=w[f+4>>2],o[n+28>>2]=0,u=m(m(c*d)+m(k*u)),w[n+24>>2]=Z+m(m(t*G)+u),b=m(m(c*s)+m(k*b)),w[n+20>>2]=v+m(m(t*h)+b),c=m(m(c*l)+m(k*B)),w[n+16>>2]=Q+m(m(t*E)+c),t=w[f+8>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(m(t*G)+u),w[n+4>>2]=v+m(m(t*h)+b),w[n>>2]=Q+m(m(t*E)+c),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],h=w[e+24>>2],b=w[e+20>>2],Z=w[e+56>>2],G=w[e+40>>2],u=w[e+36>>2],Q=w[e+48>>2],E=w[e+8>>2],l=w[e>>2],B=w[e+4>>2],s=w[e+16>>2],t=w[r+8>>2],d=w[e+32>>2],c=w[r>>2],k=w[f+4>>2],o[n+28>>2]=0,u=m(m(c*d)+m(k*u)),w[n+24>>2]=Z+m(m(t*G)+u),b=m(m(c*s)+m(k*b)),w[n+20>>2]=v+m(m(t*h)+b),c=m(m(c*l)+m(k*B)),w[n+16>>2]=Q+m(m(t*E)+c),t=w[f+8>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(m(t*G)+u),w[n+4>>2]=v+m(m(t*h)+b),w[n>>2]=Q+m(m(t*E)+c),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],u=w[e+20>>2],h=w[e+56>>2],l=w[e+40>>2],B=w[e+36>>2],Z=w[e+48>>2],s=w[e+8>>2],G=w[e>>2],d=w[e+4>>2],Q=w[e+16>>2],t=w[f+8>>2],E=w[e+32>>2],c=w[r>>2],k=w[r+4>>2],o[n+28>>2]=0,l=m(t*l),B=m(k*B),w[n+24>>2]=h+m(l+m(m(c*E)+B)),b=m(t*b),u=m(k*u),w[n+20>>2]=v+m(b+m(m(c*Q)+u)),s=m(t*s),t=m(c*G),c=m(k*d),w[n+16>>2]=Z+m(s+m(t+c)),t=w[f>>2],o[n+12>>2]=0,w[n+8>>2]=h+m(l+m(m(t*E)+B)),w[n+4>>2]=v+m(b+m(m(t*Q)+u)),w[n>>2]=Z+m(s+m(m(t*G)+c)),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],h=w[e+20>>2],Z=w[e+56>>2],u=w[e+40>>2],G=w[e+36>>2],Q=w[e+48>>2],l=w[e+8>>2],B=w[e>>2],E=w[e+4>>2],s=w[e+16>>2],t=w[f+8>>2],d=w[e+32>>2],c=w[f>>2],k=w[r+4>>2],o[n+28>>2]=0,u=m(t*u),d=m(c*d),w[n+24>>2]=Z+m(u+m(d+m(k*G))),b=m(t*b),s=m(c*s),w[n+20>>2]=v+m(b+m(s+m(k*h))),l=m(t*l),c=m(c*B),w[n+16>>2]=Q+m(l+m(c+m(k*E))),t=w[f+4>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(u+m(d+m(G*t))),w[n+4>>2]=v+m(b+m(s+m(h*t))),w[n>>2]=Q+m(l+m(c+m(E*t))),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],u=w[e+20>>2],h=w[e+56>>2],l=w[e+40>>2],B=w[e+36>>2],Z=w[e+48>>2],s=w[e+8>>2],G=w[e>>2],d=w[e+4>>2],Q=w[e+16>>2],t=w[f+8>>2],E=w[e+32>>2],c=w[f>>2],k=w[f+4>>2],o[n+28>>2]=0,l=m(t*l),B=m(k*B),w[n+24>>2]=h+m(l+m(m(c*E)+B)),b=m(t*b),u=m(k*u),w[n+20>>2]=v+m(b+m(m(c*Q)+u)),s=m(t*s),t=m(c*G),c=m(k*d),w[n+16>>2]=Z+m(s+m(t+c)),t=w[r>>2],o[n+12>>2]=0,w[n+8>>2]=h+m(l+m(m(t*E)+B)),w[n+4>>2]=v+m(b+m(m(t*Q)+u)),w[n>>2]=Z+m(s+m(m(t*G)+c)),Zn[o[o[A>>2]+16>>2]](A,a,n,i),v=w[e+52>>2],b=w[e+24>>2],h=w[e+20>>2],Z=w[e+56>>2],u=w[e+40>>2],G=w[e+36>>2],Q=w[e+48>>2],l=w[e+8>>2],B=w[e>>2],E=w[e+4>>2],s=w[e+16>>2],t=w[f+8>>2],d=w[e+32>>2],c=w[r>>2],k=w[f+4>>2],o[n+28>>2]=0,u=m(t*u),d=m(c*d),w[n+24>>2]=Z+m(u+m(d+m(k*G))),b=m(t*b),s=m(c*s),w[n+20>>2]=v+m(b+m(s+m(k*h))),l=m(t*l),c=m(c*B),w[n+16>>2]=Q+m(l+m(c+m(k*E))),t=w[r+4>>2],o[n+12>>2]=0,w[n+8>>2]=Z+m(u+m(d+m(G*t))),w[n+4>>2]=v+m(b+m(s+m(h*t))),w[n>>2]=Q+m(l+m(c+m(E*t))),Zn[o[o[A>>2]+16>>2]](A,a,n,i),S=n+32|0},function(A,r,f,e,i,n){A|=0,r=m(r),f=m(f),e|=0,i|=0,n|=0;var a,t,c,b,u,l=0,s=0,k=m(0),d=m(0),v=m(0),h=0,B=m(0),Z=m(0),G=m(0),Q=m(0),E=0,W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=0,X=0,D=0,C=0;for(S=a=S-144|0,o[a+136>>2]=0,o[a+140>>2]=0,o[a+128>>2]=0,o[a+132>>2]=0,w[(g=a+128|0)+(h=e<<2)>>2]=-f,o[a+120>>2]=0,o[a+124>>2]=0,o[a+112>>2]=0,o[a+116>>2]=0,w[h+(X=a+112|0)>>2]=f,l=o[i+12>>2],o[a+56>>2]=o[i+8>>2],o[a+60>>2]=l,l=o[i+4>>2],o[a+48>>2]=o[i>>2],o[a+52>>2]=l,l=o[i+28>>2],o[a+72>>2]=o[i+24>>2],o[a+76>>2]=l,l=o[i+20>>2],o[a+64>>2]=o[i+16>>2],o[a+68>>2]=l,l=o[i+44>>2],o[a+88>>2]=o[i+40>>2],o[a+92>>2]=l,l=o[i+36>>2],o[a+80>>2]=o[i+32>>2],o[a+84>>2]=l,d=w[i+8>>2],G=w[i+56>>2],F=w[i+40>>2],R=w[i+36>>2],Y=w[i+48>>2],V=w[i>>2],B=w[i+4>>2],Z=w[i+32>>2],f=w[a+136>>2],k=w[a+128>>2],v=w[a+132>>2],w[a+100>>2]=m(m(f*w[i+24>>2])+m(m(k*w[i+16>>2])+m(v*w[i+20>>2])))+w[i+52>>2],o[a+108>>2]=0,w[a+104>>2]=G+m(m(f*F)+m(m(k*Z)+m(v*R))),w[a+96>>2]=Y+m(m(f*d)+m(m(k*V)+m(v*B))),l=o[a+108>>2],o[a+40>>2]=o[a+104>>2],o[a+44>>2]=l,l=o[a+100>>2],o[a+32>>2]=o[a+96>>2],o[a+36>>2]=l,t=(l=(e+1|0)%3<<2)+(E=a+48|0)|0,w[a+16>>2]=w[t>>2],c=(D=a- -64|0)+l|0,w[a+20>>2]=w[c>>2],f=w[(b=(C=a+80|0)+l|0)>>2],o[a+28>>2]=0,w[a+24>>2]=f,f=w[(D=h+D|0)>>2],k=w[(C=h+C|0)>>2],o[a+12>>2]=0,h=h+E|0,w[a>>2]=-w[h>>2],w[a+8>>2]=-k,w[a+4>>2]=-f,E=a+32|0,u=a+16|0,Zn[o[o[A>>2]+72>>2]](A,E,u,a,r,m(-1.5707963705062866),m(1.5707963705062866),m(-1.5707963705062866),m(1.5707963705062866),n,m(30),0),s=o[i+12>>2],o[a+56>>2]=o[i+8>>2],o[a+60>>2]=s,s=o[i+4>>2],o[a+48>>2]=o[i>>2],o[a+52>>2]=s,s=o[i+28>>2],o[a+72>>2]=o[i+24>>2],o[a+76>>2]=s,s=o[i+20>>2],o[a+64>>2]=o[i+16>>2],o[a+68>>2]=s,s=o[i+44>>2],o[a+88>>2]=o[i+40>>2],o[a+92>>2]=s,s=o[i+36>>2],o[a+80>>2]=o[i+32>>2],o[a+84>>2]=s,d=w[i+8>>2],G=w[i+56>>2],F=w[i+40>>2],R=w[i+36>>2],f=w[i+52>>2],k=w[i+24>>2],v=w[i+20>>2],Y=w[i+48>>2],V=w[i>>2],B=w[i+4>>2],Z=w[i+32>>2],Q=w[i+16>>2],o[a+108>>2]=0,W=f,f=w[a+120>>2],N=m(k*f),k=w[a+112>>2],p=v,v=w[a+116>>2],w[a+100>>2]=W+m(N+m(m(Q*k)+m(p*v))),w[a+104>>2]=G+m(m(f*F)+m(m(k*Z)+m(v*R))),w[a+96>>2]=Y+m(m(f*d)+m(m(k*V)+m(v*B))),s=o[a+108>>2],o[a+40>>2]=o[a+104>>2],o[a+44>>2]=s,s=o[a+100>>2],o[a+32>>2]=o[a+96>>2],o[a+36>>2]=s,w[a+16>>2]=w[t>>2],w[a+20>>2]=w[c>>2],f=w[b>>2],o[a+28>>2]=0,w[a+24>>2]=f,w[a>>2]=w[h>>2],w[a+4>>2]=w[D>>2],f=w[C>>2],o[a+12>>2]=0,w[a+8>>2]=f,Zn[o[o[A>>2]+72>>2]](A,E,u,a,r,m(-1.5707963705062866),m(1.5707963705062866),m(-1.5707963705062866),m(1.5707963705062866),n,m(30),0),h=(e=(e+2|0)%3<<2)+X|0,E=e+g|0,X=l+X|0,l=l+g|0,f=w[i+56>>2],k=w[i+52>>2],v=w[i+48>>2],e=0;d=m(m(0|e)*m(.01745329238474369)),G=m(Kr(d)*r),w[l>>2]=G,w[X>>2]=G,d=m($r(d)*r),w[E>>2]=d,w[h>>2]=d,d=w[i+8>>2],G=w[i>>2],F=w[i+4>>2],R=w[i+24>>2],Y=w[i+16>>2],V=w[i+20>>2],B=w[i+40>>2],Z=w[i+32>>2],Q=w[i+36>>2],o[a+60>>2]=0,W=w[a+136>>2],p=w[a+128>>2],N=w[a+132>>2],w[a+56>>2]=f+m(m(B*W)+m(m(Z*p)+m(Q*N))),w[a+52>>2]=k+m(m(R*W)+m(m(Y*p)+m(N*V))),w[a+48>>2]=v+m(m(d*W)+m(m(G*p)+m(F*N))),o[a+44>>2]=0,W=B,B=w[a+120>>2],p=Z,Z=w[a+112>>2],N=Q,Q=w[a+116>>2],w[a+40>>2]=f+m(m(W*B)+m(m(p*Z)+m(N*Q))),w[a+36>>2]=k+m(m(R*B)+m(m(Y*Z)+m(V*Q))),w[a+32>>2]=v+m(m(d*B)+m(m(G*Z)+m(F*Q))),Zn[o[o[A>>2]+16>>2]](A,a+48|0,a+32|0,n),g=e>>>0<330,e=e+30|0,g;);S=a+144|0},function(A,r,f,e,i,n){A|=0,r=m(r),f=m(f),e|=0,i|=0,n|=0;var a,t,c,b,u=0,l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=0,g=0,X=m(0),D=m(0),C=m(0),J=0;for(S=a=S-128|0,X=w[i+56>>2],D=w[i+52>>2],C=w[i+48>>2],o[a+120>>2]=0,o[a+124>>2]=0,o[a+112>>2]=0,o[a+116>>2]=0,w[(u=e<<2)+(a+112|0)>>2]=f,o[a+104>>2]=0,o[a+108>>2]=0,o[a+96>>2]=0,o[a+100>>2]=0,w[u+(V=a+96|0)>>2]=-f,o[a+88>>2]=0,o[a+92>>2]=0,o[a+80>>2]=0,o[a+84>>2]=0,w[(g=u)+(u=a+80|0)>>2]=f,t=(J=(e+2|0)%3<<2)+u|0,J=V+J|0,c=(g=u)+(u=(V=(e+1|0)%3|0)<<2)|0,b=u+(a+96|0)|0,u=0;f=m(m(0|u)*m(.01745329238474369)),d=m(Kr(f)*r),w[b>>2]=d,w[c>>2]=d,f=m($r(f)*r),w[J>>2]=f,w[t>>2]=f,f=w[i+8>>2],d=w[i>>2],Z=w[i+4>>2],G=w[i+24>>2],Q=w[i+16>>2],E=w[i+20>>2],l=w[i+40>>2],s=w[i+32>>2],k=w[i+36>>2],o[a+76>>2]=0,v=w[a+104>>2],h=w[a+96>>2],B=w[a+100>>2],w[a+72>>2]=X+m(m(l*v)+m(m(s*h)+m(k*B))),w[a+68>>2]=D+m(m(G*v)+m(m(Q*h)+m(B*E))),w[a+64>>2]=C+m(m(f*v)+m(m(d*h)+m(Z*B))),o[a+60>>2]=0,W=l,l=w[a+88>>2],N=s,s=w[a+80>>2],p=k,k=w[a+84>>2],w[a+56>>2]=X+m(m(W*l)+m(m(N*s)+m(p*k))),w[a+52>>2]=D+m(m(G*l)+m(m(Q*s)+m(E*k))),w[a+48>>2]=C+m(m(f*l)+m(m(d*s)+m(Z*k))),Zn[o[o[A>>2]+16>>2]](A,a- -64|0,a+48|0,n),g=u>>>0<330,u=u+30|0,g;);o[a+72>>2]=0,o[a+76>>2]=0,o[a+64>>2]=0,o[a+68>>2]=0,o[(a- -64|0)+(e<<2)>>2]=1065353216,o[a+56>>2]=0,o[a+60>>2]=0,o[a+48>>2]=0,o[a+52>>2]=0,o[(a+48|0)+(V<<2)>>2]=1065353216,v=w[i+8>>2],h=w[i>>2],B=w[i+4>>2],F=w[i+24>>2],R=w[i+16>>2],Y=w[i+20>>2],l=w[i+40>>2],s=w[i+32>>2],k=w[i+36>>2],o[a+44>>2]=0,f=w[a+120>>2],d=w[a+112>>2],Z=w[a+116>>2],w[a+40>>2]=X-m(m(l*f)+m(m(s*d)+m(k*Z))),w[a+36>>2]=D-m(m(F*f)+m(m(R*d)+m(Z*Y))),w[a+32>>2]=C-m(m(v*f)+m(m(h*d)+m(B*Z))),o[a+28>>2]=0,G=w[a+72>>2],Q=w[a+64>>2],E=w[a+68>>2],w[a+24>>2]=m(l*G)+m(m(s*Q)+m(k*E)),w[a+20>>2]=m(F*G)+m(m(R*Q)+m(Y*E)),w[a+16>>2]=m(v*G)+m(m(h*Q)+m(B*E)),o[a+12>>2]=0,W=l,l=w[a+56>>2],N=s,s=w[a+48>>2],p=k,k=w[a+52>>2],w[a+8>>2]=m(W*l)+m(m(N*s)+m(p*k)),w[a+4>>2]=m(F*l)+m(m(R*s)+m(Y*k)),w[a>>2]=m(v*l)+m(m(h*s)+m(B*k)),e=a+32|0,u=a+16|0,Zn[o[o[A>>2]+68>>2]](A,e,u,a,r,r,m(0),m(6.2831854820251465),n,0,m(10)),v=w[i+8>>2],h=w[i>>2],B=w[i+4>>2],F=w[i+24>>2],R=w[i+16>>2],Y=w[i+20>>2],W=w[i+40>>2],N=w[i+32>>2],p=w[i+36>>2],o[a+44>>2]=0,w[a+40>>2]=X+m(m(W*f)+m(m(N*d)+m(Z*p))),w[a+36>>2]=D+m(m(F*f)+m(m(R*d)+m(Z*Y))),w[a+32>>2]=C+m(m(v*f)+m(m(h*d)+m(Z*B))),o[a+28>>2]=0,w[a+24>>2]=m(W*G)+m(m(N*Q)+m(E*p)),w[a+20>>2]=m(F*G)+m(m(R*Q)+m(E*Y)),w[a+16>>2]=m(v*G)+m(m(h*Q)+m(E*B)),o[a+12>>2]=0,w[a+8>>2]=m(W*l)+m(m(N*s)+m(k*p)),w[a+4>>2]=m(F*l)+m(m(R*s)+m(k*Y)),w[a>>2]=m(v*l)+m(m(h*s)+m(k*B)),Zn[o[o[A>>2]+68>>2]](A,e,u,a,r,r,m(0),m(6.2831854820251465),n,0,m(10)),S=a+128|0},function(A,r,f,e,i,n){A|=0,r=m(r),f=m(f),e|=0,i|=0,n|=0;var a,t,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),N=0,p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=0,C=m(0),J=m(0),x=m(0),y=0,M=m(0);for(S=a=S-144|0,Q=w[i+56>>2],E=w[i+52>>2],W=w[i+48>>2],o[a+136>>2]=0,o[a+140>>2]=0,o[a+128>>2]=0,o[a+132>>2]=0,G=e<<2,f=m(f*m(.5)),w[G+(a+128|0)>>2]=f,o[a+120>>2]=0,o[a+124>>2]=0,o[a+112>>2]=0,o[a+116>>2]=0,w[(N=(t=(e+1|0)%3|0)<<2)+(a+112|0)>>2]=r,o[a+104>>2]=0,o[a+108>>2]=0,o[a+96>>2]=0,o[a+100>>2]=0,w[(X=(e+2|0)%3<<2)+(a+96|0)>>2]=r,o[a+88>>2]=0,o[a+92>>2]=0,o[a+80>>2]=0,o[a+84>>2]=0,w[(D=G)+(G=a+80|0)>>2]=-f,X=G+X|0,N=G+N|0,f=w[a+136>>2],l=w[a+132>>2],s=w[a+128>>2],G=0;k=m(m(0|G)*m(.01745329238474369)),y=N,M=m(Kr(k)*r),w[y>>2]=M,y=X,M=m($r(k)*r),w[y>>2]=M,k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+76>>2]=0,w[a+72>>2]=Q+m(m(c*f)+m(m(b*s)+m(l*u))),w[a+68>>2]=E+m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+64>>2]=W+m(m(k*f)+m(m(d*s)+m(v*l))),o[a+60>>2]=0,p=c,c=w[a+88>>2],F=b,b=w[a+80>>2],R=u,u=w[a+84>>2],w[a+56>>2]=Q+m(m(p*c)+m(m(F*b)+m(R*u))),w[a+52>>2]=E+m(m(h*c)+m(m(B*b)+m(Z*u))),w[a+48>>2]=W+m(m(k*c)+m(m(d*b)+m(v*u))),Zn[o[o[A>>2]+16>>2]](A,a- -64|0,a+48|0,n),D=G>>>0<330,G=G+30|0,D;);k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+76>>2]=0,w[a+72>>2]=Q+m(m(c*f)+m(m(b*s)+m(l*u))),w[a+68>>2]=E+m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+64>>2]=W+m(m(k*f)+m(m(d*s)+m(v*l))),o[a+60>>2]=0,p=c,Y=w[a+120>>2],c=m(Y-f),F=b,V=w[a+112>>2],b=m(V-s),R=u,g=w[a+116>>2],u=m(g-l),w[a+56>>2]=Q+m(m(p*c)+m(m(F*b)+m(R*u))),w[a+52>>2]=E+m(m(h*c)+m(m(B*b)+m(Z*u))),w[a+48>>2]=W+m(m(k*c)+m(m(d*b)+m(v*u))),G=a- -64|0,N=a+48|0,Zn[o[o[A>>2]+16>>2]](A,G,N,n),k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+76>>2]=0,w[a+72>>2]=Q+m(m(c*f)+m(m(b*s)+m(l*u))),w[a+68>>2]=E+m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+64>>2]=W+m(m(k*f)+m(m(d*s)+m(l*v))),o[a+60>>2]=0,p=c,C=m(-f),c=m(C-Y),F=b,Y=m(-s),b=m(Y-V),R=u,V=m(-l),u=m(V-g),w[a+56>>2]=Q+m(m(p*c)+m(m(F*b)+m(R*u))),w[a+52>>2]=E+m(m(h*c)+m(m(B*b)+m(u*Z))),w[a+48>>2]=W+m(m(k*c)+m(m(d*b)+m(u*v))),Zn[o[o[A>>2]+16>>2]](A,G,N,n),k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+76>>2]=0,w[a+72>>2]=Q+m(m(c*f)+m(m(b*s)+m(l*u))),w[a+68>>2]=E+m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+64>>2]=W+m(m(k*f)+m(m(d*s)+m(l*v))),o[a+60>>2]=0,p=c,g=w[a+104>>2],c=m(g-f),F=b,J=w[a+96>>2],b=m(J-s),R=u,x=w[a+100>>2],u=m(x-l),w[a+56>>2]=Q+m(m(p*c)+m(m(F*b)+m(R*u))),w[a+52>>2]=E+m(m(h*c)+m(m(B*b)+m(Z*u))),w[a+48>>2]=W+m(m(k*c)+m(m(d*b)+m(v*u))),Zn[o[o[A>>2]+16>>2]](A,G,N,n),k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+76>>2]=0,w[a+72>>2]=Q+m(m(c*f)+m(m(b*s)+m(l*u))),w[a+68>>2]=E+m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+64>>2]=W+m(m(k*f)+m(m(d*s)+m(l*v))),o[a+60>>2]=0,p=c,c=m(C-g),F=b,b=m(Y-J),R=u,u=m(V-x),w[a+56>>2]=Q+m(m(p*c)+m(m(F*b)+m(R*u))),w[a+52>>2]=E+m(m(h*c)+m(m(B*b)+m(u*Z))),w[a+48>>2]=W+m(m(k*c)+m(m(d*b)+m(u*v))),Zn[o[o[A>>2]+16>>2]](A,G,N,n),o[a+72>>2]=0,o[a+76>>2]=0,o[a+64>>2]=0,o[a+68>>2]=0,o[G+(e<<2)>>2]=1065353216,o[a+56>>2]=0,o[a+60>>2]=0,o[a+48>>2]=0,o[a+52>>2]=0,o[N+(t<<2)>>2]=1065353216,k=w[i+8>>2],d=w[i>>2],v=w[i+4>>2],h=w[i+24>>2],B=w[i+16>>2],Z=w[i+20>>2],c=w[i+40>>2],b=w[i+32>>2],u=w[i+36>>2],o[a+44>>2]=0,w[a+40>>2]=Q-m(m(c*f)+m(m(b*s)+m(l*u))),w[a+36>>2]=E-m(m(h*f)+m(m(B*s)+m(l*Z))),w[a+32>>2]=W-m(m(k*f)+m(m(d*s)+m(l*v))),o[a+28>>2]=0,f=w[a+72>>2],l=w[a+64>>2],s=w[a+68>>2],w[a+24>>2]=m(c*f)+m(m(b*l)+m(u*s)),w[a+20>>2]=m(h*f)+m(m(B*l)+m(Z*s)),w[a+16>>2]=m(k*f)+m(m(d*l)+m(v*s)),o[a+12>>2]=0,f=w[a+56>>2],l=w[a+48>>2],s=w[a+52>>2],w[a+8>>2]=m(c*f)+m(m(b*l)+m(u*s)),w[a+4>>2]=m(h*f)+m(m(B*l)+m(Z*s)),w[a>>2]=m(k*f)+m(m(d*l)+m(v*s)),Zn[o[o[A>>2]+68>>2]](A,a+32|0,a+16|0,a,r,r,m(0),m(6.2831854820251465),n,0,m(10)),S=a+144|0},function(A,r,f,e,i){A|=0,r|=0,f=m(f),e|=0,i|=0;var n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0);S=n=S-32|0,a=w[r+4>>2],u=w[r>>2],b=w[r+8>>2],m(Q(b))>m(.7071067690849304)?(t=m(m(a*a)+m(b*b)),c=m(m(1)/m(N(t))),s=m(t*c),k=m(a*c),t=m(k*m(100)),l=m(c*m(-b)),d=m(u*l),k=m(k*m(-u)),c=m(0)):(c=m(m(u*u)+m(a*a)),t=m(m(1)/m(N(c))),d=m(c*t),s=m(t*m(-a)),c=m(s*m(100)),k=m(b*s),l=m(u*t),s=m(l*m(-b)),t=m(0)),v=w[e+52>>2],h=w[e+20>>2],B=w[e+24>>2],Z=w[e+56>>2],G=w[e+36>>2],E=w[e+40>>2],W=w[e+48>>2],p=w[e+8>>2],F=w[e>>2],R=w[e+4>>2],Y=w[e+16>>2],X=w[e+32>>2],o[n+28>>2]=0,b=m(b*f),V=m(b+t),u=m(u*f),g=m(u+c),f=m(a*f),l=m(l*m(100)),a=m(f+l),w[n+24>>2]=Z+m(m(E*V)+m(m(X*g)+m(G*a))),w[n+20>>2]=v+m(m(V*B)+m(m(g*Y)+m(a*h))),w[n+16>>2]=W+m(m(V*p)+m(m(g*F)+m(a*R))),o[n+12>>2]=0,a=m(b-t),c=m(u-c),t=m(f-l),w[n+8>>2]=Z+m(m(E*a)+m(m(X*c)+m(G*t))),w[n+4>>2]=v+m(m(a*B)+m(m(c*Y)+m(t*h))),w[n>>2]=W+m(m(a*p)+m(m(c*F)+m(t*R))),r=n+16|0,Zn[o[o[A>>2]+16>>2]](A,r,n,i),a=w[e+52>>2],c=w[e+24>>2],t=w[e+20>>2],l=w[e+56>>2],v=w[e+40>>2],h=w[e+36>>2],B=w[e+48>>2],Z=w[e+8>>2],G=w[e>>2],E=w[e+4>>2],W=w[e+16>>2],p=w[e+32>>2],o[n+28>>2]=0,F=m(d*m(100)),d=m(b+F),R=m(s*m(100)),s=m(u+R),Y=m(k*m(100)),k=m(f+Y),w[n+24>>2]=l+m(m(v*d)+m(m(p*s)+m(h*k))),w[n+20>>2]=a+m(m(d*c)+m(m(s*W)+m(k*t))),w[n+16>>2]=B+m(m(d*Z)+m(m(s*G)+m(k*E))),o[n+12>>2]=0,b=m(b-F),u=m(u-R),f=m(f-Y),w[n+8>>2]=l+m(m(v*b)+m(m(p*u)+m(h*f))),w[n+4>>2]=a+m(m(b*c)+m(m(u*W)+m(f*t))),w[n>>2]=B+m(m(b*Z)+m(m(u*G)+m(f*E))),Zn[o[o[A>>2]+16>>2]](A,r,n,i),S=n+32|0},function(A){var r=0;A=o[140+(A|=0)>>2],1&a[33924]||(r=0|Y(1,31712),a[33924]=1,o[8480]=r),R(o[8480],0|A,4404,0)},function(A){var r=0;A=o[140+(A|=0)>>2],1&a[33924]||(r=0|Y(1,31712),a[33924]=1,o[8480]=r),R(o[8480],0|A,4415,0)},function(A,r,f,e){r|=0,f|=0,e|=0;var i,n=0;S=i=S-32|0,A=o[140+(A|=0)>>2],1&a[33932]||(n=0|Y(4,31728),a[33932]=1,o[8482]=n),n=o[8482],o[i+24>>2]=e,o[i+16>>2]=f,o[i+8>>2]=r,R(0|n,0|A,7586,i+8|0),S=i+32|0},hn,Bn,Bn,function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+16>>2]](A,r,o[r>>2])},dn,function(A){var r=0,f=0;return o[(A|=0)>>2]=31968,v[A+4|0]&&(r=o[A+8>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+8>>2]),0|A},function(A){var r=0,f=0;o[(A|=0)>>2]=31968,v[A+4|0]&&(r=o[A+8>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+8>>2]),DA(A)},function(A,r,f){r|=0,f|=0;var e,i=0;S=e=S-16|0,A=o[8+(A|=0)>>2],1&a[33940]||(i=0|Y(3,31988),a[33940]=1,o[8484]=i),i=o[8484],o[e+8>>2]=f,o[e>>2]=r,R(0|i,0|A,2251,0|e),S=e+16|0},hn,function(A){var r=0,f=0;return o[(A|=0)>>2]=32184,v[A+72|0]&&(r=o[A+76>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+76>>2]),0|A},function(A){var r=0,f=0;o[(A|=0)>>2]=32184,v[A+72|0]&&(r=o[A+76>>2],1&a[33924]||(f=0|Y(1,31712),a[33924]=1,o[8480]=f),R(o[8480],0|r,3211,0)),V(o[A+76>>2]),DA(A)},function(A,r){r|=0;var f,e=0;e=o[12+(A|=0)>>2],o[r>>2]=o[A+8>>2],o[r+4>>2]=e,e=o[A+20>>2],o[r+8>>2]=o[A+16>>2],o[r+12>>2]=e,e=o[A+36>>2],o[r+24>>2]=o[A+32>>2],o[r+28>>2]=e,e=o[A+28>>2],o[r+16>>2]=o[A+24>>2],o[r+20>>2]=e,e=o[A+44>>2],o[r+32>>2]=o[A+40>>2],o[r+36>>2]=e,e=o[A+52>>2],o[r+40>>2]=o[A+48>>2],o[r+44>>2]=e,f=o[4+(e=A- -64|0)>>2],o[r+56>>2]=o[e>>2],o[r+60>>2]=f,e=o[A+60>>2],o[r+48>>2]=o[A+56>>2],o[r+52>>2]=e},function(A,r){A|=0;var f,e=0;e=o[4+(r|=0)>>2],o[A+8>>2]=o[r>>2],o[A+12>>2]=e,e=o[r+12>>2],o[A+16>>2]=o[r+8>>2],o[A+20>>2]=e,e=o[r+28>>2],o[A+32>>2]=o[r+24>>2],o[A+36>>2]=e,e=o[r+20>>2],o[A+24>>2]=o[r+16>>2],o[A+28>>2]=e,e=o[r+44>>2],o[A+48>>2]=o[r+40>>2],o[A+52>>2]=e,e=o[r+36>>2],o[A+40>>2]=o[r+32>>2],o[A+44>>2]=e,f=o[r+60>>2],o[(e=A- -64|0)>>2]=o[r+56>>2],o[e+4>>2]=f,e=o[r+52>>2],o[A+56>>2]=o[r+48>>2],o[A+60>>2]=e,Zn[o[o[A>>2]+16>>2]](A,o[A+4>>2])},function(A,r){r|=0;var f,e=0;S=f=S-16|0,A=o[76+(A|=0)>>2],1&a[33948]||(e=0|Y(2,32204),a[33948]=1,o[8486]=e),e=o[8486],o[f+8>>2]=r,R(0|e,0|A,4677,f+8|0),S=f+16|0},hn,function(A,r){A|=0,r|=0;var f=0;return(A=0|Zn[o[8292]](3+(A+r|0)|0))&&(o[(f=3+(A+r|0)&0-r)-4>>2]=A),0|f},function(A){(A|=0)&&Zn[o[8293]](o[A-4>>2])},Pi,vn,Zf,function(A){Zf(A|=0),DA(A)},function(A,r,f,e,i,n,a,t){var c,b;return A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,a|=0,t|=0,S=t=S-48|0,o[8488]=o[8488]+1,e=0|Zn[o[8290]](64,16),o[e+8>>2]=a,o[e+4>>2]=n,o[e>>2]=i,i=o[r+4>>2],o[e+16>>2]=o[r>>2],o[e+20>>2]=i,i=o[r+12>>2],o[e+24>>2]=o[r+8>>2],o[e+28>>2]=i,i=o[f+4>>2],o[e+32>>2]=o[f>>2],o[e+36>>2]=i,i=o[f+12>>2],o[e+40>>2]=o[f+8>>2],o[e+44>>2]=i,o[e+52>>2]=0,o[e+56>>2]=0,i=o[r+12>>2],o[t+24>>2]=o[r+8>>2],o[t+28>>2]=i,i=o[r+4>>2],o[t+16>>2]=o[r>>2],o[t+20>>2]=i,r=o[f+12>>2],o[t+40>>2]=o[f+8>>2],o[t+44>>2]=r,r=o[f+4>>2],o[t+32>>2]=o[f>>2],o[t+36>>2]=r,o[e+60>>2]=o[A+104>>2],r=o[A+148>>2]+1|0,o[A+148>>2]=r,o[e+12>>2]=r,c=e,b=Gf(A+4|0,t+16|0,e),o[c+48>>2]=b,r=o[A+104>>2],o[e+52>>2]=0,r=(r<<2)+A|0,o[e+56>>2]=o[r+84>>2],(f=o[r+84>>2])&&(o[f+52>>2]=e),o[r+84>>2]=e,v[A+153|0]||(o[t+12>>2]=e,o[t+4>>2]=12168,o[t+8>>2]=A,r=t+16|0,f=t+4|0,ar(o[A+4>>2],r,f),ar(o[A+44>>2],r,f)),S=t+48|0,0|e},function(A,r,f){A|=0,f|=0;var e=0;Ie((2==o[60+(r|=0)>>2]?44:4)+A|0,o[r+48>>2]),e=o[r+52>>2],o[(e?e+56:84+((o[r+60>>2]<<2)+A|0))>>2]=o[r+56>>2],(e=o[r+56>>2])&&(o[e+52>>2]=o[r+52>>2]),e=o[A+96>>2],Zn[o[o[e>>2]+16>>2]](e,r,f),r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+154|0]=1},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=0,t=0,c=0,b=0,u=m(0),l=m(0),s=m(0),k=m(0),d=0,h=0,B=m(0),Z=m(0),G=0,Q=m(0),E=m(0),W=m(0),N=m(0),p=0,F=0;S=i=S-48|0,n=o[f+12>>2],o[i+24>>2]=o[f+8>>2],o[i+28>>2]=n,n=o[f+4>>2],o[i+16>>2]=o[f>>2],o[i+20>>2]=n,n=o[e+12>>2],o[i+40>>2]=o[e+8>>2],o[i+44>>2]=n,n=o[e+4>>2],o[i+32>>2]=o[e>>2],o[i+36>>2]=n;A:if(2!=o[r+60>>2])if(n=1,o[A+128>>2]=o[A+128>>2]+1,c=o[r+48>>2],!(w[c>>2]<=w[i+32>>2])|!(w[c+16>>2]>=w[i+16>>2])|!(w[c+4>>2]<=w[i+36>>2])|!(w[c+20>>2]>=w[i+20>>2])||!(w[c+8>>2]<=w[i+40>>2])|!(w[c+24>>2]>=w[i+24>>2]))Xf(A+4|0,c,i+16|0),o[A+132>>2]=o[A+132>>2]+1;else{l=w[r+20>>2],B=w[r+24>>2],Q=w[f>>2],E=w[f+4>>2],W=w[f+8>>2],Z=w[r+16>>2],s=w[r+36>>2],k=w[r+40>>2],N=w[r+32>>2],u=w[A+100>>2],o[i+12>>2]=0,k=m(u*m(m(k-B)*m(.5))),w[i+8>>2]=k,s=m(u*m(m(s-l)*m(.5))),w[i+4>>2]=s,u=m(u*m(m(N-Z)*m(.5))),w[i>>2]=u,m(Q-Z)>2]=-u),m(E-l)>2]=-s),m(W-B)>2]=-k),d=A+4|0;r:{if((l=w[(t=i+16|0)>>2])>=w[c>>2]){if(!(!((u=w[t+4>>2])>=w[c+4>>2])|!(w[c+8>>2]<=w[t+8>>2])|!(w[c+16>>2]>=w[t+16>>2])|!(w[c+20>>2]>=w[t+20>>2]))&&(n=0,w[c+24>>2]>=w[t+24>>2]))break r}else u=w[t+4>>2];w[t+4>>2]=u+m(-.05000000074505806),w[t>>2]=l+m(-.05000000074505806),w[t+8>>2]=w[t+8>>2]+m(-.05000000074505806),w[t+16>>2]=w[t+16>>2]+m(.05000000074505806),w[t+20>>2]=w[t+20>>2]+m(.05000000074505806),w[t+24>>2]=w[t+24>>2]+m(.05000000074505806),n=(((u=w[i>>2])>m(0))<<4)+t|0,w[n>>2]=u+w[n>>2],n=((u=w[i+4>>2])>m(0)?20:4)+t|0,w[n>>2]=u+w[n>>2],n=((u=w[i+8>>2])>m(0)?24:8)+t|0,w[n>>2]=u+w[n>>2];f:if(n=Jr(d,c))if((0|(h=o[d+8>>2]))>=0){if(!h)break f;for(;;){if(!(b=o[n+32>>2]))break f;if(n=b,(0|h)==(0|(G=G+1|0)))break}}else n=o[d>>2];else n=0;b=o[t+4>>2],o[c>>2]=o[t>>2],o[c+4>>2]=b,b=o[t+28>>2],o[c+24>>2]=o[t+24>>2],o[c+28>>2]=b,b=o[t+20>>2],o[c+16>>2]=o[t+16>>2],o[c+20>>2]=b,b=o[t+12>>2],o[c+8>>2]=o[t+8>>2],o[c+12>>2]=b,er(d,n,c),n=1}if(!n)break A;o[A+132>>2]=o[A+132>>2]+1}else Ie(A+44|0,o[r+48>>2]),p=r,F=Gf(A+4|0,i+16|0,r),o[p+48>>2]=F,n=1;b=o[r+52>>2],o[(b?b+56:84+((o[r+60>>2]<<2)+A|0))>>2]=o[r+56>>2],(b=o[r+56>>2])&&(o[b+52>>2]=o[r+52>>2]),b=o[f+4>>2],o[r+16>>2]=o[f>>2],o[r+20>>2]=b,b=o[f+12>>2],o[r+24>>2]=o[f+8>>2],o[r+28>>2]=b,f=o[e+4>>2],o[r+32>>2]=o[e>>2],o[r+36>>2]=f,f=o[e+12>>2],o[r+40>>2]=o[e+8>>2],o[r+44>>2]=f,f=o[A+104>>2],o[r+60>>2]=f,o[r+52>>2]=0,f=(f<<2)+A|0,o[r+56>>2]=o[f+84>>2],(e=o[f+84>>2])&&(o[e+52>>2]=r),o[f+84>>2]=r,n&&(a[A+154|0]=1,v[A+153|0]||(o[i>>2]=12168,o[i+4>>2]=A,yA(A+44|0,o[A+44>>2],o[r+48>>2],i),yA(A+4|0,o[A+4>>2],o[r+48>>2],i))),S=i+48|0},function(A,r,f,e){A|=0,f|=0,e|=0,A=o[20+(r|=0)>>2],o[f>>2]=o[r+16>>2],o[f+4>>2]=A,A=o[r+28>>2],o[f+8>>2]=o[r+24>>2],o[f+12>>2]=A,A=o[r+44>>2],o[e+8>>2]=o[r+40>>2],o[e+12>>2]=A,A=o[r+36>>2],o[e>>2]=o[r+32>>2],o[e+4>>2]=A},function(A,r,f,e,i,n){var a,t,c,b;A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,S=f=S-16|0,o[f+8>>2]=12264,o[f+12>>2]=e,a=e+4|0,t=e+20|0,c=o[A+168>>2],b=f+8|0,CA(o[A+4>>2],r,a,t,w[e+32>>2],i,n,c,b),CA(o[A+44>>2],r,a,t,w[e+32>>2],i,n,c,b),S=f+16|0},function(A,r,f,e){var i;A|=0,r|=0,f|=0,e|=0,S=i=S-48|0,o[i+44>>2]=e,o[i+40>>2]=12336,e=o[r+12>>2],o[i+16>>2]=o[r+8>>2],o[i+20>>2]=e,e=o[r+4>>2],o[i+8>>2]=o[r>>2],o[i+12>>2]=e,r=o[f+12>>2],o[i+32>>2]=o[f+8>>2],o[i+36>>2]=r,r=o[f+4>>2],o[i+24>>2]=o[f>>2],o[i+28>>2]=r,r=i+8|0,f=i+40|0,ar(o[A+4>>2],r,f),ar(o[A+44>>2],r,f),S=i+48|0},function(A,r){A|=0,r|=0;var f,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=m(0);if(S=t=S-32|0,Zr(b=A+4|0,1+((0|G(o[A+112>>2],o[A+16>>2]))/100|0)|0),o[A+124>>2]&&(Zr(A+44|0,e=1+((0|G(o[A+108>>2],o[A+56>>2]))/100|0)|0),e=o[A+124>>2]-e|0,o[A+124>>2]=(0|e)>0?e:0),e=(o[A+104>>2]+1|0)%2|0,o[A+104>>2]=e,e=o[84+((e<<2)+A|0)>>2]){for(c=A+44|0;n=(i=o[e+52>>2])?i+56|0:84+((o[e+60>>2]<<2)+A|0)|0,i=o[e+56>>2],o[n>>2]=i,(n=o[e+56>>2])&&(o[n+52>>2]=o[e+52>>2]),o[e+52>>2]=0,o[e+56>>2]=o[A+92>>2],(n=o[A+92>>2])&&(o[n+52>>2]=e),o[A+92>>2]=e,Ie(b,o[e+48>>2]),n=o[e+28>>2],o[t+8>>2]=o[e+24>>2],o[t+12>>2]=n,n=o[e+20>>2],o[t>>2]=o[e+16>>2],o[t+4>>2]=n,n=o[e+44>>2],o[t+24>>2]=o[e+40>>2],o[t+28>>2]=n,n=o[e+36>>2],o[t+16>>2]=o[e+32>>2],o[t+20>>2]=n,n=Gf(c,t,e),o[e+60>>2]=2,o[e+48>>2]=n,e=i;);a[A+154|0]=1,o[A+124>>2]=o[A+56>>2]}o[t>>2]=12168,o[t+4>>2]=A,v[A+153|0]&&(yA(b,o[A+4>>2],o[A+44>>2],t),v[A+153|0]&&yA(b,e=o[b>>2],e,t));A:if(v[A+154|0]&&(e=o[A+96>>2],n=0|Zn[o[o[e>>2]+28>>2]](e),!((0|(e=o[n+4>>2]))<=0))){r:{if((0|(c=(0|e)<(0|(i=(0|(i=o[A+120>>2]))>(0|(b=(0|G(o[A+116>>2],e))/100|0))?i:b))?e:i))>0){for(e=0;b=o[n+12>>2]+((o[A+144>>2]+e|0)%o[n+4>>2]<<4)|0,u=o[b>>2],i=o[u+48>>2],l=o[b+4>>2],b=o[l+48>>2],!(!(w[i>>2]<=w[b+16>>2])|!(w[i+16>>2]>=w[b>>2])|!(w[i+4>>2]<=w[b+20>>2])|!(w[i+20>>2]>=w[b+4>>2]))&&w[i+8>>2]<=w[b+24>>2]&&w[i+24>>2]>=w[b+8>>2]||(i=o[A+96>>2],Zn[o[o[i>>2]+12>>2]](i,u,l,r),e=e-1|0,c=c-1|0),(0|c)>(0|(e=e+1|0)););if((0|(e=o[n+4>>2]))<=0)break r}o[A+144>>2]=(o[A+144>>2]+c|0)%(0|e);break A}o[A+144>>2]=0}if(a[A+154|0]=0,o[A+120>>2]=1,o[A+140>>2]=o[A+140>>2]+1,e=o[A+132>>2],i=o[A+128>>2],k=m(i?m(e>>>0)/m(i>>>0):0),w[A+136>>2]=k,o[A+132>>2]=e>>>1,o[A+128>>2]=i>>>1,i=0,e=0,l=0,S=f=(S=t+32|0)-16|0,t=o[A+96>>2],0|Zn[o[o[t>>2]+56>>2]](t)){if(b=A,A=o[A+96>>2],c=0|Zn[o[o[A>>2]+28>>2]](A),(0|(A=o[c+4>>2]))>=2&&(Wr(c,f+15|0,0,A-1|0),A=o[c+4>>2]),(0|A)>0){for(;u=o[c+12>>2]+(l<<4)|0,t=o[u+4>>2],!((0|(n=i))==(0|(i=o[u>>2]))&(0|e)==(0|t))&&(e=o[i+48>>2],n=o[t+48>>2],!(!(w[e>>2]<=w[n+16>>2])|!(w[e+16>>2]>=w[n>>2])|!(w[e+4>>2]<=w[n+20>>2])|!(w[e+20>>2]>=w[n+4>>2]))&&w[e+8>>2]<=w[n+24>>2]&&w[e+24>>2]>=w[n+8>>2])||(A=o[b+96>>2],Zn[o[o[A>>2]+32>>2]](A,u,r),o[u>>2]=0,o[u+4>>2]=0,s=s+1|0,A=o[c+4>>2]),e=t,(0|(l=l+1|0))<(0|A););if((0|A)>=2&&(Wr(c,f+14|0,0,A-1|0),A=o[c+4>>2]),r=A-s|0,!((0|s)>=0)){if((0|r)>o[c+8>>2]){if(i=0,(0|A)!=(0|s)&&(o[8488]=o[8488]+1,i=0|Zn[o[8290]](r<<4,16),!((0|(n=o[c+4>>2]))<=0)))for(e=0;t=(b=e<<4)+i|0,b=b+o[c+12>>2]|0,o[t>>2]=o[b>>2],o[t+4>>2]=o[b+4>>2],o[t+8>>2]=o[b+8>>2],o[t+12>>2]=o[b+12>>2],(0|n)!=(0|(e=e+1|0)););!(e=o[c+12>>2])||!e|!v[c+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[c+12>>2]=i,a[c+16|0]=1,o[c+8>>2]=r}if(e=0,t=0-s&3)for(;i=o[c+12>>2]+(A<<4)|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,A=A+1|0,(0|t)!=(0|(e=e+1|0)););if(!(s>>>0>4294967292))for(;i=(e=A<<4)+o[c+12>>2]|0,o[i>>2]=0,o[i+4>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,i=e+o[c+12>>2]|0,o[i+24>>2]=0,o[i+28>>2]=0,o[i+16>>2]=0,o[i+20>>2]=0,i=e+o[c+12>>2]|0,o[i+40>>2]=0,o[i+44>>2]=0,o[i+32>>2]=0,o[i+36>>2]=0,e=e+o[c+12>>2]|0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,(0|r)!=(0|(A=A+4|0)););}A=r}o[c+4>>2]=A}S=f+16|0},Xi,Xi,function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);e=o[A+44>>2];A:if(A=o[A+4>>2]){if(e){a=(n=w[A+24>>2])>(i=w[e+24>>2])?n:i,t=(n=w[A+20>>2])>(i=w[e+20>>2])?n:i,c=(n=w[A+8>>2])<(i=w[e+8>>2])?n:i,b=(n=w[A+4>>2])<(i=w[e+4>>2])?n:i,u=(n=w[A+16>>2])>(i=w[e+16>>2])?n:i,i=w[A>>2],i=(n=w[e>>2])>i?i:n;break A}l=w[A+28>>2],a=w[A+24>>2],t=w[A+20>>2],u=w[A+16>>2],n=w[A+12>>2],c=w[A+8>>2],b=w[A+4>>2],i=w[A>>2]}else i=m(0),e&&(l=w[e+28>>2],a=w[e+24>>2],t=w[e+20>>2],u=w[e+16>>2],n=w[e+12>>2],c=w[e+8>>2],b=w[e+4>>2],i=w[e>>2]);w[r+12>>2]=n,w[r+8>>2]=c,w[r+4>>2]=b,w[r>>2]=i,w[f+12>>2]=l,w[f+8>>2]=a,w[f+4>>2]=t,w[f>>2]=u},function(A){o[16+(A|=0)>>2]==(0-o[A+56>>2]|0)&&(qf(A+4|0),qf(A+44|0),o[A+124>>2]=0,o[A+104>>2]=0,a[A+153|0]=0,a[A+154|0]=1,o[A+116>>2]=10,o[A+120>>2]=1,o[A+108>>2]=1,o[A+112>>2]=0,o[A+84>>2]=0,o[A+88>>2]=0,o[A+92>>2]=0,o[A+128>>2]=0,o[A+132>>2]=0,o[A+136>>2]=0,o[A+140>>2]=0,o[A+144>>2]=0,o[A+148>>2]=0)},Bn,en,vn,function(A,r,f){A|=0;var e=0;(0|(r|=0))!=(0|(f|=0))&&(e=o[o[A+4>>2]+96>>2],Zn[o[o[e>>2]+8>>2]](e,o[r+36>>2],o[f+36>>2]),A=o[A+4>>2],o[A+120>>2]=o[A+120>>2]+1)},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+8>>2]](A,r,o[o[A+8>>2]+48>>2])},function(A,r){r|=0,Zn[o[o[(A|=0)>>2]+12>>2]](A,r)},Ii,Ii,vn,zi,Se,vn,Se,Bn,function(){},Yf,function(A){Yf(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f){A|=0,r|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0;o[8492]=o[8492]+1;A:{r:{if(e=o[A+24>>2]){if(0|Zn[o[o[e>>2]+8>>2]](e,r,f))break r;break A}if(!(o[f+8>>2]&o[r+4>>2])|!(o[r+8>>2]&o[f+4>>2]))break A}i=o[r+12>>2]>o[f+12>>2],t=o[(u=i?r:f)+12>>2],c=o[(l=i?f:r)+12>>2],r=G((r=~((r=t<<16|c)<<15)+r|0)>>>10^r,9),s=(k=(r=~((r^=r>>>6)<<11)+r|0)>>>16^r)&(r=o[(f=A)+12>>2])-1;r:{if(-1!=(0|(A=o[o[f+40>>2]+(s<<2)>>2])))for(b=o[f+60>>2],e=o[f+16>>2];;){if((0|c)==o[o[(i=(n=A<<4)+e|0)>>2]+12>>2]&(0|t)==o[o[4+(e+n|0)>>2]+12>>2])break r;if(-1==(0|(A=o[b+(A<<2)>>2])))break}if(A=r,(0|(i=c=o[f+8>>2]))==(0|r)&&(i=r,!((0|(e=r?r<<1:1))<=(0|r)))){if(e?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](e<<4,16),A=o[f+8>>2]):(i=0,A=r),(0|(t=A))>0)for(A=0;b=(n=A<<4)+i|0,n=n+o[f+16>>2]|0,o[b>>2]=o[n>>2],o[b+4>>2]=o[n+4>>2],o[b+8>>2]=o[n+8>>2],o[b+12>>2]=o[n+12>>2],(0|t)!=(0|(A=A+1|0)););!(A=o[f+16>>2])||!A|!v[f+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+16>>2]=i,a[f+20|0]=1,o[f+12>>2]=e,i=o[f+8>>2],A=e}o[f+8>>2]=i+1,i=(t=o[f+16>>2])+(c<<4)|0,(e=o[f+68>>2])&&(Zn[o[o[e>>2]+8>>2]](e,l,u),A=o[f+12>>2]),(0|A)>(0|r)&&(_A(f),s=o[f+12>>2]-1&k),r=o[l+12>>2]>2],o[i>>2]=r?l:u,o[8+(A=t+(c<<4)|0)>>2]=0,o[A+12>>2]=0,o[A+4>>2]=r?u:l,A=o[f+40>>2]+(s<<2)|0,o[o[f+60>>2]+(c<<2)>>2]=o[A>>2],o[A>>2]=c}}return 0|i},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0;o[8491]=o[8491]+1,i=o[r+12>>2]>o[f+12>>2],n=o[(t=i?r:f)+12>>2],a=o[(c=i?f:r)+12>>2],r=G((r=~((r=n<<16|a)<<15)+r|0)>>>10^r,9),r=~((r^=r>>>6)<<11)+r|0,b=o[A+12>>2]-1&(r>>>16^r);A:if(-1!=(0|(f=o[o[A+40>>2]+(b<<2)>>2]))){for(u=o[A+60>>2],i=o[A+16>>2];;){if(!((0|a)==o[o[(r=i+(f<<4)|0)>>2]+12>>2]&(0|n)==o[o[r+4>>2]+12>>2])){if(-1!=(0|(f=o[(f<<2)+u>>2])))continue;break A}break}Zn[o[o[A>>2]+32>>2]](A,r,e),l=o[12+(i+(f<<4)|0)>>2];r:{if(n=o[A+40>>2]+(b<<2)|0,(0|(f=o[n>>2]))!=(0|(i=r-o[A+16>>2]>>4))){for(a=o[A+60>>2];(0|i)!=(0|(f=o[a+((r=f)<<2)>>2])););if(-1!=(0|r)){f=r<<2,r=o[A+60>>2],o[f+r>>2]=o[r+(i<<2)>>2];break r}}o[n>>2]=o[o[A+60>>2]+(i<<2)>>2]}if(n=o[A+8>>2]-1|0,(r=o[A+68>>2])&&Zn[o[o[r>>2]+12>>2]](r,c,t,e),(0|i)!=(0|n)){r:{if(t=o[A+16>>2],r=o[o[4+(e=t+(n<<4)|0)>>2]+12>>2]<<16|o[o[e>>2]+12>>2],r=G((r=~(r<<15)+r|0)>>>10^r,9),r=~((r^=r>>>6)<<11)+r|0,c=o[A+12>>2]-1&(r>>>16^r),a=o[A+40>>2]+(c<<2)|0,(0|n)!=(0|(f=o[a>>2]))){for(b=o[A+60>>2];(0|n)!=(0|(f=o[b+((r=f)<<2)>>2])););if(-1!=(0|r)){f=r<<2,r=o[A+60>>2],o[f+r>>2]=o[r+(n<<2)>>2];break r}}o[a>>2]=o[o[A+60>>2]+(n<<2)>>2]}f=o[e+4>>2],o[(r=t+(i<<4)|0)>>2]=o[e>>2],o[r+4>>2]=f,f=o[e+12>>2],o[r+8>>2]=o[e+8>>2],o[r+12>>2]=f,r=o[A+40>>2]+(c<<2)|0,o[o[A+60>>2]+(i<<2)>>2]=o[r>>2],o[r>>2]=i}o[A+8>>2]=o[A+8>>2]-1}return 0|l},function(A,r,f){var e;A|=0,r|=0,f|=0,S=e=S-16|0,o[e+12>>2]=r,o[e+8>>2]=12772,Zn[o[o[A>>2]+48>>2]](A,e+8|0,f),S=e+16|0},yi,yi,fn,function(A,r,f){A|=0,r|=0,(f|=0)&&(A=o[r+8>>2])&&(Zn[o[o[A>>2]>>2]](A),Zn[o[o[f>>2]+60>>2]](f,o[r+8>>2]),o[r+8>>2]=0)},ji,function(A,r,f){var e;A|=0,r|=0,f|=0,S=e=S-16|0,o[e+12>>2]=f,o[e+8>>2]=A,o[e+4>>2]=r,o[e>>2]=12600,Zn[o[o[A>>2]+48>>2]](A,e,f),S=e+16|0},function(A,r){r|=0,o[24+(A|=0)>>2]=r},function(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=0;if(S=e=S-16|0,Zn[o[8294]](3960),o[A+8>>2]>0)for(;n=o[A+16>>2]+(i<<4)|0,0|Zn[o[o[r>>2]+8>>2]](r,n)?(Zn[o[o[A>>2]+12>>2]](A,o[n>>2],o[n+4>>2],f),o[8490]=o[8490]-1):i=i+1|0,o[A+8>>2]>(0|i););Zn[o[8295]](),S=e+16|0},function(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=0,a=0;o[8493]=o[8493]+1,i=o[r+12>>2]>o[f+12>>2],e=o[(i?r:f)+12>>2],i=o[(i?f:r)+12>>2],r=G((r=~((r=e<<16|i)<<15)+r|0)>>>10^r,9),r=~((r^=r>>>6)<<11)+r|0;A:{if(!((0|(r=o[A+12>>2]-1&(r>>>16^r)))>=o[A+32>>2])&&-1!=(0|(f=o[o[A+40>>2]+(r<<2)>>2])))for(a=o[A+60>>2],A=o[A+16>>2];;){if((0|i)==o[o[(r=A+(n=f<<4)|0)>>2]+12>>2]&o[o[4+(A+n|0)>>2]+12>>2]==(0|e))break A;if(-1==(0|(f=o[(f<<2)+a>>2])))break}r=0}return 0|r},cn,function(A,r){r|=0,o[68+(A|=0)>>2]=r},function(A,r){A|=0,r|=0;var f,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if(S=f=S-32|0,o[f+24>>2]=0,o[f+16>>2]=0,o[f+20>>2]=0,a[f+28|0]=1,!(o[A+8>>2]<=0)){for(;;){if(i=o[A+16>>2]+(u<<4)|0,o[f+20>>2]==(0|e)&&!((0|(n=e?e<<1:1))<=(0|e))){if(c=0,b=0,n&&(o[8488]=o[8488]+1,b=0|Zn[o[8290]](n<<4,16)),(0|e)>0)for(;l=(t=c<<4)+b|0,t=t+o[f+24>>2]|0,o[l>>2]=o[t>>2],o[l+4>>2]=o[t+4>>2],o[l+8>>2]=o[t+8>>2],o[l+12>>2]=o[t+12>>2],(0|(c=c+1|0))!=(0|e););!(e=o[f+24>>2])||!e|!v[f+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[f+24>>2]=b,a[f+28|0]=1,o[f+20>>2]=n,e=o[f+16>>2]}if(e=o[f+24>>2]+(e<<4)|0,o[e>>2]=o[i>>2],o[e+4>>2]=o[i+4>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=o[i+12>>2],e=(n=o[f+16>>2])+1|0,o[f+16>>2]=e,!((0|(u=u+1|0))>2]))break}if(i=0,!((0|n)<0)){if(l=1&(b=n+1|0),c=o[f+24>>2],n)for(b&=-2,n=0;u=(t=i<<4)+c|0,Zn[o[o[A>>2]+12>>2]](A,o[u>>2],o[u+4>>2],r),t=c+(16|t)|0,Zn[o[o[A>>2]+12>>2]](A,o[t>>2],o[t+4>>2],r),i=i+2|0,(0|b)!=(0|(n=n+2|0)););l&&(i=c+(i<<4)|0,Zn[o[o[A>>2]+12>>2]](A,o[i>>2],o[i+4>>2],r))}}if(o[A+52>>2]>0){for(r=o[A+60>>2],i=0;o[r+(i<<2)>>2]=-1,(0|(i=i+1|0))>2];);e=o[f+16>>2]}if((0|e)>=2&&(Wr(f+12|0,f+11|0,0,e-1|0),e=o[f+16>>2]),(0|e)>0)for(i=0;r=o[f+24>>2]+(i<<4)|0,Zn[o[o[A>>2]+8>>2]](A,o[r>>2],o[r+4>>2]),(0|(i=i+1|0))>2];);!(A=o[f+24>>2])||!A|!v[f+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),S=f+32|0},en,vn,function(A,r){r|=0;var f=0;return(0|(f=o[4+(A|=0)>>2]))!=o[r>>2]&(0|f)!=o[r+4>>2]||(f=o[A+8>>2],Zn[o[o[f>>2]+32>>2]](f,r,o[A+12>>2])),0},vn,function(A,r){return r|=0,(0|(A=o[4+(A|=0)>>2]))==o[r>>2]|(0|A)==o[r+4>>2]},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n,a=0,t=m(0);S=e=S-96|0,i=o[o[A>>2]>>2],n=o[o[A+4>>2]>>2],0|Zn[o[o[r>>2]+24>>2]](r,i,n)&&(a=o[i+192>>2],o[e+88>>2]=-1,o[e+92>>2]=-1,o[e+84>>2]=i+4,o[e+80>>2]=i,o[e+76>>2]=a,o[e+72>>2]=0,a=o[n+192>>2],o[e+64>>2]=-1,o[e+68>>2]=-1,o[e+60>>2]=n+4,o[e+56>>2]=n,o[e+52>>2]=a,o[e+48>>2]=0,(o[A+8>>2]||(r=0|Zn[o[o[r>>2]+8>>2]](r,e+72|0,e+48|0,0,1),o[A+8>>2]=r,r))&&(o[32+(r=e+12|0)>>2]=0,o[r+12>>2]=e+48,o[r+8>>2]=e+72,o[r+4>>2]=0,o[r>>2]=17976,A=o[A+8>>2],a=o[A>>2],1!=o[f+8>>2]?(t=m(Zn[o[a+12>>2]](A,i,n,f,r)))>2]&&(w[f+12>>2]=t):Zn[o[a+8>>2]](A,e+72|0,e+48|0,f,r))),S=e+96|0},he,function(A){he(A|=0),DA(A)},function(A,r,f,e,i){var n;return A|=0,r|=0,f|=0,e|=0,i|=0,S=n=S-16|0,o[n+12>>2]=e,o[n+8>>2]=A,A=o[(((1==(0|i)?76:5260)+A|0)+G(o[o[r+4>>2]+4>>2],144)|0)+(o[o[f+4>>2]+4>>2]<<2)>>2],A=0|Zn[o[o[A>>2]+8>>2]](A,n+8|0,r,f),S=n+16|0,0|A},function(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=0,t=0,c=m(0),b=0,u=0,l=m(0),s=0,k=m(0),d=0,h=0;S=e=S-16|0,o[8494]=o[8494]+1,2&o[A+4>>2]?(i=o[r+192>>2],c=m(Zn[o[o[i>>2]+20>>2]](i,w[8297])),w[e+12>>2]=c,i=o[f+192>>2],l=m(Zn[o[o[i>>2]+20>>2]](i,w[8297])),w[e+8>>2]=l,i=c>2],k=w[f+184>>2],c=w[r+184>>2],n=o[A+72>>2];A:{if(i=o[n+12>>2])o[n+12>>2]=o[i>>2],o[n+8>>2]=o[n+8>>2]-1;else{if(i=0,4&v[A+4|0])break A;o[8488]=o[8488]+1,i=0|Zn[o[8290]](868,16)}if(o[i>>2]=1025,o[i+120>>2]=0,o[i+124>>2]=0,o[i+128>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+140>>2]=0,o[i+144>>2]=0,o[i+148>>2]=0,o[i+152>>2]=0,o[i+156>>2]=0,o[i+160>>2]=0,o[i+164>>2]=0,o[i+168>>2]=0,o[i+328>>2]=0,o[i+332>>2]=0,o[i+336>>2]=0,o[i+340>>2]=0,o[i+344>>2]=0,o[i+348>>2]=0,o[i+352>>2]=0,o[i+356>>2]=0,o[i+360>>2]=0,o[i+364>>2]=0,o[i+368>>2]=0,o[i+372>>2]=0,o[i+376>>2]=0,o[i+536>>2]=0,o[i+540>>2]=0,o[i+544>>2]=0,o[i+548>>2]=0,o[i+552>>2]=0,o[i+556>>2]=0,o[i+560>>2]=0,o[i+564>>2]=0,o[i+568>>2]=0,o[i+572>>2]=0,o[i+576>>2]=0,o[i+580>>2]=0,o[i+584>>2]=0,o[i+792>>2]=0,o[i+784>>2]=0,o[i+788>>2]=0,o[i+776>>2]=0,o[i+780>>2]=0,o[i+768>>2]=0,o[i+772>>2]=0,o[i+760>>2]=0,o[i+764>>2]=0,o[i+752>>2]=0,o[i+756>>2]=0,o[i+744>>2]=0,o[i+748>>2]=0,o[i+836>>2]=r,o[i+840>>2]=f,o[i+844>>2]=0,w[i+848>>2]=l,w[i+852>>2]=c>2],o[i+864>>2]=t,o[A+16>>2]==(0|t)&&!((0|(s=t?t<<1:1))<=(0|t))){if(s?(o[8488]=o[8488]+1,r=0|Zn[o[8290]](s<<2,16),t=o[A+12>>2]):r=0,!((0|t)<=0)){if(f=0,t>>>0>=4)for(h=-4&t;o[(b=f<<2)+r>>2]=o[b+o[A+20>>2]>>2],o[(n=4|b)+r>>2]=o[n+o[A+20>>2]>>2],o[(n=8|b)+r>>2]=o[n+o[A+20>>2]>>2],o[(n=12|b)+r>>2]=o[n+o[A+20>>2]>>2],f=f+4|0,(0|h)!=(0|(u=u+4|0)););if(n=3&t)for(;o[(u=f<<2)+r>>2]=o[u+o[A+20>>2]>>2],f=f+1|0,(0|n)!=(0|(d=d+1|0)););}!(f=o[A+20>>2])|!v[A+24|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),t=o[A+12>>2]),o[A+20>>2]=r,a[A+24|0]=1,o[A+16>>2]=s}o[o[A+20>>2]+(t<<2)>>2]=i,o[A+12>>2]=t+1}return S=e+16|0,0|i},function(A,r){A|=0,r|=0;var f,e,i,n,a,t=0,c=0;if(o[8494]=o[8494]-1,Zn[o[o[A>>2]+20>>2]](A,r),f=(t=o[r+864>>2])<<2,e=o[A+20>>2],n=o[(c=f+e|0)>>2],a=c,i=(c=o[A+12>>2]-1|0)<<2,o[a>>2]=o[e+i>>2],o[o[A+20>>2]+i>>2]=n,o[o[o[A+20>>2]+f>>2]+864>>2]=t,o[A+12>>2]=c,A=o[A+72>>2],!((t=o[A+16>>2])>>>0>r>>>0|t+G(o[A>>2],o[A+4>>2])>>>0<=r>>>0))return o[r>>2]=o[A+12>>2],o[A+12>>2]=r,void(o[A+8>>2]=o[A+8>>2]+1);r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))},function(A,r){A|=0;var f=0,e=0,i=0,n=0;if(S=A=S-16|0,(0|(f=o[844+(r|=0)>>2]))>0)for(;f=G(e,208)+r|0,(i=o[f+120>>2])&&(n=o[8785])&&(Zn[0|n](i),o[f+120>>2]=0),(0|(f=o[r+844>>2]))>(0|(e=e+1|0)););f&&(f=o[8788])&&(o[A+12>>2]=r,Zn[0|f](A+12|0)),o[r+844>>2]=0,S=A+16|0},function(A,r,f){A|=0,f|=0;A:{r:{f:switch(o[220+(r|=0)>>2]-2|0){case 0:case 3:break f;default:break r}switch(A=0,o[f+220>>2]-2|0){case 0:case 3:break A;default:break r}}if(!o[r+280>>2]||0|Zn[o[o[r>>2]+12>>2]](r,f)){if(A=1,!o[f+280>>2])break A;if(0|Zn[o[o[f>>2]+12>>2]](f,r))break A}A=0}return 0|A},function(A,r,f){if(A|=0,f|=0,A=0,!(4&(r=o[204+(r|=0)>>2])||4&(f=o[f+204>>2]))){if(!(3&r))return 1;A=!(3&f)}return 0|A},function(A,r,f,e){var i;A|=0,r|=0,f|=0,e|=0,S=i=S-16|0,o[i+12>>2]=A,o[i+8>>2]=f,o[i+4>>2]=13068,Zn[o[o[r>>2]+48>>2]](r,i+4|0,e),S=i+16|0},function(A){return o[12+(A|=0)>>2]},function(A,r){return r|=0,o[o[20+(A|=0)>>2]+(r<<2)>>2]},function(A){return 0|(o[12+(A|=0)>>2]?o[A+20>>2]:0)},xi,xi,function(A,r){var f;return r|=0,A=o[68+(A|=0)>>2],(f=o[A+12>>2])?(o[A+12>>2]=o[f>>2],o[A+8>>2]=o[A+8>>2]-1,0|f):(o[8488]=o[8488]+1,0|Zn[o[8290]](r,16))},function(A,r){A|=0;var f=0;if((r|=0)&&(A=o[A+68>>2],!((f=o[A+16>>2])>>>0>r>>>0|G(o[A>>2],o[A+4>>2])+f>>>0<=r>>>0)))return o[r>>2]=o[A+12>>2],o[A+12>>2]=r,void(o[A+8>>2]=o[A+8>>2]+1);r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))},vn,function(A,r){var f;return f=r|=0,r=o[8+(A|=0)>>2],Zn[o[r+64>>2]](f,r,o[A+4>>2]),0},se,function(A){se(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r){r|=0,o[200+(A|=0)>>2]=r,o[A+192>>2]=r,o[A+304>>2]=o[A+304>>2]+1},function(A,r){r|=0;var f,e=0;e=f=o[288+(A|=0)>>2];A:if(!((0|f)<=0)){for(A=o[A+296>>2],e=0;;){if(o[A+(e<<2)>>2]==(0|r))break A;if((0|f)==(0|(e=e+1|0)))break}e=f}return(0|e)>=(0|f)|0},function(){return 264},nr,function(A,r){var f,e,i=0,n=0,a=0,t=0;n=r|=0,a=0|Zn[o[o[(A|=0)>>2]+16>>2]](A),t=1,i=o[o[r>>2]+16>>2],e=0|Zn[i](0|n,0|a,0|t),t=r,a=e,n=0|Zn[o[o[A>>2]+20>>2]](A,o[e+8>>2],r),f=A,i=o[o[r>>2]+20>>2],Zn[i](0|t,0|a,0|n,1245859651,0|f)},Ff,function(A){Ff(A|=0),DA(A)},function(A){A|=0;var r,f=0,e=m(0),i=0,n=m(0),t=m(0),c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=0;if(S=r=S-16|0,Zn[o[8294]](4699),(0|(i=o[A+8>>2]))>0)for(;;){c=o[o[A+16>>2]+(k<<2)>>2];A:{r:if(!v[A+76|0])switch(o[c+220>>2]-2|0){case 0:case 3:break A;default:break r}S=f=S+-64|0,i=o[c+192>>2],Zn[o[o[i>>2]+8>>2]](i,c+4|0,f+48|0,f+32|0),e=w[8297],s=m(w[f+48>>2]-e),w[f+48>>2]=s,b=m(w[f+52>>2]-e),w[f+52>>2]=b,t=m(w[f+56>>2]-e),w[f+56>>2]=t,n=m(e+w[f+32>>2]),w[f+32>>2]=n,u=m(e+w[f+36>>2]),w[f+36>>2]=u,l=m(e+w[f+40>>2]),w[f+40>>2]=l,3&v[c+204|0]|!v[A+44|0]|2!=o[c+252>>2]||(i=o[c+192>>2],Zn[o[o[i>>2]+8>>2]](i,c+68|0,f+16|0,f),b=m(w[f+16>>2]-e),w[f+16>>2]=b,t=m(w[f+20>>2]-e),w[f+20>>2]=t,n=m(w[f+24>>2]-e),w[f+24>>2]=n,u=m(e+w[f>>2]),w[f>>2]=u,l=m(e+w[f+4>>2]),w[f+4>>2]=l,e=m(e+w[f+8>>2]),w[f+8>>2]=e,b<(s=w[f+48>>2])&&(w[f+48>>2]=b,s=b),t<(b=w[f+52>>2])&&(w[f+52>>2]=t,b=t),n<(t=w[f+56>>2])&&(w[f+56>>2]=n,t=n),(n=w[f+28>>2])>2]&&(w[f+60>>2]=n),u>(n=w[f+32>>2])&&(w[f+32>>2]=u,n=u),l>(u=w[f+36>>2])&&(w[f+36>>2]=l,u=l),e>(l=w[f+40>>2])&&(w[f+40>>2]=e,l=e),(e=w[f+12>>2])>w[f+44>>2]&&(w[f+44>>2]=e)),i=o[A+68>>2],1&a[c+204|0]||(e=m(l-t),t=m(e*e),e=m(n-s),n=m(e*e),e=m(u-b),m(t+m(n+m(e*e)))>2]+16>>2]](i,o[c+188>>2],f+48|0,f+32|0,o[A+24>>2]):(4!=(-2&o[c+220>>2])&&(o[c+220>>2]=5),v[33980]||(i=o[A+72>>2])&&(a[33980]=1,Zn[o[o[i>>2]+44>>2]](i,5921),i=o[A+72>>2],Zn[o[o[i>>2]+44>>2]](i,10468),i=o[A+72>>2],Zn[o[o[i>>2]+44>>2]](i,10545),i=o[A+72>>2],Zn[o[o[i>>2]+44>>2]](i,10536))),S=f- -64|0,i=o[A+8>>2]}if(!((0|(k=k+1|0))<(0|i)))break}Zn[o[8295]](),S=r+16|0},function(A){var r,f;A|=0,S=r=S-16|0,Zn[o[8294]](4017),f=o[A+68>>2],Zn[o[o[f>>2]+32>>2]](f,o[A+24>>2]),Zn[o[8295]](),S=r+16|0},function(A,r){r|=0,o[72+(A|=0)>>2]=r},xi,gA,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,a=m(0),t=m(0),c=0,b=m(0),u=0,l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=0,g=0,X=m(0),D=m(0),C=0,J=0,x=0,y=0,M=0,H=m(0),I=m(0),T=m(0),U=0,j=m(0),z=0;S=i=S-144|0,0|Zn[o[o[A>>2]+20>>2]](A)&&(n=0|Zn[o[o[A>>2]+20>>2]](A),32768&Zn[o[o[n>>2]+56>>2]](n)&&(n=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[n>>2]+64>>2]](n,r,m(.10000000149011612))));A:{r:{f:{e:{i:{n:{a:{t:{o:{c:switch(0|(n=o[f+4>>2])){case 0:break o;case 31:break c;case 28:break f;case 13:break e;case 11:break i;case 10:break n;case 9:break a;case 8:break t;default:break r}if((0|(n=o[f+24>>2]))<=0)break A;for(;u=n-1|0,c=o[f+32>>2]+G(u,80)|0,V=o[c+64>>2],v=w[c+56>>2],h=w[c+48>>2],N=w[c+52>>2],p=w[c+32>>2],F=w[c>>2],R=w[c+16>>2],Y=w[c+36>>2],B=w[c+4>>2],Z=w[c+20>>2],Q=w[c+40>>2],X=w[c+8>>2],D=w[c+24>>2],H=w[r+48>>2],I=w[r+52>>2],T=w[r+56>>2],a=w[r+8>>2],t=w[r>>2],b=w[r+4>>2],l=w[r+24>>2],s=w[r+16>>2],k=w[r+20>>2],E=w[r+40>>2],W=w[r+32>>2],d=w[r+36>>2],o[i+60>>2]=0,o[i+44>>2]=0,o[i+28>>2]=0,o[i+12>>2]=0,w[i+40>>2]=m(Q*E)+m(m(X*W)+m(D*d)),w[i+36>>2]=m(Y*E)+m(m(B*W)+m(Z*d)),w[i+32>>2]=m(p*E)+m(m(F*W)+m(R*d)),w[i+24>>2]=m(Q*l)+m(m(X*s)+m(D*k)),w[i+20>>2]=m(Y*l)+m(m(B*s)+m(Z*k)),w[i+16>>2]=m(p*l)+m(m(F*s)+m(R*k)),w[i+8>>2]=m(Q*a)+m(m(X*t)+m(D*b)),w[i+4>>2]=m(Y*a)+m(m(B*t)+m(Z*b)),w[i>>2]=m(p*a)+m(m(F*t)+m(R*b)),w[i+56>>2]=T+m(m(v*E)+m(m(h*W)+m(N*d))),w[i+52>>2]=I+m(m(v*l)+m(m(h*s)+m(N*k))),w[i+48>>2]=H+m(m(v*a)+m(m(h*t)+m(N*b))),Zn[o[o[A>>2]+28>>2]](A,i,V,e),c=n>>>0>1,n=u,c;);break A}n=o[f+48>>2],o[i+8>>2]=o[f+44>>2],o[i+12>>2]=n,n=o[f+40>>2],o[i>>2]=o[f+36>>2],o[i+4>>2]=n,a=m(Zn[o[o[f>>2]+48>>2]](f)),t=m(Zn[o[o[f>>2]+48>>2]](f)),b=m(m(Zn[o[o[f>>2]+48>>2]](f))+w[i+8>>2]),w[i+8>>2]=b,a=m(a+w[i>>2]),w[i>>2]=a,t=m(t+w[i+4>>2]),w[i+4>>2]=t,A=0|Zn[o[o[A>>2]+20>>2]](A),o[i+140>>2]=0,w[i+136>>2]=-b,w[i+132>>2]=-t,w[i+128>>2]=-a,Zn[o[o[A>>2]+80>>2]](A,i+128|0,i,r,e);break A}a=m(Zn[o[o[f>>2]+48>>2]](f)),A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+24>>2]](A,a,r,e);break A}if((0|(n=o[f+100>>2]))<=0)break A;for(;u=n-1|0,c=o[f+108>>2]+(u<<4)|0,a=w[c+8>>2],t=w[c>>2],b=w[c+4>>2],c=0|Zn[o[o[A>>2]+20>>2]](A),p=w[o[f+128>>2]+(u<<2)>>2],F=w[r+48>>2],R=w[r+52>>2],Y=w[r+56>>2],l=w[r+8>>2],s=w[r>>2],k=w[r+4>>2],E=w[r+24>>2],W=w[r+16>>2],d=w[r+20>>2],v=w[r+40>>2],h=w[r+32>>2],N=w[r+36>>2],o[i+60>>2]=0,o[i+44>>2]=0,o[i+28>>2]=0,o[i+12>>2]=0,B=m(h*m(0)),Z=m(N*m(0)),w[i+40>>2]=v+m(B+Z),Q=m(v*m(0)),w[i+36>>2]=Q+m(B+N),w[i+32>>2]=Q+m(h+Z),B=m(W*m(0)),Z=m(d*m(0)),w[i+24>>2]=E+m(B+Z),Q=m(E*m(0)),w[i+20>>2]=Q+m(B+d),w[i+16>>2]=Q+m(W+Z),B=m(s*m(0)),Z=m(k*m(0)),w[i+8>>2]=l+m(B+Z),Q=m(l*m(0)),w[i+4>>2]=Q+m(B+k),w[i>>2]=Q+m(s+Z),w[i+56>>2]=Y+m(m(a*v)+m(m(t*h)+m(b*N))),w[i+52>>2]=R+m(m(a*E)+m(m(t*W)+m(b*d))),w[i+48>>2]=F+m(m(a*l)+m(m(t*s)+m(b*k))),Zn[o[o[c>>2]+24>>2]](c,p,i,e),c=n>>>0>1,n=u,c;);break A}n=o[f+60>>2],a=w[(n<<2)+(f=f+36|0)>>2],t=w[f+((n+2|0)%3<<2)>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+84>>2]](A,t,a,n,r,e);break A}n=o[f+76>>2],a=w[f+68>>2],t=w[f+64>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+92>>2]](A,t,a,n,r,e);break A}n=o[f+60>>2],a=m(Zn[o[o[f>>2]+92>>2]](f)),u=o[f+48>>2],o[i+8>>2]=o[f+44>>2],o[i+12>>2]=u,u=o[f+40>>2],o[i>>2]=o[f+36>>2],o[i+4>>2]=u,t=m(Zn[o[o[f>>2]+48>>2]](f)),b=m(Zn[o[o[f>>2]+48>>2]](f)),U=i,j=m(m(Zn[o[o[f>>2]+48>>2]](f))+w[i+8>>2]),w[U+8>>2]=j,w[i>>2]=t+w[i>>2],w[i+4>>2]=b+w[i+4>>2],t=w[(n<<2)+i>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+88>>2]](A,a,t,n,r,e);break A}a=w[f+72>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+96>>2]](A,f+56|0,a,r,e);break A}r:if(!((0|n)>6))if(V=o[f+60>>2]){if(o[V+28>>2]<=0)break r;for(;;){if(c=o[V+36>>2],C=G(J,36),(0|(x=o[4+(n=c+C|0)>>2]))<=0)a=m(0),t=m(0),b=m(0);else for(u=o[(o[n+12>>2]+(x<<2)|0)-4>>2],b=m(0),n=0,t=m(0),a=m(0);g=(y=(c=o[o[12+(c+C|0)>>2]+(n<<2)>>2])<<4)+o[V+16>>2]|0,Q=w[g>>2],X=w[g+4>>2],D=w[g+8>>2],g=0|Zn[o[o[A>>2]+20>>2]](A),M=o[V+16>>2],l=w[8+(u=M+(u<<4)|0)>>2],s=w[u>>2],k=w[u+4>>2],E=w[r+48>>2],W=w[r+8>>2],d=w[r>>2],v=w[r+4>>2],h=w[r+52>>2],N=w[r+24>>2],p=w[r+16>>2],F=w[r+20>>2],R=w[r+56>>2],Y=w[r+40>>2],B=w[r+32>>2],Z=w[r+36>>2],o[i+12>>2]=0,w[i+8>>2]=R+m(m(l*Y)+m(m(s*B)+m(k*Z))),w[i+4>>2]=h+m(m(l*N)+m(m(s*p)+m(k*F))),w[i>>2]=E+m(m(l*W)+m(m(s*d)+m(k*v))),l=w[8+(u=y+M|0)>>2],s=w[u>>2],k=w[u+4>>2],o[i+140>>2]=0,w[i+136>>2]=R+m(m(l*Y)+m(m(s*B)+m(Z*k))),w[i+132>>2]=h+m(m(l*N)+m(m(s*p)+m(F*k))),w[i+128>>2]=E+m(m(l*W)+m(m(s*d)+m(v*k))),Zn[o[o[g>>2]+16>>2]](g,i,i+128|0,e),b=m(b+D),t=m(t+X),a=m(a+Q),u=c,n=n+1|0,c=o[V+36>>2],(0|n)>2];);if(n=0|Zn[o[o[A>>2]+20>>2]](A),16384&Zn[o[o[n>>2]+56>>2]](n)&&(o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=1065353216,o[i+4>>2]=1065353216,n=o[V+36>>2]+C|0,B=w[n+28>>2],Z=w[n+20>>2],Q=w[n+24>>2],n=0|Zn[o[o[A>>2]+20>>2]](A),l=w[r+48>>2],s=w[r+8>>2],k=w[r>>2],E=w[r+4>>2],W=w[r+52>>2],d=w[r+24>>2],v=w[r+16>>2],h=w[r+20>>2],N=w[r+56>>2],p=w[r+40>>2],F=w[r+32>>2],R=w[r+36>>2],o[i+140>>2]=0,Y=m(m(1)/m(0|x)),b=m(Y*b),a=m(Y*a),t=m(Y*t),w[i+136>>2]=N+m(m(p*b)+m(m(F*a)+m(R*t))),w[i+132>>2]=W+m(m(b*d)+m(m(a*v)+m(t*h))),w[i+128>>2]=l+m(m(b*s)+m(m(a*k)+m(t*E))),o[i+124>>2]=0,b=m(b+B),a=m(a+Z),t=m(t+Q),w[i+120>>2]=N+m(m(p*b)+m(m(F*a)+m(R*t))),w[i+116>>2]=W+m(m(b*d)+m(m(a*v)+m(t*h))),w[i+112>>2]=l+m(m(b*s)+m(m(a*k)+m(t*E))),Zn[o[o[n>>2]+16>>2]](n,i+128|0,i+112|0,i)),!((0|(J=J+1|0))>2]))break}}else if(!((0|Zn[o[o[f>>2]+100>>2]](f))<=0))for(n=0;Zn[o[o[f>>2]+104>>2]](f,n,i,i+128|0),a=w[r+48>>2],t=w[r+8>>2],b=w[r>>2],l=w[r+4>>2],s=w[r+52>>2],k=w[r+24>>2],E=w[r+16>>2],W=w[r+20>>2],d=w[r+56>>2],v=w[r+40>>2],h=w[r+32>>2],N=w[r+36>>2],o[i+124>>2]=0,p=w[i+8>>2],F=w[i>>2],R=w[i+4>>2],w[i+120>>2]=d+m(m(v*p)+m(m(h*F)+m(N*R))),w[i+116>>2]=s+m(m(p*k)+m(m(F*E)+m(R*W))),w[i+112>>2]=a+m(m(p*t)+m(m(F*b)+m(R*l))),o[i+108>>2]=0,B=d,d=w[i+136>>2],Z=m(v*d),v=w[i+128>>2],Q=m(h*v),h=w[i+132>>2],w[i+104>>2]=B+m(Z+m(Q+m(N*h))),w[i+100>>2]=s+m(m(d*k)+m(m(v*E)+m(W*h))),w[i+96>>2]=a+m(m(d*t)+m(m(v*b)+m(l*h))),u=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[u>>2]+16>>2]](u,i+112|0,i+96|0,e),n=n+1|0,(0|Zn[o[o[f>>2]+100>>2]](f))>(0|n););(n=o[f+4>>2])-21>>>0<=8&&(o[i+136>>2]=1566444395,o[i+140>>2]=0,o[i+128>>2]=1566444395,o[i+132>>2]=1566444395,o[i+120>>2]=-581039253,o[i+124>>2]=0,o[i+112>>2]=-581039253,o[i+116>>2]=-581039253,U=i,z=0|Zn[o[o[A>>2]+20>>2]](A),o[U+8>>2]=z,o[i+4>>2]=14992,o[i>>2]=14968,n=o[e+12>>2],o[i+20>>2]=o[e+8>>2],o[i+24>>2]=n,n=o[e+4>>2],o[i+12>>2]=o[e>>2],o[i+16>>2]=n,n=o[r+12>>2],o[i+36>>2]=o[r+8>>2],o[i+40>>2]=n,n=o[r+4>>2],o[i+28>>2]=o[r>>2],o[i+32>>2]=n,n=o[r+20>>2],o[i+44>>2]=o[r+16>>2],o[i+48>>2]=n,n=o[r+28>>2],o[i+52>>2]=o[r+24>>2],o[i+56>>2]=n,n=o[r+44>>2],o[i+68>>2]=o[r+40>>2],o[i+72>>2]=n,n=o[r+36>>2],o[i+60>>2]=o[r+32>>2],o[i+64>>2]=n,n=o[r+52>>2],o[i+76>>2]=o[r+48>>2],o[i+80>>2]=n,n=o[r+60>>2],o[i+84>>2]=o[r+56>>2],o[i+88>>2]=n,Zn[o[o[f>>2]+64>>2]](f,i,i+112|0,i+128|0),n=o[f+4>>2]),3==(0|n)&&(o[i+136>>2]=1566444395,o[i+140>>2]=0,o[i+128>>2]=1566444395,o[i+132>>2]=1566444395,o[i+120>>2]=-581039253,o[i+124>>2]=0,o[i+112>>2]=-581039253,o[i+116>>2]=-581039253,U=i,z=0|Zn[o[o[A>>2]+20>>2]](A),o[U+8>>2]=z,o[i+4>>2]=14992,o[i>>2]=14968,A=o[e+12>>2],o[i+20>>2]=o[e+8>>2],o[i+24>>2]=A,A=o[e+4>>2],o[i+12>>2]=o[e>>2],o[i+16>>2]=A,A=o[r+12>>2],o[i+36>>2]=o[r+8>>2],o[i+40>>2]=A,A=o[r+4>>2],o[i+28>>2]=o[r>>2],o[i+32>>2]=A,A=o[r+20>>2],o[i+44>>2]=o[r+16>>2],o[i+48>>2]=A,A=o[r+28>>2],o[i+52>>2]=o[r+24>>2],o[i+56>>2]=A,A=o[r+44>>2],o[i+68>>2]=o[r+40>>2],o[i+72>>2]=A,A=o[r+36>>2],o[i+60>>2]=o[r+32>>2],o[i+64>>2]=A,A=o[r+52>>2],o[i+76>>2]=o[r+48>>2],o[i+80>>2]=A,A=o[r+60>>2],o[i+84>>2]=o[r+56>>2],o[i+88>>2]=A,A=o[f+100>>2],Zn[o[o[A>>2]+8>>2]](A,i+4|0,i+112|0,i+128|0))}S=i+144|0},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,a=0,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0);S=i=S-256|0,o[i+36>>2]=14784,a=o[r+12>>2],o[i+80>>2]=o[r+8>>2],o[i+84>>2]=a,a=o[r+4>>2],o[i+72>>2]=o[r>>2],o[i+76>>2]=a,a=o[f+12>>2],o[i+96>>2]=o[f+8>>2],o[i+100>>2]=a,a=o[f>>2],n=o[f+4>>2],o[i+108>>2]=0,o[i+112>>2]=0,o[i+116>>2]=0,o[i+120>>2]=0,o[i+128>>2]=0,o[i+132>>2]=0,o[i+124>>2]=1065353216,o[i+136>>2]=0,o[i+140>>2]=0,o[i+144>>2]=1065353216,o[i+148>>2]=0,o[i+88>>2]=a,o[i+92>>2]=n,o[i+252>>2]=e,o[i+104>>2]=1065353216,o[i+248>>2]=A,e=o[r+4>>2],o[i+152>>2]=o[r>>2],o[i+156>>2]=e,e=o[r+12>>2],o[i+160>>2]=o[r+8>>2],o[i+164>>2]=e,o[i+172>>2]=0,o[i+176>>2]=0,o[i+180>>2]=0,o[i+184>>2]=0,o[i+188>>2]=1065353216,o[i+192>>2]=0,o[i+196>>2]=0,o[i+200>>2]=0,o[i+204>>2]=0,o[i+208>>2]=1065353216,o[i+212>>2]=0,o[i+168>>2]=1065353216,e=o[f+12>>2],o[i+224>>2]=o[f+8>>2],o[i+228>>2]=e,e=o[f+4>>2],o[i+216>>2]=o[f>>2],o[i+220>>2]=e,t=m(w[f+8>>2]-w[r+8>>2]),u=m(w[f>>2]-w[r>>2]),c=m(w[f+4>>2]-w[r+4>>2]),b=m(m(1)/m(N(m(m(t*t)+m(m(u*u)+m(c*c)))))),l=(t=m(t*b))==m(0)?m(0xde0b6b000000000):m(m(1)/t),w[i+48>>2]=l,s=(c=m(c*b))==m(0)?m(0xde0b6b000000000):m(m(1)/c),w[i+44>>2]=s,o[i- -64>>2]=l>2]=s>2]=u,o[i+56>>2]=u>2]=m(t*m(w[i+96>>2]-w[i+80>>2]))+m(m(b*m(w[i+88>>2]-w[i+72>>2]))+m(c*m(w[i+92>>2]-w[i+76>>2]))),A=o[A+68>>2],o[i+24>>2]=0,o[i+28>>2]=0,o[i+16>>2]=0,o[i+20>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=0,o[i+4>>2]=0,Zn[o[o[A>>2]+24>>2]](A,r,f,i+36|0,i+16|0,i),S=i+256|0},wr,ef,function(A){A|=0;var r,f,e=0,i=0,n=0,a=0,t=0,c=0;S=f=S-16|0,Zn[o[8294]](5665),Zn[o[o[A>>2]+8>>2]](A),Zn[o[o[A>>2]+12>>2]](A),r=o[A+24>>2],Zn[o[8294]](3934),r&&(e=o[A+68>>2],n=r,a=0|Zn[o[o[e>>2]+36>>2]](e),t=A+28|0,c=o[A+24>>2],i=o[o[r>>2]+32>>2],Zn[i](0|n,0|a,0|t,0|c)),Zn[o[8295]](),Zn[o[8295]](),S=f+16|0},function(A,r){A|=0,Zn[o[o[(r|=0)>>2]+32>>2]](r),hA(A,r),Zn[o[o[r>>2]+36>>2]](r)},bn,dn,zi,en,vn,en,vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=0,V=m(0);S=i=S-32|0,c=w[r+20>>2],B=w[r+36>>2],Z=w[r+24>>2],p=w[r+40>>2],b=w[r+4>>2],G=w[r+32>>2],d=w[r+8>>2],v=w[r>>2],Q=w[r+16>>2],o[i+28>>2]=0,t=m(Q-v),u=m(B-b),n=m(G-v),l=m(c-b),a=m(m(t*u)-m(n*l)),s=l,l=m(p-d),k=m(Z-d),u=m(m(s*l)-m(u*k)),t=m(m(k*n)-m(l*t)),n=m(m(d*a)+m(m(v*u)+m(b*t))),E=w[A+12>>2],s=w[A+4>>2],h=w[A+8>>2],l=m(m(m(a*E)+m(m(u*s)+m(t*h)))-n),W=w[A+28>>2],F=w[A+20>>2],R=w[A+24>>2],n=m(m(m(a*W)+m(m(u*F)+m(t*R)))-n),m(l*n)>=m(0)||1&(r=o[A+36>>2])&l<=m(0)||(n=m(l/m(l-n)))>2]&&(k=m(m(1)-n),s=m(m(k*s)+m(F*n)),v=m(v-s),h=m(m(k*h)+m(R*n)),c=m(c-h),Q=m(Q-s),b=m(b-h),k=m(m(k*E)+m(W*n)),Z=m(Z-k),d=m(d-k),W=m(m(a*a)+m(m(u*u)+m(t*t))),E=m(W*m(-9999999747378752e-20)),m(m(m(m(v*c)-m(Q*b))*a)+m(m(m(m(b*Z)-m(c*d))*u)+m(t*m(m(d*Q)-m(Z*v)))))>=E&&(B=m(B-h),G=m(G-s),h=m(m(m(Q*B)-m(G*c))*a),s=c,c=m(p-k),!(E<=m(h+m(m(m(m(s*c)-m(B*Z))*u)+m(t*m(m(Z*G)-m(c*Q))))))|!(E<=m(m(m(m(G*b)-m(v*B))*a)+m(m(m(m(B*d)-m(b*c))*u)+m(t*m(m(c*v)-m(d*G))))))||(c=a,a=m(m(1)/m(N(W))),b=m(c*a),w[i+24>>2]=b,t=m(t*a),w[i+20>>2]=t,a=m(u*a),w[i+16>>2]=a,!(l<=m(0))|2&r?(Y=A,V=m(Zn[o[o[A>>2]+12>>2]](A,i+16|0,n,f,e)),w[Y+40>>2]=V):(o[i+12>>2]=0,w[i+8>>2]=-b,w[i+4>>2]=-t,w[i>>2]=-a,Y=A,V=m(Zn[o[o[A>>2]+12>>2]](A,i,n,f,e)),w[Y+40>>2]=V)))),S=i+32|0},function(A,r,f,e,i){A|=0,r|=0,f=m(f),e|=0,i|=0;var n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0);return S=n=S-48|0,o[n+40>>2]=i,o[n+36>>2]=e,o[n+44>>2]=o[A+52>>2],b=w[A- -64>>2],u=w[A+60>>2],l=w[A+80>>2],s=w[A+72>>2],k=w[A+76>>2],d=w[A+96>>2],v=w[A+88>>2],h=w[A+92>>2],B=w[A+56>>2],a=w[r+8>>2],t=w[r>>2],c=w[r+4>>2],r=o[A+48>>2],o[n+28>>2]=0,w[n+24>>2]=m(d*a)+m(m(v*t)+m(c*h)),w[n+20>>2]=m(l*a)+m(m(s*t)+m(c*k)),w[n+32>>2]=f,o[n+8>>2]=r,w[n+16>>2]=m(b*a)+m(m(B*t)+m(u*c)),o[n+12>>2]=n+36,A=o[A+44>>2],f=m(Zn[o[o[A>>2]+12>>2]](A,n+8|0,1)),S=n+48|0,m(f)},vn,function(A,r){A|=0,r|=0;var f,e,i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0);S=f=S-128|0,e=o[r+36>>2],r=o[o[A+8>>2]+32>>2]+G(e,80)|0,i=o[r+64>>2],d=w[r+32>>2],v=w[r>>2],h=w[r+16>>2],B=w[r+56>>2],Z=w[r+52>>2],Q=w[r+48>>2],E=w[r+36>>2],W=w[r+20>>2],N=w[r+4>>2],p=w[r+40>>2],F=w[r+24>>2],R=w[r+8>>2],r=o[A+12>>2],Y=w[r+52>>2],V=w[r+56>>2],n=w[r+24>>2],a=w[r+20>>2],t=w[r+40>>2],c=w[r+36>>2],g=w[r+48>>2],b=w[r+8>>2],u=w[r>>2],l=w[r+4>>2],s=w[r+16>>2],k=w[r+32>>2],o[f+124>>2]=0,o[f+108>>2]=0,o[f+92>>2]=0,w[f+104>>2]=m(p*t)+m(m(R*k)+m(F*c)),w[f+100>>2]=m(E*t)+m(m(N*k)+m(W*c)),w[f+88>>2]=m(p*n)+m(m(R*s)+m(F*a)),w[f+84>>2]=m(E*n)+m(m(N*s)+m(W*a)),w[f+120>>2]=V+m(m(B*t)+m(m(Q*k)+m(c*Z))),w[f+116>>2]=Y+m(m(B*n)+m(m(Q*s)+m(a*Z))),o[f+76>>2]=0,w[f+72>>2]=m(p*b)+m(m(R*u)+m(l*F)),w[f+68>>2]=m(E*b)+m(m(N*u)+m(l*W)),w[f+64>>2]=m(d*b)+m(m(v*u)+m(h*l)),w[f+112>>2]=g+m(m(B*b)+m(m(Q*u)+m(l*Z))),w[f+96>>2]=m(d*t)+m(m(v*k)+m(h*c)),w[f+80>>2]=m(d*n)+m(m(v*s)+m(h*a)),r=o[A+4>>2],o[f+60>>2]=e,o[f+56>>2]=-1,o[f+48>>2]=r,o[f+44>>2]=i,o[f+40>>2]=0,o[f+52>>2]=f- -64,r=o[A+24>>2],o[f+36>>2]=e,o[f+32>>2]=r,o[f+28>>2]=i,o[f+8>>2]=13708,o[f+16>>2]=0,w[f+12>>2]=w[r+4>>2],o[f+24>>2]=o[r+16>>2],cA(o[A+16>>2],o[A+20>>2],f+40|0,f+8|0),S=f+128|0},vn,$e,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=0,a=m(0);return S=e=S-16|0,n=o[A+28>>2],o[e+8>>2]=n,o[e+4>>2]=n,(i=o[r+4>>2])?(o[i+4>>2]=n,o[i>>2]=n):o[r+4>>2]=e+4,n=o[A+24>>2],a=m(Zn[o[o[n>>2]+12>>2]](n,r,f)),w[A+4>>2]=w[o[A+24>>2]+4>>2],S=e+16|0,m(a)},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);S=i=S-688|0,n=oi(i+576|0),o[n+4>>2]=1,o[n>>2]=15956,t=o[r+12>>2],o[n+72>>2]=o[r+8>>2],o[n+76>>2]=t,t=o[r+4>>2],o[n+64>>2]=o[r>>2],o[n+68>>2]=t,t=o[r+28>>2],o[n+88>>2]=o[r+24>>2],o[n+92>>2]=t,t=o[r+20>>2],o[n+80>>2]=o[r+16>>2],o[n+84>>2]=t,t=o[r+44>>2],o[n+104>>2]=o[r+40>>2],o[n+108>>2]=t,t=o[r+36>>2],o[n+96>>2]=o[r+32>>2],o[n+100>>2]=t,w[n+52>>2]=w[A+204>>2],a[i+548|0]=0,o[i+524>>2]=953267991,o[i+212>>2]=22800,t=o[A+4>>2],o[20+(r=i+188|0)>>2]=0,o[r+16>>2]=n,o[r+12>>2]=t,o[r+8>>2]=i+212,o[r+4>>2]=i+216,o[r>>2]=22576,o[i+12>>2]=13280,o[i+176>>2]=1065353216,o[i+180>>2]=0,w[i+184>>2]=w[A+208>>2],HA(t=r,A+8|0,A+72|0,r=A+136|0,r,i+12|0)&&(c=w[i+152>>2],b=w[i+144>>2],u=w[i+148>>2],(l=m(m(c*c)+m(m(b*b)+m(u*u))))>m(9999999747378752e-20)&&(s=w[i+176>>2])>2]&&(k=c,c=m(m(1)/m(N(l))),w[i+152>>2]=k*c,w[i+148>>2]=u*c,w[i+144>>2]=b*c,m(Zn[o[o[A>>2]+12>>2]](A,i+144|0,i+160|0,s,f,e)))),Ne(n),S=i+688|0},pf,vn,pf,vn,function(A,r){A|=0,r|=0;var f,e,i,n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0);S=f=S-128|0,e=o[r+36>>2],r=o[o[A+24>>2]+32>>2]+G(e,80)|0,i=o[r+64>>2],v=w[r+32>>2],h=w[r>>2],B=w[r+16>>2],Z=w[r+56>>2],Q=w[r+52>>2],E=w[r+48>>2],W=w[r+36>>2],N=w[r+20>>2],p=w[r+4>>2],F=w[r+40>>2],R=w[r+24>>2],Y=w[r+8>>2],r=o[A+28>>2],V=w[r+52>>2],g=w[r+56>>2],a=w[r+24>>2],t=w[r+20>>2],c=w[r+40>>2],b=w[r+36>>2],X=w[r+48>>2],u=w[r+8>>2],l=w[r>>2],s=w[r+4>>2],k=w[r+16>>2],d=w[r+32>>2],o[f+124>>2]=0,o[f+108>>2]=0,o[f+92>>2]=0,w[f+104>>2]=m(F*c)+m(m(Y*d)+m(R*b)),w[f+100>>2]=m(W*c)+m(m(p*d)+m(N*b)),w[f+88>>2]=m(F*a)+m(m(Y*k)+m(R*t)),w[f+84>>2]=m(W*a)+m(m(p*k)+m(N*t)),w[f+120>>2]=g+m(m(Z*c)+m(m(E*d)+m(Q*b))),w[f+116>>2]=V+m(m(Z*a)+m(m(E*k)+m(Q*t))),o[f+76>>2]=0,w[f+72>>2]=m(F*u)+m(m(Y*l)+m(R*s)),w[f+68>>2]=m(W*u)+m(m(p*l)+m(N*s)),w[f+64>>2]=m(v*u)+m(m(h*l)+m(B*s)),w[f+112>>2]=X+m(m(Z*u)+m(m(E*l)+m(Q*s))),w[f+96>>2]=m(v*c)+m(m(h*d)+m(B*b)),w[f+80>>2]=m(v*a)+m(m(h*k)+m(B*t)),r=o[A+32>>2],o[f+48>>2]=0,o[f+40>>2]=1,o[f+44>>2]=-1,o[f+60>>2]=e,o[f+56>>2]=r,o[f+52>>2]=i,o[f+32>>2]=14524,w[f+36>>2]=w[r+4>>2],r=o[A+4>>2],n=o[r+8>>2],o[f+28>>2]=e,o[f+24>>2]=-1,o[f+16>>2]=n,o[f+12>>2]=i,o[f+8>>2]=r,o[f+20>>2]=f- -64,nA(o[A+8>>2],o[A+12>>2],o[A+16>>2],f+8|0,f+32|0,w[A+20>>2]),S=f+128|0},vn,$e,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0);return S=e=S-16|0,o[e+4>>2]=-1,o[e+8>>2]=o[A+28>>2],o[e+12>>2]=o[A+20>>2],o[r+4>>2]||(o[r+4>>2]=e+4),i=o[A+24>>2],n=m(Zn[o[o[i>>2]+12>>2]](i,r,f)),w[A+4>>2]=w[o[A+24>>2]+4>>2],S=e+16|0,m(n)},en,vn,function(A,r){A|=0,r|=0;var f,e=0,i=m(0),n=0;return S=f=S-32|0,e=o[A+216>>2],(i=w[e+4>>2])!=m(0)&&(r=o[r>>2],0|Zn[o[o[e>>2]+8>>2]](e,o[r+188>>2])&&(e=o[A+216>>2],n=o[r+192>>2],o[f+24>>2]=-1,o[f+28>>2]=-1,o[f+20>>2]=r+4,o[f+16>>2]=r,o[f+12>>2]=n,o[f+8>>2]=0,cA(A+68|0,A+132|0,f+8|0,e))),S=f+32|0,i!=m(0)|0},vn,function(A,r){A|=0,r|=0;var f,e=0,i=m(0),n=m(0),a=0,t=0;return S=f=S-32|0,e=o[A+184>>2],(i=w[e+4>>2])!=m(0)&&(r=o[r>>2],0|Zn[o[o[e>>2]+8>>2]](e,o[r+188>>2])&&(n=w[A+188>>2],e=o[A+184>>2],a=o[A+192>>2],t=o[r+192>>2],o[f+24>>2]=-1,o[f+28>>2]=-1,o[f+20>>2]=r+4,o[f+16>>2]=r,o[f+12>>2]=t,o[f+8>>2]=0,nA(a,A+36|0,A+100|0,f+8|0,e,n))),S=f+32|0,i!=m(0)|0},en,vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=0,W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0);S=f=S-96|0,a=w[A+76>>2],u=w[A+36>>2],t=w[A+32>>2],l=w[A+80>>2],v=w[A+52>>2],h=w[A+44>>2],B=w[A+48>>2],s=w[A+84>>2],Z=w[A+68>>2],F=w[A+60>>2],R=w[A- -64>>2],Y=w[A+28>>2],k=w[r+8>>2],c=w[r>>2],b=w[r+4>>2],o[f+92>>2]=0,W=m(s+m(m(k*Z)+m(m(c*F)+m(b*R)))),w[f+88>>2]=W,p=m(l+m(m(k*v)+m(m(c*h)+m(b*B)))),w[f+84>>2]=p,k=m(a+m(m(k*u)+m(m(c*Y)+m(b*t)))),w[f+80>>2]=k,c=w[r+20>>2],b=w[r+24>>2],d=w[r+16>>2],o[f+76>>2]=0,V=m(s+m(m(b*Z)+m(m(d*F)+m(R*c)))),w[f+72>>2]=V,G=m(l+m(m(b*v)+m(m(d*h)+m(B*c)))),w[f+68>>2]=G,Q=m(a+m(m(b*u)+m(m(d*Y)+m(t*c)))),w[f+64>>2]=Q,c=w[r+36>>2],b=w[r+40>>2],d=w[r+32>>2],o[f+60>>2]=0,s=m(s+m(m(b*Z)+m(m(d*F)+m(R*c)))),w[f+56>>2]=s,l=m(l+m(m(b*v)+m(m(d*h)+m(B*c)))),w[f+52>>2]=l,a=m(a+m(m(b*u)+m(m(d*Y)+m(t*c)))),w[f+48>>2]=a,o[f+44>>2]=0,v=m(m(m(W+V)+s)*m(.3333333432674408)),w[f+40>>2]=v,h=m(m(m(p+G)+l)*m(.3333333432674408)),w[f+36>>2]=h,B=m(m(m(k+Q)+a)*m(.3333333432674408)),w[f+32>>2]=B,r=o[A+8>>2],16384&Zn[o[o[r>>2]+56>>2]](r)&&(o[f+24>>2]=0,o[f+28>>2]=0,o[f+16>>2]=1065353216,o[f+20>>2]=1065353216,r=o[A+8>>2],o[f+12>>2]=0,u=m(Q-k),t=m(l-p),l=m(a-k),Z=m(G-p),Q=a=m(m(u*t)-m(l*Z)),G=m(a*a),s=m(s-W),a=t,t=m(V-W),a=m(m(Z*s)-m(a*t)),u=m(m(t*l)-m(s*u)),t=m(m(1)/m(N(m(G+m(m(a*a)+m(u*u)))))),w[f+8>>2]=m(Q*t)+v,w[f+4>>2]=m(u*t)+h,w[f>>2]=B+m(a*t),Zn[o[o[r>>2]+16>>2]](r,f+32|0,f,f+16|0)),e=o[A+8>>2],i=f+80|0,E=f- -64|0,r=A+12|0,Zn[o[o[e>>2]+16>>2]](e,i,E,r),e=o[A+8>>2],n=E,E=f+48|0,Zn[o[o[e>>2]+16>>2]](e,n,E,r),A=o[A+8>>2],Zn[o[o[A>>2]+16>>2]](A,E,i,r),S=f+96|0},qe,function(A){return(A|=0)-4|0},function(A){DA((A|=0)-4|0)},function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A=(A|=0)-4|0)>>2]+8>>2]](A,r,f,e)},en,hn,en,hn,en,vn,function(A,r,f,e){var i,n;return A|=0,f|=0,e|=0,f=o[(r|=0)>>2],f=0|Zn[o[o[f>>2]+56>>2]](f,72),i=o[r+4>>2],e=o[A+8>>2],n=o[A+12>>2],A=o[A+16>>2],o[f>>2]=15064,o[f+4>>2]=o[r>>2],o[f>>2]=15092,o[f+8>>2]=e,o[f>>2]=15216,o[f+68>>2]=A,o[f+64>>2]=n,a[f+60|0]=0,o[f+56>>2]=i,a[f+52|0]=0,a[f+28|0]=1,o[f+24>>2]=0,a[f+48|0]=1,o[f+16>>2]=0,o[f+20>>2]=0,o[f+44>>2]=0,o[f+36>>2]=0,o[f+40>>2]=0,0|f},Cf,function(A){Cf(A|=0),DA(A)},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,t=m(0),c=0,b=0,u=m(0),l=0,s=m(0),k=m(0),d=0,h=0,B=m(0),Z=0,E=0,W=m(0),p=m(0),F=0,R=0,Y=m(0),V=0,g=m(0),X=0,D=0,C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),iA=0,nA=m(0),aA=m(0),tA=m(0),oA=m(0),cA=m(0),bA=m(0),lA=0,sA=m(0),kA=m(0),dA=m(0),vA=m(0),hA=m(0),BA=0,wA=0,ZA=m(0),GA=m(0),mA=m(0),QA=0;S=n=S-928|0,(c=o[A+56>>2])||(c=o[A+4>>2],c=0|Zn[o[o[c>>2]+12>>2]](c,o[r+8>>2],o[f+8>>2]),a[A+52|0]=1,o[A+56>>2]=c),o[i+4>>2]=c,V=o[f+4>>2];A:{r:{f:{e:switch(X=o[r+4>>2],o[X+4>>2]-8|0){case 0:break f;case 2:break e;default:break r}e:switch(o[V+4>>2]-8|0){case 2:if(e=X+36|0,A=o[X+60>>2],t=w[e+(A<<2)>>2],s=w[e+((A+2|0)%3<<2)>>2],l=V+36|0,e=o[V+60>>2],u=w[c+848>>2],(t=vr(n+432|0,n+8|0,t,s,w[l+(e<<2)>>2],w[l+((e+2|0)%3<<2)>>2],A,e,o[r+12>>2],o[f+12>>2],u))>2]+16>>2]](i,n+432|0,n+8|0,t),A=o[i+4>>2],!o[A+844>>2])break A;r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0);break A;case 0:break e;default:break r}if(e=X+36|0,A=o[X+60>>2],u=w[c+848>>2],(t=vr(n+432|0,n+8|0,w[e+(A<<2)>>2],w[e+((A+2|0)%3<<2)>>2],m(0),m(w[V+36>>2]*w[V+20>>2]),A,1,o[r+12>>2],o[f+12>>2],u))>2]+16>>2]](i,n+432|0,n+8|0,t),A=o[i+4>>2],!o[A+844>>2])break A;r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0);break A}if(10==o[V+4>>2]){if(e=V+36|0,A=o[V+60>>2],u=w[c+848>>2],(t=vr(n+432|0,n+8|0,m(0),m(w[X+36>>2]*w[X+20>>2]),w[e+(A<<2)>>2],w[e+((A+2|0)%3<<2)>>2],1,A,o[r+12>>2],o[f+12>>2],u))>2]+16>>2]](i,n+432|0,n+8|0,t),A=o[i+4>>2],!o[A+844>>2])break A;r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0);break A}}if(o[n+920>>2]=1566444395,a[n+764|0]=0,o[n+740>>2]=953267991,E=Hf(n+352|0,X,V,n+432|0,o[A+8>>2]),o[E+32>>2]=V,o[E+28>>2]=X,u=m(m(m(m(Zn[o[o[X>>2]+48>>2]](X))+m(Zn[o[o[V>>2]+48>>2]](V)))+w[o[A+56>>2]+848>>2])+w[i+32>>2]),w[n+920>>2]=u*u,c=o[r+12>>2],l=o[c+12>>2],o[n+800>>2]=o[c+8>>2],o[n+804>>2]=l,l=o[c+4>>2],o[n+792>>2]=o[c>>2],o[n+796>>2]=l,l=o[c+28>>2],o[n+816>>2]=o[c+24>>2],o[n+820>>2]=l,l=o[c+20>>2],o[n+808>>2]=o[c+16>>2],o[n+812>>2]=l,l=o[c+44>>2],o[n+832>>2]=o[c+40>>2],o[n+836>>2]=l,l=o[c+36>>2],o[n+824>>2]=o[c+32>>2],o[n+828>>2]=l,l=o[c+60>>2],o[n+848>>2]=o[c+56>>2],o[n+852>>2]=l,l=o[c+52>>2],o[n+840>>2]=o[c+48>>2],o[n+844>>2]=l,c=o[f+12>>2],l=o[c+12>>2],o[n+864>>2]=o[c+8>>2],o[n+868>>2]=l,l=o[c+4>>2],o[n+856>>2]=o[c>>2],o[n+860>>2]=l,b=o[c+20>>2],o[(l=n+872|0)>>2]=o[c+16>>2],o[l+4>>2]=b,b=o[c+28>>2],o[n+880>>2]=o[c+24>>2],o[n+884>>2]=b,d=o[c+36>>2],o[(b=n+888|0)>>2]=o[c+32>>2],o[b+4>>2]=d,d=o[c+44>>2],o[n+896>>2]=o[c+40>>2],o[n+900>>2]=d,Z=o[c+52>>2],o[(d=n+904|0)>>2]=o[c+48>>2],o[d+4>>2]=Z,Z=o[c+60>>2],o[n+912>>2]=o[c+56>>2],o[n+916>>2]=Z,!((0|(Z=o[X+4>>2]))>6)&&!((0|(c=o[V+4>>2]))>6)&&(o[n+348>>2]=15336,Z&&($=m(Zn[o[o[X>>2]+48>>2]](X)),c=o[V+4>>2]),c&&(t=m(Zn[o[o[V>>2]+48>>2]](V))),a[n+44|0]=0,w[n+36>>2]=t,w[n+32>>2]=$,o[n+12>>2]=i,o[n+8>>2]=15568,o[X+60>>2])){if(o[V+60>>2]){I=w[o[A+56>>2]+848>>2];r:{f:{if(v[e+24|0]){$=m(-1.0000000150474662e30),R=o[X+60>>2],F=o[V+60>>2],d=o[r+12>>2],Z=o[f+12>>2],S=b=S-96|0,o[8791]=o[8791]+1,t=w[R+72>>2],u=w[R+64>>2],g=w[R+68>>2],s=w[F+72>>2],Y=w[F+64>>2],J=w[F+68>>2],AA=m(m(m(m(t*w[d+40>>2])+m(m(u*w[d+32>>2])+m(g*w[d+36>>2])))+w[d+56>>2])-m(m(m(s*w[Z+40>>2])+m(m(Y*w[Z+32>>2])+m(J*w[Z+36>>2])))+w[Z+56>>2])),rA=m(m(m(m(t*w[d+24>>2])+m(m(u*w[d+16>>2])+m(g*w[d+20>>2])))+w[d+52>>2])-m(m(m(s*w[Z+24>>2])+m(m(Y*w[Z+16>>2])+m(J*w[Z+20>>2])))+w[Z+52>>2])),fA=m(m(m(m(t*w[d+8>>2])+m(m(u*w[d>>2])+m(g*w[d+4>>2])))+w[d+48>>2])-m(m(m(s*w[Z+8>>2])+m(m(Y*w[Z>>2])+m(J*w[Z+4>>2])))+w[Z+48>>2])),u=m(34028234663852886e22);e:{i:{if((0|(c=o[R+28>>2]))>0)for(;;){if(e=o[R+36>>2]+G(D,36)|0,g=w[e+28>>2],s=w[e+20>>2],Y=w[e+24>>2],J=w[d+8>>2],x=w[d>>2],M=w[d+4>>2],q=w[d+24>>2],_=w[d+16>>2],H=w[d+20>>2],T=w[d+40>>2],U=w[d+32>>2],K=w[d+36>>2],o[b+12>>2]=0,t=m(m(T*g)+m(m(U*s)+m(Y*K))),w[b+8>>2]=t,B=m(m(q*g)+m(m(_*s)+m(Y*H))),w[b+4>>2]=B,p=m(m(J*g)+m(m(x*s)+m(Y*M))),w[b>>2]=p,m(m(AA*t)+m(m(fA*p)+m(rA*B)))>2]=t,B=m(-B),w[b+4>>2]=B,p=m(-p),w[b>>2]=p),o[8789]=o[8789]+1,!(v[33193]&&(g=m(m(AA*t)+m(m(fA*p)+m(rA*B))),s=w[R+88>>2],z=m(-s),C=s,s=m(m(T*t)+m(m(J*p)+m(q*B))),j=m((s>2],z=m(-s),C=s,s=m(m(U*t)+m(m(x*p)+m(_*B))),C=m((s>2],M=(s=m(j+m(C+m(s*(s(Y=w[R+96>>2])?s:Y,s=w[F+88>>2],z=m(-s),C=s,s=m(m(w[Z+40>>2]*t)+m(m(w[Z+8>>2]*p)+m(B*w[Z+24>>2]))),j=m((s>2],z=m(-s),C=s,s=m(m(w[Z+32>>2]*t)+m(m(w[Z>>2]*p)+m(B*w[Z+16>>2]))),C=m((s>2]*t)+m(m(w[Z+4>>2]*p)+m(B*w[Z+20>>2]))),s=w[F+84>>2],t=m(j+m(C+m(t*(t>2],t=m(M+(t>s?t:s)),s=m(g+t),((t=m(t-g))>s?s:t)>u))){if(o[8790]=o[8790]+1,Xr(R,d,b,b+92|0,b+88|0,b- -64|0,b+48|0),Xr(F,Z,b,b+84|0,b+80|0,b+32|0,b+16|0),(t=w[b+88>>2])<(g=w[b+84>>2]))break i;if((s=w[b+80>>2])<(Y=w[b+92>>2]))break i;(t=(t=m(t-g))<(g=m(s-Y))?t:g)>2],o[n+248>>2]=o[b>>2],o[n+252>>2]=e,e=o[b+12>>2],o[n+256>>2]=o[b+8>>2],o[n+260>>2]=e,u=t)}if((0|c)==(0|(D=D+1|0)))break}if((0|(c=o[F+28>>2]))>0)for(D=0;;){if(e=o[F+36>>2]+G(D,36)|0,g=w[e+28>>2],s=w[e+20>>2],Y=w[e+24>>2],J=w[Z+8>>2],x=w[Z>>2],M=w[Z+4>>2],q=w[Z+24>>2],_=w[Z+16>>2],H=w[Z+20>>2],T=w[Z+40>>2],U=w[Z+32>>2],K=w[Z+36>>2],o[b+12>>2]=0,t=m(m(T*g)+m(m(U*s)+m(Y*K))),w[b+8>>2]=t,B=m(m(q*g)+m(m(_*s)+m(Y*H))),w[b+4>>2]=B,p=m(m(J*g)+m(m(x*s)+m(Y*M))),w[b>>2]=p,m(m(AA*t)+m(m(fA*p)+m(rA*B)))>2]=t,B=m(-B),w[b+4>>2]=B,p=m(-p),w[b>>2]=p),o[8789]=o[8789]+1,!(v[33193]&&(g=m(m(AA*t)+m(m(fA*p)+m(rA*B))),s=w[R+88>>2],z=m(-s),C=s,s=m(m(w[d+40>>2]*t)+m(m(w[d+8>>2]*p)+m(B*w[d+24>>2]))),j=m((s>2],z=m(-s),C=s,s=m(m(w[d+32>>2]*t)+m(m(w[d>>2]*p)+m(B*w[d+16>>2]))),C=m((s>2]*t)+m(m(w[d+4>>2]*p)+m(B*w[d+20>>2]))),Y=w[R+84>>2],Y=(s=m(j+m(C+m(s*(s(Y=w[R+96>>2])?s:Y,s=w[F+88>>2],z=m(-s),C=s,s=m(m(T*t)+m(m(J*p)+m(q*B))),j=m((s>2],z=m(-s),C=s,s=m(m(U*t)+m(m(x*p)+m(_*B))),C=m((s>2],t=m(j+m(C+m(t*(t>2],t=m(Y+(t>s?t:s)),s=m(g+t),((t=m(t-g))>s?s:t)>u))){if(o[8790]=o[8790]+1,Xr(R,d,b,b+92|0,b+88|0,b- -64|0,b+48|0),Xr(F,Z,b,b+84|0,b+80|0,b+32|0,b+16|0),(t=w[b+88>>2])<(g=w[b+84>>2]))break i;if((s=w[b+80>>2])<(Y=w[b+92>>2]))break i;(t=(t=m(t-g))<(g=m(s-Y))?t:g)>2],o[n+248>>2]=o[b>>2],o[n+252>>2]=e,e=o[b+12>>2],o[n+256>>2]=o[b+8>>2],o[n+260>>2]=e,u=t)}if((0|c)==(0|(D=D+1|0)))break}if(iA=1,!((0|(e=o[R+48>>2]))<=0||(c=0,(0|(D=o[F+48>>2]))<=0))){for(T=m(0),E=-1,l=-1,U=m(0),K=m(0),q=m(0),_=m(0),H=m(0);;){if((0|D)>0){for(e=o[R+56>>2]+(c<<4)|0,t=w[e+8>>2],Y=w[e>>2],J=w[e+4>>2],g=m(m(w[d+24>>2]*t)+m(m(w[d+16>>2]*Y)+m(J*w[d+20>>2]))),ZA=m(-g),s=m(m(w[d+8>>2]*t)+m(m(w[d>>2]*Y)+m(J*w[d+4>>2]))),GA=m(-s),Y=m(m(w[d+40>>2]*t)+m(m(w[d+32>>2]*Y)+m(J*w[d+36>>2]))),mA=m(-Y),e=0;;){if(D=o[F+56>>2]+(e<<4)|0,M=w[D+8>>2],B=w[D>>2],p=w[D+4>>2],j=w[Z+40>>2],aA=w[Z+32>>2],tA=w[Z+36>>2],oA=w[Z+24>>2],sA=w[Z+16>>2],kA=w[Z+20>>2],dA=w[Z+8>>2],vA=w[Z>>2],hA=w[Z+4>>2],o[b+12>>2]=0,J=m(m(oA*M)+m(m(sA*B)+m(p*kA))),x=m(m(dA*M)+m(m(vA*B)+m(p*hA))),t=m(m(s*J)+m(x*ZA)),M=m(m(j*M)+m(m(aA*B)+m(p*tA))),B=m(m(Y*x)+m(M*GA)),p=m(m(g*M)+m(J*mA)),+m(Q(p))>1e-6|+m(Q(B))>1e-6|+m(Q(t))>1e-6&&(cA=m(m(1)/m(N(m(m(t*t)+m(m(p*p)+m(B*B)))))),t=m(t*cA),w[b+8>>2]=t,B=m(B*cA),w[b+4>>2]=B,p=m(p*cA),w[b>>2]=p,m(m(AA*t)+m(m(fA*p)+m(rA*B)))>2]=t,B=m(-B),w[b+4>>2]=B,p=m(-p),w[b>>2]=p),o[8789]=o[8789]+1,!(v[33193]&&(cA=m(m(AA*t)+m(m(fA*p)+m(rA*B))),C=w[R+88>>2],nA=m(-C),z=C,C=m(m(w[d+40>>2]*t)+m(m(w[d+8>>2]*p)+m(B*w[d+24>>2]))),bA=m((C>2],nA=m(-C),z=C,C=m(m(w[d+32>>2]*t)+m(m(w[d>>2]*p)+m(B*w[d+16>>2]))),z=m((C>2]*t)+m(m(w[d+4>>2]*p)+m(B*w[d+20>>2]))),nA=w[R+84>>2],bA=(C=m(bA+m(z+m(C*(C(nA=w[R+96>>2])?C:nA,C=w[F+88>>2],j=m(m(j*t)+m(m(dA*p)+m(oA*B))),nA=m((j>2],z=m(-j),C=j,j=m(m(aA*t)+m(m(vA*p)+m(sA*B))),t=m(m(tA*t)+m(m(hA*p)+m(kA*B))),B=w[F+84>>2],t=m(nA+m(m((j>2],t=m(bA+(t>B?t:B)),B=m(cA+t),((t=m(t-cA))>B?B:t)>u)))){if(o[8790]=o[8790]+1,Xr(R,d,b,b+92|0,b+88|0,b- -64|0,b+48|0),Xr(F,Z,b,b+84|0,b+80|0,b+32|0,b+16|0),(t=w[b+88>>2])<(B=w[b+84>>2]))break i;if((p=w[b+80>>2])<(j=w[b+92>>2]))break i;(t=(D=(t=m(t-B))<(B=m(p-j)))?t:B)>2],_=w[l+4>>2],T=w[8+(l=D?b+48|0:b- -64|0)>>2],U=w[l+4>>2],u=w[b+16>>2],k=w[b+32>>2],W=w[b+64>>2],y=w[b+48>>2],l=o[b+4>>2],o[n+248>>2]=o[b>>2],o[n+252>>2]=l,l=o[b+12>>2],o[n+256>>2]=o[b+8>>2],o[n+260>>2]=l,K=D?y:W,H=D?k:u,k=x,W=J,y=M,P=s,O=g,L=Y,l=c,E=e,u=t)}if(!((0|(e=e+1|0))<(0|(D=o[F+48>>2]))))break}e=o[R+48>>2]}if(!((0|(c=c+1|0))<(0|e)))break}if(!((l|E)<0)){Y=m(q-T),J=m(H-K),x=m(_-U),s=m(m(L*Y)+m(m(P*J)+m(O*x))),t=m(0),M=m(-m(m(y*Y)+m(m(k*J)+m(W*x)))),g=m(m(L*y)+m(m(P*k)+m(O*W))),(u=m(m(1)-m(g*g)))!=m(0)&&(t=m(-1.0000000150474662e30),(u=m(m(m(M*g)+s)/u))m(1.0000000150474662e30)&&(t=m(1.0000000150474662e30)));n:if((B=m(m(t*g)+M))m(1.0000000150474662e30))){B=m(-1.0000000150474662e30),t=u;break n}B=m(-1.0000000150474662e30)}else B>m(1.0000000150474662e30)&&(t=m(-1.0000000150474662e30),B=m(1.0000000150474662e30),(u=m(m(g*m(1.0000000150474662e30))+s))m(1.0000000150474662e30)&&(t=m(1.0000000150474662e30)));o[b+76>>2]=0,y=m(y*B),u=m(y+m(Y-m(L*t))),L=m(k*B),k=m(L+m(J-m(P*t))),P=m(W*B),t=m(P+m(x-m(O*t))),(W=m(m(u*u)+m(m(k*k)+m(t*t))))>m(1.1920928955078125e-7)&&(s=u,O=m(N(W)),u=m(m(1)/O),W=m(s*u),w[b+72>>2]=W,t=m(t*u),w[b+68>>2]=t,u=m(k*u),w[b+64>>2]=u,m(m(W*AA)+m(m(u*fA)+m(rA*t)))>2]=-W,w[b+68>>2]=-t,w[b+64>>2]=-u),o[b+60>>2]=0,w[b+56>>2]=q+y,w[b+52>>2]=_+P,w[b+48>>2]=H+L,Zn[o[o[i>>2]+16>>2]](i,b- -64|0,b+48|0,m(-O)))}}if(t=w[n+256>>2],u=w[n+248>>2],k=w[n+252>>2],!(m(m(AA*t)+m(m(fA*u)+m(rA*k)))>2]=0,w[n+256>>2]=-t,w[n+252>>2]=-k,w[n+248>>2]=-u;break e}iA=0}if(S=b+96|0,iA)break f;break r}if(eA(E,n+792|0,n+8|0,o[e+20>>2],0),e=o[n+28>>2],o[n+256>>2]=o[n+24>>2],o[n+260>>2]=e,e=o[n+20>>2],o[n+248>>2]=o[n+16>>2],o[n+252>>2]=e,!v[n+44|0])break r;if(!(($=w[n+40>>2])>2]&o[A+20>>2])<0&&(!(e=o[A+24>>2])||!e|!v[A+28|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),a[A+28|0]=1,o[A+20>>2]=0,o[A+24>>2]=0),o[A+16>>2]=0,iA=o[X+60>>2],d=o[V+60>>2],h=o[r+12>>2],E=o[f+12>>2],S=b=S-16|0,t=w[n+256>>2],u=w[n+248>>2],k=w[n+252>>2],w[b+12>>2]=w[n+260>>2],s=t,t=m(m(1)/m(N(m(m(t*t)+m(m(u*u)+m(k*k)))))),y=m(s*t),w[b+8>>2]=y,P=m(k*t),w[b+4>>2]=P,O=m(u*t),w[b>>2]=O,Z=-1,(0|(f=o[d+28>>2]))>0)for(L=w[E+40>>2],g=w[E+36>>2],s=w[E+24>>2],Y=w[E+20>>2],e=o[d+36>>2],J=w[E+32>>2],x=w[E+16>>2],M=w[E+8>>2],B=w[E+4>>2],p=w[E>>2],c=0,t=m(-34028234663852886e22);r=e+G(c,36)|0,u=w[r+28>>2],k=w[r+20>>2],W=w[r+24>>2],t=(r=(u=m(m(m(m(L*u)+m(m(J*k)+m(W*g)))*y)+m(m(m(m(M*u)+m(m(p*k)+m(W*B)))*O)+m(m(m(s*u)+m(m(x*k)+m(W*Y)))*P))))>t)?u:t,Z=r?c:Z,(0|f)!=(0|(c=c+1|0)););if((o[4+(f=A+12|0)>>2]&o[f+8>>2])<0&&(!(r=o[f+12>>2])||!r|!v[f+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[f+16|0]=1,o[f+8>>2]=0,o[f+12>>2]=0),o[f+4>>2]=0,BA=o[d+36>>2]+G(Z,36)|0,(0|(wA=o[BA+4>>2]))>0)for(e=0,V=0;;){if(r=o[d+16>>2]+(o[o[BA+12>>2]+(V<<2)>>2]<<4)|0,t=w[r+8>>2],u=w[r>>2],k=w[r+4>>2],W=m(m(m(t*w[E+40>>2])+m(m(u*w[E+32>>2])+m(k*w[E+36>>2])))+w[E+56>>2]),y=m(m(m(t*w[E+24>>2])+m(m(u*w[E+16>>2])+m(k*w[E+20>>2])))+w[E+52>>2]),t=m(m(m(t*w[E+8>>2])+m(m(u*w[E>>2])+m(k*w[E+4>>2])))+w[E+48>>2]),o[f+8>>2]==(0|e)&&!((0|(R=e?e<<1:1))<=(0|e))){if(R?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](R<<4,16),e=o[f+4>>2]):l=0,!((0|e)<=0)){if(c=0,1!=(0|e))for(QA=-2&e,r=0;D=(X=c<<4)+l|0,F=X+o[f+12>>2]|0,lA=o[F+4>>2],o[D>>2]=o[F>>2],o[D+4>>2]=lA,lA=o[F+12>>2],o[D+8>>2]=o[F+8>>2],o[D+12>>2]=lA,X=(F=16|X)+l|0,F=F+o[f+12>>2]|0,D=o[F+4>>2],o[X>>2]=o[F>>2],o[X+4>>2]=D,D=o[F+12>>2],o[X+8>>2]=o[F+8>>2],o[X+12>>2]=D,c=c+2|0,(0|QA)!=(0|(r=r+2|0)););1&e&&(e=(r=c<<4)+l|0,r=r+o[f+12>>2]|0,c=o[r+4>>2],o[e>>2]=o[r>>2],o[e+4>>2]=c,c=o[r+12>>2],o[e+8>>2]=o[r+8>>2],o[e+12>>2]=c)}!(r=o[f+12>>2])||!r|!v[f+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+12>>2]=l,a[f+16|0]=1,o[f+8>>2]=R,e=o[f+4>>2]}if(r=o[f+12>>2]+(e<<4)|0,o[r+12>>2]=0,w[r+8>>2]=W,w[r+4>>2]=y,w[r>>2]=t,e=o[f+4>>2]+1|0,o[f+4>>2]=e,(0|wA)==(0|(V=V+1|0)))break}(0|Z)>=0&&uA(b,iA,h,f,A+32|0,m($-I),I,i),S=b+16|0}if(!v[A+52|0])break A;if(A=o[i+4>>2],!o[A+844>>2])break A;r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0);break A}if(1==o[V+4>>2]){if(o[n+252>>2]=0,c=o[f+12>>2],W=w[c+52>>2],y=w[c+20>>2],P=w[c+24>>2],O=w[c+56>>2],L=w[c+36>>2],g=w[c+40>>2],t=w[V+72>>2],u=w[V+68>>2],s=w[c+16>>2],Y=w[c+32>>2],J=w[c+48>>2],x=w[c+8>>2],k=w[V+64>>2],M=w[c>>2],B=w[c+4>>2],o[8488]=o[8488]+1,c=0|Zn[o[8290]](16,16),o[n+260>>2]=c,a[n+264|0]=1,o[n+256>>2]=1,o[c+12>>2]=0,w[c>>2]=J+m(m(t*x)+m(m(k*M)+m(u*B))),w[c+8>>2]=O+m(m(t*g)+m(m(k*Y)+m(u*L))),w[c+4>>2]=W+m(m(t*P)+m(m(k*s)+m(u*y))),c=(b=o[n+252>>2])+1|0,o[n+252>>2]=c,t=w[V+88>>2],l=o[f+12>>2],u=w[V+80>>2],k=w[V+84>>2],W=m(m(m(t*w[l+40>>2])+m(m(u*w[l+32>>2])+m(k*w[l+36>>2])))+w[l+56>>2]),y=m(m(m(t*w[l+24>>2])+m(m(u*w[l+16>>2])+m(k*w[l+20>>2])))+w[l+52>>2]),t=m(m(m(t*w[l+8>>2])+m(m(u*w[l>>2])+m(k*w[l+4>>2])))+w[l+48>>2]),o[n+256>>2]==(0|c)&&!((0|(d=c?c<<1:1))<=(0|c))){if(l=0,d&&(o[8488]=o[8488]+1,l=0|Zn[o[8290]](d<<4,16)),!((0|b)<0)){if(D=1&(c=b+1|0),b)for(iA=-2&c,c=0,Z=0;F=(R=c<<4)+l|0,b=R+o[n+260>>2]|0,h=o[b+4>>2],o[F>>2]=o[b>>2],o[F+4>>2]=h,h=o[b+12>>2],o[F+8>>2]=o[b+8>>2],o[F+12>>2]=h,R=(b=16|R)+l|0,b=b+o[n+260>>2]|0,F=o[b+4>>2],o[R>>2]=o[b>>2],o[R+4>>2]=F,F=o[b+12>>2],o[R+8>>2]=o[b+8>>2],o[R+12>>2]=F,c=c+2|0,(0|iA)!=(0|(Z=Z+2|0)););else c=0;D&&(b=(c<<=4)+l|0,c=c+o[n+260>>2]|0,Z=o[c+4>>2],o[b>>2]=o[c>>2],o[b+4>>2]=Z,Z=o[c+12>>2],o[b+8>>2]=o[c+8>>2],o[b+12>>2]=Z)}!(c=o[n+260>>2])||!c|!v[n+264|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[n+260>>2]=l,a[n+264|0]=1,o[n+256>>2]=d,c=o[n+252>>2]}if(c=o[n+260>>2]+(c<<4)|0,o[c+12>>2]=0,w[c+8>>2]=W,w[c+4>>2]=y,w[c>>2]=t,c=(l=o[n+252>>2])+1|0,o[n+252>>2]=c,t=w[V+104>>2],f=o[f+12>>2],u=w[V+96>>2],k=w[V+100>>2],W=m(m(m(t*w[f+40>>2])+m(m(u*w[f+32>>2])+m(k*w[f+36>>2])))+w[f+56>>2]),y=m(m(m(t*w[f+24>>2])+m(m(u*w[f+16>>2])+m(k*w[f+20>>2])))+w[f+52>>2]),t=m(m(m(t*w[f+8>>2])+m(m(u*w[f>>2])+m(k*w[f+4>>2])))+w[f+48>>2]),o[n+256>>2]==(0|c)&&!((0|(b=c?c<<1:1))<=(0|c))){if(c=0,b&&(o[8488]=o[8488]+1,c=0|Zn[o[8290]](b<<4,16)),!((0|l)<0)){if(F=1&(f=l+1|0),l)for(D=-2&f,f=0,l=0;R=(Z=f<<4)+c|0,d=Z+o[n+260>>2]|0,iA=o[d+4>>2],o[R>>2]=o[d>>2],o[R+4>>2]=iA,iA=o[d+12>>2],o[R+8>>2]=o[d+8>>2],o[R+12>>2]=iA,Z=(d=16|Z)+c|0,d=d+o[n+260>>2]|0,R=o[d+4>>2],o[Z>>2]=o[d>>2],o[Z+4>>2]=R,R=o[d+12>>2],o[Z+8>>2]=o[d+8>>2],o[Z+12>>2]=R,f=f+2|0,(0|D)!=(0|(l=l+2|0)););else f=0;F&&(l=(f<<=4)+c|0,f=f+o[n+260>>2]|0,d=o[f+4>>2],o[l>>2]=o[f>>2],o[l+4>>2]=d,d=o[f+12>>2],o[l+8>>2]=o[f+8>>2],o[l+12>>2]=d)}!(f=o[n+260>>2])||!f|!v[n+264|0]||(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[n+260>>2]=c,a[n+264|0]=1,o[n+256>>2]=b,c=o[n+252>>2]}if(f=o[n+260>>2]+(c<<4)|0,o[f+12>>2]=0,w[f+8>>2]=W,w[f+4>>2]=y,w[f>>2]=t,o[n+252>>2]=o[n+252>>2]+1,t=w[o[A+56>>2]+848>>2],eA(E,n+792|0,n+348|0,o[e+20>>2],0),u=w[E+12>>2],k=w[E+4>>2],W=w[E+8>>2],(y=m(m(u*u)+m(m(k*k)+m(W*W))))>m(1.1920928955078125e-7)){o[n+344>>2]=0,s=u,u=m(m(1)/y),w[n+340>>2]=s*u,w[n+336>>2]=W*u,w[n+332>>2]=k*u,u=w[E+56>>2],k=m(Zn[o[o[X>>2]+48>>2]](X)),W=m(Zn[o[o[V>>2]+48>>2]](V)),c=0,E=0;r:if(!((0|(e=o[4+(f=A+32|0)>>2]))>0||(d=(0|e)>=0))){if(o[f+8>>2]<0){if(!((0|e)<=0)){if(1!=(0|e))for(Z=-2&e;b=(l=c<<4)+o[f+12>>2]|0,V=o[b+4>>2],o[l>>2]=o[b>>2],o[l+4>>2]=V,V=o[b+12>>2],o[l+8>>2]=o[b+8>>2],o[l+12>>2]=V,b=(l|=16)+o[f+12>>2]|0,V=o[b+4>>2],o[l>>2]=o[b>>2],o[l+4>>2]=V,V=o[b+12>>2],o[l+8>>2]=o[b+8>>2],o[l+12>>2]=V,c=c+2|0,(0|Z)!=(0|(E=E+2|0)););1&e&&(l=(c<<=4)+o[f+12>>2]|0,E=o[l+4>>2],o[c>>2]=o[l>>2],o[c+4>>2]=E,E=o[l+12>>2],o[c+8>>2]=o[l+8>>2],o[c+12>>2]=E)}if(!(c=o[f+12>>2])||!c|!v[f+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[f+12>>2]=0,a[f+16|0]=1,o[f+8>>2]=0,d)break r}if(E=~e,b=0-e&3)for(c=0;d=o[n+320>>2],l=o[f+12>>2]+(e<<4)|0,o[l>>2]=o[n+316>>2],o[l+4>>2]=d,d=o[n+328>>2],o[l+8>>2]=o[n+324>>2],o[l+12>>2]=d,e=e+1|0,(0|b)!=(0|(c=c+1|0)););if(!(E>>>0<3))for(;E=o[n+320>>2],l=(c=e<<4)+o[f+12>>2]|0,o[l>>2]=o[n+316>>2],o[l+4>>2]=E,E=o[n+328>>2],o[l+8>>2]=o[n+324>>2],o[l+12>>2]=E,E=o[n+328>>2],l=c+o[f+12>>2]|0,o[l+24>>2]=o[n+324>>2],o[l+28>>2]=E,E=o[n+320>>2],o[l+16>>2]=o[n+316>>2],o[l+20>>2]=E,E=o[n+328>>2],l=c+o[f+12>>2]|0,o[l+40>>2]=o[n+324>>2],o[l+44>>2]=E,E=o[n+320>>2],o[l+32>>2]=o[n+316>>2],o[l+36>>2]=E,l=o[n+328>>2],c=c+o[f+12>>2]|0,o[c+56>>2]=o[n+324>>2],o[c+60>>2]=l,l=o[n+320>>2],o[c+48>>2]=o[n+316>>2],o[c+52>>2]=l,e=e+4|0;);}o[f+4>>2]=0,uA(n+332|0,o[X+60>>2],o[r+12>>2],n+248|0,f,m(m(m(u-k)-W)-t),t,i)}if(v[A+52|0]&&(A=o[i+4>>2],o[A+844>>2]&&(r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0))),!(A=o[n+260>>2])|!v[n+264|0])break A;A&&(o[8489]=o[8489]+1,Zn[o[8291]](A));break A}}if(eA(E,n+792|0,i,o[e+20>>2],0),!(!o[A+64>>2]|o[o[i+4>>2]+844>>2]>=o[A+68>>2])&&(t=w[E+12>>2],u=w[E+4>>2],k=w[E+8>>2],(W=m(m(t*t)+m(m(u*u)+m(k*k))))>m(1.1920928955078125e-7)&&(Z=n+856|0,R=n+840|0,F=n+824|0,D=n+808|0,s=k,k=m(m(1)/W),y=m(s*k),s=m(u*k),Y=m(t*k),m(Q(Y))>m(.7071067690849304)?(t=m(m(1)/m(N(m(m(y*y)+m(Y*Y))))),$=m(y*t),t=m(t*m(-Y)),u=m(0)):(u=m(m(1)/m(N(m(m(s*s)+m(y*y))))),t=m(s*u),$=m(0),u=m(u*m(-y))),k=m(Zn[o[o[X>>2]+16>>2]](X)),W=m(Zn[o[o[V>>2]+16>>2]](V)),P=w[8297],X=o[(c=(V=k>2],o[n+256>>2]=o[c+8>>2],o[n+260>>2]=X,X=o[c+4>>2],o[n+248>>2]=o[c>>2],o[n+252>>2]=X,X=o[(c=V?D:l)+12>>2],o[n+272>>2]=o[c+8>>2],o[n+276>>2]=X,X=o[c+4>>2],o[n+264>>2]=o[c>>2],o[n+268>>2]=X,X=o[(c=V?F:b)+12>>2],o[n+288>>2]=o[c+8>>2],o[n+292>>2]=X,X=o[c+4>>2],o[n+280>>2]=o[c>>2],o[n+284>>2]=X,X=o[(c=V?R:d)+12>>2],o[n+304>>2]=o[c+8>>2],o[n+308>>2]=X,X=o[c+4>>2],o[n+296>>2]=o[c>>2],o[n+300>>2]=X,!((0|(c=o[A+64>>2]))<=0)&&(W=Kr(k=(k=m(P/(V?k:W)))>m(.39269909262657166)?m(.19634954631328583):m(k*m(.5))),P=$r(k),(k=m(m($*$)+m(m(u*u)+m(t*t))))>m(1.1920928955078125e-7)))))for(k=m(W/m(N(k))),O=m($*k),L=m(t*k),g=m(u*k),j=m(N(m(m(Y*Y)+m(m(s*s)+m(y*y))))),X=n- -64|0;W=m(m(m(m(6.2831854820251465)/m(0|c))*m(0|iA))*m(.5)),k=m(Kr(W)/j),t=m(Y*k),u=m(y*k),k=m(s*k),W=$r(W),V?(c=o[r+12>>2],M=w[c+36>>2],B=w[c+20>>2],p=w[c+40>>2],$=w[c+24>>2],AA=w[c+32>>2],rA=w[c>>2],fA=w[c+16>>2],q=w[c+4>>2],_=w[c+8>>2],o[n+836>>2]=0,o[n+820>>2]=0,o[n+804>>2]=0,H=m(m(k*O)+m(m(m(W*L)-m(P*u))-m(t*g))),I=m(m(t*O)+m(m(u*L)+m(m(W*P)+m(g*k)))),T=m(m(t*L)+m(m(m(W*g)-m(P*k))-m(u*O))),U=m(m(u*g)+m(m(m(W*O)-m(P*t))-m(k*L))),J=m(m(m(H*t)+m(m(I*k)+m(W*T)))-m(U*u)),x=m(m(m(m(I*W)-m(k*T))-m(H*u))-m(U*t)),K=m(m(m(T*u)+m(m(I*t)+m(W*U)))-m(H*k)),t=m(m(m(U*k)+m(m(I*u)+m(W*H)))-m(T*t)),u=m(m(2)/m(m(x*x)+m(m(K*K)+m(m(J*J)+m(t*t))))),I=m(J*u),T=m(J*I),k=m(t*u),U=m(t*k),W=m(m(1)-m(T+U)),u=m(K*u),aA=m(J*u),tA=m(x*k),H=m(aA-tA),oA=m(t*u),I=m(x*I),t=m(oA+I),w[n+832>>2]=m(p*W)+m(m(_*H)+m($*t)),w[n+828>>2]=m(M*W)+m(m(q*H)+m(t*B)),w[n+824>>2]=m(AA*W)+m(m(rA*H)+m(t*fA)),t=m(oA-I),W=m(J*k),J=m(x*u),k=m(W+J),x=m(K*u),u=m(m(1)-m(T+x)),w[n+816>>2]=m(p*t)+m(m(_*k)+m($*u)),w[n+812>>2]=m(M*t)+m(m(q*k)+m(u*B)),w[n+808>>2]=m(AA*t)+m(m(rA*k)+m(u*fA)),t=m(aA+tA),u=m(m(1)-m(U+x)),k=m(W-J),w[n+800>>2]=m(p*t)+m(m(_*u)+m($*k)),w[n+796>>2]=m(M*t)+m(m(q*u)+m(k*B)),w[n+792>>2]=m(AA*t)+m(m(rA*u)+m(k*fA)),c=o[f+12>>2],h=o[c+4>>2],o[Z>>2]=o[c>>2],o[Z+4>>2]=h,h=o[c+12>>2],o[Z+8>>2]=o[c+8>>2],o[Z+12>>2]=h,h=o[c+28>>2],o[l+8>>2]=o[c+24>>2],o[l+12>>2]=h,h=o[c+20>>2],o[l>>2]=o[c+16>>2],o[l+4>>2]=h,h=o[c+44>>2],o[b+8>>2]=o[c+40>>2],o[b+12>>2]=h,h=o[c+36>>2],o[b>>2]=o[c+32>>2],o[b+4>>2]=h,h=o[c+60>>2],o[d+8>>2]=o[c+56>>2],o[d+12>>2]=h,h=o[c+52>>2],o[d>>2]=o[c+48>>2],o[d+4>>2]=h):(c=o[r+12>>2],h=o[c+12>>2],o[n+800>>2]=o[c+8>>2],o[n+804>>2]=h,h=o[c+4>>2],o[n+792>>2]=o[c>>2],o[n+796>>2]=h,h=o[c+28>>2],o[D+8>>2]=o[c+24>>2],o[D+12>>2]=h,h=o[c+20>>2],o[D>>2]=o[c+16>>2],o[D+4>>2]=h,h=o[c+44>>2],o[F+8>>2]=o[c+40>>2],o[F+12>>2]=h,h=o[c+36>>2],o[F>>2]=o[c+32>>2],o[F+4>>2]=h,h=o[c+60>>2],o[R+8>>2]=o[c+56>>2],o[R+12>>2]=h,h=o[c+52>>2],o[R>>2]=o[c+48>>2],o[R+4>>2]=h,c=o[f+12>>2],M=w[c+36>>2],B=w[c+20>>2],p=w[c+40>>2],$=w[c+24>>2],AA=w[c+32>>2],rA=w[c>>2],fA=w[c+16>>2],q=w[c+4>>2],_=w[c+8>>2],o[n+900>>2]=0,o[n+884>>2]=0,o[n+868>>2]=0,H=m(m(k*O)+m(m(m(W*L)-m(P*u))-m(t*g))),I=m(m(t*O)+m(m(u*L)+m(m(W*P)+m(g*k)))),T=m(m(t*L)+m(m(m(W*g)-m(P*k))-m(u*O))),U=m(m(u*g)+m(m(m(W*O)-m(P*t))-m(k*L))),J=m(m(m(H*t)+m(m(I*k)+m(W*T)))-m(U*u)),x=m(m(m(m(I*W)-m(k*T))-m(H*u))-m(U*t)),K=m(m(m(T*u)+m(m(I*t)+m(W*U)))-m(H*k)),t=m(m(m(U*k)+m(m(I*u)+m(W*H)))-m(T*t)),u=m(m(2)/m(m(x*x)+m(m(K*K)+m(m(J*J)+m(t*t))))),I=m(J*u),T=m(J*I),k=m(t*u),U=m(t*k),W=m(m(1)-m(T+U)),u=m(K*u),aA=m(J*u),tA=m(x*k),H=m(aA-tA),oA=m(t*u),I=m(x*I),t=m(oA+I),w[n+896>>2]=m(p*W)+m(m(_*H)+m($*t)),w[n+892>>2]=m(M*W)+m(m(q*H)+m(t*B)),w[n+888>>2]=m(AA*W)+m(m(rA*H)+m(t*fA)),t=m(oA-I),W=m(J*k),J=m(x*u),k=m(W+J),x=m(K*u),u=m(m(1)-m(T+x)),w[n+880>>2]=m(p*t)+m(m(_*k)+m($*u)),w[n+876>>2]=m(M*t)+m(m(q*k)+m(u*B)),w[n+872>>2]=m(AA*t)+m(m(rA*k)+m(u*fA)),t=m(aA+tA),u=m(m(1)-m(U+x)),k=m(W-J),w[n+864>>2]=m(p*t)+m(m(_*u)+m($*k)),w[n+860>>2]=m(M*t)+m(m(q*u)+m(k*B)),w[n+856>>2]=m(AA*t)+m(m(rA*u)+m(k*fA))),c=o[e+20>>2],o[n+44>>2]=i,o[n+8>>2]=15752,o[n+40>>2]=0,h=o[n+804>>2],o[n+56>>2]=o[n+800>>2],o[n+60>>2]=h,h=o[n+796>>2],o[n+48>>2]=o[n+792>>2],o[n+52>>2]=h,h=o[D+12>>2],o[X+8>>2]=o[D+8>>2],o[X+12>>2]=h,h=o[D+4>>2],o[X>>2]=o[D>>2],o[X+4>>2]=h,h=o[F+12>>2],o[n+88>>2]=o[F+8>>2],o[n+92>>2]=h,h=o[F+4>>2],o[n+80>>2]=o[F>>2],o[n+84>>2]=h,h=o[R+12>>2],o[n+104>>2]=o[R+8>>2],o[n+108>>2]=h,h=o[R+4>>2],o[n+96>>2]=o[R>>2],o[n+100>>2]=h,h=o[Z+12>>2],o[n+120>>2]=o[Z+8>>2],o[n+124>>2]=h,h=o[Z+4>>2],o[n+112>>2]=o[Z>>2],o[n+116>>2]=h,h=o[l+12>>2],o[n+136>>2]=o[l+8>>2],o[n+140>>2]=h,h=o[l+4>>2],o[n+128>>2]=o[l>>2],o[n+132>>2]=h,h=o[b+12>>2],o[n+152>>2]=o[b+8>>2],o[n+156>>2]=h,h=o[b+4>>2],o[n+144>>2]=o[b>>2],o[n+148>>2]=h,h=o[d+12>>2],o[n+168>>2]=o[d+8>>2],o[n+172>>2]=h,h=o[d+4>>2],o[n+160>>2]=o[d>>2],o[n+164>>2]=h,h=o[n+260>>2],o[n+184>>2]=o[n+256>>2],o[n+188>>2]=h,h=o[n+252>>2],o[n+176>>2]=o[n+248>>2],o[n+180>>2]=h,h=o[n+276>>2],o[n+200>>2]=o[n+272>>2],o[n+204>>2]=h,h=o[n+268>>2],o[n+192>>2]=o[n+264>>2],o[n+196>>2]=h,h=o[n+292>>2],o[n+216>>2]=o[n+288>>2],o[n+220>>2]=h,h=o[n+284>>2],o[n+208>>2]=o[n+280>>2],o[n+212>>2]=h,h=o[n+300>>2],o[n+224>>2]=o[n+296>>2],o[n+228>>2]=h,h=o[n+308>>2],o[n+232>>2]=o[n+304>>2],o[n+236>>2]=h,o[n+244>>2]=c,a[n+240|0]=V,eA(E,n+792|0,n+8|0,c,0),(0|(c=o[A+64>>2]))>(0|(iA=iA+1|0)););v[A+52|0]&&(A=o[i+4>>2],o[A+844>>2]&&(r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),E=A,A=o[o[i+12>>2]+8>>2],OA(E,(r?f:A)+4|0,(r?A:e)+4|0)))}S=n+928|0},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=m(0),t=m(0),c=m(0),b=0,u=0,l=0,s=0,k=m(0),d=0;S=A=S-624|0,t=m(w[r+124>>2]-w[r+60>>2]),c=m(t*t),t=m(w[r+116>>2]-w[r+52>>2]),n=m(t*t),t=m(w[r+120>>2]-w[r+56>>2]),n=m(c+m(n+m(t*t))),t=w[r+276>>2];A:{r:{if(n>2]-w[f+60>>2]),k=m(n*n),n=m(w[f+116>>2]-w[f+52>>2]),c=m(n*n),n=m(w[f+120>>2]-w[f+56>>2]),c=m(k+m(c+m(n*n))),n=w[f+276>>2],c>2],t=w[f+272>>2],e=ae(A+564|0),o[e+32>>2]=0,o[e+36>>2]=0,o[e+20>>2]=1065353216,o[e+24>>2]=1065353216,o[e+4>>2]=8,o[e>>2]=21520,o[e+56>>2]=0,w[e+52>>2]=t,o[e+28>>2]=1065353216,o[e+40>>2]=0,o[e+44>>2]=0,o[e+48>>2]=0,w[e+36>>2]=t,o[A+560>>2]=0,o[A+552>>2]=1566444395,o[A+556>>2]=0,o[A+388>>2]=13280,a[A+360|0]=0,o[A+336>>2]=953267991,o[12+(i=A+12|0)>>2]=e,o[i+8>>2]=b,o[i+4>>2]=A+28,o[i>>2]=22724,b=r+4|0,u=r+68|0,l=f+4|0,s=f+68|0,t=m(1),IA(i,b,u,l,s,A+388|0)&&((n=w[A+552>>2])>2]&&(w[r+268>>2]=n),n>2]&&(w[f+268>>2]=n),t=m(1),n>2],n=w[r+272>>2],e=ae(A+564|0),o[e+32>>2]=0,o[e+36>>2]=0,o[e+20>>2]=1065353216,o[e+24>>2]=1065353216,o[e+4>>2]=8,o[e>>2]=21520,o[e+56>>2]=0,w[e+52>>2]=n,o[e+28>>2]=1065353216,o[e+40>>2]=0,o[e+44>>2]=0,o[e+48>>2]=0,w[e+36>>2]=n,o[A+560>>2]=0,o[A+552>>2]=1566444395,o[A+556>>2]=0,o[A+388>>2]=13280,a[A+360|0]=0,o[A+336>>2]=953267991,o[12+(i=A+12|0)>>2]=d,o[i+8>>2]=e,o[i+4>>2]=A+28,o[i>>2]=22724,IA(i,b,u,l,s,A+388|0)&&((n=w[A+552>>2])>2]&&(w[r+268>>2]=n),n>2]&&(w[f+268>>2]=n),n>2])|!v[A+52|0])){if((0|(e=o[r+4>>2]))==o[r+8>>2]&&!((0|(c=e?e<<1:1))<=(0|e))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),e=o[r+4>>2]),!((0|e)<=0)){if(f=0,e>>>0>=4)for(b=-4&e;o[(i=f<<2)+n>>2]=o[i+o[r+12>>2]>>2],o[(t=4|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(t=8|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(i|=12)+n>>2]=o[i+o[r+12>>2]>>2],f=f+4|0,(0|b)!=(0|(u=u+4|0)););if(i=3&e)for(;o[(b=f<<2)+n>>2]=o[b+o[r+12>>2]>>2],f=f+1|0,(0|i)!=(0|(l=l+1|0)););}!(f=o[r+12>>2])|!v[r+16|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),e=o[r+4>>2]),o[r+12>>2]=n,a[r+16|0]=1,o[r+8>>2]=c,f=o[A+56>>2]}o[o[r+12>>2]+(e<<2)>>2]=f,o[r+4>>2]=e+1}},en,vn,zi,zi,mi,vn,zi,zi,function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e);var i,n=m(0),t=0,c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);S=i=S-16|0,w[A+32>>2]=e,t=o[r+4>>2],o[A+8>>2]=o[r>>2],o[A+12>>2]=t,t=o[r+12>>2],o[A+16>>2]=o[r+8>>2],o[A+20>>2]=t,c=w[r+8>>2],b=w[f>>2],u=w[r>>2],l=w[f+4>>2],s=w[r+4>>2],k=w[f+8>>2],n=w[A+28>>2],o[i+12>>2]=0,w[i+8>>2]=k-m(n*c),w[i+4>>2]=l-m(n*s),w[i>>2]=b-m(u*n),e=m(m(n+w[A+24>>2])+e),w[A+32>>2]=e,e>2],Zn[o[o[A>>2]+16>>2]](A,r,i,e),S=i+16|0},vn,function(A,r,f){r|=0,f|=0,o[24+(A|=0)>>2]=f,o[A+16>>2]=r},function(A,r,f){r|=0,f|=0,o[28+(A|=0)>>2]=f,o[A+20>>2]=r},function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e);var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0);S=i=S-16|0,l=w[r+8>>2],a=w[f+8>>2],B=m(m(l*e)+a),g=w[r+4>>2],V=w[f+4>>2],X=m(m(g*e)+V),D=w[r>>2],n=m(D*e),e=w[f>>2],C=m(n+e),v[A+232|0]?(Z=w[A+48>>2],b=m(-w[A+88>>2]),G=w[A- -64>>2],c=w[A+92>>2],Q=w[A+80>>2],t=w[A+96>>2],F=m(m(m(Z*b)-m(G*c))-m(Q*t)),n=w[A+208>>2],E=w[A+40>>2],W=w[A+56>>2],N=w[A+72>>2],R=m(m(m(E*b)-m(W*c))-m(N*t)),s=w[A+200>>2],p=w[A+44>>2],u=m(p*b),b=w[A+60>>2],u=m(u-m(b*c)),c=w[A+76>>2],u=m(u-m(c*t)),t=w[A+204>>2],t=n=m(m(m(m(F*n)+m(m(R*s)+m(u*t)))+w[A+224>>2])+m(m(B*m(m(Q*n)+m(m(N*s)+m(c*t))))+m(m(C*m(m(Z*n)+m(m(E*s)+m(p*t))))+m(X*m(m(G*n)+m(m(W*s)+m(b*t))))))),s=l,d=m(m(n-a)*l),a=w[A+176>>2],n=w[A+168>>2],l=w[A+172>>2],n=m(m(m(B*m(m(Q*a)+m(m(N*n)+m(c*l))))+m(m(C*m(m(Z*a)+m(m(E*n)+m(p*l))))+m(X*m(m(G*a)+m(m(W*n)+m(b*l))))))+m(m(m(F*a)+m(m(R*n)+m(l*u)))+w[A+216>>2])),h=m(m(n-e)*D),l=B,e=w[A+192>>2],a=w[A+184>>2],B=w[A+188>>2],a=m(m(m(l*m(m(Q*e)+m(m(N*a)+m(c*B))))+m(m(C*m(m(Z*e)+m(m(E*a)+m(p*B))))+m(X*m(m(G*e)+m(m(W*a)+m(b*B))))))+m(m(m(F*e)+m(m(R*a)+m(u*B)))+w[A+220>>2])),e=m(d+m(h+m(g*m(a-V)))),w[i+8>>2]=t+m(s*e),w[i+4>>2]=a+m(g*e),w[i>>2]=n+m(D*e)):(y=w[A+224>>2],Z=w[A+208>>2],G=w[A+200>>2],Q=w[A+204>>2],M=w[A+216>>2],n=w[A+172>>2],E=w[A+176>>2],W=w[A+168>>2],N=w[A+112>>2],d=m(-w[A+152>>2]),s=w[A+128>>2],h=w[A+156>>2],p=w[A+144>>2],Y=w[A+160>>2],b=m(m(m(N*d)-m(s*h))-m(p*Y)),c=w[A+104>>2],t=w[A+120>>2],F=w[A+136>>2],R=m(m(m(c*d)-m(t*h))-m(F*Y)),u=w[A+108>>2],k=m(u*d),d=w[A+124>>2],k=m(k-m(d*h)),h=w[A+140>>2],Y=m(k-m(h*Y)),k=w[A+192>>2],J=w[A+184>>2],x=w[A+188>>2],k=m(m(m(a*m(m(p*k)+m(m(F*J)+m(h*x))))+m(m(e*m(m(N*k)+m(m(c*J)+m(u*x))))+m(V*m(m(s*k)+m(m(t*J)+m(d*x))))))+m(m(m(b*k)+m(m(R*J)+m(Y*x)))+w[A+220>>2])),w[i+4>>2]=k,n=m(m(m(a*m(m(p*E)+m(m(F*W)+m(h*n))))+m(m(e*m(m(N*E)+m(m(c*W)+m(u*n))))+m(V*m(m(s*E)+m(m(t*W)+m(d*n))))))+m(M+m(m(b*E)+m(m(R*W)+m(n*Y))))),w[i>>2]=n,e=m(m(y+m(m(b*Z)+m(m(R*G)+m(Y*Q))))+m(m(a*m(m(p*Z)+m(m(F*G)+m(h*Q))))+m(m(e*m(m(N*Z)+m(m(c*G)+m(u*Q))))+m(V*m(m(s*Z)+m(m(t*G)+m(d*Q))))))),w[i+8>>2]=e,e=m(m(m(B-e)*l)+m(m(m(C-n)*D)+m(g*m(X-k))))),o[i+12>>2]=0,A=o[A+36>>2],Zn[o[o[A>>2]+16>>2]](A,r,i,e),S=i+16|0},ci,function(A){ci(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,a,t=0,c=m(0),b=0,u=0,l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0);S=a=S-16|0,Zn[o[8294]](6061),t=v[A+76|0],b=o[(n=t?r:f)+4>>2],o[b+4>>2]-21>>>0>8||o[o[(u=t?f:r)+4>>2]+4>>2]>19||(y=m(Zn[o[o[b>>2]+48>>2]](b)),o[i+4>>2]=o[A+72>>2],S=f=S+-64|0,w[56+(r=A+8|0)>>2]=y,o[r+52>>2]=e,o[r+40>>2]=n,o[r+36>>2]=u,o[r+44>>2]=i,e=o[n+12>>2],E=w[e+52>>2],W=w[e+56>>2],t=o[u+12>>2],N=w[t+52>>2],p=w[t+56>>2],c=w[e+20>>2],l=w[e+36>>2],F=w[t+20>>2],R=w[t+36>>2],Y=w[t+24>>2],s=w[e+24>>2],V=w[t+40>>2],k=w[e+40>>2],g=w[t+32>>2],d=w[e+32>>2],X=w[t>>2],h=w[e>>2],D=w[t+16>>2],B=w[e+16>>2],Z=w[e+48>>2],C=w[t+48>>2],G=w[e+4>>2],J=w[t+4>>2],x=w[t+8>>2],Q=w[e+8>>2],o[f+60>>2]=0,o[f+44>>2]=0,o[f+28>>2]=0,w[f+40>>2]=m(V*k)+m(m(x*Q)+m(s*Y)),w[f+36>>2]=m(R*k)+m(m(J*Q)+m(s*F)),w[f+24>>2]=m(V*l)+m(m(x*G)+m(c*Y)),w[f+20>>2]=m(R*l)+m(m(J*G)+m(c*F)),Z=m(-Z),w[f+56>>2]=m(m(m(Q*Z)-m(s*E))-m(k*W))+m(m(p*k)+m(m(C*Q)+m(s*N))),w[f+52>>2]=m(m(m(G*Z)-m(c*E))-m(l*W))+m(m(p*l)+m(m(C*G)+m(c*N))),o[f+12>>2]=0,w[f>>2]=m(g*d)+m(m(X*h)+m(B*D)),w[f+32>>2]=m(g*k)+m(m(X*Q)+m(s*D)),w[f+16>>2]=m(g*l)+m(m(X*G)+m(c*D)),w[f+8>>2]=m(V*d)+m(m(x*h)+m(B*Y)),w[f+4>>2]=m(R*d)+m(m(J*h)+m(B*F)),w[f+48>>2]=m(m(m(h*Z)-m(B*E))-m(d*W))+m(m(p*d)+m(m(C*h)+m(B*N))),e=o[u+4>>2],Zn[o[o[e>>2]+8>>2]](e,f,r+4|0,r+20|0),c=m(w[i+32>>2]+y),w[r+20>>2]=c+w[r+20>>2],w[r+24>>2]=c+w[r+24>>2],w[r+28>>2]=c+w[r+28>>2],w[r+4>>2]=w[r+4>>2]-c,w[r+8>>2]=w[r+8>>2]-c,w[r+12>>2]=w[r+12>>2]-c,S=f- -64|0,f=o[u+8>>2],e=o[A+72>>2],o[e+840>>2]=o[n+8>>2],o[e+836>>2]=f,Zn[o[o[b>>2]+64>>2]](b,r,A+12|0,A+28|0),r=o[i+4>>2],o[r+844>>2]&&(f=(0|(e=o[r+836>>2]))==(0|(t=o[o[i+8>>2]+8>>2])),b=r,r=o[o[i+12>>2]+8>>2],OA(b,(f?e:r)+4|0,(f?r:t)+4|0)),o[A+44>>2]=0,o[A+48>>2]=0),Zn[o[8295]](),S=a+16|0},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=m(0),nA=m(0),aA=m(0),tA=m(0),oA=m(0),cA=m(0),bA=m(0);return S=e=S-240|0,P=m(1),i=v[A+76|0],u=w[(A=i?f:r)+60>>2],a=m(w[A+124>>2]-u),n=m(a*a),c=w[A+116>>2],E=w[A+52>>2],a=m(c-E),b=m(a*a),N=w[A+56>>2],a=m(w[A+120>>2]-N),n=m(n+m(b+m(a*a))),a=w[A+276>>2],n>2],o[f+4>>2]-21>>>0>8||(t=w[r+12>>2],W=m(-w[r+52>>2]),n=w[r+28>>2],b=w[r+56>>2],l=w[r+44>>2],s=w[r+60>>2],O=m(m(m(t*W)-m(n*b))-m(l*s)),k=w[A+124>>2],p=w[A+120>>2],$=m(m(k*l)+m(m(c*t)+m(n*p))),d=w[r+8>>2],h=w[r+24>>2],B=w[r+40>>2],L=m(m(m(d*W)-m(h*b))-m(B*s)),a=m(L+m(m(k*B)+m(m(c*d)+m(h*p)))),Z=w[r+36>>2],F=w[A+92>>2],K=m(n*F),R=w[A+76>>2],q=m(R*t),Y=w[A+108>>2],V=w[A+88>>2],_=m(n*V),g=w[A+72>>2],AA=m(g*t),X=w[A+104>>2],D=w[A+84>>2],rA=m(n*D),C=w[A+68>>2],fA=m(C*t),J=w[A+100>>2],G=w[r+4>>2],eA=m(R*G),Q=w[r+20>>2],iA=m(Q*F),x=w[A+28>>2],nA=m(n*x),y=w[A+12>>2],aA=m(y*t),M=w[A+44>>2],H=w[A+24>>2],tA=m(n*H),I=w[A+8>>2],oA=m(I*t),T=w[A+40>>2],U=w[A+20>>2],cA=m(n*U),j=w[A+4>>2],bA=m(j*t),z=w[A+36>>2],o[e+236>>2]=0,b=m(m(m(G*W)-m(Q*b))-m(Z*s)),W=s=m(b+m(m(u*Z)+m(m(E*G)+m(Q*N)))),(c=m(b+m(m(k*Z)+m(m(c*G)+m(Q*p)))))>2]=c,W=c),b=k=m(L+m(m(u*B)+m(m(E*d)+m(h*N)))),a>2]=a,b=a),(n=u=m(O+m(m(u*l)+m(m(E*t)+m(n*N)))))>(t=m(O+$))&&(w[e+232>>2]=t,n=t),o[e+220>>2]=0,E=n,n=w[A+272>>2],w[e+232>>2]=E-n,w[e+228>>2]=b-n,w[e+224>>2]=W-n,w[e+216>>2]=n+(t>u?t:u),w[e+212>>2]=n+(a>k?a:k),w[e+208>>2]=n+(c>s?c:s),o[e+132>>2]=0,w[e+128>>2]=t,w[e+124>>2]=a,w[e+120>>2]=c,o[e+116>>2]=0,w[e+112>>2]=m(Y*l)+m(q+K),w[e+108>>2]=m(X*l)+m(AA+_),w[e+104>>2]=m(J*l)+m(fA+rA),o[e+100>>2]=0,w[e+96>>2]=m(Y*B)+m(m(R*d)+m(h*F)),w[e+92>>2]=m(X*B)+m(m(g*d)+m(h*V)),w[e+88>>2]=m(J*B)+m(m(C*d)+m(h*D)),o[e+84>>2]=0,w[e+80>>2]=m(Y*Z)+m(eA+iA),w[e+76>>2]=m(X*Z)+m(m(g*G)+m(Q*V)),o[e+68>>2]=0,w[e- -64>>2]=u,w[e+60>>2]=k,w[e+56>>2]=s,o[e+52>>2]=0,w[e+48>>2]=m(M*l)+m(aA+nA),w[e+44>>2]=m(T*l)+m(oA+tA),w[e+40>>2]=m(z*l)+m(bA+cA),o[e+36>>2]=0,w[e+32>>2]=m(M*B)+m(m(y*d)+m(h*x)),w[e+28>>2]=m(T*B)+m(m(I*d)+m(h*H)),w[e+24>>2]=m(z*B)+m(m(j*d)+m(h*U)),o[e+20>>2]=0,w[e+16>>2]=m(M*Z)+m(m(y*G)+m(Q*x)),w[e+12>>2]=m(T*Z)+m(m(I*G)+m(Q*H)),w[e+200>>2]=n,w[e+72>>2]=m(J*Z)+m(m(C*G)+m(Q*D)),w[e+8>>2]=m(z*Z)+m(m(j*G)+m(Q*U)),o[e+4>>2]=16124,w[e+204>>2]=w[A+268>>2],Zn[o[o[f>>2]+64>>2]](f,e+4|0,e+224|0,e+208|0),(a=w[e+204>>2])>2]&&(w[A+268>>2]=a,P=a))),S=e+240|0,m(P)},function(A,r){r|=0;var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if(f=o[72+(A|=0)>>2]){if((0|(e=o[r+4>>2]))==o[r+8>>2]&&!((0|(c=e?e<<1:1))<=(0|e))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),e=o[r+4>>2]),!((0|e)<=0)){if(f=0,e>>>0>=4)for(b=-4&e;o[(i=f<<2)+n>>2]=o[i+o[r+12>>2]>>2],o[(t=4|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(t=8|i)+n>>2]=o[t+o[r+12>>2]>>2],o[(i|=12)+n>>2]=o[i+o[r+12>>2]>>2],f=f+4|0,(0|b)!=(0|(u=u+4|0)););if(i=3&e)for(;o[(b=f<<2)+n>>2]=o[b+o[r+12>>2]>>2],f=f+1|0,(0|i)!=(0|(l=l+1|0)););}!(f=o[r+12>>2])|!v[r+16|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),e=o[r+4>>2]),o[r+12>>2]=n,a[r+16|0]=1,o[r+8>>2]=c,f=o[A+72>>2]}o[o[r+12>>2]+(e<<2)>>2]=f,o[r+4>>2]=e+1}},Ee,function(A){Ee(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,a=0,t=m(0),c=m(0),b=0,u=m(0),l=0,s=m(0),k=0,d=0,v=0;S=i=S-144|0,Zn[o[8294]](7602),s=(t=w[r>>2])<(c=w[r+16>>2])?t:c,u=w[r+32>>2],w[A+20>>2]<(u>s?s:u)||w[(u<((n=t>c)?t:c)?!n<<4:32)+r>>2]>2]||(s=(t=w[r+8>>2])<(c=w[(n=r+24|0)>>2])?t:c,u=w[(b=r+40|0)>>2],w[A+28>>2]<(u>s?s:u)||(l=n,w[(u<((n=t>c)?t:c)?n?r+8:l:b)>>2]>2]||(s=(t=w[r+4>>2])<(c=w[(n=r+20|0)>>2])?t:c,u=w[(b=r+36|0)>>2],w[A+24>>2]<(u>s?s:u)||(l=n,n=t>c,o[o[o[A+36>>2]+4>>2]+4>>2]>19|w[(u<(n?t:c)?n?r+4:l:b)>>2]>2]||(b=o[A+48>>2],n=oi(i+28|0),o[n+4>>2]=1,o[n>>2]=15956,a=o[r+12>>2],o[n+72>>2]=o[r+8>>2],o[n+76>>2]=a,a=o[r+4>>2],o[n+64>>2]=o[r>>2],o[n+68>>2]=a,a=o[r+28>>2],o[n+88>>2]=o[r+24>>2],o[n+92>>2]=a,a=o[r+20>>2],o[n+80>>2]=o[r+16>>2],o[n+84>>2]=a,a=o[r+44>>2],o[n+104>>2]=o[r+40>>2],o[n+108>>2]=a,a=o[r+36>>2],o[n+96>>2]=o[r+32>>2],o[n+100>>2]=a,w[n+52>>2]=w[A+56>>2],r=o[A+40>>2],a=o[r+8>>2],k=o[r+12>>2],o[i+24>>2]=e,o[i+20>>2]=f,o[i+12>>2]=a,o[i+16>>2]=k,o[i+8>>2]=n,o[i+4>>2]=r,r=o[A+36>>2],r=w[o[A+44>>2]+32>>2]>m(0)?0|Zn[o[o[b>>2]+8>>2]](b,r,i+4|0,0,2):0|Zn[o[o[b>>2]+8>>2]](b,r,i+4|0,o[A+64>>2],1),a=o[A+44>>2],k=o[a+8>>2],o[k+8>>2]!=o[o[A+40>>2]+8>>2]?(k=o[a+12>>2],l=a+12|0,d=3):(l=a+8|0,d=2),v=l,l=i+4|0,o[v>>2]=l,Zn[o[o[a>>2]+(d<<2)>>2]](a,f,e),Zn[o[o[r>>2]+8>>2]](r,o[A+36>>2],l,o[A+52>>2],o[A+44>>2]),f=o[A+44>>2],o[(o[o[f+8>>2]+8>>2]==o[o[A+40>>2]+8>>2]?8:12)+f>>2]=k,Zn[o[o[r>>2]>>2]](r),Zn[o[o[b>>2]+60>>2]](b,r),Ne(n)))))),Zn[o[8295]](),S=i+144|0},Ne,ri,Ke,We,Si,Pe,function(){return 7660},pi,Ri,tn,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return te(A,r,f),w[r+28>>2]=w[A+36>>2],w[r+32>>2]=w[A+40>>2],w[r+36>>2]=w[A+44>>2],w[r+40>>2]=w[A+48>>2],w[r+12>>2]=w[A+20>>2],w[r+16>>2]=w[A+24>>2],w[r+20>>2]=w[A+28>>2],w[r+24>>2]=w[A+32>>2],e=w[A+52>>2],o[r+48>>2]=0,w[r+44>>2]=e,8962},Rf,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0);e=w[f+8>>2],i=w[f>>2],n=w[f+4>>2],f=(a=m(m(e*w[r+72>>2])+m(m(i*w[r+64>>2])+m(n*w[r+68>>2]))))<(t=m(m(e*w[r+88>>2])+m(m(i*w[r+80>>2])+m(n*w[r+84>>2])))),r=(r- -64|0)+((m(m(e*w[r+104>>2])+m(m(i*w[r+96>>2])+m(n*w[r+100>>2])))>(f?t:a)?2:f)<<4)|0,f=o[r+4>>2],o[A>>2]=o[r>>2],o[A+4>>2]=f,f=o[r+12>>2],o[A+8>>2]=o[r+8>>2],o[A+12>>2]=f},function(A,r,f,e,i,n,a){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,a|=0;var t,c,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0);S=t=S-48|0,s=w[r+36>>2],k=w[r+20>>2],d=w[r+40>>2],v=w[r+24>>2],h=w[r+4>>2],B=w[r+8>>2],b=w[f+8>>2],Z=w[r+32>>2],u=w[f>>2],G=w[r>>2],l=w[f+4>>2],Q=w[r+16>>2],o[t+44>>2]=0,w[t+32>>2]=m(Z*b)+m(m(G*u)+m(Q*l)),w[t+40>>2]=m(d*b)+m(m(B*u)+m(l*v)),w[t+36>>2]=m(s*b)+m(m(h*u)+m(l*k)),c=t+16|0,Zn[o[o[A>>2]+64>>2]](c,A,t+32|0),v=w[r+56>>2],h=w[r+40>>2],B=w[r+36>>2],Z=w[r+52>>2],G=w[r+24>>2],Q=w[r+20>>2],E=w[r+32>>2],W=w[r+48>>2],N=w[r+8>>2],p=w[r>>2],F=w[r+4>>2],R=w[r+16>>2],b=w[t+24>>2],u=w[t+16>>2],l=w[t+20>>2],o[t+12>>2]=0,w[t+8>>2]=-w[t+40>>2],w[t+4>>2]=-w[t+36>>2],w[t>>2]=-w[t+32>>2],Zn[o[o[A>>2]+64>>2]](c,A,t),Y=w[r+56>>2],V=w[r+40>>2],g=w[r+36>>2],X=w[r+52>>2],D=w[r+24>>2],C=w[r+20>>2],J=w[r+32>>2],x=w[r+48>>2],y=w[r+8>>2],M=w[r>>2],H=w[r+4>>2],I=w[r+16>>2],s=w[t+24>>2],k=w[t+16>>2],d=w[t+20>>2],v=m(v+m(m(b*h)+m(m(u*E)+m(l*B)))),h=m(W+m(m(b*N)+m(m(u*p)+m(l*F)))),b=m(Z+m(m(b*G)+m(m(u*R)+m(l*Q)))),w[e>>2]=m(v*w[f+8>>2])+m(m(h*w[f>>2])+m(b*w[f+4>>2])),u=m(Y+m(m(s*V)+m(m(k*J)+m(d*g)))),l=m(x+m(m(s*y)+m(m(k*M)+m(d*H)))),s=m(X+m(m(s*D)+m(m(k*I)+m(d*C)))),w[i>>2]=m(u*w[f+8>>2])+m(m(l*w[f>>2])+m(s*w[f+4>>2])),o[a+12>>2]=0,w[a+8>>2]=u,w[a+4>>2]=s,w[a>>2]=l,o[n+12>>2]=0,w[n+8>>2]=v,w[n+4>>2]=b,w[n>>2]=h,(k=w[e>>2])>(d=w[i>>2])&&(w[e>>2]=d,w[i>>2]=k,o[a+12>>2]=0,w[a+8>>2]=v,w[a+4>>2]=b,w[a>>2]=h,o[n+12>>2]=0,w[n+8>>2]=u,w[n+4>>2]=s,w[n>>2]=l),S=t+48|0},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=0,a=0,t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0;if((0|e)>0)for(k=A- -64|0;n=(i=a<<4)+f|0,t=w[8+(i=r+i|0)>>2],c=w[i>>2],b=w[i+4>>2],i=(l=m(m(t*w[A+72>>2])+m(m(c*w[A+64>>2])+m(b*w[A+68>>2]))))<(s=m(m(t*w[A+88>>2])+m(m(c*w[A+80>>2])+m(b*w[A+84>>2])))),i=((m(m(t*w[A+104>>2])+m(m(c*w[A+96>>2])+m(b*w[A+100>>2])))>(i?s:l)?2:i)<<4)+k|0,u=o[i+4>>2],o[n>>2]=o[i>>2],o[n+4>>2]=u,u=o[i+12>>2],o[n+8>>2]=o[i+8>>2],o[n+12>>2]=u,(0|(a=a+1|0))!=(0|e););},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=0,Z=0,G=0,Q=m(0),E=m(0),W=m(0),N=m(0),p=0;for(S=i=S-80|0,N=m(Zn[o[o[A>>2]+48>>2]](A));o[i+72>>2]=0,o[i+76>>2]=0,o[i+64>>2]=0,o[i+68>>2]=0,o[(p=(Z=G<<2)+(i- -64|0)|0)>>2]=1065353216,c=w[r+32>>2],b=w[r>>2],u=w[r+16>>2],l=w[r+36>>2],s=w[r+4>>2],k=w[r+20>>2],n=w[r+40>>2],a=w[r+8>>2],t=w[r+24>>2],o[i+44>>2]=0,d=n,n=w[i+72>>2],v=a,a=w[i+64>>2],h=t,t=w[i+68>>2],w[i+40>>2]=m(d*n)+m(m(v*a)+m(h*t)),w[i+36>>2]=m(l*n)+m(m(s*a)+m(t*k)),w[i+32>>2]=m(c*n)+m(m(b*a)+m(u*t)),B=i+32|0,Zn[o[o[A>>2]+64>>2]](i+48|0,A,B),c=w[r+48>>2],b=w[r+8>>2],u=w[r>>2],l=w[r+4>>2],s=w[r+52>>2],k=w[r+24>>2],v=w[r+16>>2],h=w[r+20>>2],n=w[r+56>>2],a=w[r+40>>2],t=w[r+32>>2],Q=w[r+36>>2],o[i+44>>2]=0,d=n,n=w[i+56>>2],E=m(a*n),a=w[i+48>>2],W=m(t*a),t=w[i+52>>2],w[i+40>>2]=d+m(E+m(W+m(Q*t))),w[i+36>>2]=s+m(m(n*k)+m(m(a*v)+m(t*h))),w[i+32>>2]=c+m(m(n*b)+m(m(a*u)+m(t*l))),B=Z+B|0,w[e+Z>>2]=N+w[B>>2],o[p>>2]=-1082130432,c=w[r+32>>2],b=w[r>>2],u=w[r+16>>2],l=w[r+36>>2],s=w[r+4>>2],k=w[r+20>>2],n=w[r+40>>2],a=w[r+8>>2],t=w[r+24>>2],o[i+12>>2]=0,d=n,n=w[i+72>>2],v=a,a=w[i+64>>2],h=t,t=w[i+68>>2],w[i+8>>2]=m(d*n)+m(m(v*a)+m(h*t)),w[i+4>>2]=m(l*n)+m(m(s*a)+m(t*k)),w[i>>2]=m(c*n)+m(m(b*a)+m(u*t)),Zn[o[o[A>>2]+64>>2]](i+16|0,A,i),c=w[r+48>>2],b=w[r+8>>2],u=w[r>>2],l=w[r+4>>2],s=w[r+52>>2],k=w[r+24>>2],v=w[r+16>>2],h=w[r+20>>2],n=w[r+56>>2],a=w[r+40>>2],t=w[r+32>>2],Q=w[r+36>>2],o[i+44>>2]=0,d=n,n=w[i+24>>2],E=m(a*n),a=w[i+16>>2],W=m(t*a),t=w[i+20>>2],w[i+40>>2]=d+m(E+m(W+m(Q*t))),w[i+36>>2]=s+m(m(n*k)+m(m(a*v)+m(t*h))),w[i+32>>2]=c+m(m(n*b)+m(m(a*u)+m(t*l))),w[f+Z>>2]=w[B>>2]-N,3!=(0|(G=G+1|0)););S=i+80|0},un,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0);n=w[A+96>>2],t=w[A+80>>2],b=w[A+84>>2],u=w[A+104>>2],c=w[A+100>>2],e=w[A+68>>2],i=w[A+72>>2],l=w[A+88>>2],a=w[A+64>>2],o[f+12>>2]=0,t=m(t-a),c=m(c-e),a=m(n-a),n=m(b-e),b=e=m(m(t*c)-m(a*n)),s=m(e*e),e=n,n=m(u-i),i=m(l-i),e=m(m(e*n)-m(c*i)),i=m(m(i*a)-m(n*t)),a=m(m(1)/m(N(m(s+m(m(e*e)+m(i*i)))))),n=m(b*a),w[f+8>>2]=n,i=m(i*a),w[f+4>>2]=i,e=m(e*a),w[f>>2]=e,r&&(w[f+8>>2]=-n,w[f+4>>2]=-i,w[f>>2]=-e)},function(A,r){A|=0,r|=0;var f,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=m(0),Z=m(0),E=0,W=0,p=0,F=m(0),R=m(0),Y=0,V=0,g=m(0),X=0,D=0,C=m(0),J=0,x=m(0),y=m(0),M=0,H=m(0),I=m(0),T=m(0),U=0,j=m(0),z=0,P=0,O=0,L=m(0),$=m(0),q=0,_=m(0),AA=m(0),fA=0;if(S=f=S-192|0,(e=o[A+60>>2])&&(Zn[o[o[e>>2]>>2]](e),(e=o[A+60>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](e))),o[8488]=o[8488]+1,e=0|Zn[o[8290]](132,16),a[e+20|0]=1,o[e>>2]=20936,o[e+16>>2]=0,a[e+40|0]=1,o[e+8>>2]=0,o[e+12>>2]=0,o[e+36>>2]=0,a[e+60|0]=1,o[e+28>>2]=0,o[e+32>>2]=0,o[e+56>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,o[A+60>>2]=e,o[f+184>>2]=0,o[f+176>>2]=0,o[f+180>>2]=0,a[f+188|0]=1,e=0,(0|Zn[o[o[A>>2]+96>>2]](A))>0){for(u=(Y=o[f+176>>2])-1|0,e=o[f+184>>2],d=v[f+188|0],i=o[f+180>>2];;){if((0|i)==(0|Y)&&!((0|(b=Y?Y<<1:1))<=(0|Y))){if(b?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](b<<4,16)):e=0,!((0|Y)<=0)){if(W=0,i=0,n+u>>>0>=3)for(t=-4&Y,V=0;E=(h=i<<4)+e|0,s=o[4+(l=c+h|0)>>2],o[E>>2]=o[l>>2],o[E+4>>2]=s,s=o[l+12>>2],o[E+8>>2]=o[l+8>>2],o[E+12>>2]=s,E=(s=16|h)+e|0,s=o[12+(l=c+s|0)>>2],o[E+8>>2]=o[l+8>>2],o[E+12>>2]=s,s=o[l+4>>2],o[E>>2]=o[l>>2],o[E+4>>2]=s,E=(s=32|h)+e|0,s=o[12+(l=c+s|0)>>2],o[E+8>>2]=o[l+8>>2],o[E+12>>2]=s,s=o[l+4>>2],o[E>>2]=o[l>>2],o[E+4>>2]=s,E=(s=48|h)+e|0,s=o[12+(l=c+s|0)>>2],o[E+8>>2]=o[l+8>>2],o[E+12>>2]=s,s=o[l+4>>2],o[E>>2]=o[l>>2],o[E+4>>2]=s,i=i+4|0,(0|t)!=(0|(V=V+4|0)););if(t=3&Y)for(;E=(s=i<<4)+e|0,s=o[4+(l=c+s|0)>>2],o[E>>2]=o[l>>2],o[E+4>>2]=s,s=o[l+12>>2],o[E+8>>2]=o[l+8>>2],o[E+12>>2]=s,i=i+1|0,(0|t)!=(0|(W=W+1|0)););}!c||!c|!d||(o[8489]=o[8489]+1,Zn[o[8291]](c)),d=1,i=b}if(Zn[o[o[A>>2]+108>>2]](A,n,(Y<<4)+e|0),Y=Y+1|0,c=e,n=n+1|0,!((0|Zn[o[o[A>>2]+96>>2]](A))>(0|n)))break}a[f+188|0]=d,o[f+180>>2]=i,o[f+176>>2]=Y,o[f+184>>2]=e}if(a[f+148|0]=1,o[f+144>>2]=0,a[f+168|0]=1,o[f+136>>2]=0,o[f+140>>2]=0,o[f+164>>2]=0,o[f+156>>2]=0,o[f+160>>2]=0,o[f+124>>2]=0,a[f+128|0]=1,o[f+116>>2]=0,o[f+120>>2]=0,r){if(Y=0,o[f+28>>2]=0,a[f+32|0]=1,o[f+20>>2]=0,o[f+24>>2]=0,e=0,(0|(X=o[f+176>>2]))>0)for(;;){if(r=e,(0|X)>(0|(e=e+1|0)))for(D=o[f+184>>2]+(r<<4)|0,r=e;;){if(n=r,(0|X)>(0|(r=r+1|0)))for(p=o[f+184>>2]+(n<<4)|0,n=r;;){L=w[D>>2],R=m(w[p>>2]-L),b=(c=o[f+184>>2])+(n<<4)|0,j=w[D+4>>2],g=m(w[b+4>>2]-j),F=m(w[b>>2]-L),B=m(w[p+4>>2]-j),y=m(m(R*g)-m(F*B)),C=w[D+8>>2],Z=m(w[b+8>>2]-C),I=m(B*Z),B=m(w[p+8>>2]-C),g=m(I-m(g*B)),F=m(m(B*F)-m(Z*R));A:if(u=(Z=m(m(y*y)+m(m(g*g)+m(F*F))))>m(9999999747378752e-20)){if(B=m(m(1)/m(N(Z))),x=m(y*B),H=m(F*B),R=m(g*B),(0|(b=o[f+20>>2]))>0){if(i=0,d=o[f+28>>2],m(m(x*w[d+8>>2])+m(m(R*w[d>>2])+m(H*w[d+4>>2])))>m(.9990000128746033))break A;for(;!((0|b)==(0|(i=i+1|0))||m(m(x*w[8+(s=d+(i<<4)|0)>>2])+m(m(R*w[s>>2])+m(H*w[s+4>>2])))>m(.9990000128746033)););if((0|i)<(0|b))break A}if(B=m(m(x*C)+m(m(R*L)+m(H*j))),(0|(d=o[f+176>>2]))>0){if(i=0,m(m(m(m(x*w[c+8>>2])+m(m(R*w[c>>2])+m(H*w[c+4>>2])))-B)+m(-.009999999776482582))>m(0))break A;for(;!((0|d)==(0|(i=i+1|0))||m(m(m(m(x*w[8+(s=c+(i<<4)|0)>>2])+m(m(R*w[s>>2])+m(H*w[s+4>>2])))-B)+m(-.009999999776482582))>m(0)););if((0|i)<(0|d))break A}if(B=m(-B),o[f+24>>2]==(0|b)&&!((0|(k=b?b<<1:1))<=(0|b))){if(k?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](k<<4,16),b=o[f+20>>2]):d=0,!((0|b)<=0)){if(t=1&b,i=0,1!=(0|b))for(E=-2&b,b=0;c=(l=i<<4)+d|0,h=l+o[f+28>>2]|0,s=o[h+4>>2],o[c>>2]=o[h>>2],o[c+4>>2]=s,s=o[h+12>>2],o[c+8>>2]=o[h+8>>2],o[c+12>>2]=s,c=(s=16|l)+d|0,l=s+o[f+28>>2]|0,s=o[l+4>>2],o[c>>2]=o[l>>2],o[c+4>>2]=s,s=o[l+12>>2],o[c+8>>2]=o[l+8>>2],o[c+12>>2]=s,i=i+2|0,(0|E)!=(0|(b=b+2|0)););t&&(s=(b=i<<4)+d|0,i=b+o[f+28>>2]|0,b=o[i+4>>2],o[s>>2]=o[i>>2],o[s+4>>2]=b,b=o[i+12>>2],o[s+8>>2]=o[i+8>>2],o[s+12>>2]=b)}!(b=o[f+28>>2])||!b|!v[f+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),o[f+28>>2]=d,a[f+32|0]=1,o[f+24>>2]=k,b=o[f+20>>2]}b=o[f+28>>2]+(b<<4)|0,w[b+12>>2]=B,w[b+8>>2]=x,w[b+4>>2]=H,w[b>>2]=R,o[f+20>>2]=o[f+20>>2]+1}A:if(u){if(B=m(m(1)/m(N(Z))),R=m(B*m(-y)),F=m(B*m(-F)),Z=m(B*m(-g)),(0|(b=o[f+20>>2]))>0){if(i=0,d=o[f+28>>2],m(m(R*w[d+8>>2])+m(m(Z*w[d>>2])+m(F*w[d+4>>2])))>m(.9990000128746033))break A;for(;!((0|b)==(0|(i=i+1|0))||m(m(R*w[8+(s=d+(i<<4)|0)>>2])+m(m(Z*w[s>>2])+m(F*w[s+4>>2])))>m(.9990000128746033)););if((0|i)<(0|b))break A}if(B=m(m(R*w[D+8>>2])+m(m(Z*w[D>>2])+m(F*w[D+4>>2]))),(0|(d=o[f+176>>2]))>0){if(i=0,c=o[f+184>>2],m(m(m(m(R*w[c+8>>2])+m(m(Z*w[c>>2])+m(F*w[c+4>>2])))-B)+m(-.009999999776482582))>m(0))break A;for(;!((0|d)==(0|(i=i+1|0))||m(m(m(m(R*w[8+(s=c+(i<<4)|0)>>2])+m(m(Z*w[s>>2])+m(F*w[s+4>>2])))-B)+m(-.009999999776482582))>m(0)););if((0|i)<(0|d))break A}if(B=m(-B),o[f+24>>2]==(0|b)&&!((0|(h=b?b<<1:1))<=(0|b))){if(h?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](h<<4,16),b=o[f+20>>2]):d=0,!((0|b)<=0)){if(t=1&b,i=0,1!=(0|b))for(E=-2&b,b=0;c=(u=i<<4)+d|0,l=u+o[f+28>>2]|0,s=o[l+4>>2],o[c>>2]=o[l>>2],o[c+4>>2]=s,s=o[l+12>>2],o[c+8>>2]=o[l+8>>2],o[c+12>>2]=s,c=(s=16|u)+d|0,u=s+o[f+28>>2]|0,s=o[u+4>>2],o[c>>2]=o[u>>2],o[c+4>>2]=s,s=o[u+12>>2],o[c+8>>2]=o[u+8>>2],o[c+12>>2]=s,i=i+2|0,(0|E)!=(0|(b=b+2|0)););t&&(s=(b=i<<4)+d|0,i=b+o[f+28>>2]|0,b=o[i+4>>2],o[s>>2]=o[i>>2],o[s+4>>2]=b,b=o[i+12>>2],o[s+8>>2]=o[i+8>>2],o[s+12>>2]=b)}!(b=o[f+28>>2])||!b|!v[f+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),o[f+28>>2]=d,a[f+32|0]=1,o[f+24>>2]=h,b=o[f+20>>2]}b=o[f+28>>2]+(b<<4)|0,w[b+12>>2]=B,w[b+8>>2]=R,w[b+4>>2]=F,w[b>>2]=Z,o[f+20>>2]=o[f+20>>2]+1}if(!((0|X)>(0|(n=n+1|0))))break}if((0|r)==(0|X))break}if((0|e)==(0|X))break}if(o[f+104>>2]=0,a[f+108|0]=1,o[f+96>>2]=0,o[f+100>>2]=0,!(o[f+20>>2]<=0))for(;;){if(r=o[f+28>>2]+(Y<<4)|0,o[f+80>>2]=o[r+8>>2],e=o[r+4>>2],o[f+72>>2]=o[r>>2],o[f+76>>2]=e,B=m(w[r+12>>2]-m(Zn[o[o[A>>2]+48>>2]](A))),(0|(e=o[f+96>>2]))==o[f+100>>2]&&!((0|(t=e?e<<1:1))<=(0|e))){if(t?(o[8488]=o[8488]+1,c=0|Zn[o[8290]](t<<4,16),e=o[f+96>>2]):c=0,!((0|e)<=0)){if(i=0,1!=(0|e))for(s=-2&e,n=0;b=(d=i<<4)+c|0,E=d+o[f+104>>2]|0,r=o[E+4>>2],o[b>>2]=o[E>>2],o[b+4>>2]=r,r=o[E+12>>2],o[b+8>>2]=o[E+8>>2],o[b+12>>2]=r,b=(r=16|d)+c|0,d=r+o[f+104>>2]|0,r=o[d+4>>2],o[b>>2]=o[d>>2],o[b+4>>2]=r,r=o[d+12>>2],o[b+8>>2]=o[d+8>>2],o[b+12>>2]=r,i=i+2|0,(0|s)!=(0|(n=n+2|0)););1&e&&(e=(r=i<<4)+c|0,n=r+o[f+104>>2]|0,r=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=r,r=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=r)}!(r=o[f+104>>2])||!r|!v[f+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+104>>2]=c,a[f+108|0]=1,o[f+100>>2]=t,e=o[f+96>>2]}if(r=o[f+76>>2],e=o[f+104>>2]+(e<<4)|0,o[e>>2]=o[f+72>>2],o[e+4>>2]=r,r=o[f+80>>2],w[e+12>>2]=B,o[e+8>>2]=r,o[f+96>>2]=o[f+96>>2]+1,!((0|(Y=Y+1|0))>2]))break}if(o[f+84>>2]=0,a[f+88|0]=1,o[f+76>>2]=0,o[f+80>>2]=0,e=0,(0|(p=o[f+96>>2]))>0)for(;;){if(r=e,(0|p)>(0|(e=e+1|0)))for(k=o[f+104>>2]+(r<<4)|0,r=e;;){if(n=r,(0|p)>(0|(r=r+1|0)))for(h=o[f+104>>2]+(n<<4)|0,n=r;;){$=w[h>>2],i=o[f+104>>2],R=w[4+(b=i+(n<<4)|0)>>2],g=w[b>>2],F=w[h+4>>2],I=m(m($*R)-m(g*F)),Z=w[b+8>>2],B=w[h+8>>2],x=m(m(F*Z)-m(R*B)),H=m(m(B*g)-m(Z*$));A:if(m(m(I*I)+m(m(x*x)+m(H*H)))>m(9999999747378752e-20)&&(_=w[k+4>>2],AA=w[k>>2],y=m(m(g*_)-m(AA*R)),T=w[k+8>>2],L=m(m(R*T)-m(_*Z)),j=m(m(Z*AA)-m(T*g)),m(m(y*y)+m(m(L*L)+m(j*j)))>m(9999999747378752e-20)&&(Z=m(m(AA*F)-m($*_)),C=m(m(_*B)-m(F*T)),R=m(m(T*$)-m(B*AA)),m(m(Z*Z)+m(m(C*C)+m(R*R)))>m(9999999747378752e-20)&&(B=m(m(T*I)+m(m(AA*x)+m(_*H))),m(Q(B))>m(9.999999974752427e-7))))){if(g=m(m(-1)/B),F=w[b+12>>2],T=m(Z*F),Z=w[k+12>>2],B=w[h+12>>2],y=m(g*m(T+m(m(I*Z)+m(y*B)))),R=m(g*m(m(R*F)+m(m(H*Z)+m(j*B)))),B=m(g*m(m(C*F)+m(m(x*Z)+m(L*B)))),(0|(s=o[f+96>>2]))>0){if(b=0,m(m(w[i+12>>2]+m(m(w[i+8>>2]*y)+m(m(w[i>>2]*B)+m(R*w[i+4>>2]))))+m(-.009999999776482582))>m(0))break A;for(;!((0|s)==(0|(b=b+1|0))||m(m(w[12+(d=i+(b<<4)|0)>>2]+m(m(w[d+8>>2]*y)+m(m(w[d>>2]*B)+m(R*w[d+4>>2]))))+m(-.009999999776482582))>m(0)););if((0|b)<(0|s))break A}if((0|(i=o[f+76>>2]))==o[f+80>>2]&&!((0|(l=i?i<<1:1))<=(0|i))){if(l?(o[8488]=o[8488]+1,b=0|Zn[o[8290]](l<<4,16),i=o[f+76>>2]):b=0,!((0|i)<=0)){if(E=0,1!=(0|i))for(c=-2&i,V=0;d=(t=E<<4)+b|0,u=t+o[f+84>>2]|0,s=o[u+4>>2],o[d>>2]=o[u>>2],o[d+4>>2]=s,s=o[u+12>>2],o[d+8>>2]=o[u+8>>2],o[d+12>>2]=s,d=(s=16|t)+b|0,t=s+o[f+84>>2]|0,s=o[t+4>>2],o[d>>2]=o[t>>2],o[d+4>>2]=s,s=o[t+12>>2],o[d+8>>2]=o[t+8>>2],o[d+12>>2]=s,E=E+2|0,(0|c)!=(0|(V=V+2|0)););1&i&&(d=(s=E<<4)+b|0,i=s+o[f+84>>2]|0,s=o[i+4>>2],o[d>>2]=o[i>>2],o[d+4>>2]=s,s=o[i+12>>2],o[d+8>>2]=o[i+8>>2],o[d+12>>2]=s)}!(s=o[f+84>>2])||!s|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](s)),o[f+84>>2]=b,a[f+88|0]=1,o[f+80>>2]=l,i=o[f+76>>2]}b=o[f+84>>2]+(i<<4)|0,o[b+12>>2]=0,w[b+8>>2]=y,w[b+4>>2]=R,w[b>>2]=B,o[f+76>>2]=o[f+76>>2]+1}if(!((0|p)>(0|(n=n+1|0))))break}if((0|r)==(0|p))break}if((0|e)==(0|p))break}K(f+112|0,o[f+84>>2],o[f+76>>2]),!(r=o[f+84>>2])||!r|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),!(r=o[f+104>>2])||!r|!v[f+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),!(r=o[f+28>>2])|!v[f+32|0]||r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}else K(f+112|0,e,o[f+176>>2]);A:{r:{if((0|(s=o[f+156>>2]))>=0){if(s)break r;o[f+32>>2]=0,o[f+36>>2]=0,o[f+48>>2]=0,o[f+40>>2]=0,o[f+44>>2]=0,o[f+24>>2]=0,o[f+28>>2]=0,a[f+32|0]=1,o[f+16>>2]=0,o[f+20>>2]=0,o[f+20>>2]=0;break A}for(o[f+32>>2]=0,o[f+36>>2]=0,o[f+48>>2]=0,o[f+40>>2]=0,o[f+44>>2]=0,o[f+24>>2]=0,o[f+28>>2]=0,a[f+32|0]=1,o[f+16>>2]=0,o[f+20>>2]=0,o[f+20>>2]=0,e=s;n=G(e,36),!(r=o[n+12>>2])||!r|!v[n+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[n+12>>2]=0,a[n+16|0]=1,o[n+4>>2]=0,o[n+8>>2]=0,e=e+1|0;);break A}for(o[8488]=o[8488]+1,fA=0|Zn[o[8290]](s<<4,16),o[f+32>>2]=0,o[f+36>>2]=0,i=0,o[f+48>>2]=0,o[f+40>>2]=0,o[f+44>>2]=0,o[f+24>>2]=0,o[f+28>>2]=0,a[f+32|0]=1,o[f+16>>2]=0,o[f+20>>2]=0,o[f+20>>2]=0,o[8488]=o[8488]+1,z=0|Zn[o[8290]](G(s,36),16);Fr(e=G(i,36)+z|0,f+16|0),r=o[f+48>>2],o[e+28>>2]=o[f+44>>2],o[e+32>>2]=r,r=o[f+40>>2],o[e+20>>2]=o[f+36>>2],o[e+24>>2]=r,(0|s)!=(0|(i=i+1|0)););}if(!(r=o[f+28>>2])||!r|!v[f+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),t=o[A+60>>2],!((0|(c=o[t+8>>2]))>=(0|(E=o[f+116>>2]))|(0|E)<=o[t+12>>2])){if(E?(o[8488]=o[8488]+1,W=0|Zn[o[8290]](E<<4,16),c=o[t+8>>2]):W=0,!((0|c)<=0)){if(e=0,1!=(0|c))for(b=-2&c,V=0;n=(d=e<<4)+W|0,i=d+o[t+16>>2]|0,r=o[i+4>>2],o[n>>2]=o[i>>2],o[n+4>>2]=r,r=o[i+12>>2],o[n+8>>2]=o[i+8>>2],o[n+12>>2]=r,n=(r=16|d)+W|0,d=r+o[t+16>>2]|0,r=o[d+4>>2],o[n>>2]=o[d>>2],o[n+4>>2]=r,r=o[d+12>>2],o[n+8>>2]=o[d+8>>2],o[n+12>>2]=r,e=e+2|0,(0|b)!=(0|(V=V+2|0)););1&c&&(e=(r=e<<4)+W|0,n=r+o[t+16>>2]|0,r=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=r,r=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=r)}!(r=o[t+16>>2])||!r|!v[t+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[t+16>>2]=W,a[t+20|0]=1,o[t+12>>2]=E}if(o[t+8>>2]=E,!((0|E)<=0)){if(i=0,1!=(0|E))for(n=-2&E,c=0;e=(b=i<<4)+o[o[A+60>>2]+16>>2]|0,d=b+o[f+124>>2]|0,r=o[d+4>>2],o[e>>2]=o[d>>2],o[e+4>>2]=r,r=o[d+12>>2],o[e+8>>2]=o[d+8>>2],o[e+12>>2]=r,e=(r=16|b)+o[o[A+60>>2]+16>>2]|0,b=r+o[f+124>>2]|0,r=o[b+4>>2],o[e>>2]=o[b>>2],o[e+4>>2]=r,r=o[b+12>>2],o[e+8>>2]=o[b+8>>2],o[e+12>>2]=r,i=i+2|0,(0|n)!=(0|(c=c+2|0)););1&E&&(e=(r=i<<4)+o[o[A+60>>2]+16>>2]|0,n=r+o[f+124>>2]|0,r=o[n+4>>2],o[e>>2]=o[n>>2],o[e+4>>2]=r,r=o[n+12>>2],o[e+8>>2]=o[n+8>>2],o[e+12>>2]=r)}A:{r:{f:{if(!((0|s)<=0)){for(c=0;;){k=G(c,36)+z|0,n=o[k+4>>2],d=0,Y=t=o[f+144>>2]+G(o[o[f+164>>2]+(c<<2)>>2],12)|0;e:{for(;;){if(E=o[8+(G(o[Y+4>>2],12)+Y|0)>>2],o[k+8>>2]==(0|n)&&!((0|(u=n?n<<1:1))<=(0|n))){u?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](u<<2,16),n=o[k+4>>2]):e=0,h=o[k+12>>2];i:{n:if((0|n)>0){if(W=0,i=0,n>>>0>=4)for(b=-4&n,J=0;o[(l=i<<2)+e>>2]=o[l+h>>2],o[(r=4|l)+e>>2]=o[r+h>>2],o[(r=8|l)+e>>2]=o[r+h>>2],o[(r=12|l)+e>>2]=o[r+h>>2],i=i+4|0,(0|b)!=(0|(J=J+4|0)););if(!(n&=3))break n;for(;o[(r=i<<2)+e>>2]=o[r+h>>2],i=i+1|0,(0|n)!=(0|(W=W+1|0)););}else if(!h)break i;h&&v[k+16|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](h)),n=o[k+4>>2]}o[k+12>>2]=e,a[k+16|0]=1,o[k+8>>2]=u}o[o[k+12>>2]+(n<<2)>>2]=E,n=o[k+4>>2]+1|0,o[k+4>>2]=n;i:{if((0|d)<=1){if(r=o[f+124>>2],C=w[8+(e=r+(E<<4)|0)>>2],r=r+(o[Y+8>>2]<<4)|0,R=w[r+8>>2],g=w[e>>2],F=w[r>>2],Z=w[e+4>>2],B=w[r+4>>2],o[12+(r=(f+16|0)+(d<<4)|0)>>2]=0,R=m(R-C),F=m(F-g),B=m(B-Z),Z=m(m(1)/m(N(m(m(R*R)+m(m(F*F)+m(B*B)))))),w[r+8>>2]=R*Z,w[r+4>>2]=B*Z,w[r>>2]=F*Z,d=d+1|0,r=G(o[Y+4>>2],12)+Y|0,(0|t)!=(0|(Y=G(o[r>>2],12)+r|0)))continue;if(2==(0|d))break i;o[(r=(c<<4)+fA|0)>>2]=0,o[r+4>>2]=0,o[r+8>>2]=0,o[r+12>>2]=0;break e}if(d=2,r=G(o[Y+4>>2],12)+Y|0,(0|t)!=(0|(Y=G(o[r>>2],12)+r|0)))continue}break}j=w[f+20>>2],Z=w[f+36>>2],C=w[f+32>>2],R=w[f+24>>2],g=w[f+16>>2],B=w[f+40>>2],o[12+(r=(c<<4)+fA|0)>>2]=0,F=m(m(g*Z)-m(C*j)),Z=m(m(j*B)-m(Z*R)),B=m(m(R*C)-m(B*g)),g=m(m(1)/m(N(m(m(F*F)+m(m(Z*Z)+m(B*B)))))),w[r+8>>2]=F*g,w[r+4>>2]=B*g,B=m(Z*g),w[r>>2]=B,w[k+20>>2]=B,w[k+24>>2]=w[r+4>>2],B=w[r+8>>2],o[k+32>>2]=1900671690,w[k+28>>2]=B}if((0|(e=o[k+4>>2]))<=0)C=m(1.0000000150474662e30);else{if(n=1&e,R=w[8+(r=(c<<4)+fA|0)>>2],g=w[r+4>>2],F=w[r>>2],E=o[o[A+60>>2]+16>>2],d=o[k+12>>2],1!=(0|e))for(e&=-2,C=m(1.0000000150474662e30),i=0,W=0;b=E+(o[d+(4|(r=i<<2))>>2]<<4)|0,Z=m(m(w[b+8>>2]*R)+m(m(w[b>>2]*F)+m(w[b+4>>2]*g))),r=E+(o[r+d>>2]<<4)|0,C=(B=(B=m(m(w[r+8>>2]*R)+m(m(w[r>>2]*F)+m(w[r+4>>2]*g))))Z?Z:B,i=i+2|0,(0|e)!=(0|(W=W+2|0)););else C=m(1.0000000150474662e30),i=0;n&&(r=E+(o[d+(i<<2)>>2]<<4)|0,C=(B=m(m(w[r+8>>2]*R)+m(m(w[r>>2]*F)+m(w[r+4>>2]*g))))>2]=-C,(0|s)==(0|(c=c+1|0)))break}if(n=0,!((0|s)<=0)){for(E=0,r=0;;){if((0|r)==(0|n))if(n>>>0>=(r=n?n<<1:1)>>>0)r=n;else{o[8488]=o[8488]+1,e=0|Zn[o[8290]](r<<2,16);e:{i:if(n){if(W=0,i=0,n>>>0>=4)for(d=2147483644&n,V=0;o[(c=i<<2)+e>>2]=o[c+E>>2],o[(b=4|c)+e>>2]=o[b+E>>2],o[(b=8|c)+e>>2]=o[b+E>>2],o[(b=12|c)+e>>2]=o[b+E>>2],i=i+4|0,(0|d)!=(0|(V=V+4|0)););if(!(d=3&n))break i;for(;o[(b=i<<2)+e>>2]=o[b+E>>2],i=i+1|0,(0|d)!=(0|(W=W+1|0)););}else if(!E){r=1;break e}E&&(o[8489]=o[8489]+1,Zn[o[8291]](E))}E=e}if(o[(n<<2)+E>>2]=n,(0|s)==(0|(n=n+1|0)))break}for(b=s;;){r=o[((e=b-1|0)<<2)+E>>2],o[8488]=o[8488]+1,d=0|Zn[o[8290]](4,16),o[d>>2]=r;e:{if((0|b)<2)b=e,P=1;else{for(r=G(r,36)+z|0,F=w[r+20>>2],Z=w[r+28>>2],B=w[r+24>>2],i=b-2|0,r=1,b=e,P=1;;){if(c=i,l=o[(i<<2)+E>>2],e=G(l,36)+z|0,m(m(Z*w[e+28>>2])+m(m(F*w[e+20>>2])+m(B*w[e+24>>2])))>m(.9990000128746033)){i:if((0|r)!=(0|P)||(0|(n=r?r<<1:1))<=(0|r))n=r,e=d;else{n?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](n<<2,16)):e=0;n:if((0|r)>0){if(W=0,i=0,r>>>0>=4)for(u=-4&r,Y=0;o[(h=i<<2)+e>>2]=o[d+h>>2],o[(t=4|h)+e>>2]=o[t+d>>2],o[(t=8|h)+e>>2]=o[t+d>>2],o[(t=12|h)+e>>2]=o[t+d>>2],i=i+4|0,(0|u)!=(0|(Y=Y+4|0)););if(!(t=3&r))break n;for(;o[(r=i<<2)+e>>2]=o[r+d>>2],i=i+1|0,(0|t)!=(0|(W=W+1|0)););}else if(!d)break i;d&&(o[8489]=o[8489]+1,Zn[o[8291]](d))}o[(P<<2)+e>>2]=l,P=P+1|0,i=0;i:if(!((0|b)<=0)){for(;;){if((0|l)!=o[(r=(i<<2)+E|0)>>2]){if((0|b)!=(0|(i=i+1|0)))continue;break i}break}(0|i)>=(0|b)||(i=r,r=((b=b-1|0)<<2)+E|0,o[i>>2]=o[r>>2],o[r>>2]=l)}d=e,r=n}if(i=c-1|0,!((0|c)>0))break}if((0|P)>1){for(e=0,o[f+104>>2]=0,a[f+108|0]=1,o[f+96>>2]=0,o[f+100>>2]=0,o[f+8>>2]=0,o[f+12>>2]=0,o[f>>2]=0,o[f+4>>2]=0,c=0;;){if(X=G(o[(c<<2)+d>>2],36)+z|0,Z=w[X+28>>2],B=w[X+24>>2],w[f>>2]=w[X+20>>2]+w[f>>2],w[f+4>>2]=B+w[f+4>>2],w[f+8>>2]=Z+w[f+8>>2],(0|(W=o[X+4>>2]))>0)for(n=0;;){k=o[o[X+12>>2]+(n<<2)>>2],t=o[o[A+60>>2]+16>>2];i:{if((0|e)>0)for(i=0,r=o[f+104>>2];;){if((0|k)==o[20+(r+G(i,24)|0)>>2])break i;if((0|(i=i+1|0))==(0|e))break}if(r=o[12+(i=t+(k<<4)|0)>>2],o[f+24>>2]=o[i+8>>2],o[f+28>>2]=r,r=o[i+4>>2],o[f+16>>2]=o[i>>2],o[f+20>>2]=r,o[f+100>>2]==(0|e)&&!((0|(h=e?e<<1:1))<=(0|e))){if(h?(o[8488]=o[8488]+1,W=0|Zn[o[8290]](G(h,24),16),e=o[f+96>>2]):W=0,D=o[f+104>>2],!((0|e)<=0)){if(J=0,i=0,e>>>0>=4)for(l=-4&e,r=0;u=(t=G(i,24))+W|0,t=o[4+(p=t+D|0)>>2],o[u>>2]=o[p>>2],o[u+4>>2]=t,t=o[p+20>>2],o[u+16>>2]=o[p+16>>2],o[u+20>>2]=t,t=o[p+12>>2],o[u+8>>2]=o[p+8>>2],o[u+12>>2]=t,u=(t=G(1|i,24))+W|0,t=o[20+(p=t+D|0)>>2],o[u+16>>2]=o[p+16>>2],o[u+20>>2]=t,t=o[p+12>>2],o[u+8>>2]=o[p+8>>2],o[u+12>>2]=t,t=o[p+4>>2],o[u>>2]=o[p>>2],o[u+4>>2]=t,u=(t=G(2|i,24))+W|0,t=o[20+(p=t+D|0)>>2],o[u+16>>2]=o[p+16>>2],o[u+20>>2]=t,t=o[p+12>>2],o[u+8>>2]=o[p+8>>2],o[u+12>>2]=t,t=o[p+4>>2],o[u>>2]=o[p>>2],o[u+4>>2]=t,u=(t=G(3|i,24))+W|0,t=o[20+(p=t+D|0)>>2],o[u+16>>2]=o[p+16>>2],o[u+20>>2]=t,t=o[p+12>>2],o[u+8>>2]=o[p+8>>2],o[u+12>>2]=t,t=o[p+4>>2],o[u>>2]=o[p>>2],o[u+4>>2]=t,i=i+4|0,(0|l)!=(0|(r=r+4|0)););if(u=3&e)for(;t=(r=G(i,24))+W|0,r=o[4+(l=r+D|0)>>2],o[t>>2]=o[l>>2],o[t+4>>2]=r,r=o[l+20>>2],o[t+16>>2]=o[l+16>>2],o[t+20>>2]=r,r=o[l+12>>2],o[t+8>>2]=o[l+8>>2],o[t+12>>2]=r,i=i+1|0,(0|u)!=(0|(J=J+1|0)););}!D|!v[f+108|0]||(D&&(o[8489]=o[8489]+1,Zn[o[8291]](D)),e=o[f+96>>2]),o[f+104>>2]=W,a[f+108|0]=1,o[f+100>>2]=h}r=o[f+20>>2],t=o[f+104>>2]+G(e,24)|0,o[(e=t)>>2]=o[f+16>>2],o[e+4>>2]=r,i=o[f+28>>2],e=o[f+24>>2],r=o[f+32>>2],o[t+20>>2]=k,o[t+16>>2]=r,o[t+8>>2]=e,o[t+12>>2]=i,e=o[f+96>>2]+1|0,o[f+96>>2]=e,W=o[X+4>>2]}if(!((0|W)>(0|(n=n+1|0))))break}if((0|P)==(0|(c=c+1|0)))break}o[f+28>>2]=0,a[f+32|0]=1,o[f+20>>2]=0,o[f+24>>2]=0,r=G(o[d>>2],36)+z|0,w[f+36>>2]=w[r+20>>2],w[f+40>>2]=w[r+24>>2],w[f+44>>2]=w[r+28>>2],w[f+48>>2]=w[r+32>>2],o[f+84>>2]=0,a[f+88|0]=1,o[f+76>>2]=0,o[f+80>>2]=0,F=w[f+8>>2],Z=w[f>>2],B=w[f+4>>2],g=m(m(1)/m(N(m(m(F*F)+m(m(Z*Z)+m(B*B)))))),w[f+8>>2]=F*g,w[f+4>>2]=B*g,w[f>>2]=Z*g,p=f+92|0,e=0,J=0,c=0,T=m(0),$=m(0),S=X=S-32|0,R=w[f+8>>2],m(Q(R))>m(.7071067690849304)?(Z=w[f+4>>2],B=m(m(Z*Z)+m(R*R)),F=m(m(1)/m(N(B))),H=m(B*F),B=w[f>>2],I=m(F*m(-R)),y=m(B*I),$=m(Z*F),B=m($*m(-B))):(F=w[f>>2],Z=w[f+4>>2],B=m(m(F*F)+m(Z*Z)),g=m(m(1)/m(N(B))),y=m(B*g),I=m(F*g),H=m(I*m(-R)),T=m(g*m(-Z)),B=m(R*T));i:if((0|(n=o[p+4>>2]))>=2){for(;t=o[p+12>>2],i=G(e,24),m(m(w[8+(r=t+i|0)>>2]*$)+m(m(w[r>>2]*T)+m(I*w[r+4>>2])))>2]*$)+m(m(w[t>>2]*T)+m(I*w[t+4>>2])))&&(n=o[t+20>>2],o[X+24>>2]=o[t+16>>2],o[X+28>>2]=n,n=o[t+12>>2],o[X+16>>2]=o[t+8>>2],o[X+20>>2]=n,n=o[t+4>>2],o[X+8>>2]=o[t>>2],o[X+12>>2]=n,n=o[r+4>>2],o[t>>2]=o[r>>2],o[t+4>>2]=n,n=o[r+12>>2],o[t+8>>2]=o[r+8>>2],o[t+12>>2]=n,n=o[r+20>>2],o[t+16>>2]=o[r+16>>2],o[t+20>>2]=n,r=o[X+12>>2],n=i+o[p+12>>2]|0,o[n>>2]=o[X+8>>2],o[n+4>>2]=r,r=o[X+28>>2],o[n+16>>2]=o[X+24>>2],o[n+20>>2]=r,r=o[X+20>>2],o[n+8>>2]=o[X+16>>2],o[n+12>>2]=r,n=o[p+4>>2]),(0|n)>(0|(e=e+1|0)););if(i=o[p+12>>2],o[i+16>>2]=-246811958,(0|n)>=2)for(j=w[i+8>>2],C=w[i+4>>2],R=w[i>>2],r=1;L=m(0),e=i+G(r,24)|0,g=m(w[e+8>>2]-j),F=m(w[e>>2]-R),Z=m(w[e+4>>2]-C),x=m(m(y*g)+m(m(H*F)+m(B*Z))),F=m(m($*g)+m(m(T*F)+m(I*Z))),m(m(x*x)+m(F*F))=m(0)?m(m(m(m(F-Z)/m(F+Z))*m(-.7853981852531433))+m(.7853981852531433)):m(m(m(m(F+Z)/m(Z-F))*m(-.7853981852531433))+m(2.356194496154785)),L=x>2]=L,(0|n)!=(0|(r=r+1|0)););if(r=o[i+12>>2],o[X+16>>2]=o[i+8>>2],o[X+20>>2]=r,r=o[i+4>>2],o[X+8>>2]=o[i>>2],o[X+12>>2]=r,kr(p,X+8|0,1,n-1|0),i=o[p+12>>2],(0|(r=o[f+76>>2]))==o[f+80>>2]&&!((0|(h=r?r<<1:1))<=(0|r))){if(h?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](G(h,24),16),r=o[f+76>>2]):n=0,!((0|r)<=0)){if(e=0,1!=(0|r))for(l=-2&r;u=(t=G(e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,u=(t=G(1|e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,e=e+2|0,(0|l)!=(0|(c=c+2|0)););1&r&&(e=(r=G(e,24))+n|0,c=r+o[f+84>>2]|0,r=o[c+4>>2],o[e>>2]=o[c>>2],o[e+4>>2]=r,r=o[c+20>>2],o[e+16>>2]=o[c+16>>2],o[e+20>>2]=r,r=o[c+12>>2],o[e+8>>2]=o[c+8>>2],o[e+12>>2]=r)}!(r=o[f+84>>2])||!r|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+84>>2]=n,a[f+88|0]=1,o[f+80>>2]=h,r=o[f+76>>2]}if(e=o[f+84>>2]+G(r,24)|0,r=o[i+4>>2],o[e>>2]=o[i>>2],o[e+4>>2]=r,r=o[i+20>>2],o[e+16>>2]=o[i+16>>2],o[e+20>>2]=r,r=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=r,r=o[f+76>>2]+1|0,o[f+76>>2]=r,i=o[p+12>>2],o[f+80>>2]==(0|r)&&!((0|(h=r?r<<1:1))<=(0|r))){if(h?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](G(h,24),16),r=o[f+76>>2]):n=0,!((0|r)<=0)){if(e=0,1!=(0|r))for(l=-2&r,c=0;u=(t=G(e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,u=(t=G(1|e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,e=e+2|0,(0|l)!=(0|(c=c+2|0)););1&r&&(e=(r=G(e,24))+n|0,c=r+o[f+84>>2]|0,r=o[c+4>>2],o[e>>2]=o[c>>2],o[e+4>>2]=r,r=o[c+20>>2],o[e+16>>2]=o[c+16>>2],o[e+20>>2]=r,r=o[c+12>>2],o[e+8>>2]=o[c+8>>2],o[e+12>>2]=r)}!(r=o[f+84>>2])||!r|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+84>>2]=n,a[f+88|0]=1,o[f+80>>2]=h,r=o[f+76>>2]}if(e=o[f+84>>2]+G(r,24)|0,r=o[i+28>>2],o[e>>2]=o[i+24>>2],o[e+4>>2]=r,r=o[i+44>>2],o[e+16>>2]=o[i+40>>2],o[e+20>>2]=r,r=o[i+36>>2],o[e+8>>2]=o[i+32>>2],o[e+12>>2]=r,r=o[f+76>>2]+1|0,o[f+76>>2]=r,2==o[p+4>>2])break i;for(W=2;;){n:if(!((0|r)<2))for(i=o[p+12>>2]+G(W,24)|0,x=w[i+8>>2],H=w[i+4>>2],y=w[i>>2],L=w[f+8>>2],j=w[f+4>>2],C=w[f>>2],n=o[f+84>>2],e=r;;){if(r=G(e,24)+n|0,Z=w[(c=r-48|0)>>2],R=m(Z-w[(r=r-24|0)>>2]),B=w[c+4>>2],g=m(B-H),F=m(Z-y),B=m(B-w[r+4>>2]),T=m(m(m(R*g)-m(F*B))*L),I=B,B=w[c+8>>2],Z=m(B-x),B=m(B-w[r+8>>2]),m(T+m(m(m(m(I*Z)-m(g*B))*C)+m(j*m(m(B*F)-m(Z*R)))))>m(0)){if(o[f+80>>2]==(0|e)&&!((0|(u=e<<1))<=(0|e))){if(o[8488]=o[8488]+1,n=0|Zn[o[8290]](G(e,48),16),!((0|(l=o[f+76>>2]))<=0)){if(e=0,1!=(0|l))for(t=-2&l,Y=0;c=(r=G(e,24))+n|0,h=r+o[f+84>>2]|0,r=o[h+4>>2],o[c>>2]=o[h>>2],o[c+4>>2]=r,r=o[h+20>>2],o[c+16>>2]=o[h+16>>2],o[c+20>>2]=r,r=o[h+12>>2],o[c+8>>2]=o[h+8>>2],o[c+12>>2]=r,c=(r=G(1|e,24))+n|0,h=r+o[f+84>>2]|0,r=o[h+4>>2],o[c>>2]=o[h>>2],o[c+4>>2]=r,r=o[h+12>>2],o[c+8>>2]=o[h+8>>2],o[c+12>>2]=r,r=o[h+20>>2],o[c+16>>2]=o[h+16>>2],o[c+20>>2]=r,e=e+2|0,(0|t)!=(0|(Y=Y+2|0)););1&l&&(e=(r=G(e,24))+n|0,c=r+o[f+84>>2]|0,r=o[c+4>>2],o[e>>2]=o[c>>2],o[e+4>>2]=r,r=o[c+20>>2],o[e+16>>2]=o[c+16>>2],o[e+20>>2]=r,r=o[c+12>>2],o[e+8>>2]=o[c+8>>2],o[e+12>>2]=r)}!(r=o[f+84>>2])||!r|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+84>>2]=n,a[f+88|0]=1,o[f+80>>2]=u,e=o[f+76>>2]}r=o[i+4>>2],e=G(e,24)+n|0,o[e>>2]=o[i>>2],o[e+4>>2]=r,r=o[i+20>>2],o[e+16>>2]=o[i+16>>2],o[e+20>>2]=r,r=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=r,r=o[f+76>>2]+1|0,o[f+76>>2]=r;break n}if(r=e-1|0,o[f+76>>2]=r,c=e>>>0>2,e=r,!c)break}if(1==(0|r)){if(r=o[p+12>>2]+G(W,24)|0,1==o[f+80>>2]){if(o[8488]=o[8488]+1,n=0|Zn[o[8290]](48,16),!((0|(l=o[f+76>>2]))<=0)){if(e=0,1!=(0|l))for(u=-2&l,c=0;t=(i=G(e,24))+n|0,h=i+o[f+84>>2]|0,i=o[h+4>>2],o[t>>2]=o[h>>2],o[t+4>>2]=i,i=o[h+20>>2],o[t+16>>2]=o[h+16>>2],o[t+20>>2]=i,i=o[h+12>>2],o[t+8>>2]=o[h+8>>2],o[t+12>>2]=i,t=(i=G(1|e,24))+n|0,h=i+o[f+84>>2]|0,i=o[h+4>>2],o[t>>2]=o[h>>2],o[t+4>>2]=i,i=o[h+12>>2],o[t+8>>2]=o[h+8>>2],o[t+12>>2]=i,i=o[h+20>>2],o[t+16>>2]=o[h+16>>2],o[t+20>>2]=i,e=e+2|0,(0|u)!=(0|(c=c+2|0)););1&l&&(i=(e=G(e,24))+n|0,c=e+o[f+84>>2]|0,e=o[c+4>>2],o[i>>2]=o[c>>2],o[i+4>>2]=e,e=o[c+20>>2],o[i+16>>2]=o[c+16>>2],o[i+20>>2]=e,e=o[c+12>>2],o[i+8>>2]=o[c+8>>2],o[i+12>>2]=e)}!(e=o[f+84>>2])||!e|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[f+84>>2]=n,a[f+88|0]=1,o[f+80>>2]=2,e=o[f+76>>2]}else n=o[f+84>>2],e=1;n=G(e,24)+n|0,e=o[r+4>>2],o[n>>2]=o[r>>2],o[n+4>>2]=e,e=o[r+20>>2],o[n+16>>2]=o[r+16>>2],o[n+20>>2]=e,e=o[r+12>>2],o[n+8>>2]=o[r+8>>2],o[n+12>>2]=e,r=o[f+76>>2]+1|0,o[f+76>>2]=r}if((0|(W=W+1|0))==o[p+4>>2])break}}else if(1==(0|n))for(r=o[f+76>>2];;){if(i=o[p+12>>2],o[f+80>>2]==(0|r)&&!((0|(h=r?r<<1:1))<=(0|r))){if(h?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](G(h,24),16),r=o[f+76>>2]):n=0,!((0|r)<=0)){if(e=0,1!=(0|r))for(l=-2&r,c=0;u=(t=G(e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,u=(t=G(1|e,24))+n|0,k=t+o[f+84>>2]|0,t=o[k+4>>2],o[u>>2]=o[k>>2],o[u+4>>2]=t,t=o[k+12>>2],o[u+8>>2]=o[k+8>>2],o[u+12>>2]=t,t=o[k+20>>2],o[u+16>>2]=o[k+16>>2],o[u+20>>2]=t,e=e+2|0,(0|l)!=(0|(c=c+2|0)););1&r&&(e=(r=G(e,24))+n|0,c=r+o[f+84>>2]|0,r=o[c+4>>2],o[e>>2]=o[c>>2],o[e+4>>2]=r,r=o[c+20>>2],o[e+16>>2]=o[c+16>>2],o[e+20>>2]=r,r=o[c+12>>2],o[e+8>>2]=o[c+8>>2],o[e+12>>2]=r)}!(r=o[f+84>>2])||!r|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[f+84>>2]=n,a[f+88|0]=1,o[f+80>>2]=h,r=o[f+76>>2]}if(e=o[f+84>>2]+G(r,24)|0,r=o[i+4>>2],o[e>>2]=o[i>>2],o[e+4>>2]=r,r=o[i+20>>2],o[e+16>>2]=o[i+16>>2],o[e+20>>2]=r,r=o[i+12>>2],o[e+8>>2]=o[i+8>>2],o[e+12>>2]=r,r=o[f+76>>2]+1|0,o[f+76>>2]=r,!((0|(J=J+1|0))>2]))break}if(S=X+32|0,o[f+76>>2]<=0)e=o[f+96>>2];else for(r=0,V=o[f+20>>2];;){if(t=(u=G(r,24))+o[f+84>>2]|0,o[f+24>>2]==(0|V)&&!((0|(h=V?V<<1:1))<=(0|V))){h?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](h<<2,16),V=o[f+20>>2]):e=0,p=o[f+28>>2];i:{n:if((0|V)>0){if(l=3&V,W=0,i=0,V>>>0>=4)for(c=-4&V,V=0;o[(k=i<<2)+e>>2]=o[k+p>>2],o[(n=4|k)+e>>2]=o[n+p>>2],o[(n=8|k)+e>>2]=o[n+p>>2],o[(n=12|k)+e>>2]=o[n+p>>2],i=i+4|0,(0|c)!=(0|(V=V+4|0)););if(!l)break n;for(;o[(n=i<<2)+e>>2]=o[n+p>>2],i=i+1|0,(0|l)!=(0|(W=W+1|0)););}else if(!p)break i;p&&v[f+32|0]&&(o[8489]=o[8489]+1,Zn[o[8291]](p)),V=o[f+20>>2]}o[f+28>>2]=e,a[f+32|0]=1,o[f+24>>2]=h}o[o[f+28>>2]+(V<<2)>>2]=o[t+20>>2],V=o[f+20>>2]+1|0,o[f+20>>2]=V;i:if(!((0|(e=o[f+96>>2]))<=0)){for(t=o[20+(u+o[f+84>>2]|0)>>2],i=0,c=o[f+104>>2];;){if(n=c+G(i,24)|0,(0|t)!=o[n+20>>2]){if((0|(i=i+1|0))!=(0|e))continue;break i}break}o[n+20>>2]=-1}if(!((0|(r=r+1|0))>2]))break}i:{if((0|e)>0)for(Y=0,t=o[f+104>>2];;){n:if(!(-1==(0|(u=o[20+(t+G(Y,24)|0)>>2]))|(0|s)<=0)){if(c=0,(0|P)>0)for(;;){r=G(c,36)+z|0,i=0;a:{for(;;){if(o[(i<<2)+d>>2]==(0|c))break a;if((0|P)==(0|(i=i+1|0)))break}if(!((0|(n=o[r+4>>2]))<=0)){for(r=o[r+12>>2],i=0;;){if((0|u)!=o[r+(i<<2)>>2]){if((0|n)!=(0|(i=i+1|0)))continue;break a}break}r=1;break i}}if((0|s)==(0|(c=c+1|0)))break n}for(;;){a:if(r=G(c,36)+z|0,!((0|(n=o[r+4>>2]))<=0)){for(r=o[r+12>>2],i=0;;){if((0|u)!=o[r+(i<<2)>>2]){if((0|n)!=(0|(i=i+1|0)))continue;break a}break}r=1;break i}if((0|s)==(0|(c=c+1|0)))break}}if((0|(Y=Y+1|0))==(0|e))break}if(l=o[A+60>>2],(0|(e=o[l+28>>2]))==o[l+32>>2]){if(n=0,(0|(t=e?e<<1:1))>o[l+32>>2]){if(t?(o[8488]=o[8488]+1,e=0|Zn[o[8290]](G(t,36),16)):e=0,!((0|(c=o[l+28>>2]))<=0)){for(;Fr(u=(r=G(n,36))+e|0,r=r+o[l+36>>2]|0),i=o[r+32>>2],o[u+28>>2]=o[r+28>>2],o[u+32>>2]=i,i=o[r+24>>2],o[u+20>>2]=o[r+20>>2],o[u+24>>2]=i,(0|c)!=(0|(n=n+1|0)););if(!((0|(r=o[l+28>>2]))<=0))for(n=0;c=o[l+36>>2]+G(n,36)|0,!(i=o[c+12>>2])||!i|!v[c+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[c+12>>2]=0,a[c+16|0]=1,o[c+4>>2]=0,o[c+8>>2]=0,(0|r)!=(0|(n=n+1|0)););}!(r=o[l+36>>2])||!r|!v[l+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[l+36>>2]=e,a[l+40|0]=1,o[l+32>>2]=t}e=o[l+28>>2]}Fr(e=o[l+36>>2]+G(e,36)|0,f+16|0),r=o[f+48>>2],o[e+28>>2]=o[f+44>>2],o[e+32>>2]=r,r=o[f+40>>2],o[e+20>>2]=o[f+36>>2],o[e+24>>2]=r,o[l+28>>2]=o[l+28>>2]+1,r=0}if(!(e=o[f+84>>2])||!e|!v[f+88|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),!(e=o[f+28>>2])||!e|!v[f+32|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),!(e=o[f+104>>2])||!e|!v[f+108|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),!(r&(0|P)>0))break e}else if(r=1!=(0|P),P=1,r)break e}for(X=0;;){if(r=0,e=G(o[(X<<2)+d>>2],36)+z|0,!((0|(O=o[e+4>>2]))<=0)){if(W=0,o[8488]=o[8488]+1,n=O<<2,l=Af(r=0|Zn[o[8290]](n,16),0,n),u=o[e+12>>2],i=0,O>>>0>=4)for(c=-4&O,V=0;o[(t=i<<2)+l>>2]=o[t+u>>2],o[(n=4|t)+l>>2]=o[n+u>>2],o[(n=8|t)+l>>2]=o[n+u>>2],o[(n=12|t)+l>>2]=o[n+u>>2],i=i+4|0,(0|c)!=(0|(V=V+4|0)););if(c=3&O)for(;o[(n=i<<2)+l>>2]=o[n+u>>2],i=i+1|0,(0|c)!=(0|(W=W+1|0)););}if(i=v[e+24|0]|v[e+25|0]<<8|v[e+26|0]<<16|v[e+27|0]<<24,n=v[e+20|0]|v[e+21|0]<<8|v[e+22|0]<<16|v[e+23|0]<<24,a[f+19|0]=n,a[f+20|0]=n>>>8,a[f+21|0]=n>>>16,a[f+22|0]=n>>>24,a[f+23|0]=i,a[f+24|0]=i>>>8,a[f+25|0]=i>>>16,a[f+26|0]=i>>>24,n=v[e+32|0]|v[e+33|0]<<8|v[e+34|0]<<16|v[e+35|0]<<24,e=v[e+28|0]|v[e+29|0]<<8|v[e+30|0]<<16|v[e+31|0]<<24,a[f+27|0]=e,a[f+28|0]=e>>>8,a[f+29|0]=e>>>16,a[f+30|0]=e>>>24,a[f+31|0]=n,a[f+32|0]=n>>>8,a[f+33|0]=n>>>16,a[f+34|0]=n>>>24,U=o[A+60>>2],(0|(c=o[U+28>>2]))==o[U+32>>2]&&!((0|(p=c?c<<1:1))<=(0|c))){if(p?(o[8488]=o[8488]+1,k=0|Zn[o[8290]](G(p,36),16),c=o[U+28>>2]):k=0,!((0|c)<=0)){for(h=0;;){if(n=o[U+36>>2],e=G(h,36),o[12+(M=e+k|0)>>2]=0,a[M+16|0]=1,o[M+4>>2]=0,o[M+8>>2]=0,(0|(Y=o[4+(e=e+n|0)>>2]))<=0)o[M+4>>2]=Y;else{o[8488]=o[8488]+1,u=Y<<2,J=0|Zn[o[8290]](u,16),q=o[M+12>>2];i:{n:{if((0|(l=o[M+4>>2]))>0){if(W=0,i=0,l>>>0>=4)for(t=-4&l,V=0;o[(D=i<<2)+J>>2]=o[D+q>>2],o[(n=4|D)+J>>2]=o[n+q>>2],o[(n=8|D)+J>>2]=o[n+q>>2],o[(n=12|D)+J>>2]=o[n+q>>2],i=i+4|0,(0|t)!=(0|(V=V+4|0)););if(t=3&l)for(;o[(n=i<<2)+J>>2]=o[n+q>>2],i=i+1|0,(0|t)!=(0|(W=W+1|0)););if(v[M+16|0])break n;break i}if(!q|!v[M+16|0])break i}q&&(o[8489]=o[8489]+1,Zn[o[8291]](q))}if(o[M+12>>2]=J,a[M+16|0]=1,o[M+8>>2]=Y,W=0,D=Af(J,0,u),o[M+4>>2]=Y,l=o[e+12>>2],i=0,Y>>>0>=4)for(t=-4&Y,V=0;o[(u=i<<2)+D>>2]=o[u+l>>2],o[(n=4|u)+D>>2]=o[n+l>>2],o[(n=8|u)+D>>2]=o[n+l>>2],o[(n=12|u)+D>>2]=o[n+l>>2],i=i+4|0,(0|t)!=(0|(V=V+4|0)););if(t=3&Y)for(;o[(n=i<<2)+D>>2]=o[n+l>>2],i=i+1|0,(0|t)!=(0|(W=W+1|0)););}if(n=o[e+24>>2],o[M+20>>2]=o[e+20>>2],o[M+24>>2]=n,n=o[e+32>>2],o[M+28>>2]=o[e+28>>2],o[M+32>>2]=n,(0|(h=h+1|0))==(0|c))break}if(e=0,!((0|(n=o[U+28>>2]))<=0))for(;c=o[U+36>>2]+G(e,36)|0,!(i=o[c+12>>2])||!i|!v[c+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[c+12>>2]=0,a[c+16|0]=1,o[c+4>>2]=0,o[c+8>>2]=0,(0|n)!=(0|(e=e+1|0)););}!(e=o[U+36>>2])||!e|!v[U+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[U+36>>2]=k,a[U+40|0]=1,o[U+32>>2]=p,c=o[U+28>>2]}if(k=o[U+36>>2]+G(c,36)|0,o[k+12>>2]=0,a[k+16|0]=1,o[k+4>>2]=0,o[k+8>>2]=0,(0|O)<=0)o[k+4>>2]=O;else{o[8488]=o[8488]+1,c=O<<2,l=0|Zn[o[8290]](c,16),h=o[k+12>>2];i:{n:{if((0|(t=o[k+4>>2]))>0){if(W=0,i=0,t>>>0>=4)for(n=-4&t,V=0;o[(u=i<<2)+l>>2]=o[u+h>>2],o[(e=4|u)+l>>2]=o[e+h>>2],o[(e=8|u)+l>>2]=o[e+h>>2],o[(e=12|u)+l>>2]=o[e+h>>2],i=i+4|0,(0|n)!=(0|(V=V+4|0)););if(n=3&t)for(;o[(e=i<<2)+l>>2]=o[e+h>>2],i=i+1|0,(0|n)!=(0|(W=W+1|0)););if(v[k+16|0])break n;break i}if(!h|!v[k+16|0])break i}h&&(o[8489]=o[8489]+1,Zn[o[8291]](h))}if(o[k+12>>2]=l,a[k+16|0]=1,o[k+8>>2]=O,n=0,u=Af(l,0,c),o[k+4>>2]=O,i=0,O>>>0>=4)for(c=-4&O,W=0;o[(t=i<<2)+u>>2]=o[r+t>>2],o[(e=4|t)+u>>2]=o[r+e>>2],o[(e=8|t)+u>>2]=o[r+e>>2],o[(e=12|t)+u>>2]=o[r+e>>2],i=i+4|0,(0|c)!=(0|(W=W+4|0)););if(c=3&O)for(;o[(e=i<<2)+u>>2]=o[r+e>>2],i=i+1|0,(0|c)!=(0|(n=n+1|0)););}if(n=v[f+23|0]|v[f+24|0]<<8|v[f+25|0]<<16|v[f+26|0]<<24,e=v[f+19|0]|v[f+20|0]<<8|v[f+21|0]<<16|v[f+22|0]<<24,a[k+20|0]=e,a[k+21|0]=e>>>8,a[k+22|0]=e>>>16,a[k+23|0]=e>>>24,a[k+24|0]=n,a[k+25|0]=n>>>8,a[k+26|0]=n>>>16,a[k+27|0]=n>>>24,n=v[f+31|0]|v[f+32|0]<<8|v[f+33|0]<<16|v[f+34|0]<<24,e=v[f+27|0]|v[f+28|0]<<8|v[f+29|0]<<16|v[f+30|0]<<24,a[k+28|0]=e,a[k+29|0]=e>>>8,a[k+30|0]=e>>>16,a[k+31|0]=e>>>24,a[k+32|0]=n,a[k+33|0]=n>>>8,a[k+34|0]=n>>>16,a[k+35|0]=n>>>24,o[U+28>>2]=o[U+28>>2]+1,r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),(0|(X=X+1|0))==(0|P))break}}if(d&&(o[8489]=o[8489]+1,Zn[o[8291]](d)),!b)break}if(rA(o[A+60>>2]),E&&(o[8489]=o[8489]+1,Zn[o[8291]](E)),(0|s)<=0)break f;for(e=0;r=G(e,36)+z|0,!(A=o[r+12>>2])||!A|!v[r+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[r+12>>2]=0,a[r+16|0]=1,o[r+4>>2]=0,o[r+8>>2]=0,(0|s)!=(0|(e=e+1|0)););break r}}rA(o[A+60>>2])}if(!z)break A}z&&(o[8489]=o[8489]+1,Zn[o[8291]](z))}return fA&&(o[8489]=o[8489]+1,Zn[o[8291]](fA)),!(A=o[f+164>>2])||!A|!v[f+168|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+164>>2]=0,a[f+168|0]=1,o[f+156>>2]=0,o[f+160>>2]=0,!(A=o[f+144>>2])||!A|!v[f+148|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[f+144>>2]=0,a[f+148|0]=1,o[f+136>>2]=0,o[f+140>>2]=0,!(A=o[f+124>>2])||!A|!v[f+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),!(A=o[f+184>>2])||!A|!v[f+188|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),S=f+192|0,1},ln,ln,function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+108>>2]](A,r,f),Zn[o[o[A>>2]+108>>2]](A,(r+1|0)%3|0,e)},function(A,r,f){f|=0,r=o[76+(A=((r|=0)<<4)+(A|=0)|0)>>2],o[f+8>>2]=o[A+72>>2],o[f+12>>2]=r,r=o[4+(A=A- -64|0)>>2],o[f>>2]=o[A>>2],o[f+4>>2]=r},sn,function(A,r,f,e){r|=0,f|=0,e|=0,Zn[o[o[(A|=0)>>2]+124>>2]](A,e,r,f)},function(A,r,f){A|=0,r|=0,f=m(f);var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=0;return S=e=S-32|0,l=w[A+64>>2],c=m(w[A+80>>2]-l),i=w[A+68>>2],t=m(w[A+100>>2]-i),b=m(w[A+96>>2]-l),n=m(w[A+84>>2]-i),u=a=m(m(c*t)-m(b*n)),d=m(a*a),k=n,n=w[A+72>>2],a=m(w[A+104>>2]-n),s=m(w[A+88>>2]-n),t=m(m(k*a)-m(t*s)),c=m(m(s*b)-m(a*c)),b=m(m(1)/m(N(m(d+m(m(t*t)+m(c*c)))))),a=m(u*b),t=m(t*b),c=m(c*b),!((i=m(m(m(w[r+8>>2]*a)+m(m(w[r>>2]*t)+m(w[r+4>>2]*c)))-m(m(n*a)+m(m(l*t)+m(i*c)))))>=(l=m(-f)))|!(f>=i)||(Zn[o[o[A>>2]+104>>2]](A,0,e+16|0,e),b=w[e+16>>2],i=m(w[e>>2]-b),s=w[e+20>>2],n=m(w[e+4>>2]-s),u=f=m(m(i*c)-m(t*n)),d=m(f*f),f=m(n*a),k=w[e+24>>2],n=m(w[e+8>>2]-k),f=m(f-m(c*n)),i=m(m(n*t)-m(a*i)),n=m(m(1)/m(N(m(d+m(m(f*f)+m(i*i)))))),u=m(u*n),f=m(f*n),i=m(i*n),l>m(m(m(w[r+8>>2]*u)+m(m(w[r>>2]*f)+m(w[r+4>>2]*i)))-m(m(k*u)+m(m(b*f)+m(s*i))))||(Zn[o[o[A>>2]+104>>2]](A,1,e+16|0,e),b=w[e+16>>2],i=m(w[e>>2]-b),s=w[e+20>>2],n=m(w[e+4>>2]-s),u=f=m(m(i*c)-m(t*n)),d=m(f*f),f=m(n*a),k=w[e+24>>2],n=m(w[e+8>>2]-k),f=m(f-m(c*n)),i=m(m(n*t)-m(a*i)),n=m(m(1)/m(N(m(d+m(m(f*f)+m(i*i)))))),u=m(u*n),f=m(f*n),i=m(i*n),l>m(m(m(w[r+8>>2]*u)+m(m(w[r>>2]*f)+m(w[r+4>>2]*i)))-m(m(k*u)+m(m(b*f)+m(s*i))))||(Zn[o[o[A>>2]+104>>2]](A,2,e+16|0,e),u=l,l=w[e+16>>2],i=m(w[e>>2]-l),n=w[e+20>>2],b=m(w[e+4>>2]-n),k=f=m(m(i*c)-m(t*b)),s=m(f*f),d=m(b*a),f=c,c=w[e+24>>2],b=m(w[e+8>>2]-c),f=m(d-m(f*b)),a=m(m(b*t)-m(a*i)),t=m(m(1)/m(N(m(s+m(m(f*f)+m(a*a)))))),i=m(k*t),f=m(f*t),a=m(a*t),u>m(m(m(w[r+8>>2]*i)+m(m(w[r>>2]*f)+m(w[r+4>>2]*a)))-m(m(c*i)+m(m(l*f)+m(n*a))))||(v=1)))),S=e+32|0,0|v},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);t=w[A+96>>2],c=w[A+80>>2],u=w[A+84>>2],l=w[A+104>>2],b=w[A+100>>2],i=w[A+68>>2],n=w[A+72>>2],s=w[A+88>>2],a=w[A+64>>2],o[f+12>>2]=0,c=m(c-a),b=m(b-i),a=m(t-a),t=m(u-i),u=i=m(m(c*b)-m(a*t)),k=m(i*i),i=t,t=m(l-n),n=m(s-n),i=m(m(i*t)-m(b*n)),n=m(m(n*a)-m(t*c)),a=m(m(1)/m(N(m(k+m(m(i*i)+m(n*n)))))),w[f+8>>2]=u*a,w[f+4>>2]=n*a,w[f>>2]=i*a,r=o[A+76>>2],o[e+8>>2]=o[A+72>>2],o[e+12>>2]=r,r=o[A+68>>2],o[e>>2]=o[A+64>>2],o[e+4>>2]=r},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,t=m(0);S=f=S-800|0,Zn[o[8294]](7628),o[f+744>>2]=0,o[f+748>>2]=0,o[f+756>>2]=0,o[f+760>>2]=0,o[f+752>>2]=1065353216,o[f+764>>2]=0,o[f+768>>2]=0,o[f+776>>2]=0,o[f+780>>2]=0,o[f+772>>2]=1065353216,o[f+784>>2]=0,o[f+788>>2]=0,o[f+792>>2]=0,o[f+736>>2]=0,o[f+740>>2]=0,o[f+732>>2]=1065353216,o[f+724>>2]=0,o[f+728>>2]=0,o[f+556>>2]=13280,w[f+720>>2]=w[A+200>>2],t=w[A+196>>2],e=ae(f+496|0),o[e+32>>2]=0,o[e+36>>2]=0,o[e+20>>2]=1065353216,o[e+24>>2]=1065353216,o[e+4>>2]=8,o[e>>2]=21520,o[e+56>>2]=0,w[e+52>>2]=t,o[e+28>>2]=1065353216,o[e+40>>2]=0,o[e+44>>2]=0,o[e+48>>2]=0,w[e+36>>2]=t,i=oi(f+384|0),o[i+4>>2]=1,o[i>>2]=15956,n=o[r+12>>2],o[i+72>>2]=o[r+8>>2],o[i+76>>2]=n,n=o[r+4>>2],o[i+64>>2]=o[r>>2],o[i+68>>2]=n,n=o[r+20>>2],o[i+80>>2]=o[r+16>>2],o[i+84>>2]=n,n=o[r+28>>2],o[i+88>>2]=o[r+24>>2],o[i+92>>2]=n,n=o[r+36>>2],o[i+96>>2]=o[r+32>>2],o[i+100>>2]=n,n=o[r+44>>2],o[i+104>>2]=o[r+40>>2],o[i+108>>2]=n,a[f+356|0]=0,o[f+332>>2]=953267991,o[12+(r=f+8|0)>>2]=i,o[r+8>>2]=e,o[r+4>>2]=f+24,o[r>>2]=23372,ZA(e=r,A+4|0,A+68|0,r=f+732|0,r,f+556|0)&&(t=w[f+720>>2])>2]&&(w[A+200>>2]=t),Ne(i),Zn[o[8295]](),S=f+800|0},kf,function(A){kf(A|=0),DA(A)},aA,function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,a,t,c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),Q=m(0),E=m(0),W=0,N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0);if((0|(n=o[A+52>>2]))<=0)return m(m(1));for(a=(c=v[A+68|0])?r:f,H=w[(r=c?f:r)- -64>>2],x=w[r+60>>2],y=w[r+56>>2],M=w[r+52>>2],I=w[r+48>>2],u=w[r+44>>2],l=w[r+40>>2],s=w[r+36>>2],T=w[r+32>>2],k=w[r+28>>2],d=w[r+24>>2],h=w[r+20>>2],U=w[r+16>>2],B=w[r+12>>2],Z=w[r+8>>2],W=o[r+304>>2],Q=w[r+4>>2],t=o[r+192>>2],E=m(1),c=0;f=o[t+32>>2]+G(c,80)|0,b=w[f+56>>2],N=w[f+52>>2],p=w[f+48>>2],F=w[f+36>>2],R=w[f+20>>2],Y=w[f+4>>2],V=w[f+40>>2],g=w[f+24>>2],X=w[f+8>>2],D=w[f+32>>2],C=w[f>>2],J=w[f+16>>2],o[r+64>>2]=0,o[r+48>>2]=0,o[r+32>>2]=0,o[r+16>>2]=0,o[r+304>>2]=W+1,w[r+36>>2]=m(D*u)+m(m(C*s)+m(l*J)),w[r+20>>2]=m(D*k)+m(m(C*h)+m(d*J)),w[r+4>>2]=m(D*B)+m(m(C*Q)+m(Z*J)),w[r+44>>2]=m(V*u)+m(m(X*s)+m(l*g)),w[r+40>>2]=m(F*u)+m(m(Y*s)+m(l*R)),w[r+28>>2]=m(V*k)+m(m(X*h)+m(d*g)),w[r+24>>2]=m(F*k)+m(m(Y*h)+m(d*R)),w[r+12>>2]=m(V*B)+m(m(X*Q)+m(Z*g)),w[r+8>>2]=m(F*B)+m(m(Y*Q)+m(Z*R)),w[r+60>>2]=x+m(m(b*u)+m(m(p*s)+m(l*N))),w[r+56>>2]=y+m(m(b*k)+m(m(p*h)+m(d*N))),w[r+52>>2]=M+m(m(b*B)+m(m(p*Q)+m(Z*N))),f=o[o[A+60>>2]+(c<<2)>>2],b=m(Zn[o[o[f>>2]+12>>2]](f,r,a,e,i)),w[r+64>>2]=H,w[r+60>>2]=x,w[r+56>>2]=y,w[r+52>>2]=M,w[r+48>>2]=I,w[r+44>>2]=u,w[r+40>>2]=l,w[r+36>>2]=s,w[r+32>>2]=T,w[r+28>>2]=k,w[r+24>>2]=d,w[r+20>>2]=h,w[r+16>>2]=U,w[r+12>>2]=B,w[r+8>>2]=Z,w[r+4>>2]=Q,W=o[r+304>>2]+1|0,o[r+304>>2]=W,E=b>2]))>0)for(;(i=o[o[A+60>>2]+(e<<2)>>2])&&(Zn[o[o[i>>2]+16>>2]](i,r),f=o[A+52>>2]),(0|f)>(0|(e=e+1|0)););},vn,function(A,r){var f,e;r|=0,f=A|=0,e=o[o[o[A+4>>2]+4>>2]+32>>2],A=o[r+36>>2],zA(f,o[64+(e+G(A,80)|0)>>2],A)},Ef,function(A){Ef(A|=0),DA(A)},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n,t,c=0,b=0,u=0,l=0,s=0,k=0,d=m(0),h=m(0),B=m(0),Z=m(0),E=0,W=0,N=m(0),p=m(0),F=m(0),R=0,Y=m(0),V=m(0),g=m(0),X=m(0),D=0,C=m(0),J=m(0),x=0,y=0,M=m(0),H=m(0),I=m(0),T=0,U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=0,rA=0,fA=m(0),eA=0,iA=m(0),nA=0,tA=0,oA=m(0),cA=m(0),bA=m(0),uA=m(0);if(S=n=S-3584|0,t=o[r+4>>2],(E=o[t+72>>2])&&(tA=o[f+4>>2],l=o[tA+72>>2])){if(!(o[t+76>>2]==o[A+108>>2]&o[tA+76>>2]==o[A+112>>2])){if(c=o[A+84>>2],(0|(s=o[c+8>>2]))>0){for(;(y=o[8+(o[c+16>>2]+G(b,12)|0)>>2])&&(Zn[o[o[y>>2]>>2]](y),u=o[A+4>>2],Zn[o[o[u>>2]+60>>2]](u,y)),(0|s)!=(0|(b=b+1|0)););c=o[A+84>>2]}Vr(c),o[A+108>>2]=o[t+76>>2],o[A+112>>2]=o[tA+76>>2]}if(o[n+88>>2]=0,a[n+92|0]=1,b=Pr(n+112|0),Pr(b+868|0),Pr(b+1736|0),Pr(b+2604|0),!(c=o[n+88>>2])||!c|!v[n+92|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[n+88>>2]=b,o[n+80>>2]=0,o[n+84>>2]=4,a[n+92|0]=0,y=o[A+84>>2],!((0|(R=o[y+8>>2]))<=0)){for(;;){if(c=o[8+(o[y+16>>2]+G(T,12)|0)>>2]){if(Zn[o[o[c>>2]+16>>2]](c,n+76|0),b=0,(0|(c=o[n+80>>2]))>0)for(;k=o[o[n+88>>2]+(b<<2)>>2],o[k+844>>2]&&(o[i+4>>2]=k,s=(0|(c=o[k+836>>2]))==(0|(u=o[o[i+8>>2]+8>>2])),rA=c,c=o[o[i+12>>2]+8>>2],OA(k,(s?rA:c)+4|0,(s?c:u)+4|0),o[i+4>>2]=0,c=o[n+80>>2]),(0|(b=b+1|0))<(0|c););if(!((0|c)>=0)){if(o[n+84>>2]<0&&(!(b=o[n+88>>2])||!b|!v[n+92|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[n+92|0]=1,o[n+84>>2]=0,o[n+88>>2]=0),R=0,b=c,u=0-c&3)for(;o[o[n+88>>2]+(b<<2)>>2]=0,b=b+1|0,(0|u)!=(0|(R=R+1|0)););if(!(c>>>0>4294967292))for(;o[(c=b<<2)+o[n+88>>2]>>2]=0,o[4+(c+o[n+88>>2]|0)>>2]=0,o[8+(c+o[n+88>>2]|0)>>2]=0,o[12+(c+o[n+88>>2]|0)>>2]=0,b=b+4|0;);}o[n+80>>2]=0,R=o[y+8>>2]}if(!((0|(T=T+1|0))<(0|R)))break}!(c=o[n+88>>2])|!v[n+92|0]||c&&(o[8489]=o[8489]+1,Zn[o[8291]](c))}if(b=o[A+4>>2],c=o[A+84>>2],o[n+108>>2]=o[A+72>>2],o[n+104>>2]=c,o[n+96>>2]=e,o[n+92>>2]=b,o[n+80>>2]=0,o[n+76>>2]=16544,o[n+100>>2]=i,o[n+88>>2]=f,o[n+84>>2]=r,(c=o[E>>2])&&(e=o[l>>2])){for(u=o[r+12>>2],Y=w[u+8>>2],d=m(-w[u+48>>2]),F=w[u+24>>2],B=w[u+52>>2],V=w[u+40>>2],N=w[u+56>>2],b=o[f+12>>2],p=w[b+56>>2],Z=w[b+48>>2],h=w[b+52>>2],bA=m(m(m(m(Y*d)-m(F*B))-m(V*N))+m(m(p*V)+m(m(Z*Y)+m(F*h)))),g=w[u+4>>2],C=w[u+20>>2],X=w[u+36>>2],uA=m(m(m(m(g*d)-m(C*B))-m(X*N))+m(m(p*X)+m(m(Z*g)+m(C*h)))),U=w[b+40>>2],M=w[b+24>>2],j=w[b+8>>2],H=w[b+36>>2],z=w[b+20>>2],I=w[b+4>>2],_=w[u>>2],iA=m(_*d),d=w[u+16>>2],iA=m(iA-m(d*B)),B=w[u+32>>2],iA=m(m(iA-m(B*N))+m(m(p*B)+m(m(Z*_)+m(d*h)))),p=w[b+16>>2],Z=w[b>>2],h=w[b+32>>2],fA=w[i+32>>2],o[n+116>>2]=e,o[n+112>>2]=c,J=m(m(U*V)+m(m(j*Y)+m(F*M))),$=m(Q(J)),P=m(m(H*V)+m(m(I*Y)+m(F*z))),K=m(Q(P)),O=m(m(h*V)+m(m(Z*Y)+m(F*p))),q=m(Q(O)),L=m(m(U*X)+m(m(j*g)+m(C*M))),Y=m(Q(L)),F=m(m(H*X)+m(m(I*g)+m(C*z))),V=m(Q(F)),g=m(m(h*X)+m(m(Z*g)+m(C*p))),C=m(Q(g)),X=m(m(U*B)+m(m(j*_)+m(d*M))),U=m(Q(X)),M=m(m(H*B)+m(m(I*_)+m(d*z))),j=m(Q(M)),H=m(m(h*B)+m(m(Z*_)+m(d*p))),z=m(Q(H)),T=124,y=0,c=n+112|0,s=128,e=128,l=1;;){A:{r:{f:{if(x=o[(b=(rA=(E=l-1|0)<<3)+c|0)>>2],D=o[b+4>>2],I=w[D+24>>2],d=w[D+8>>2],oA=m(m(m(I-d)*m(.5))+m(0)),B=w[D+16>>2],N=w[D>>2],cA=m(m(m(B-N)*m(.5))+m(0)),p=w[D+20>>2],h=w[D+4>>2],_=m(m(m(p-h)*m(.5))+m(0)),Z=m(m(oA*U)+m(m(cA*z)+m(j*_))),d=m(m(I+d)*m(.5)),N=m(m(B+N)*m(.5)),p=m(m(p+h)*m(.5)),h=m(iA+m(m(d*X)+m(m(N*H)+m(M*p)))),!(!(w[x>>2]<=m(fA+m(Z+h)))|!(w[x+16>>2]>=m(m(h-Z)-fA))||(Z=m(m(oA*Y)+m(m(cA*C)+m(V*_))),h=m(uA+m(m(d*L)+m(m(N*g)+m(F*p)))),!(w[x+4>>2]<=m(fA+m(Z+h)))|!(w[x+20>>2]>=m(m(h-Z)-fA))||(Z=m(m(oA*$)+m(m(cA*q)+m(K*_))),h=m(bA+m(m(d*J)+m(m(N*O)+m(P*p)))),!(w[x+8>>2]<=m(fA+m(Z+h)))|!(w[x+24>>2]>=m(m(h-Z)-fA)))))){if((0|E)<=(0|T))b=s,u=c;else{if((0|s)>=(0|(b=s<<1)))u=c;else if((0|e)>=(0|b))u=c;else{if(s){if(o[8488]=o[8488]+1,u=0|Zn[o[8290]](s<<4,16),!((0|s)<=0)){if(R=0,T=0,s>>>0>=4)for(eA=-4&s,AA=0;W=(nA=T<<3)+u|0,e=o[4+(k=c+nA|0)>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,W=(e=8|nA)+u|0,e=o[4+(k=e+c|0)>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,W=(e=16|nA)+u|0,e=o[4+(k=e+c|0)>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,W=(e=24|nA)+u|0,e=o[4+(k=e+c|0)>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,T=T+4|0,(0|eA)!=(0|(AA=AA+4|0)););if(W=3&s)for(;k=(e=T<<3)+u|0,e=o[4+(s=e+c|0)>>2],o[k>>2]=o[s>>2],o[k+4>>2]=e,T=T+1|0,(0|W)!=(0|(R=R+1|0)););}}else u=0;e=y,y=1,c&&e&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),e=b}T=b-4|0}if(c=o[D+40>>2],o[x+40>>2]){if(s=o[x+36>>2],c){o[4+(c=u+rA|0)>>2]=o[D+36>>2],o[c>>2]=s,c=o[x+40>>2],o[4+(s=(l<<3)+u|0)>>2]=o[D+36>>2],o[s>>2]=c,c=o[x+36>>2],o[s+12>>2]=o[D+40>>2],o[s+8>>2]=c,c=o[x+40>>2],o[s+20>>2]=o[D+40>>2],o[s+16>>2]=c,l=l+3|0;break r}o[4+(c=u+rA|0)>>2]=D,o[c>>2]=s,s=o[x+40>>2],o[4+(c=(l<<3)+u|0)>>2]=D,o[c>>2]=s;break f}if(c){o[4+(c=u+rA|0)>>2]=o[D+36>>2],o[c>>2]=x,o[4+(c=(l<<3)+u|0)>>2]=o[D+40>>2],o[c>>2]=x;break f}Zn[o[o[n+76>>2]+8>>2]](n+76|0,x,D),s=b,c=u}l=E;break A}l=l+1|0}s=b,c=u}if(!l)break}!c|!y||c&&(o[8489]=o[8489]+1,Zn[o[8291]](c))}if(AA=o[A+84>>2],o[AA+8>>2]>0)for(c=0;;){if(e=(u=G(c,12))+o[AA+16>>2]|0,(s=o[e+8>>2])&&(l=o[t+32>>2]+G(o[e>>2],80)|0,b=o[l+64>>2],e=o[r+12>>2],p=w[e+52>>2],Z=w[e+56>>2],g=w[l+48>>2],C=w[l+52>>2],X=w[l+56>>2],U=w[l+4>>2],M=w[l+20>>2],j=w[l+36>>2],H=w[l+8>>2],z=w[l+24>>2],I=w[l+40>>2],$=w[e+20>>2],P=w[e+24>>2],d=w[l>>2],K=w[e+36>>2],B=w[l+16>>2],O=w[e+40>>2],N=w[l+32>>2],h=w[e+48>>2],q=w[e+8>>2],L=w[e>>2],Y=w[e+4>>2],F=w[e+16>>2],V=w[e+32>>2],o[n+172>>2]=0,o[n+156>>2]=0,o[n+140>>2]=0,o[n+124>>2]=0,w[n+144>>2]=m(N*O)+m(m(d*V)+m(K*B)),w[n+128>>2]=m(N*P)+m(m(d*F)+m($*B)),w[n+112>>2]=m(N*q)+m(m(d*L)+m(Y*B)),w[n+152>>2]=m(I*O)+m(m(H*V)+m(K*z)),w[n+148>>2]=m(j*O)+m(m(U*V)+m(K*M)),w[n+136>>2]=m(I*P)+m(m(H*F)+m($*z)),w[n+132>>2]=m(j*P)+m(m(U*F)+m($*M)),w[n+120>>2]=m(I*q)+m(m(H*L)+m(Y*z)),w[n+116>>2]=m(j*q)+m(m(U*L)+m(Y*M)),w[n+168>>2]=Z+m(m(X*O)+m(m(g*V)+m(K*C))),w[n+164>>2]=p+m(m(X*P)+m(m(g*F)+m($*C))),w[n+160>>2]=h+m(m(X*q)+m(m(g*L)+m(Y*C))),e=n+112|0,Zn[o[o[b>>2]+8>>2]](b,e,n+60|0,n+44|0),J=w[i+32>>2],w[n+60>>2]=w[n+60>>2]-J,w[n+64>>2]=w[n+64>>2]-J,w[n+68>>2]=w[n+68>>2]-J,w[n+44>>2]=J+w[n+44>>2],w[n+48>>2]=J+w[n+48>>2],w[n+52>>2]=J+w[n+52>>2],E=o[tA+32>>2]+G(o[4+(u+o[AA+16>>2]|0)>>2],80)|0,b=o[E+64>>2],l=o[f+12>>2],p=w[l+52>>2],Z=w[l+56>>2],g=w[E+48>>2],C=w[E+52>>2],X=w[E+56>>2],U=w[E+4>>2],M=w[E+20>>2],j=w[E+36>>2],H=w[E+8>>2],z=w[E+24>>2],I=w[E+40>>2],$=w[l+20>>2],P=w[l+24>>2],d=w[E>>2],K=w[l+36>>2],B=w[E+16>>2],O=w[l+40>>2],N=w[E+32>>2],h=w[l+48>>2],q=w[l+8>>2],L=w[l>>2],Y=w[l+4>>2],F=w[l+16>>2],V=w[l+32>>2],o[n+172>>2]=0,o[n+156>>2]=0,o[n+140>>2]=0,o[n+124>>2]=0,w[n+144>>2]=m(N*O)+m(m(d*V)+m(K*B)),w[n+128>>2]=m(N*P)+m(m(d*F)+m($*B)),w[n+112>>2]=m(N*q)+m(m(d*L)+m(Y*B)),w[n+152>>2]=m(I*O)+m(m(H*V)+m(K*z)),w[n+148>>2]=m(j*O)+m(m(U*V)+m(K*M)),w[n+136>>2]=m(I*P)+m(m(H*F)+m($*z)),w[n+132>>2]=m(j*P)+m(m(U*F)+m($*M)),w[n+120>>2]=m(I*q)+m(m(H*L)+m(Y*z)),w[n+116>>2]=m(j*q)+m(m(U*L)+m(Y*M)),w[n+168>>2]=Z+m(m(X*O)+m(m(g*V)+m(K*C))),w[n+164>>2]=p+m(m(X*P)+m(m(g*F)+m($*C))),w[n+160>>2]=h+m(m(X*q)+m(m(g*L)+m(Y*C))),Zn[o[o[b>>2]+8>>2]](b,e,n+28|0,n+12|0),d=m(w[n+28>>2]-J),w[n+28>>2]=d,B=m(w[n+32>>2]-J),w[n+32>>2]=B,N=m(w[n+36>>2]-J),w[n+36>>2]=N,p=m(J+w[n+12>>2]),w[n+12>>2]=p,Z=m(J+w[n+20>>2]),w[n+20>>2]=Z,h=m(J+w[n+16>>2]),w[n+16>>2]=h,h>2]|B>w[n+48>>2]|Z>2]|N>w[n+52>>2]||p>2]||d>w[n+44>>2])){if(Zn[o[o[s>>2]>>2]](s),e=o[A+4>>2],Zn[o[o[e>>2]+60>>2]](e,s),e=u+o[AA+16>>2]|0,y=o[e+4>>2],E=o[e>>2],(0|(u=o[A+92>>2]))==o[A+96>>2]&&!((0|(eA=u?u<<1:1))<=(0|u))){if(eA?(o[8488]=o[8488]+1,R=0|Zn[o[8290]](G(eA,12),16),u=o[A+92>>2]):R=0,!((0|u)<=0)){if(l=1&u,b=0,1!=(0|u))for(s=-2&u,u=0;W=(e=G(b,12))+R|0,k=e+o[A+100>>2]|0,e=o[k+4>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,o[W+8>>2]=o[k+8>>2],W=(e=G(1|b,12))+R|0,k=e+o[A+100>>2]|0,e=o[k+4>>2],o[W>>2]=o[k>>2],o[W+4>>2]=e,o[W+8>>2]=o[k+8>>2],b=b+2|0,(0|s)!=(0|(u=u+2|0)););l&&(u=(e=G(b,12))+R|0,b=e+o[A+100>>2]|0,e=o[b+4>>2],o[u>>2]=o[b>>2],o[u+4>>2]=e,o[u+8>>2]=o[b+8>>2])}!(e=o[A+100>>2])||!e|!v[A+104|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+100>>2]=R,a[A+104|0]=1,o[A+96>>2]=eA,u=o[A+92>>2]}e=o[A+100>>2]+G(u,12)|0,o[e+8>>2]=0,o[e+4>>2]=y,o[e>>2]=E,o[A+92>>2]=o[A+92>>2]+1}if(!((0|(c=c+1|0))>2]))break}if(o[A+92>>2]>0)for(b=0;f=o[A+84>>2],r=o[A+100>>2]+G(b,12)|0,Zn[o[o[f>>2]+8>>2]](f,o[r>>2],o[r+4>>2]),(0|(b=b+1|0))>2];);!(r=o[A+100>>2])||!r|!v[A+104|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+100>>2]=0,a[A+104|0]=1,o[A+92>>2]=0,o[A+96>>2]=0}else aA(A,r,f,e,i);S=n+3584|0},function(){return m(m(0))},function(A,r){r|=0;var f,e=0,i=0;if(f=o[84+(A|=0)>>2],(0|(e=o[f+8>>2]))>0)for(A=0;(i=o[8+(o[f+16>>2]+G(A,12)|0)>>2])&&(Zn[o[o[i>>2]+16>>2]](i,r),e=o[f+8>>2]),(0|e)>(0|(A=A+1|0)););},vn,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n,a,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=0,B=0,Z=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=0,C=0,J=m(0),x=m(0),y=m(0),M=0,H=0;S=e=S-256|0,Zn[o[8294]](3795),o[A+4>>2]=o[A+4>>2]+1,i=o[f+36>>2],D=G(i,80),C=o[A+12>>2],a=o[C+4>>2],h=o[64+(D+o[a+32>>2]|0)>>2],f=o[A+8>>2],n=o[r+36>>2],r=o[o[f+4>>2]+32>>2]+G(n,80)|0,B=o[r+64>>2],f=o[f+12>>2],J=w[f+52>>2],x=w[f+56>>2],t=w[f+24>>2],c=w[f+20>>2],b=w[f+40>>2],u=w[f+36>>2],y=w[f+48>>2],l=w[f+8>>2],s=w[f>>2],k=w[f+4>>2],d=w[f+16>>2],v=w[f+32>>2],Z=w[r+32>>2],Q=w[r>>2],E=w[r+16>>2],W=w[r+56>>2],N=w[r+48>>2],p=w[r+52>>2],F=w[r+36>>2],R=w[r+4>>2],Y=w[r+20>>2],V=w[r+40>>2],g=w[r+8>>2],X=w[r+24>>2],r=0,o[e+248>>2]=0,o[e+232>>2]=0,o[e+216>>2]=0,w[e+228>>2]=m(V*b)+m(m(g*v)+m(u*X)),w[e+224>>2]=m(F*b)+m(m(R*v)+m(u*Y)),w[e+212>>2]=m(V*t)+m(m(g*d)+m(c*X)),w[e+208>>2]=m(F*t)+m(m(R*d)+m(c*Y)),w[e+244>>2]=x+m(m(W*b)+m(m(N*v)+m(u*p))),w[e+240>>2]=J+m(m(W*t)+m(m(N*d)+m(c*p))),o[e+200>>2]=0,w[e+220>>2]=m(Z*b)+m(m(Q*v)+m(u*E)),w[e+204>>2]=m(Z*t)+m(m(Q*d)+m(c*E)),w[e+196>>2]=m(V*l)+m(m(g*s)+m(k*X)),w[e+192>>2]=m(F*l)+m(m(R*s)+m(k*Y)),w[e+188>>2]=m(Z*l)+m(m(Q*s)+m(k*E)),w[e+236>>2]=y+m(m(W*l)+m(m(N*s)+m(k*p))),f=o[C+12>>2],J=w[f+52>>2],x=w[f+56>>2],t=w[f+24>>2],c=w[f+20>>2],b=w[f+40>>2],u=w[f+36>>2],y=w[f+48>>2],l=w[f+8>>2],s=w[f>>2],k=w[f+4>>2],d=w[f+16>>2],v=w[f+32>>2],f=o[a+32>>2]+D|0,Z=w[f+32>>2],Q=w[f>>2],E=w[f+16>>2],W=w[f+56>>2],N=w[f+48>>2],p=w[f+52>>2],F=w[f+36>>2],R=w[f+4>>2],Y=w[f+20>>2],V=w[f+40>>2],g=w[f+8>>2],X=w[f+24>>2],o[e+184>>2]=0,o[e+168>>2]=0,o[e+152>>2]=0,w[e+164>>2]=m(V*b)+m(m(g*v)+m(u*X)),w[e+160>>2]=m(F*b)+m(m(R*v)+m(u*Y)),w[e+148>>2]=m(V*t)+m(m(g*d)+m(c*X)),w[e+144>>2]=m(F*t)+m(m(R*d)+m(c*Y)),w[e+180>>2]=x+m(m(W*b)+m(m(N*v)+m(u*p))),w[e+176>>2]=J+m(m(W*t)+m(m(N*d)+m(c*p))),o[e+136>>2]=0,w[e+156>>2]=m(Z*b)+m(m(Q*v)+m(u*E)),w[e+140>>2]=m(Z*t)+m(m(Q*d)+m(c*E)),w[e+132>>2]=m(V*l)+m(m(g*s)+m(k*X)),w[e+128>>2]=m(F*l)+m(m(R*s)+m(k*Y)),w[e+124>>2]=m(Z*l)+m(m(Q*s)+m(k*E)),w[e+172>>2]=y+m(m(W*l)+m(m(N*s)+m(k*p))),Zn[o[o[B>>2]+8>>2]](B,e+188|0,e+108|0,e+92|0),Zn[o[o[h>>2]+8>>2]](h,e+124|0,e+76|0,e+60|0),t=w[o[A+24>>2]+32>>2],c=m(w[e+108>>2]-t),w[e+108>>2]=c,w[e+112>>2]=w[e+112>>2]-t,w[e+116>>2]=w[e+116>>2]-t,w[e+92>>2]=t+w[e+92>>2],w[e+96>>2]=t+w[e+96>>2],w[e+100>>2]=t+w[e+100>>2];A:{if(f=o[8497]){if(!(0|Zn[0|f](B,h)))break A;c=w[e+108>>2]}if(r=c>w[e+60>>2]|w[e+92>>2]>2]?r:1,f=0,!(1^(w[e+100>>2]>2]|w[e+116>>2]>w[e+68>>2]?f:r)|w[e+96>>2]>2]|w[e+112>>2]>w[e+64>>2])){r=o[A+8>>2],f=o[r+8>>2],o[e+56>>2]=n,o[e+52>>2]=-1,o[e+44>>2]=f,o[e+40>>2]=B,o[e+36>>2]=r,o[e+48>>2]=e+188,r=o[A+12>>2],f=o[r+8>>2],o[e+32>>2]=i,o[e+28>>2]=-1,o[e+20>>2]=f,o[e+16>>2]=h,o[e+12>>2]=r,o[e+24>>2]=e+124,r=o[A+28>>2],o[8500]=o[8500]+1,f=G((f=~((f=i<<16|n)<<15)+f|0)>>>10^f,9),f=~((f^=f>>>6)<<11)+f|0;r:{if(!((0|(f=o[r+12>>2]-1&(f>>>16^f)))>=o[r+28>>2])&&-1!=(0|(f=o[o[r+36>>2]+(f<<2)>>2])))for(h=o[r+56>>2],B=o[r+16>>2];;){if(r=B+G(f,12)|0,o[r>>2]==(0|n)&o[r+4>>2]==(0|i))break r;if(-1==(0|(f=o[h+(f<<2)>>2])))break}r=0}w[o[A+24>>2]+32>>2]>m(0)?(r=o[A+16>>2],r=0|Zn[o[o[r>>2]+8>>2]](r,e+36|0,e+12|0,0,2)):r?r=o[r+8>>2]:(r=o[A+16>>2],r=0|Zn[o[o[r>>2]+8>>2]](r,e+36|0,e+12|0,o[A+32>>2],1),f=o[A+28>>2],M=0|Zn[o[o[f>>2]+12>>2]](f,n,i),H=r,o[M+8>>2]=H),f=o[A+24>>2],h=o[f+8>>2],B=o[f+12>>2],D=e+12|0,o[f+12>>2]=D,C=e+36|0,o[f+8>>2]=C,Zn[o[o[f>>2]+8>>2]](f,-1,n),f=o[A+24>>2],Zn[o[o[f>>2]+12>>2]](f,-1,i),Zn[o[o[r>>2]+8>>2]](r,C,D,o[A+20>>2],o[A+24>>2]),A=o[A+24>>2],o[A+8>>2]=h,o[A+12>>2]=B}}Zn[o[8295]](),S=e+256|0},dn,en,vn,$,pe,function(A){pe(A|=0),DA(A)},function(A,r,f,e,i){r|=0,f|=0,e|=0,i|=0;var n,a=0,t=0,c=0,b=0;S=n=S-160|0,(a=o[12+(A|=0)>>2])&&(t=o[f+4>>2],c=o[r+4>>2],o[i+4>>2]=a,o[n+152>>2]=1566444395,r=o[r+12>>2],a=o[r+12>>2],o[n+32>>2]=o[r+8>>2],o[n+36>>2]=a,a=o[r+4>>2],o[n+24>>2]=o[r>>2],o[n+28>>2]=a,a=o[r+28>>2],o[n+48>>2]=o[r+24>>2],o[n+52>>2]=a,a=o[r+20>>2],o[n+40>>2]=o[r+16>>2],o[n+44>>2]=a,b=o[r+44>>2],o[(a=n- -64|0)>>2]=o[r+40>>2],o[a+4>>2]=b,a=o[r+36>>2],o[n+56>>2]=o[r+32>>2],o[n+60>>2]=a,a=o[r+60>>2],o[n+80>>2]=o[r+56>>2],o[n+84>>2]=a,a=o[r+52>>2],o[n+72>>2]=o[r+48>>2],o[n+76>>2]=a,r=o[f+12>>2],f=o[r+12>>2],o[n+96>>2]=o[r+8>>2],o[n+100>>2]=f,f=o[r+4>>2],o[n+88>>2]=o[r>>2],o[n+92>>2]=f,f=o[r+20>>2],o[n+104>>2]=o[r+16>>2],o[n+108>>2]=f,f=o[r+28>>2],o[n+112>>2]=o[r+24>>2],o[n+116>>2]=f,f=o[r+36>>2],o[n+120>>2]=o[r+32>>2],o[n+124>>2]=f,f=o[r+44>>2],o[n+128>>2]=o[r+40>>2],o[n+132>>2]=f,f=o[r+52>>2],o[n+136>>2]=o[r+48>>2],o[n+140>>2]=f,f=o[r+60>>2],o[n+144>>2]=o[r+56>>2],o[n+148>>2]=f,o[8+(r=n+12|0)>>2]=t,o[r+4>>2]=c,o[r>>2]=16628,$(r,n+24|0,i,o[e+20>>2],0),v[A+8|0]&&(A=o[i+4>>2],o[A+844>>2]&&(r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),a=A,A=o[o[i+12>>2]+8>>2],OA(a,(r?f:A)+4|0,(r?A:e)+4|0)))),S=n+160|0},ei,Lr,Fe,function(A){Fe(A|=0),DA(A)},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=0,a=m(0),t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0,d=m(0),h=0,B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=0,$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=m(0),nA=m(0),aA=m(0),tA=m(0),oA=m(0),cA=0,bA=0,uA=m(0),lA=m(0),sA=0,kA=m(0);if(S=e=S-48|0,o[A+12>>2]){if(k=v[A+16|0],n=o[(u=k?f:r)+12>>2],Y=w[n+56>>2],V=w[n+52>>2],g=w[n+48>>2],k=o[(h=k?r:f)+12>>2],X=w[k+56>>2],aA=w[k+48>>2],D=w[k+52>>2],u=o[u+4>>2],F=w[n+32>>2],C=w[n+16>>2],J=w[n>>2],x=w[n+36>>2],s=w[n+20>>2],G=w[n+4>>2],t=w[k+40>>2],b=w[k+24>>2],a=w[k+8>>2],c=w[k+32>>2],d=w[k+16>>2],Z=w[k>>2],E=w[k+36>>2],l=w[n+40>>2],W=w[k+20>>2],M=w[n+24>>2],R=w[k+4>>2],H=w[n+8>>2],k=o[h+4>>2],I=w[(L=k- -64|0)>>2],p=w[k+56>>2],T=w[k+60>>2],o[e+28>>2]=0,K=m(m(c*l)+m(m(Z*H)+m(M*d))),p=m(-p),q=m(m(E*l)+m(m(R*H)+m(M*W))),l=m(m(t*l)+m(m(a*H)+m(M*b))),w[e+24>>2]=m(m(K*p)-m(T*q))-m(I*l),M=m(m(c*x)+m(m(Z*G)+m(s*d))),H=m(m(E*x)+m(m(R*G)+m(s*W))),_=m(m(t*x)+m(m(a*G)+m(s*b))),w[e+20>>2]=m(m(M*p)-m(T*H))-m(I*_),AA=m(m(c*F)+m(m(Z*J)+m(C*d))),B=T,T=m(m(E*F)+m(m(R*J)+m(C*W))),tA=I,I=m(m(t*F)+m(m(a*J)+m(C*b))),w[e+16>>2]=m(m(AA*p)-m(B*T))-m(tA*I),Zn[o[o[u>>2]+64>>2]](e+32|0,u,e+16|0),n=o[h+12>>2],p=w[n+48>>2],P=w[n+32>>2],O=w[n+16>>2],B=w[n+8>>2],j=w[n+4>>2],U=w[n>>2],z=w[n+56>>2],y=w[n+52>>2],$=w[n+40>>2],rA=w[n+36>>2],oA=w[n+24>>2],fA=w[n+20>>2],eA=w[k+72>>2],x=w[L>>2],s=w[k+56>>2],G=w[k+60>>2],F=w[e+40>>2],C=w[e+32>>2],J=w[e+36>>2],n=o[A+12>>2],iA=w[n+848>>2],o[i+4>>2]=n,nA=m(m(Y*t)+m(m(g*a)+m(V*b))),tA=a,a=m(-aA),l=m(m(nA+m(m(m(tA*a)-m(b*D))-m(t*X)))+m(m(F*l)+m(m(C*I)+m(_*J)))),d=m(m(m(m(Y*c)+m(m(g*Z)+m(V*d)))+m(m(m(Z*a)-m(d*D))-m(c*X)))+m(m(F*K)+m(m(C*AA)+m(M*J)))),Z=m(m(m(m(Y*E)+m(m(g*R)+m(V*W)))+m(m(m(R*a)-m(W*D))-m(E*X)))+m(m(F*q)+m(m(C*T)+m(H*J)))),(t=m(m(m(x*l)+m(m(s*d)+m(G*Z)))-eA))>2],E=w[n+24>>2],W=w[n+20>>2],R=w[n+40>>2],Y=w[n+36>>2],V=w[n+16>>2],g=w[n+32>>2],b=w[k+64>>2],X=w[n+8>>2],a=w[k+56>>2],D=w[n>>2],c=w[k+60>>2],F=w[n+4>>2],o[e+28>>2]=0,w[e+16>>2]=m(X*b)+m(m(D*a)+m(F*c)),w[e+24>>2]=m(R*b)+m(m(g*a)+m(c*Y)),w[e+20>>2]=m(E*b)+m(m(V*a)+m(c*W)),o[e+12>>2]=0,b=m(l-m(x*t)),a=m(d-m(s*t)),c=m(Z-m(G*t)),w[e+8>>2]=m(m(b*$)+m(m(a*P)+m(c*rA)))+z,w[e+4>>2]=m(m(b*oA)+m(m(a*O)+m(c*fA)))+y,w[e>>2]=m(m(b*B)+m(m(a*U)+m(j*c)))+p,Zn[o[o[i>>2]+16>>2]](i,e+16|0,e,t)),!(o[u+4>>2]>6|o[o[i+4>>2]+844>>2]>=o[A+24>>2]||(b=w[k+64>>2],m(Q(b))>m(.7071067690849304)?(t=w[k+60>>2],a=m(m(1)/m(N(m(m(t*t)+m(b*b))))),t=m(t*a),b=m(a*m(-b)),a=m(0)):(t=w[k+56>>2],a=w[k+60>>2],c=m(m(1)/m(N(m(m(t*t)+m(a*a))))),b=m(t*c),t=m(0),a=m(c*m(-a))),L=0,c=m(Zn[o[o[u>>2]+16>>2]](u)),d=Kr(c=(c=m(w[8297]/c))>m(.39269909262657166)?m(.19634954631328583):m(c*m(.5))),n=o[A+20>>2],M=$r(c),(0|n)<=0)))for(B=t,t=m(d/m(N(m(m(t*t)+m(m(a*a)+m(b*b)))))),H=m(B*t),I=m(b*t),T=m(a*t);b=w[k+60>>2],c=w[k+56>>2],t=w[k+64>>2],a=m(m(m(m(6.2831854820251465)/m(0|n))*m(0|L))*m(.5)),d=m(Kr(a)/m(N(m(m(t*t)+m(m(c*c)+m(b*b)))))),t=m(t*d),b=m(b*d),a=$r(a),c=m(c*d),d=m(m(t*H)+m(m(b*I)+m(m(a*M)+m(T*c)))),Z=m(m(t*I)+m(m(m(a*T)-m(M*c))-m(b*H))),E=m(m(c*H)+m(m(m(a*I)-m(M*b))-m(t*T))),W=m(m(b*T)+m(m(m(a*H)-m(M*t))-m(c*I))),w[e+28>>2]=m(m(m(d*a)-m(c*Z))-m(E*b))-m(W*t),w[e+24>>2]=m(m(Z*b)+m(m(d*t)+m(a*W)))-m(E*c),w[e+20>>2]=m(m(W*c)+m(m(d*b)+m(a*E)))-m(Z*t),w[e+16>>2]=m(m(E*t)+m(m(d*c)+m(a*Z)))-m(W*b),S=n=S-48|0,h=v[A+16|0],u=o[(cA=h?f:r)+12>>2],aA=w[u+56>>2],K=w[u+52>>2],q=w[u+48>>2],h=o[(bA=h?r:f)+12>>2],_=w[h+56>>2],rA=w[h+48>>2],AA=w[h+52>>2],cA=o[cA+4>>2],t=w[h+40>>2],b=w[h+8>>2],a=w[h+24>>2],c=w[h+32>>2],d=w[h>>2],Z=w[h+16>>2],E=w[h+36>>2],Y=w[u+40>>2],V=w[u+32>>2],g=w[u+36>>2],W=w[h+4>>2],X=w[u+8>>2],D=w[u>>2],F=w[u+4>>2],R=w[h+20>>2],C=w[u+24>>2],J=w[u+16>>2],x=w[u+20>>2],G=w[e+28>>2],p=w[e+24>>2],s=w[e+16>>2],l=w[e+20>>2],h=o[bA+4>>2],P=w[(sA=h- -64|0)>>2],oA=w[h+56>>2],O=w[h+60>>2],o[n+28>>2]=0,B=m(m(2)/m(m(G*G)+m(m(p*p)+m(m(s*s)+m(l*l))))),y=m(s*B),fA=m(s*y),j=m(l*B),eA=m(l*j),U=m(m(1)-m(fA+eA)),B=m(p*B),iA=m(s*B),nA=m(G*j),z=m(iA+nA),uA=m(l*B),lA=m(G*y),l=m(uA-lA),y=m(m(Y*U)+m(m(V*z)+m(g*l))),$=m(m(U*X)+m(m(z*D)+m(F*l))),l=m(m(U*C)+m(m(z*J)+m(x*l))),U=m(-oA),w[n+24>>2]=m(m(m(m(c*y)+m(m(d*$)+m(Z*l)))*U)-m(O*m(m(E*y)+m(m(W*$)+m(R*l)))))-m(P*m(m(t*y)+m(m(b*$)+m(a*l)))),l=m(uA+lA),j=m(s*j),z=m(G*B),s=m(j-z),y=m(p*B),G=m(m(1)-m(fA+y)),p=m(m(Y*l)+m(m(V*s)+m(g*G))),B=m(m(l*X)+m(m(s*D)+m(F*G))),s=m(m(l*C)+m(m(s*J)+m(x*G))),w[n+20>>2]=m(m(m(m(c*p)+m(m(d*B)+m(Z*s)))*U)-m(O*m(m(E*p)+m(m(W*B)+m(R*s)))))-m(P*m(m(t*p)+m(m(b*B)+m(a*s)))),s=m(iA-nA),G=m(m(1)-m(eA+y)),l=m(j+z),p=m(m(Y*s)+m(m(V*G)+m(g*l))),B=m(m(s*X)+m(m(G*D)+m(F*l))),s=m(m(s*C)+m(m(G*J)+m(x*l))),w[n+16>>2]=m(m(m(m(c*p)+m(m(d*B)+m(Z*s)))*U)-m(O*m(m(E*p)+m(m(W*B)+m(R*s)))))-m(P*m(m(t*p)+m(m(b*B)+m(a*s)))),Zn[o[o[cA>>2]+64>>2]](n+32|0,cA,n+16|0),u=o[bA+12>>2],j=w[u+48>>2],U=w[u+32>>2],z=w[u+16>>2],y=w[u+8>>2],$=w[u+4>>2],oA=w[u>>2],fA=w[u+56>>2],eA=w[u+52>>2],iA=w[u+40>>2],nA=w[u+36>>2],uA=w[u+24>>2],lA=w[u+20>>2],kA=w[h+72>>2],p=w[sA>>2],P=w[h+56>>2],O=w[h+60>>2],s=w[n+40>>2],G=w[n+32>>2],l=w[n+36>>2],u=o[A+12>>2],B=w[u+848>>2],o[i+4>>2]=u,tA=B,B=m(-rA),rA=m(m(m(m(aA*t)+m(m(q*b)+m(K*a)))+m(m(m(b*B)-m(a*AA))-m(t*_)))+m(m(s*m(m(Y*t)+m(m(X*b)+m(C*a))))+m(m(G*m(m(V*t)+m(m(D*b)+m(J*a))))+m(l*m(m(g*t)+m(m(F*b)+m(x*a))))))),d=m(m(m(m(aA*c)+m(m(q*d)+m(K*Z)))+m(m(m(d*B)-m(Z*AA))-m(c*_)))+m(m(s*m(m(Y*c)+m(m(X*d)+m(C*Z))))+m(m(G*m(m(V*c)+m(m(D*d)+m(J*Z))))+m(l*m(m(g*c)+m(m(F*d)+m(x*Z))))))),Z=m(m(m(m(aA*E)+m(m(q*W)+m(K*R)))+m(m(m(W*B)-m(R*AA))-m(E*_)))+m(m(s*m(m(Y*E)+m(m(X*W)+m(C*R))))+m(m(G*m(m(V*E)+m(m(D*W)+m(J*R))))+m(l*m(m(g*E)+m(m(F*W)+m(x*R))))))),tA>(t=m(m(m(p*rA)+m(m(P*d)+m(O*Z)))-kA))&&(u=o[bA+12>>2],E=w[u+24>>2],W=w[u+20>>2],R=w[u+40>>2],Y=w[u+36>>2],V=w[u+16>>2],g=w[u+32>>2],b=w[h+64>>2],X=w[u+8>>2],a=w[h+56>>2],D=w[u>>2],c=w[h+60>>2],F=w[u+4>>2],o[n+28>>2]=0,w[n+16>>2]=m(X*b)+m(m(D*a)+m(F*c)),w[n+24>>2]=m(R*b)+m(m(g*a)+m(c*Y)),w[n+20>>2]=m(E*b)+m(m(V*a)+m(c*W)),o[n+12>>2]=0,b=m(rA-m(p*t)),a=m(d-m(P*t)),c=m(Z-m(O*t)),w[n+8>>2]=m(m(b*iA)+m(m(a*U)+m(c*nA)))+fA,w[n+4>>2]=m(m(b*uA)+m(m(a*z)+m(c*lA)))+eA,w[n>>2]=m(m(b*y)+m(m(a*oA)+m($*c)))+j,Zn[o[o[i>>2]+16>>2]](i,n+16|0,n,t)),S=n+48|0,(0|(n=o[A+20>>2]))>(0|(L=L+1|0)););!v[A+8|0]|!o[o[A+12>>2]+844>>2]||(A=o[i+4>>2],o[A+844>>2]&&(r=(0|(f=o[A+836>>2]))==(0|(n=o[o[i+8>>2]+8>>2])),u=A,A=o[o[i+12>>2]+8>>2],OA(u,(r?f:A)+4|0,(r?A:n)+4|0)))}S=e+48|0},ei,Lr,cr,function(A){cr(A|=0),DA(A)},ji,yi,function(A,r,f){var e;if(A|=0,!((e=8!=(0|(r|=0)))|8!=(0|(f|=0))))return o[A+56>>2];if(!(1!=(0|f)|e))return o[A+72>>2];if(!(1!=(0|r)|8!=(0|f)))return o[A+76>>2];if(!(r|f))return o[A+68>>2];if(!(28!=(0|f)|(0|r)>19))return o[A+84>>2];if(!(28!=(0|r)|(0|f)>19))return o[A+80>>2];A:{if((0|r)<=19){if((0|f)<=19)return o[A+28>>2];if(f-21>>>0>8)break A;return o[A+32>>2]}if(!((0|f)>19|r-21>>>0>8))return o[A+36>>2];if(31==(0|r))return 31==(0|f)?o[A+44>>2]:o[A+40>>2]}return 31==(0|f)?o[A+48>>2]:o[A+52>>2]},function(A,r,f){var e;if(A|=0,!((e=8!=(0|(r|=0)))|8!=(0|(f|=0))))return o[A+56>>2];if(!(1!=(0|f)|e))return o[A+72>>2];if(!(1!=(0|r)|8!=(0|f)))return o[A+76>>2];if(!(28!=(0|f)|(0|r)>19))return o[A+84>>2];if(!(28!=(0|r)|(0|f)>19))return o[A+80>>2];A:{if((0|r)<=19){if((0|f)<=19)return o[A+28>>2];if(f-21>>>0>8)break A;return o[A+32>>2]}if(!((0|f)>19|r-21>>>0>8))return o[A+36>>2];if(31==(0|r))return 31==(0|f)?o[A+44>>2]:o[A+40>>2]}return 31==(0|f)?o[A+48>>2]:o[A+52>>2]},en,vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],0|zf(0|Zn[o[o[A>>2]+56>>2]](A,80),r,f,e,0)},vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],0|zf(0|Zn[o[o[A>>2]+56>>2]](A,80),r,f,e,1)},vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],0|Uf(0|Zn[o[o[A>>2]+56>>2]](A,84),r,f,e,0)},vn,function(A,r,f,e){A|=0,f|=0,e|=0;var i,n=0,t=0,c=0,b=0,u=0,l=0,s=0;if(A=o[(r|=0)>>2],r=Uf(0|Zn[o[o[A>>2]+56>>2]](A,116),r,f,e,0),o[r>>2]=16464,a[r+104|0]=1,o[r+100>>2]=0,o[r+92>>2]=0,o[r+96>>2]=0,o[8488]=o[8488]+1,A=0|Zn[o[8290]](64,16),a[A+20|0]=1,o[A>>2]=17912,o[A+16>>2]=0,a[A+40|0]=1,o[A+8>>2]=0,o[A+12>>2]=0,o[A+36>>2]=0,a[A+60|0]=1,o[A+28>>2]=0,o[A+32>>2]=0,o[A+56>>2]=0,o[A+48>>2]=0,o[A+52>>2]=0,o[8488]=o[8488]+1,i=0|Zn[o[8290]](24,16),!((0|(c=o[A+8>>2]))<=0)){if(1!=(0|c))for(s=-2&c;b=(n=G(t,12))+o[A+16>>2]|0,u=o[b+4>>2],o[(n=n+i|0)>>2]=o[b>>2],o[n+4>>2]=u,o[n+8>>2]=o[b+8>>2],b=(n=G(1|t,12))+o[A+16>>2]|0,u=o[b+4>>2],o[(n=n+i|0)>>2]=o[b>>2],o[n+4>>2]=u,o[n+8>>2]=o[b+8>>2],t=t+2|0,(0|s)!=(0|(l=l+2|0)););1&c&&(t=(c=G(t,12))+o[A+16>>2]|0,b=o[t+4>>2],o[(c=c+i|0)>>2]=o[t>>2],o[c+4>>2]=b,o[c+8>>2]=o[t+8>>2])}return!(t=o[A+16>>2])||!t|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](t)),o[A+16>>2]=i,a[A+20|0]=1,o[A+12>>2]=2,Ar(A),o[r+84>>2]=A,o[r+108>>2]=o[o[f+4>>2]+76>>2],o[r+112>>2]=o[o[e+4>>2]+76>>2],0|r},vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],0|Uf(0|Zn[o[o[A>>2]+56>>2]](A,84),r,f,e,1)},vn,function(A,r){return A|=0,A=o[(r|=0)>>2],A=0|Zn[o[o[A>>2]+56>>2]](A,8),o[A>>2]=15064,o[A+4>>2]=o[r>>2],o[A>>2]=17852,0|A},vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],A=0|Zn[o[o[A>>2]+56>>2]](A,16),o[A>>2]=15064,o[A+4>>2]=o[r>>2],o[A>>2]=15092,o[A+12>>2]=0,a[A+8|0]=0,o[A>>2]=18036,r=o[A+4>>2],r=0|Zn[o[o[r>>2]+12>>2]](r,o[f+8>>2],o[e+8>>2]),a[A+8|0]=1,o[A+12>>2]=r,0|A},vn,function(A,r,f,e){A|=0,f|=0,e|=0;var i,n=0;return n=o[(r|=0)>>2],n=0|Zn[o[o[n>>2]+56>>2]](n,20),i=o[r+4>>2],A=v[A+4|0],o[n>>2]=15064,o[n+4>>2]=o[r>>2],o[n>>2]=15092,a[n+16|0]=A,o[n+12>>2]=i,a[n+8|0]=0,o[n>>2]=18112,i||(A=o[n+4>>2],A=0|Zn[o[o[A>>2]+12>>2]](A,o[f+8>>2],o[e+8>>2]),a[n+8|0]=1,o[n+12>>2]=A),0|n},vn,function(A,r,f,e){return A|=0,f|=0,e|=0,A=o[(r|=0)>>2],A=0|Zn[o[o[A>>2]+56>>2]](A,16),o[A>>2]=15064,o[A+4>>2]=o[r>>2],o[A>>2]=15092,o[A+12>>2]=0,a[A+8|0]=0,o[A>>2]=16728,r=o[A+4>>2],0|Zn[o[o[r>>2]+24>>2]](r,o[f+8>>2],o[e+8>>2])&&(r=o[A+4>>2],r=0|Zn[o[o[r>>2]+12>>2]](r,o[f+8>>2],o[e+8>>2]),a[A+8|0]=1,o[A+12>>2]=r),0|A},vn,function(A,r,f,e){A|=0,f|=0,e|=0;var i,n,t=0;return t=o[(r|=0)>>2],t=0|Zn[o[o[t>>2]+56>>2]](t,28),i=v[A+4|0],n=o[A+8>>2],A=o[A+12>>2],o[t>>2]=15064,o[t+4>>2]=o[r>>2],o[t+24>>2]=A,o[t+20>>2]=n,a[t+16|0]=i,o[t+12>>2]=0,a[t+8|0]=0,o[t>>2]=16800,A=o[t+4>>2],r=i?e:f,f=i?f:e,0|Zn[o[o[A>>2]+24>>2]](A,o[r+8>>2],o[f+8>>2])&&(A=o[t+4>>2],A=0|Zn[o[o[A>>2]+12>>2]](A,o[r+8>>2],o[f+8>>2]),a[t+8|0]=1,o[t+12>>2]=A),0|t},vn,function(){},ei,dn,Vf,function(A){Vf(A|=0),DA(A)},function(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=0,a=0,t=0,c=0,b=0,u=0,l=0;o[8498]=o[8498]+1,e=o[A+36>>2],i=G((i=~((i=f<<16|r)<<15)+i|0)>>>10^i,9),i=~((i^=i>>>6)<<11)+i|0,b=e+((o[A+12>>2]-1&(i>>>16^i))<<2)|0;A:if(-1!=(0|(i=o[b>>2]))){for(a=o[A+56>>2],t=o[A+16>>2],n=i;;){if(u=t+G(n,12)|0,!(o[u>>2]==(0|r)&o[u+4>>2]==(0|f))){if(-1!=(0|(n=o[(n<<2)+a>>2])))continue;break A}break}l=o[8+(t+G(n,12)|0)>>2];r:{if((0|i)!=(0|n)){for(;(0|n)!=(0|(i=o[((r=i)<<2)+a>>2])););if(-1!=(0|r)){o[(r<<2)+a>>2]=o[(n<<2)+a>>2];break r}}o[b>>2]=o[(n<<2)+a>>2]}if((0|(c=o[A+8>>2]-1|0))!=(0|n)){r:{if(t=t+G(c,12)|0,r=o[t+4>>2]<<16|o[t>>2],r=G((r=~(r<<15)+r|0)>>>10^r,9),r=~((r^=r>>>6)<<11)+r|0,b=o[A+12>>2]-1&(r>>>16^r),(0|c)!=(0|(r=o[(i=e+(b<<2)|0)>>2]))){for(;f=r,(0|c)!=(0|(r=o[(r<<2)+a>>2])););if(-1!=(0|f)){o[(f<<2)+a>>2]=o[(c<<2)+a>>2];break r}}o[i>>2]=o[(c<<2)+a>>2]}r=o[t+4>>2],o[u>>2]=o[t>>2],o[u+4>>2]=r,o[u+8>>2]=o[t+8>>2],r=o[A+36>>2]+(b<<2)|0,o[o[A+56>>2]+(n<<2)>>2]=o[r>>2],o[r>>2]=n,n=o[A+8>>2]-1|0}o[A+8>>2]=n}return 0|l},function(A,r,f){A|=0,r|=0,f|=0;var e,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0;o[8499]=o[8499]+1,i=G((i=~((i=f<<16|r)<<15)+i|0)>>>10^i,9),s=(e=(i=~((i^=i>>>6)<<11)+i|0)>>>16^i)&(i=o[A+12>>2])-1;A:{if(-1!=(0|(n=o[o[A+36>>2]+(s<<2)>>2])))for(u=o[A+56>>2],l=o[A+16>>2];;){if(t=l+G(n,12)|0,o[t>>2]==(0|r)&o[t+4>>2]==(0|f))break A;if(-1==(0|(n=o[u+(n<<2)>>2])))break}r:{f:{if((0|(t=u=o[A+8>>2]))==(0|i)){if(!(d=(0|(l=i?i<<1:1))<=(0|i)))break f}else i=t;o[A+8>>2]=i+1,t=o[A+16>>2];break r}if(l?(o[8488]=o[8488]+1,t=0|Zn[o[8290]](G(l,12),16),i=o[A+8>>2]):t=0,!((0|i)<=0)){if(n=0,1!=(0|i))for(B=-2&i;b=(c=G(n,12))+o[A+16>>2]|0,k=o[b+4>>2],o[(c=t+c|0)>>2]=o[b>>2],o[c+4>>2]=k,o[c+8>>2]=o[b+8>>2],b=(c=G(1|n,12))+o[A+16>>2]|0,k=o[b+4>>2],o[(c=t+c|0)>>2]=o[b>>2],o[c+4>>2]=k,o[c+8>>2]=o[b+8>>2],n=n+2|0,(0|B)!=(0|(h=h+2|0)););1&i&&(i=(n=G(n,12))+t|0,n=n+o[A+16>>2]|0,b=o[n+4>>2],o[i>>2]=o[n>>2],o[i+4>>2]=b,o[i+8>>2]=o[n+8>>2])}!(i=o[A+16>>2])||!i|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+16>>2]=t,a[A+20|0]=1,o[A+12>>2]=l,o[A+8>>2]=o[A+8>>2]+1,d||(Ar(A),s=o[A+12>>2]-1&e)}t=G(u,12)+t|0,o[t+8>>2]=0,o[t+4>>2]=f,o[t>>2]=r,r=o[A+56>>2]+(u<<2)|0,A=o[A+36>>2]+(s<<2)|0,o[r>>2]=o[A>>2],o[A>>2]=u}return 0|t},yi,vn,function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e);var i,n=m(0),a=0,t=m(0),c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=0,d=0,h=m(0),B=0,Z=0,E=0,W=0,p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=0,X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=0;if(S=i=S-208|0,!(w[o[A+4>>2]+848>>2]>2],u=m(m(w[r+8>>2]*e)+h),F=w[f+4>>2],t=m(m(w[r+4>>2]*e)+F),R=w[f>>2],l=m(m(w[r>>2]*e)+R),Z=o[A+8>>2],a=o[Z+8>>2],B=o[A+4>>2],(E=(0|a)==(0|(c=o[B+836>>2])))?(n=m(u-w[c+60>>2]),s=m(l-w[c+52>>2]),b=m(t-w[c+56>>2]),Y=m(m(w[c+44>>2]*n)+m(m(w[c+12>>2]*s)+m(b*w[c+28>>2]))),V=m(m(w[c+40>>2]*n)+m(m(w[c+8>>2]*s)+m(b*w[c+24>>2]))),d=o[A+12>>2],a=o[d+8>>2],n=m(m(w[c+36>>2]*n)+m(m(w[c+4>>2]*s)+m(b*w[c+20>>2])))):(d=o[A+12>>2],c=o[d+8>>2],n=m(u-w[c+60>>2]),s=m(l-w[c+52>>2]),b=m(t-w[c+56>>2]),Y=m(m(w[c+44>>2]*n)+m(m(w[c+12>>2]*s)+m(b*w[c+28>>2]))),V=m(m(w[c+40>>2]*n)+m(m(w[c+8>>2]*s)+m(b*w[c+24>>2]))),n=m(m(w[c+36>>2]*n)+m(m(w[c+4>>2]*s)+m(b*w[c+20>>2])))),g=o[B+844>>2],X=w[a+20>>2],D=w[a+36>>2],C=w[a+40>>2],J=w[a+8>>2],x=w[a+24>>2],s=w[a+44>>2],b=w[a+60>>2],y=w[a+12>>2],M=w[a+52>>2],H=w[a+28>>2],I=w[a+56>>2],T=w[a+4>>2],o[i+28>>2]=0,p=s,s=m(h-b),b=m(R-M),h=m(F-I),w[i+24>>2]=m(p*s)+m(m(y*b)+m(H*h)),w[i+20>>2]=m(C*s)+m(m(J*b)+m(h*x)),o[i+12>>2]=0,w[i+8>>2]=Y,w[i+4>>2]=V,w[i>>2]=n,w[i+16>>2]=m(D*s)+m(m(T*b)+m(h*X)),a=o[r+12>>2],o[i+72>>2]=o[r+8>>2],o[i+76>>2]=a,a=o[r>>2],r=o[r+4>>2],o[i+92>>2]=0,o[i+96>>2]=0,o[i+124>>2]=0,o[i+128>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+140>>2]=0,o[i+144>>2]=0,o[i+148>>2]=0,o[i+152>>2]=0,o[i+156>>2]=0,o[i+160>>2]=0,o[i+164>>2]=0,w[i+52>>2]=t,w[i+56>>2]=u,o[i+60>>2]=0,o[i+64>>2]=a,o[i+68>>2]=r,o[i+84>>2]=0,o[i+88>>2]=0,w[i+80>>2]=e,o[i+116>>2]=0,o[i+120>>2]=0,w[i+48>>2]=l,r=o[f+12>>2],o[i+40>>2]=o[f+8>>2],o[i+44>>2]=r,r=o[f+4>>2],o[i+32>>2]=o[f>>2],o[i+36>>2]=r,r=(r=o[Z>>2])||Z,a=(f=o[d>>2])||d,E?(k=A+28|0,f=A+24|0,W=A+16|0,c=a,a=r,r=A+20|0):(k=A+24|0,f=A+28|0,W=A+20|0,c=r,r=A+16|0),a=o[a+4>>2],W=o[W>>2],U=o[r>>2],r=o[f>>2],f=o[k>>2],k=o[c+4>>2],o[i+204>>2]=k,o[i+112>>2]=f,o[i+108>>2]=r,o[i+104>>2]=U,o[i+100>>2]=W,o[i+200>>2]=a,31==o[a+4>>2]&&(a=o[64+(o[a+32>>2]+G(r,80)|0)>>2],o[i+200>>2]=a),31==o[k+4>>2]&&(k=o[64+(o[k+32>>2]+G(f,80)|0)>>2],o[i+204>>2]=k),c=A+4|0,(r=o[a+16>>2])&&(f=o[k+16>>2])?(t=w[r+12>>2],l=w[f+12>>2],n=w[r+8>>2],s=w[f+8>>2],e=w[f+4>>2],u=w[r+4>>2],w[i+96>>2]=w[r>>2]*w[f>>2],b=(b=m(u*e))>2]=b>m(10)?m(10):b,n=(n=m(m(n*e)+m(u*s)))>2]=n>m(10)?m(10):n,e=(e=(e=m(m(t*e)+m(u*l)))m(10)?m(10):e):(r=o[Z+8>>2],e=w[r+228>>2],f=o[d+8>>2],u=w[f+228>>2],t=(t=m(e*u))>2]=t>m(10)?m(10):t,w[i+96>>2]=w[r+232>>2]*w[f+232>>2],t=(t=m(m(u*w[r+236>>2])+m(e*w[f+236>>2])))>2]=t>m(10)?m(10):t,e=(e=(e=m(m(u*w[r+240>>2])+m(e*w[f+240>>2])))m(10)?m(10):e),w[i+92>>2]=e,e=w[i+72>>2],m(Q(e))>m(.7071067690849304)?(t=w[i+68>>2],l=m(m(t*t)+m(e*e)),u=m(m(1)/m(N(l))),l=m(l*u),n=m(u*m(-e)),b=w[i+64>>2],s=m(n*b),e=m(t*u),t=m(e*m(-b)),b=m(0)):(l=w[i+64>>2],t=w[i+68>>2],n=m(m(l*l)+m(t*t)),u=m(m(1)/m(N(n))),s=m(n*u),b=m(u*m(-t)),t=m(e*b),n=m(l*u),l=m(n*m(-e)),e=m(0)),w[i+192>>2]=s,w[i+188>>2]=t,w[i+172>>2]=n,w[i+184>>2]=l,w[i+176>>2]=e,w[i+168>>2]=b,a=o[c>>2],(0|(d=o[B+844>>2]))<=0)r=-1;else for(u=w[i+8>>2],t=w[i+4>>2],l=w[i>>2],e=w[B+848>>2],e=m(e*e),f=0,r=-1;k=G(f,208)+B|0,n=m(w[k+12>>2]-u),s=m(n*n),n=m(w[k+4>>2]-l),p=m(n*n),n=m(w[k+8>>2]-t),e=(k=(n=m(s+m(p+m(n*n))))=0?(r=a+G(k,208)|0,e=w[r+144>>2],u=w[r+140>>2],t=w[r+136>>2],f=o[r+168>>2],16&v[i+128|0]&&(l=m(m(w[r+88>>2]*t)+m(0)),!(m(m(u*u)+m(e*e))>m(l*l)))||(a=o[r+120>>2],pr(r+4|0,i,208),o[r+120>>2]=a,w[r+136>>2]=t,w[r+140>>2]=u,w[r+144>>2]=e),o[r+168>>2]=f):k=wA(a,i),(f=o[8501])&&(r=o[A+12>>2],A=o[A+8>>2],8&v[o[A+8>>2]+204|0]|8&v[o[r+8>>2]+204|0]&&Zn[0|f](4+(o[c>>2]+G(k,208)|0)|0,E?A:r,o[i+100>>2],o[i+108>>2],E?r:A,o[i+104>>2],o[i+112>>2])),g||(A=o[8787])&&Zn[0|A](c)}S=i+208|0},Re,function(A){Re(A|=0),DA(A)},function(A,r,f,e,i){A|=0,r|=0,f|=0,e|=0,i|=0;var n=0,a=m(0),t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=m(0),d=m(0),v=0;if(S=e=S-32|0,A=o[A+12>>2]){if(o[i+4>>2]=A,n=o[r+12>>2],u=o[f+12>>2],c=m(w[n+56>>2]-w[u+56>>2]),s=m(w[n+48>>2]-w[u+48>>2]),b=m(w[n+52>>2]-w[u+52>>2]),a=m(m(c*c)+m(m(s*s)+m(b*b))),n=o[f+4>>2],l=w[n+20>>2],t=w[n+36>>2],r=o[r+4>>2],k=w[r+20>>2],d=w[r+36>>2],(0|(n=o[A+844>>2]))>0)for(r=0;n=A+G(r,208)|0,(u=o[n+120>>2])&&(v=o[8785])&&(Zn[0|v](u),o[n+120>>2]=0),(0|(r=r+1|0))<(0|(n=o[A+844>>2])););a=m(N(a)),l=m(t*l),t=m(d*k),n&&(r=o[8788])&&(o[e+16>>2]=A,Zn[0|r](e+16|0)),o[A+844>>2]=0,t=m(t+l),a>m(t+w[i+32>>2])||(o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=1065353216,o[e+20>>2]=0,t=m(a-t),a>m(1.1920928955078125e-7)?(a=m(m(1)/a),c=m(c*a),w[e+24>>2]=c,b=m(b*a),w[e+20>>2]=b,a=m(s*a),w[e+16>>2]=a):(a=m(1),c=m(0),b=m(0)),A=o[f+12>>2],s=w[A+52>>2],k=w[A+56>>2],d=w[A+48>>2],o[e+12>>2]=0,w[e>>2]=d+m(l*a),w[e+8>>2]=k+m(l*c),w[e+4>>2]=s+m(l*b),Zn[o[o[i>>2]+16>>2]](i,e+16|0,e,t))}S=e+32|0},ei,Lr,Ye,function(A){Ye(A|=0),DA(A)},function(A,r,f,e,i){r|=0,f|=0,e|=0,i|=0;var n,a=0,t=0,c=0,b=0;S=n=S-160|0,(a=o[12+(A|=0)>>2])&&(t=v[A+16|0],b=o[(c=t?r:f)+4>>2],t=o[(r=t?f:r)+4>>2],o[i+4>>2]=a,w[12+(f=n+144|0)>>2]=w[a+848>>2]+w[i+32>>2],o[f+8>>2]=b,o[f+4>>2]=t,o[f>>2]=18192,o[n+136>>2]=1566444395,r=o[r+12>>2],a=o[r+12>>2],o[n+16>>2]=o[r+8>>2],o[n+20>>2]=a,a=o[r+4>>2],o[n+8>>2]=o[r>>2],o[n+12>>2]=a,a=o[r+28>>2],o[n+32>>2]=o[r+24>>2],o[n+36>>2]=a,a=o[r+20>>2],o[n+24>>2]=o[r+16>>2],o[n+28>>2]=a,a=o[r+44>>2],o[n+48>>2]=o[r+40>>2],o[n+52>>2]=a,a=o[r+36>>2],o[n+40>>2]=o[r+32>>2],o[n+44>>2]=a,t=o[r+60>>2],o[(a=n- -64|0)>>2]=o[r+56>>2],o[a+4>>2]=t,a=o[r+52>>2],o[n+56>>2]=o[r+48>>2],o[n+60>>2]=a,r=o[c+12>>2],a=o[r+12>>2],o[n+80>>2]=o[r+8>>2],o[n+84>>2]=a,a=o[r+4>>2],o[n+72>>2]=o[r>>2],o[n+76>>2]=a,a=o[r+20>>2],o[n+88>>2]=o[r+16>>2],o[n+92>>2]=a,a=o[r+28>>2],o[n+96>>2]=o[r+24>>2],o[n+100>>2]=a,a=o[r+36>>2],o[n+104>>2]=o[r+32>>2],o[n+108>>2]=a,a=o[r+44>>2],o[n+112>>2]=o[r+40>>2],o[n+116>>2]=a,a=o[r+52>>2],o[n+120>>2]=o[r+48>>2],o[n+124>>2]=a,a=o[r+60>>2],o[n+128>>2]=o[r+56>>2],o[n+132>>2]=a,BA(f,n+8|0,i,o[e+20>>2],v[A+16|0]),v[A+8|0]&&(A=o[i+4>>2],o[A+844>>2]&&(r=(0|(f=o[A+836>>2]))==(0|(e=o[o[i+8>>2]+8>>2])),a=A,A=o[o[i+12>>2]+8>>2],OA(a,(r?f:A)+4|0,(r?A:e)+4|0)))),S=n+160|0},ei,Lr,vn,BA,ri,of,Df,function(A,r,f){A|=0,r=m(r),f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0);e=w[A+44>>2],i=w[A+40>>2],n=w[A+36>>2],a=m(Zn[o[o[A>>2]+48>>2]](A)),t=m(Zn[o[o[A>>2]+48>>2]](A)),c=m(Zn[o[o[A>>2]+48>>2]](A)),o[f+12>>2]=0,r=m(r/m(12)),n=m(n+a),n=m(n+n),n=m(n*n),i=m(i+t),i=m(i+i),i=m(i*i),w[f+8>>2]=r*m(n+i),e=m(e+c),e=m(e+e),e=m(e*e),w[f+4>>2]=r*m(n+e),w[f>>2]=r*m(i+e)},function(){return 1476},xf,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);e=w[r+40>>2],i=w[r+44>>2],n=w[r+36>>2],a=m(Zn[o[o[r>>2]+48>>2]](r)),t=m(Zn[o[o[r>>2]+48>>2]](r)),c=m(Zn[o[o[r>>2]+48>>2]](r)),b=w[f>>2],u=w[f+4>>2],l=w[f+8>>2],o[A+12>>2]=0,i=m(i+c),w[A+8>>2]=l>=m(0)?i:m(-i),e=m(e+t),w[A+4>>2]=u>=m(0)?e:m(-e),e=m(n+a),w[A>>2]=b>=m(0)?e:m(-e)},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0);e=w[r+40>>2],i=w[r+44>>2],a=w[f+4>>2],t=w[f+8>>2],n=w[r+36>>2],c=w[f>>2],o[A+12>>2]=0,w[A>>2]=c>=m(0)?n:m(-n),w[A+8>>2]=t>=m(0)?i:m(-i),w[A+4>>2]=a>=m(0)?e:m(-e)},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=0,a=0,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0);if((0|e)>0)for(;u=w[(i=(a=n<<4)+r|0)>>2],l=w[i+4>>2],s=w[i+8>>2],t=w[A+36>>2],c=w[A+40>>2],b=w[A+44>>2],o[12+(i=f+a|0)>>2]=0,w[i+8>>2]=s>=m(0)?b:m(-b),w[i+4>>2]=l>=m(0)?c:m(-c),w[i>>2]=u>=m(0)?t:m(-t),(0|(n=n+1|0))!=(0|e););},kn,function(A,r,f){A|=0,f|=0,(r|=0)>>>0<=5&&(o[f+12>>2]=0,A=r<<2,w[f+8>>2]=w[A+18456>>2],w[f+4>>2]=w[A+18432>>2],w[f>>2]=w[A+18408>>2])},function(){return 8},on,function(A,r,f,e){A|=0,f|=0,e|=0;var i=0;(r|=0)>>>0<=11?(i=o[18528+(r<<=2)>>2],r=o[r+18480>>2]):r=0,Zn[o[o[A>>2]+108>>2]](A,r,f),Zn[o[o[A>>2]+108>>2]](A,i,e)},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0);i=w[A+44>>2],e=w[A+40>>2],n=w[A+36>>2],a=m(Zn[o[o[A>>2]+48>>2]](A)),t=m(Zn[o[o[A>>2]+48>>2]](A)),c=m(Zn[o[o[A>>2]+48>>2]](A)),o[f+12>>2]=0,e=m(e+t),A=r>>>1&1,w[f+4>>2]=m(e*m(0|!A))-m(m(0|A)*e),e=m(n+a),A=1&r,w[f>>2]=m(e*m(0|!A))-m(m(0|A)*e),i=m(i+c),A=r>>>2&1,w[f+8>>2]=m(i*m(0|!A))-m(m(0|A)*i)},kn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0);S=i=S-48|0,Zn[o[o[A>>2]+124>>2]](A,i+32|0,e),n=w[i+32>>2],a=w[i+36>>2],t=w[i+40>>2],o[r+12>>2]=0,w[r+8>>2]=t,w[r+4>>2]=a,w[r>>2]=n,o[i+12>>2]=0,w[i+8>>2]=-t,w[i+4>>2]=-a,w[i>>2]=-n,Zn[o[o[A>>2]+64>>2]](i+16|0,A,i),A=o[i+28>>2],o[f+8>>2]=o[i+24>>2],o[f+12>>2]=A,A=o[i+20>>2],o[f>>2]=o[i+16>>2],o[f+4>>2]=A,S=i+48|0},function(A,r,f){A|=0,r|=0,f=m(f);var e=m(0),i=m(0),n=0;return e=w[r>>2],i=w[A+36>>2],!(e<=m(i+f))|!(e>=m(m(-i)-f))||(e=w[r+4>>2],i=w[A+40>>2],!(e<=m(i+f))|!(e>=m(m(-i)-f))||(e=w[r+8>>2],i=w[A+44>>2],e<=m(i+f)&&(n=e>=m(m(-i)-f)))),0|n},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),o=m(0);a=w[A+44>>2],t=w[A+40>>2],e=w[A+36>>2],i=m(1);A:{r:{f:{e:{i:switch(0|f){case 1:i=m(-1);break r;case 2:n=m(1);break f;case 3:n=m(-1);break f;case 4:e=m(1);break e;case 0:break r;case 5:break i;default:break A}e=m(-1)}o=e,i=m(0),e=a;break r}i=m(0),e=t}w[r+8>>2]=o,w[r+4>>2]=n,w[r>>2]=i,w[r+12>>2]=-e}},nf,ii,vA,nn,function(A,r,f){A|=0,f|=0;var e=0,i=0,n=0,a=0,c=0,b=0;if(w[16+(r|=0)>>2]=w[A+20>>2],w[r+20>>2]=w[A+24>>2],w[r+24>>2]=w[A+28>>2],w[r+28>>2]=w[A+32>>2],w[r>>2]=w[A+4>>2],w[r+4>>2]=w[A+8>>2],w[r+8>>2]=w[A+12>>2],w[r+12>>2]=w[A+16>>2],w[r+32>>2]=w[A+36>>2],w[r+36>>2]=w[A+40>>2],w[r+40>>2]=w[A+44>>2],w[r+44>>2]=w[A+48>>2],o[r+48>>2]=o[A+56>>2],o[r+52>>2]=v[A+60|0],e=o[A+88>>2],o[r+56>>2]=e,e){if(e=0|Zn[o[o[f>>2]+28>>2]](f,o[A+96>>2]),o[r+64>>2]=e,e){if(a=o[A+88>>2],c=0|Zn[o[o[f>>2]+16>>2]](f,48,a),(0|a)>0)for(e=o[c+8>>2];i=o[A+96>>2]+(n<<6)|0,w[e+16>>2]=w[i+16>>2],w[e+20>>2]=w[i+20>>2],w[e+24>>2]=w[i+24>>2],w[e+28>>2]=w[i+28>>2],w[e>>2]=w[i>>2],w[e+4>>2]=w[i+4>>2],w[e+8>>2]=w[i+8>>2],w[e+12>>2]=w[i+12>>2],o[e+32>>2]=o[i+32>>2],o[e+36>>2]=o[i+36>>2],i=o[i+40>>2],o[e+44>>2]=0,o[e+40>>2]=i,e=e+48|0,(0|a)!=(0|(n=n+1|0)););Zn[o[o[f>>2]+20>>2]](f,c,9163,1497453121,o[A+96>>2])}}else o[r+64>>2]=0;if(e=o[A+128>>2],o[r+60>>2]=e,e){if(e=0|Zn[o[o[f>>2]+28>>2]](f,o[A+136>>2]),o[r+68>>2]=e,e){if(n=0,c=o[A+128>>2],b=0|Zn[o[o[f>>2]+16>>2]](f,16,c),(0|c)<=0)a=o[A+136>>2];else for(a=o[A+136>>2],e=o[b+8>>2];i=(n<<4)+a|0,o[e+12>>2]=o[i+12>>2],t[e+6>>1]=h[i+6>>1],t[e+8>>1]=h[i+8>>1],t[e+10>>1]=h[i+10>>1],t[e>>1]=h[i>>1],t[e+2>>1]=h[i+2>>1],t[e+4>>1]=h[i+4>>1],e=e+16|0,(0|c)!=(0|(n=n+1|0)););Zn[o[o[f>>2]+20>>2]](f,b,9140,1497453121,a)}}else o[r+68>>2]=0;if(o[r+76>>2]=o[A+144>>2],e=o[A+152>>2],o[r+80>>2]=e,!e)return o[r+72>>2]=0,8832;if(e=r,r=0|Zn[o[o[f>>2]+28>>2]](f,o[A+160>>2]),o[e+72>>2]=r,r){if(n=0,i=o[A+152>>2],a=0|Zn[o[o[f>>2]+16>>2]](f,20,i),(0|i)<=0)A=o[A+160>>2];else for(A=o[A+160>>2],e=o[a+8>>2];r=(n<<5)+A|0,t[e+14>>1]=h[r+6>>1],t[e+16>>1]=h[r+8>>1],t[e+18>>1]=h[r+10>>1],t[e+8>>1]=h[r>>1],t[e+10>>1]=h[r+2>>1],t[e+12>>1]=h[r+4>>1],o[e>>2]=o[r+12>>2],o[e+4>>2]=o[r+16>>2],e=e+20|0,(0|i)!=(0|(n=n+1|0)););Zn[o[o[f>>2]+20>>2]](f,a,8900,1497453121,A)}return 8832},function(A,r){r|=0;var f,e=0,i=0,n=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,B=0;if(w[20+(A|=0)>>2]=w[r+16>>2],w[A+24>>2]=w[r+20>>2],w[A+28>>2]=w[r+24>>2],w[A+32>>2]=w[r+28>>2],w[A+4>>2]=w[r>>2],w[A+8>>2]=w[r+4>>2],w[A+12>>2]=w[r+8>>2],w[A+16>>2]=w[r+12>>2],w[A+36>>2]=w[r+32>>2],w[A+40>>2]=w[r+36>>2],w[A+44>>2]=w[r+40>>2],w[A+48>>2]=w[r+44>>2],o[A+56>>2]=o[r+48>>2],a[A+60|0]=0!=o[r+52>>2],!((0|(c=o[A+88>>2]))>=(0|(k=o[r+56>>2])))){if((0|k)>o[A+92>>2]){if(k?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](k<<6,16),e=o[A+88>>2]):e=c,!((0|e)<=0)){if(1!=(0|e))for(B=-2&e;b=(u=d<<6)+s|0,l=u+o[A+96>>2]|0,n=o[l+4>>2],o[b>>2]=o[l>>2],o[b+4>>2]=n,n=o[l+60>>2],o[b+56>>2]=o[l+56>>2],o[b+60>>2]=n,n=o[l+52>>2],o[b+48>>2]=o[l+48>>2],o[b+52>>2]=n,n=o[l+44>>2],o[b+40>>2]=o[l+40>>2],o[b+44>>2]=n,n=o[l+36>>2],o[b+32>>2]=o[l+32>>2],o[b+36>>2]=n,n=o[l+28>>2],o[b+24>>2]=o[l+24>>2],o[b+28>>2]=n,n=o[l+20>>2],o[b+16>>2]=o[l+16>>2],o[b+20>>2]=n,n=o[l+12>>2],o[b+8>>2]=o[l+8>>2],o[b+12>>2]=n,b=(n=64|u)+s|0,u=n+o[A+96>>2]|0,n=o[u+4>>2],o[b>>2]=o[u>>2],o[b+4>>2]=n,n=o[u+12>>2],o[b+8>>2]=o[u+8>>2],o[b+12>>2]=n,n=o[u+20>>2],o[b+16>>2]=o[u+16>>2],o[b+20>>2]=n,n=o[u+28>>2],o[b+24>>2]=o[u+24>>2],o[b+28>>2]=n,n=o[u+36>>2],o[b+32>>2]=o[u+32>>2],o[b+36>>2]=n,n=o[u+44>>2],o[b+40>>2]=o[u+40>>2],o[b+44>>2]=n,n=o[u+52>>2],o[b+48>>2]=o[u+48>>2],o[b+52>>2]=n,n=o[u+60>>2],o[b+56>>2]=o[u+56>>2],o[b+60>>2]=n,d=d+2|0,(0|B)!=(0|(i=i+2|0)););1&e&&(i=(e=d<<6)+s|0,n=e+o[A+96>>2]|0,e=o[n+4>>2],o[i>>2]=o[n>>2],o[i+4>>2]=e,e=o[n+60>>2],o[i+56>>2]=o[n+56>>2],o[i+60>>2]=e,e=o[n+52>>2],o[i+48>>2]=o[n+48>>2],o[i+52>>2]=e,e=o[n+44>>2],o[i+40>>2]=o[n+40>>2],o[i+44>>2]=e,e=o[n+36>>2],o[i+32>>2]=o[n+32>>2],o[i+36>>2]=e,e=o[n+28>>2],o[i+24>>2]=o[n+24>>2],o[i+28>>2]=e,e=o[n+20>>2],o[i+16>>2]=o[n+16>>2],o[i+20>>2]=e,e=o[n+12>>2],o[i+8>>2]=o[n+8>>2],o[i+12>>2]=e)}!(e=o[A+96>>2])||!e|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+96>>2]=s,a[A+100|0]=1,o[A+92>>2]=k}if(i=k+~c|0,e=k-c&3)for(s=0;n=o[A+96>>2]+(c<<6)|0,o[n>>2]=0,o[n+4>>2]=0,o[n+56>>2]=0,o[n+60>>2]=0,o[n+48>>2]=0,o[n+52>>2]=0,o[n+40>>2]=0,o[n+44>>2]=0,o[n+32>>2]=0,o[n+36>>2]=0,o[n+24>>2]=0,o[n+28>>2]=0,o[n+16>>2]=0,o[n+20>>2]=0,o[n+8>>2]=0,o[n+12>>2]=0,c=c+1|0,(0|e)!=(0|(s=s+1|0)););if(!(i>>>0<3))for(;e=(i=c<<6)+o[A+96>>2]|0,o[e>>2]=0,o[e+4>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0,e=i+o[A+96>>2]|0,o[e+120>>2]=0,o[e+124>>2]=0,o[e+112>>2]=0,o[e+116>>2]=0,o[e+104>>2]=0,o[e+108>>2]=0,o[e+96>>2]=0,o[e+100>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+80>>2]=0,o[e+84>>2]=0,o[e+72>>2]=0,o[e+76>>2]=0,o[(e=e- -64|0)>>2]=0,o[e+4>>2]=0,e=i+o[A+96>>2]|0,o[e+184>>2]=0,o[e+188>>2]=0,o[e+176>>2]=0,o[e+180>>2]=0,o[e+168>>2]=0,o[e+172>>2]=0,o[e+160>>2]=0,o[e+164>>2]=0,o[e+152>>2]=0,o[e+156>>2]=0,o[e+144>>2]=0,o[e+148>>2]=0,o[e+136>>2]=0,o[e+140>>2]=0,o[e+128>>2]=0,o[e+132>>2]=0,e=i+o[A+96>>2]|0,o[e+248>>2]=0,o[e+252>>2]=0,o[e+240>>2]=0,o[e+244>>2]=0,o[e+232>>2]=0,o[e+236>>2]=0,o[e+224>>2]=0,o[e+228>>2]=0,o[e+216>>2]=0,o[e+220>>2]=0,o[e+208>>2]=0,o[e+212>>2]=0,o[e+200>>2]=0,o[e+204>>2]=0,o[e+192>>2]=0,o[e+196>>2]=0,(0|k)!=(0|(c=c+4|0)););}if(o[A+88>>2]=k,(0|k)>0)for(e=o[A+96>>2],i=o[r+64>>2],s=0;w[16+(c=e+(s<<6)|0)>>2]=w[i+16>>2],w[c+20>>2]=w[i+20>>2],w[c+24>>2]=w[i+24>>2],w[c+28>>2]=w[i+28>>2],w[c>>2]=w[i>>2],w[c+4>>2]=w[i+4>>2],w[c+8>>2]=w[i+8>>2],w[c+12>>2]=w[i+12>>2],o[c+32>>2]=o[i+32>>2],o[c+36>>2]=o[i+36>>2],o[c+40>>2]=o[i+40>>2],i=i+48|0,(0|k)!=(0|(s=s+1|0)););if(!((0|(i=o[A+128>>2]))>=(0|(f=o[r+60>>2])))){if((0|f)>o[A+132>>2]){if(f?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](f<<4,16),e=o[A+128>>2]):(d=0,e=i),!((0|e)<=0)){if(c=0,1!=(0|e))for(B=-2&e,l=0;b=(u=c<<4)+d|0,k=u+o[A+136>>2]|0,n=o[k+4>>2],o[b>>2]=o[k>>2],o[b+4>>2]=n,n=o[k+12>>2],o[b+8>>2]=o[k+8>>2],o[b+12>>2]=n,b=(n=16|u)+d|0,u=n+o[A+136>>2]|0,n=o[u+4>>2],o[b>>2]=o[u>>2],o[b+4>>2]=n,n=o[u+12>>2],o[b+8>>2]=o[u+8>>2],o[b+12>>2]=n,c=c+2|0,(0|B)!=(0|(l=l+2|0)););1&e&&(c=(e=c<<4)+d|0,n=e+o[A+136>>2]|0,e=o[n+4>>2],o[c>>2]=o[n>>2],o[c+4>>2]=e,e=o[n+12>>2],o[c+8>>2]=o[n+8>>2],o[c+12>>2]=e)}!(e=o[A+136>>2])||!e|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+136>>2]=d,a[A+140|0]=1,o[A+132>>2]=f}if(n=f+~i|0,e=f-i&3)for(c=0;b=o[A+136>>2]+(i<<4)|0,o[b>>2]=0,o[b+4>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,i=i+1|0,(0|e)!=(0|(c=c+1|0)););if(!(n>>>0<3))for(;e=(c=i<<4)+o[A+136>>2]|0,o[e>>2]=0,o[e+4>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0,e=c+o[A+136>>2]|0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,e=c+o[A+136>>2]|0,o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,e=c+o[A+136>>2]|0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,(0|f)!=(0|(i=i+4|0)););}if(o[A+128>>2]=f,(0|f)>0)for(e=o[A+136>>2],i=o[r+68>>2],s=0;o[12+(c=e+(s<<4)|0)>>2]=o[i+12>>2],t[c+6>>1]=h[i+6>>1],t[c+8>>1]=h[i+8>>1],t[c+10>>1]=h[i+10>>1],t[c>>1]=h[i>>1],t[c+2>>1]=h[i+2>>1],t[c+4>>1]=h[i+4>>1],i=i+16|0,(0|f)!=(0|(s=s+1|0)););if(o[A+144>>2]=o[r+76>>2],!((0|(i=o[A+152>>2]))>=(0|(u=o[r+80>>2]))|(0|u)<=o[A+156>>2])){if(u?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](u<<5,16),i=o[A+152>>2]):l=0,!((0|i)<=0)){if(d=0,1!=(0|i))for(n=-2&i,s=0;c=(b=d<<5)+l|0,B=b+o[A+160>>2]|0,e=o[B+4>>2],o[c>>2]=o[B>>2],o[c+4>>2]=e,e=o[B+28>>2],o[c+24>>2]=o[B+24>>2],o[c+28>>2]=e,e=o[B+20>>2],o[c+16>>2]=o[B+16>>2],o[c+20>>2]=e,e=o[B+12>>2],o[c+8>>2]=o[B+8>>2],o[c+12>>2]=e,c=(e=32|b)+l|0,b=e+o[A+160>>2]|0,e=o[b+4>>2],o[c>>2]=o[b>>2],o[c+4>>2]=e,e=o[b+12>>2],o[c+8>>2]=o[b+8>>2],o[c+12>>2]=e,e=o[b+20>>2],o[c+16>>2]=o[b+16>>2],o[c+20>>2]=e,e=o[b+28>>2],o[c+24>>2]=o[b+24>>2],o[c+28>>2]=e,d=d+2|0,(0|n)!=(0|(s=s+2|0)););1&i&&(c=(e=d<<5)+l|0,i=e+o[A+160>>2]|0,e=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=e,e=o[i+28>>2],o[c+24>>2]=o[i+24>>2],o[c+28>>2]=e,e=o[i+20>>2],o[c+16>>2]=o[i+16>>2],o[c+20>>2]=e,e=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=e)}!(e=o[A+160>>2])||!e|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+160>>2]=l,a[A+164|0]=1,o[A+156>>2]=u}if(o[A+152>>2]=u,(0|u)>0)for(e=o[A+160>>2],i=o[r+72>>2],A=0;t[6+(r=e+(A<<5)|0)>>1]=h[i+14>>1],t[r+8>>1]=h[i+16>>1],t[r+10>>1]=h[i+18>>1],t[r>>1]=h[i+8>>1],t[r+2>>1]=h[i+10>>1],t[r+4>>1]=h[i+12>>1],o[r+12>>2]=o[i>>2],o[r+16>>2]=o[i+4>>2],i=i+20|0,(0|u)!=(0|(A=A+1|0)););},function(A,r){r|=0;var f,e=0,i=0,n=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,B=0;if(w[20+(A|=0)>>2]=Z[r+32>>3],w[A+24>>2]=Z[r+40>>3],w[A+28>>2]=Z[r+48>>3],w[A+32>>2]=Z[r+56>>3],w[A+4>>2]=Z[r>>3],w[A+8>>2]=Z[r+8>>3],w[A+12>>2]=Z[r+16>>3],w[A+16>>2]=Z[r+24>>3],w[A+36>>2]=Z[r+64>>3],w[A+40>>2]=Z[r+72>>3],w[A+44>>2]=Z[r+80>>3],w[A+48>>2]=Z[r+88>>3],o[A+56>>2]=o[r+96>>2],a[A+60|0]=0!=o[r+100>>2],!((0|(c=o[A+88>>2]))>=(0|(k=o[r+104>>2])))){if((0|k)>o[A+92>>2]){if(k?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](k<<6,16),e=o[A+88>>2]):e=c,!((0|e)<=0)){if(1!=(0|e))for(B=-2&e;b=(u=d<<6)+s|0,l=u+o[A+96>>2]|0,n=o[l+4>>2],o[b>>2]=o[l>>2],o[b+4>>2]=n,n=o[l+60>>2],o[b+56>>2]=o[l+56>>2],o[b+60>>2]=n,n=o[l+52>>2],o[b+48>>2]=o[l+48>>2],o[b+52>>2]=n,n=o[l+44>>2],o[b+40>>2]=o[l+40>>2],o[b+44>>2]=n,n=o[l+36>>2],o[b+32>>2]=o[l+32>>2],o[b+36>>2]=n,n=o[l+28>>2],o[b+24>>2]=o[l+24>>2],o[b+28>>2]=n,n=o[l+20>>2],o[b+16>>2]=o[l+16>>2],o[b+20>>2]=n,n=o[l+12>>2],o[b+8>>2]=o[l+8>>2],o[b+12>>2]=n,b=(n=64|u)+s|0,u=n+o[A+96>>2]|0,n=o[u+4>>2],o[b>>2]=o[u>>2],o[b+4>>2]=n,n=o[u+12>>2],o[b+8>>2]=o[u+8>>2],o[b+12>>2]=n,n=o[u+20>>2],o[b+16>>2]=o[u+16>>2],o[b+20>>2]=n,n=o[u+28>>2],o[b+24>>2]=o[u+24>>2],o[b+28>>2]=n,n=o[u+36>>2],o[b+32>>2]=o[u+32>>2],o[b+36>>2]=n,n=o[u+44>>2],o[b+40>>2]=o[u+40>>2],o[b+44>>2]=n,n=o[u+52>>2],o[b+48>>2]=o[u+48>>2],o[b+52>>2]=n,n=o[u+60>>2],o[b+56>>2]=o[u+56>>2],o[b+60>>2]=n,d=d+2|0,(0|B)!=(0|(i=i+2|0)););1&e&&(i=(e=d<<6)+s|0,n=e+o[A+96>>2]|0,e=o[n+4>>2],o[i>>2]=o[n>>2],o[i+4>>2]=e,e=o[n+60>>2],o[i+56>>2]=o[n+56>>2],o[i+60>>2]=e,e=o[n+52>>2],o[i+48>>2]=o[n+48>>2],o[i+52>>2]=e,e=o[n+44>>2],o[i+40>>2]=o[n+40>>2],o[i+44>>2]=e,e=o[n+36>>2],o[i+32>>2]=o[n+32>>2],o[i+36>>2]=e,e=o[n+28>>2],o[i+24>>2]=o[n+24>>2],o[i+28>>2]=e,e=o[n+20>>2],o[i+16>>2]=o[n+16>>2],o[i+20>>2]=e,e=o[n+12>>2],o[i+8>>2]=o[n+8>>2],o[i+12>>2]=e)}!(e=o[A+96>>2])||!e|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+96>>2]=s,a[A+100|0]=1,o[A+92>>2]=k}if(i=k+~c|0,e=k-c&3)for(s=0;n=o[A+96>>2]+(c<<6)|0,o[n>>2]=0,o[n+4>>2]=0,o[n+56>>2]=0,o[n+60>>2]=0,o[n+48>>2]=0,o[n+52>>2]=0,o[n+40>>2]=0,o[n+44>>2]=0,o[n+32>>2]=0,o[n+36>>2]=0,o[n+24>>2]=0,o[n+28>>2]=0,o[n+16>>2]=0,o[n+20>>2]=0,o[n+8>>2]=0,o[n+12>>2]=0,c=c+1|0,(0|e)!=(0|(s=s+1|0)););if(!(i>>>0<3))for(;e=(i=c<<6)+o[A+96>>2]|0,o[e>>2]=0,o[e+4>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0,e=i+o[A+96>>2]|0,o[e+120>>2]=0,o[e+124>>2]=0,o[e+112>>2]=0,o[e+116>>2]=0,o[e+104>>2]=0,o[e+108>>2]=0,o[e+96>>2]=0,o[e+100>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+80>>2]=0,o[e+84>>2]=0,o[e+72>>2]=0,o[e+76>>2]=0,o[(e=e- -64|0)>>2]=0,o[e+4>>2]=0,e=i+o[A+96>>2]|0,o[e+184>>2]=0,o[e+188>>2]=0,o[e+176>>2]=0,o[e+180>>2]=0,o[e+168>>2]=0,o[e+172>>2]=0,o[e+160>>2]=0,o[e+164>>2]=0,o[e+152>>2]=0,o[e+156>>2]=0,o[e+144>>2]=0,o[e+148>>2]=0,o[e+136>>2]=0,o[e+140>>2]=0,o[e+128>>2]=0,o[e+132>>2]=0,e=i+o[A+96>>2]|0,o[e+248>>2]=0,o[e+252>>2]=0,o[e+240>>2]=0,o[e+244>>2]=0,o[e+232>>2]=0,o[e+236>>2]=0,o[e+224>>2]=0,o[e+228>>2]=0,o[e+216>>2]=0,o[e+220>>2]=0,o[e+208>>2]=0,o[e+212>>2]=0,o[e+200>>2]=0,o[e+204>>2]=0,o[e+192>>2]=0,o[e+196>>2]=0,(0|k)!=(0|(c=c+4|0)););}if(o[A+88>>2]=k,(0|k)>0)for(e=o[A+96>>2],i=o[r+112>>2],s=0;w[16+(c=e+(s<<6)|0)>>2]=Z[i+32>>3],w[c+20>>2]=Z[i+40>>3],w[c+24>>2]=Z[i+48>>3],w[c+28>>2]=Z[i+56>>3],w[c>>2]=Z[i>>3],w[c+4>>2]=Z[i+8>>3],w[c+8>>2]=Z[i+16>>3],w[c+12>>2]=Z[i+24>>3],o[c+32>>2]=o[i+64>>2],o[c+36>>2]=o[i+68>>2],o[c+40>>2]=o[i+72>>2],i=i+80|0,(0|k)!=(0|(s=s+1|0)););if(!((0|(i=o[A+128>>2]))>=(0|(f=o[r+108>>2])))){if((0|f)>o[A+132>>2]){if(f?(o[8488]=o[8488]+1,d=0|Zn[o[8290]](f<<4,16),e=o[A+128>>2]):(d=0,e=i),!((0|e)<=0)){if(c=0,1!=(0|e))for(B=-2&e,l=0;b=(u=c<<4)+d|0,k=u+o[A+136>>2]|0,n=o[k+4>>2],o[b>>2]=o[k>>2],o[b+4>>2]=n,n=o[k+12>>2],o[b+8>>2]=o[k+8>>2],o[b+12>>2]=n,b=(n=16|u)+d|0,u=n+o[A+136>>2]|0,n=o[u+4>>2],o[b>>2]=o[u>>2],o[b+4>>2]=n,n=o[u+12>>2],o[b+8>>2]=o[u+8>>2],o[b+12>>2]=n,c=c+2|0,(0|B)!=(0|(l=l+2|0)););1&e&&(c=(e=c<<4)+d|0,n=e+o[A+136>>2]|0,e=o[n+4>>2],o[c>>2]=o[n>>2],o[c+4>>2]=e,e=o[n+12>>2],o[c+8>>2]=o[n+8>>2],o[c+12>>2]=e)}!(e=o[A+136>>2])||!e|!v[A+140|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+136>>2]=d,a[A+140|0]=1,o[A+132>>2]=f}if(n=f+~i|0,e=f-i&3)for(c=0;b=o[A+136>>2]+(i<<4)|0,o[b>>2]=0,o[b+4>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,i=i+1|0,(0|e)!=(0|(c=c+1|0)););if(!(n>>>0<3))for(;e=(c=i<<4)+o[A+136>>2]|0,o[e>>2]=0,o[e+4>>2]=0,o[e+8>>2]=0,o[e+12>>2]=0,e=c+o[A+136>>2]|0,o[e+24>>2]=0,o[e+28>>2]=0,o[e+16>>2]=0,o[e+20>>2]=0,e=c+o[A+136>>2]|0,o[e+40>>2]=0,o[e+44>>2]=0,o[e+32>>2]=0,o[e+36>>2]=0,e=c+o[A+136>>2]|0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+48>>2]=0,o[e+52>>2]=0,(0|f)!=(0|(i=i+4|0)););}if(o[A+128>>2]=f,(0|f)>0)for(e=o[A+136>>2],i=o[r+116>>2],s=0;o[12+(c=e+(s<<4)|0)>>2]=o[i+12>>2],t[c+6>>1]=h[i+6>>1],t[c+8>>1]=h[i+8>>1],t[c+10>>1]=h[i+10>>1],t[c>>1]=h[i>>1],t[c+2>>1]=h[i+2>>1],t[c+4>>1]=h[i+4>>1],i=i+16|0,(0|f)!=(0|(s=s+1|0)););if(o[A+144>>2]=o[r+120>>2],!((0|(i=o[A+152>>2]))>=(0|(u=o[r+124>>2]))|(0|u)<=o[A+156>>2])){if(u?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](u<<5,16),i=o[A+152>>2]):l=0,!((0|i)<=0)){if(d=0,1!=(0|i))for(n=-2&i,s=0;c=(b=d<<5)+l|0,B=b+o[A+160>>2]|0,e=o[B+4>>2],o[c>>2]=o[B>>2],o[c+4>>2]=e,e=o[B+28>>2],o[c+24>>2]=o[B+24>>2],o[c+28>>2]=e,e=o[B+20>>2],o[c+16>>2]=o[B+16>>2],o[c+20>>2]=e,e=o[B+12>>2],o[c+8>>2]=o[B+8>>2],o[c+12>>2]=e,c=(e=32|b)+l|0,b=e+o[A+160>>2]|0,e=o[b+4>>2],o[c>>2]=o[b>>2],o[c+4>>2]=e,e=o[b+12>>2],o[c+8>>2]=o[b+8>>2],o[c+12>>2]=e,e=o[b+20>>2],o[c+16>>2]=o[b+16>>2],o[c+20>>2]=e,e=o[b+28>>2],o[c+24>>2]=o[b+24>>2],o[c+28>>2]=e,d=d+2|0,(0|n)!=(0|(s=s+2|0)););1&i&&(c=(e=d<<5)+l|0,i=e+o[A+160>>2]|0,e=o[i+4>>2],o[c>>2]=o[i>>2],o[c+4>>2]=e,e=o[i+28>>2],o[c+24>>2]=o[i+24>>2],o[c+28>>2]=e,e=o[i+20>>2],o[c+16>>2]=o[i+16>>2],o[c+20>>2]=e,e=o[i+12>>2],o[c+8>>2]=o[i+8>>2],o[c+12>>2]=e)}!(e=o[A+160>>2])||!e|!v[A+164|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+160>>2]=l,a[A+164|0]=1,o[A+156>>2]=u}if(o[A+152>>2]=u,(0|u)>0)for(e=o[A+160>>2],i=o[r+128>>2],A=0;t[6+(r=e+(A<<5)|0)>>1]=h[i+14>>1],t[r+8>>1]=h[i+16>>1],t[r+10>>1]=h[i+18>>1],t[r>>1]=h[i+8>>1],t[r+2>>1]=h[i+10>>1],t[r+4>>1]=h[i+12>>1],o[r+12>>2]=o[i>>2],o[r+16>>2]=o[i+4>>2],i=i+20|0,(0|u)!=(0|(A=A+1|0)););},me,function(A){me(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0);t=w[A+32>>2],n=w[A+48>>2],E=w[A+28>>2],W=w[A+44>>2],N=w[A+24>>2],p=w[A+40>>2],F=m(Zn[o[o[A>>2]+48>>2]](A)),R=m(Zn[o[o[A>>2]+48>>2]](A)),Y=m(Zn[o[o[A>>2]+48>>2]](A)),V=w[r+52>>2],c=w[r+24>>2],b=w[r+20>>2],u=w[r+56>>2],l=w[A+28>>2],d=w[A+44>>2],s=w[A+32>>2],g=w[A+48>>2],i=w[r+40>>2],k=w[r+36>>2],X=w[r+48>>2],h=w[r+8>>2],B=w[r>>2],Z=w[r+4>>2],G=w[r+16>>2],D=w[A+24>>2],C=w[A+40>>2],a=w[r+32>>2],o[f+12>>2]=0,v=u,u=m(m(g+s)*m(.5)),s=m(m(C+D)*m(.5)),l=m(m(d+l)*m(.5)),d=m(v+m(m(i*u)+m(m(a*s)+m(k*l)))),t=m(Y+m(m(n-t)*m(.5))),v=m(t*m(Q(i))),i=m(F+m(m(p-N)*m(.5))),n=m(i*m(Q(a))),a=m(R+m(m(W-E)*m(.5))),k=m(v+m(n+m(a*m(Q(k))))),w[f+8>>2]=d-k,n=m(V+m(m(u*c)+m(m(s*G)+m(l*b)))),c=m(m(t*m(Q(c)))+m(m(i*m(Q(G)))+m(a*m(Q(b))))),w[f+4>>2]=n-c,b=m(X+m(m(u*h)+m(m(s*B)+m(l*Z)))),i=m(m(t*m(Q(h)))+m(m(i*m(Q(B)))+m(a*m(Q(Z))))),w[f>>2]=b-i,o[e+12>>2]=0,w[e+8>>2]=k+d,w[e+4>>2]=c+n,w[e>>2]=i+b},function(A,r){A|=0,r|=0;var f,e=m(0),i=m(0),n=m(0);f=0|Zn[o[o[A>>2]+28>>2]](A),e=m(w[f+8>>2]-w[r+8>>2]),i=m(e*e),e=m(w[f>>2]-w[r>>2]),n=m(e*e),e=m(w[f+4>>2]-w[r+4>>2]),m(i+m(n+m(e*e)))>m(1.1920928955078125e-7)&&(Nr(A,r),v[A+69|0]&&(r=o[A+60>>2],Zn[o[o[r>>2]>>2]](r),(r=o[A+60>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](r))),o[8488]=o[8488]+1,r=Gi(0|Zn[o[8290]](172,16)),o[A+60>>2]=r,lA(r,o[A+56>>2],v[A+68|0],A+24|0,A+40|0),a[A+69|0]=1)},function(A){return o[56+(A|=0)>>2]+4|0},Pe,function(){return 9299},function(A,r){A|=0,r=m(r),w[A+20>>2]=r},function(A){return m(w[20+(A|=0)>>2])},an,function(A,r,f){var e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0;te(A|=0,r|=0,f|=0),e=o[A+56>>2],Zn[o[o[e>>2]+56>>2]](e,r+12|0,f),w[r+52>>2]=w[A+20>>2];A:if(!o[A+60>>2]||1&Zn[o[o[f>>2]+52>>2]](f))o[r+40>>2]=0,o[r+44>>2]=0;else{if(e=0|Zn[o[o[f>>2]+24>>2]](f,o[A+60>>2])){o[r+44>>2]=0,o[r+40>>2]=e;break A}e=0|Zn[o[o[f>>2]+28>>2]](f,o[A+60>>2]),o[r+44>>2]=0,o[r+40>>2]=e,e=o[A+60>>2],a=f,t=0|Zn[o[o[e>>2]+12>>2]](e),c=1,n=o[o[f>>2]+16>>2],e=0|Zn[n](0|a,0|t,0|c),i=o[A+60>>2],c=f,t=e,a=0|Zn[o[o[i>>2]+16>>2]](i,o[e+8>>2],f),b=1213612625,u=o[A+60>>2],n=o[o[f>>2]+20>>2],Zn[n](0|c,0|t,0|a,0|b,0|u)}A:if(!o[A+64>>2]||2&Zn[o[o[f>>2]+52>>2]](f))o[r+48>>2]=0;else{if(e=0|Zn[o[o[f>>2]+24>>2]](f,o[A+64>>2])){o[r+48>>2]=e;break A}n=r,u=0|Zn[o[o[f>>2]+28>>2]](f,o[A+64>>2]),o[n+48>>2]=u,e=o[A+64>>2],u=f,b=0|Zn[o[o[e>>2]+8>>2]](e),a=1,n=o[o[f>>2]+16>>2],e=0|Zn[n](0|u,0|b,0|a),i=o[A+64>>2],a=f,b=e,u=0|Zn[o[o[i>>2]+12>>2]](i,o[e+8>>2],f),t=1346456916,c=o[A+64>>2],n=o[o[f>>2]+20>>2],Zn[n](0|a,0|b,0|u,0|t,0|c)}return o[r+56>>2]=0,8988},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,a=0,c=0,b=0,u=m(0),l=0,s=m(0),k=m(0),d=m(0),B=m(0),Z=0,G=m(0),Q=0,E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=0,V=0,g=0;S=i=S+-64|0,c=o[A+56>>2],o[i+60>>2]=0,o[i+8>>2]=r,o[i+4>>2]=c,o[i>>2]=19096,S=c=S-16|0,a=o[A+60>>2];A:if(v[a+60|0]){p=w[a+40>>2],E=w[a+24>>2],u=w[a+8>>2],F=w[a+36>>2],W=w[a+20>>2],G=w[a+4>>2],d=w[f>>2],B=w[f+4>>2],N=w[a+28>>2],s=(k=w[a+12>>2])>(s=w[f+8>>2])?k:s,R=w[a+44>>2],l=65534&(A=(s=m(m((s>N?N:s)-k)*R))=m(0)?~~s>>>0:0),t[c+14>>1]=l,Q=65534&(A=(B=m(p*m(((B=u>B?u:B)>E?E:B)-u)))=m(0)?~~B>>>0:0),t[c+12>>1]=Q,Y=65534&(A=(d=m(m(((d=dW?W:d)-G)*F))=m(0)?~~d>>>0:0),t[c+10>>1]=Y,d=w[e>>2],B=w[e+4>>2],s=w[e+8>>2],e=1|(A=(k=m(m(R*m(((s=k>s?k:s)>N?N:s)-k))+m(1)))=m(0)?~~k>>>0:0),t[c+8>>1]=e,V=1|(A=(u=m(m(p*m(((k=u>B?u:B)>E?E:k)-u))+m(1)))=m(0)?~~u>>>0:0),t[c+6>>1]=V,g=1|(A=(u=m(m(F*m(((u=dW?W:u)-G))+m(1)))=m(0)?~~u>>>0:0),t[c+4>>1]=g;r:switch(o[a+144>>2]){case 0:if((0|(A=o[a+56>>2]))>0)for(n=o[a+136>>2];;){Z=Z+1|0;f:{e:{if((a=(0|(r=o[n+12>>2]))<0)|!(f=Y>>>0<=h[n+6>>1]&g>>>0>=h[n>>1]&h[n+10>>1]>=l>>>0&e>>>0>=h[n+4>>1]&Q>>>0<=h[n+8>>1]&V>>>0>=h[n+2>>1])){if(a&~f)break e}else Zn[o[o[i>>2]+8>>2]](i,r>>>21|0,2097151&r);n=n+16|0,b=b+1|0;break f}n=n-(r<<4)|0,b=b-r|0}if(!((0|A)>(0|b)))break}if(o[8502]>=(0|Z))break A;o[8502]=Z;break A;case 1:if(o[a+152>>2]>0)for(;;){if(A=o[a+160>>2]+(n<<5)|0,!(h[c+10>>1]>h[A+6>>1]|h[c+4>>1]>1]|h[c+8>>1]>1]|h[c+14>>1]>h[A+10>>1]||h[c+6>>1]>1]|h[c+12>>1]>h[A+8>>1])){if((0|(r=o[A+16>>2]))<=0)r=0;else for(e=r+(l=o[A+12>>2])|0,b=o[a+136>>2]+(l<<4)|0,r=0;;){f:{e:{if((Z=(0|(A=o[b+12>>2]))<0)|!(f=h[c+10>>1]<=h[b+6>>1]&h[c+4>>1]>=h[b>>1]&h[c+14>>1]<=h[b+10>>1]&h[c+8>>1]>=h[b+4>>1]&h[c+12>>1]<=h[b+8>>1]&h[c+6>>1]>=h[b+2>>1])){if(Z&~f)break e}else Zn[o[o[i>>2]+8>>2]](i,A>>>21|0,2097151&A);l=l+1|0,b=b+16|0;break f}l=l-A|0,b=b-(A<<4)|0}if(r=r+1|0,!((0|e)>(0|l)))break}o[8502]>=(0|r)||(o[8502]=r)}if(!((0|(n=n+1|0))>2]))break}break A;case 2:break r;default:break A}If(a,o[a+136>>2],i,c+10|0,c+4|0)}else{if((0|(Q=o[a+56>>2]))>0)for(n=o[a+96>>2];;){A=0,w[f>>2]>w[n+16>>2]||(A=0,w[e>>2]>2]||(A=1)),r=0,r=w[e+8>>2]>2]|w[f+8>>2]>w[n+24>>2]?r:A;r:{f:{if(w[e+4>>2]>2]|w[f+4>>2]>w[n+20>>2])A=-1==(0|(l=o[n+32>>2])),r=0;else if(r&(A=-1==(0|(l=o[n+32>>2])))){Zn[o[o[i>>2]+8>>2]](i,o[n+36>>2],o[n+40>>2]),Q=o[a+56>>2];break f}if(!(A|r)){n=(l<<6)+n|0,b=b+l|0;break r}}n=n- -64|0,b=b+1|0}if(Z=Z+1|0,!((0|b)<(0|Q)))break}o[8502]>=(0|Z)||(o[8502]=Z)}S=c+16|0,S=i- -64|0},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0);S=e=S-144|0,o[e+72>>2]=0,o[e+76>>2]=0,o[(i=e- -64|0)>>2]=0,o[i+4>>2]=0,o[e+108>>2]=0,o[e+112>>2]=0,o[e+116>>2]=0,o[e+120>>2]=0,o[e+52>>2]=0,o[e+56>>2]=0,o[e+84>>2]=0,o[e+88>>2]=0,o[e+80>>2]=1065353216,o[e+92>>2]=0,o[e+96>>2]=0,o[e+100>>2]=1065353216,o[e+104>>2]=0,o[e+44>>2]=0,o[e+48>>2]=0,o[e+60>>2]=1065353216,o[e+124>>2]=-581039253,o[e+40>>2]=22520,n=w[f+8>>2],a=w[f>>2],t=w[f+4>>2],o[e+140>>2]=0,c=m(t*m(0)),w[e+136>>2]=n+m(m(a*w[e+68>>2])+c),n=m(n*m(0)),w[e+132>>2]=n+m(t+m(a*w[i>>2])),w[e+128>>2]=n+m(a+c),o[e+32>>2]=1566444395,o[e+36>>2]=0,o[e+24>>2]=1566444395,o[e+28>>2]=1566444395,o[e+16>>2]=-581039253,o[e+20>>2]=0,o[e+8>>2]=-581039253,o[e+12>>2]=-581039253,Zn[o[o[r>>2]+64>>2]](r,e+40|0,e+8|0,e+24|0),r=o[e+56>>2],o[A+8>>2]=o[e+52>>2],o[A+12>>2]=r,r=o[e+48>>2],o[A>>2]=o[e+44>>2],o[A+4>>2]=r,S=e+144|0},function(A,r,f){A|=0,f|=0,Zn[o[o[(r|=0)>>2]+68>>2]](A,r,f)},function(A,r){r|=0;var f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0;(f=o[60+(A|=0)>>2])&&(n=r,a=0|Zn[o[o[f>>2]+12>>2]](f),t=1,i=o[o[r>>2]+16>>2],f=0|Zn[i](0|n,0|a,0|t),e=o[A+60>>2],t=r,a=f,n=0|Zn[o[o[e>>2]+16>>2]](e,o[f+8>>2],r),c=1213612625,b=o[A+60>>2],i=o[o[r>>2]+20>>2],Zn[i](0|t,0|a,0|n,0|c,0|b))},function(A,r){r|=0;var f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0;(f=o[64+(A|=0)>>2])&&(n=r,a=0|Zn[o[o[f>>2]+8>>2]](f),t=1,i=o[o[r>>2]+16>>2],f=0|Zn[i](0|n,0|a,0|t),e=o[A+64>>2],t=r,a=f,n=0|Zn[o[o[e>>2]+12>>2]](e,o[f+8>>2],r),c=1346456916,b=o[A+64>>2],i=o[o[r>>2]+20>>2],Zn[i](0|t,0|a,0|n,0|c,0|b))},en,vn,PA,vn,PA,vn,function(A,r,f){A|=0,r|=0,f|=0;var e,i,n,a,t=0,c=0,b=m(0),u=m(0),l=m(0),s=0,k=0,d=0,B=0,Q=m(0),E=m(0),W=m(0);S=n=S-32|0,o[A+60>>2]=o[A+60>>2]+1,t=o[A+4>>2],Zn[o[o[t>>2]+16>>2]](t,n+28|0,n+24|0,n+20|0,n+16|0,n+12|0,n+8|0,n+4|0,n,r),e=o[A+4>>2],i=o[n+12>>2]+G(o[n+8>>2],f)|0,a=o[n+16>>2],t=o[n+28>>2],c=o[n>>2];A:if(o[n+20>>2]){switch(s=e+12|0,c-2|0){case 0:c=G(o[i+8>>2],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+56>>2]=0,w[A+52>>2]=l*m(B),w[A+48>>2]=u*m(d),w[A+44>>2]=b*m(k),c=G(o[i+4>>2],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+40>>2]=0,w[A+36>>2]=l*m(B),w[A+32>>2]=u*m(d),w[A+28>>2]=b*m(k),t=G(o[i>>2],a)+t|0,b=m(w[e+8>>2]*m(Z[t+8>>3])),l=m(w[e+4>>2]*m(Z[t>>3])),u=m(Z[t+16>>3]);break A;case 1:c=G(h[i+4>>1],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+56>>2]=0,w[A+52>>2]=l*m(B),w[A+48>>2]=u*m(d),w[A+44>>2]=b*m(k),c=G(h[i+2>>1],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+40>>2]=0,w[A+36>>2]=l*m(B),w[A+32>>2]=u*m(d),w[A+28>>2]=b*m(k),t=G(h[i>>1],a)+t|0,b=m(w[e+8>>2]*m(Z[t+8>>3])),l=m(w[e+4>>2]*m(Z[t>>3])),u=m(Z[t+16>>3]);break A}c=G(v[i+2|0],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+56>>2]=0,w[A+52>>2]=l*m(B),w[A+48>>2]=u*m(d),w[A+44>>2]=b*m(k),c=G(v[i+1|0],a)+t|0,k=Z[c>>3],d=Z[c+8>>3],B=Z[c+16>>3],b=w[e+4>>2],u=w[e+8>>2],l=w[e+12>>2],o[A+40>>2]=0,w[A+36>>2]=l*m(B),w[A+32>>2]=u*m(d),w[A+28>>2]=b*m(k),t=G(v[0|i],a)+t|0,b=m(w[e+8>>2]*m(Z[t+8>>3])),l=m(w[e+4>>2]*m(Z[t>>3])),u=m(Z[t+16>>3])}else{r:{switch(c-2|0){case 0:s=o[i+8>>2];break r;case 1:s=h[i+4>>1];break r}s=v[i+2|0]}s=G(s,a)+t|0,b=w[s>>2],u=w[s+4>>2],l=w[s+8>>2],Q=w[e+4>>2],E=w[e+8>>2],W=w[e+12>>2],o[A+56>>2]=0,w[A+52>>2]=l*W,w[A+48>>2]=u*E,w[A+44>>2]=b*Q;r:{switch(c-2|0){case 0:s=o[i+4>>2];break r;case 1:s=h[i+2>>1];break r}s=v[i+1|0]}s=G(s,a)+t|0,b=w[s>>2],u=w[s+4>>2],l=w[s+8>>2],Q=w[e+4>>2],E=w[e+8>>2],W=w[e+12>>2],o[A+40>>2]=0,w[A+36>>2]=l*W,w[A+32>>2]=u*E,w[A+28>>2]=b*Q;r:{switch(c-2|0){case 0:c=o[i>>2];break r;case 1:c=h[i>>1];break r}c=v[0|i]}s=8+(t=G(c,a)+t|0)|0,b=m(w[t+4>>2]*w[e+8>>2]),l=m(w[t>>2]*w[e+4>>2]),u=w[e+12>>2]}Q=w[s>>2],o[A+24>>2]=0,w[A+16>>2]=b,w[A+12>>2]=l,w[A+20>>2]=Q*u,t=o[A+8>>2],Zn[o[o[t>>2]+8>>2]](t,A+12|0,r,f),A=o[A+4>>2],Zn[o[o[A>>2]+24>>2]](A,r),S=n+32|0},en,ai,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0);i=S-16|0,n=A+36|0,A=o[A+60>>2],a=w[n+((A+2|0)%3<<2)>>2],w[i+8>>2]=a,w[i+4>>2]=a,w[i>>2]=a,w[(A<<=2)+i>>2]=a+w[A+n>>2],l=w[r+52>>2],t=w[r+24>>2],d=w[r+20>>2],s=w[r+56>>2],c=w[r+40>>2],v=w[r+36>>2],k=w[r+48>>2],h=w[r+8>>2],B=w[r>>2],Z=w[r+4>>2],G=w[r+16>>2],E=w[r+32>>2],a=w[i+8>>2],b=w[i>>2],u=w[i+4>>2],o[f+12>>2]=0,c=m(m(a*m(Q(c)))+m(m(b*m(Q(E)))+m(u*m(Q(v))))),w[f+8>>2]=s-c,t=m(m(a*m(Q(t)))+m(m(b*m(Q(G)))+m(u*m(Q(d))))),w[f+4>>2]=l-t,a=m(m(a*m(Q(h)))+m(m(b*m(Q(B)))+m(u*m(Q(Z))))),w[f>>2]=k-a,o[e+12>>2]=0,w[e+8>>2]=s+c,w[e+4>>2]=l+t,w[e>>2]=k+a},function(A,r){A|=0,r|=0;var f=m(0),e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);f=w[A+24>>2],e=w[A+40>>2],i=w[A+28>>2],n=w[A+44>>2],a=w[A+20>>2],t=w[A+36>>2],We(A,r),c=w[r>>2],b=w[r+4>>2],u=w[r+8>>2],o[A+48>>2]=0,w[A+44>>2]=u*m(n/i),w[A+40>>2]=b*m(e/f),w[A+36>>2]=c*m(t/a),w[A+52>>2]=w[(A+36|0)+((o[A+60>>2]+2|0)%3<<2)>>2]},function(A,r,f){A|=0,r=m(r),f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=0;e=A+36|0,c=o[A+60>>2],n=w[e+((c+2|0)%3<<2)>>2],o[12+(A=S-16|0)>>2]=0,w[A+8>>2]=n,w[A+4>>2]=n,w[A>>2]=n,w[(i=(c<<=2)+A|0)>>2]=w[c+e>>2]+w[i>>2],n=w[A+8>>2],r=m(r*m(.0833333283662796)),a=w[A>>2],a=m(a+a),a=m(a*a),t=w[A+4>>2],t=m(t+t),t=m(t*t),w[f+8>>2]=r*m(a+t),n=m(n+n),n=m(n*n),w[f+4>>2]=r*m(a+n),w[f>>2]=r*m(t+n)},function(){return 7481},Te,bn,an,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return te(A,r,f),w[r+28>>2]=w[A+36>>2],w[r+32>>2]=w[A+40>>2],w[r+36>>2]=w[A+44>>2],w[r+40>>2]=w[A+48>>2],w[r+12>>2]=w[A+20>>2],w[r+16>>2]=w[A+24>>2],w[r+20>>2]=w[A+28>>2],w[r+24>>2]=w[A+32>>2],e=w[A+52>>2],o[r+48>>2]=0,w[r+44>>2]=e,A=o[A+60>>2],o[r+56>>2]=0,o[r+52>>2]=A,9081},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0);e=S-16|0,o[A>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,n=w[f+8>>2],a=w[f>>2],t=w[f+4>>2],(c=m(m(n*n)+m(m(a*a)+m(t*t))))>2]=0,o[e+12>>2]=0,o[e>>2]=0,o[e+4>>2]=0,i=(f=o[r+60>>2]<<2)+e|0,b=w[36+(r+f|0)>>2],w[i>>2]=b,a=m(-0xde0b6b000000000),u=w[e+8>>2],s=w[e>>2],k=w[e+4>>2],(t=m(m(l*u)+m(m(c*s)+m(n*k))))>m(-0xde0b6b000000000)&&(w[A+12>>2]=w[e+12>>2],w[A+8>>2]=u,w[A+4>>2]=k,w[A>>2]=s,a=t),o[e+8>>2]=0,o[e+12>>2]=0,o[e>>2]=0,o[e+4>>2]=0,w[i>>2]=-b,b=a,a=w[e+8>>2],t=w[e>>2],u=n,n=w[e+4>>2],b>2]=w[e+12>>2],w[A+8>>2]=a,w[A+4>>2]=n,w[A>>2]=t)},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=0,a=0,t=m(0),c=m(0),b=m(0),u=m(0),l=0,s=0,k=m(0),d=m(0),v=m(0),h=0,B=m(0),Z=m(0);if((0|e)>0)for(i=S-16|0,h=A+36|0;o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=0,o[i+4>>2]=0,a=o[A+60>>2],t=w[(n=a<<2)+h>>2],w[i+n>>2]=t,c=m(-0xde0b6b000000000),k=w[8+(n=(s=l<<4)+r|0)>>2],u=w[i+8>>2],d=w[n>>2],B=w[i>>2],Z=w[i+4>>2],v=w[n+4>>2],(b=m(m(k*u)+m(m(d*B)+m(Z*v))))>m(-0xde0b6b000000000)&&(w[12+(a=f+s|0)>>2]=w[i+12>>2],w[a+8>>2]=u,w[a+4>>2]=Z,w[a>>2]=B,a=o[A+60>>2],t=w[(a<<2)+h>>2],k=w[n+8>>2],v=w[n+4>>2],d=w[n>>2],c=b),o[i+8>>2]=0,o[i+12>>2]=0,o[i>>2]=0,o[i+4>>2]=0,w[(a<<2)+i>>2]=-t,u=c,c=w[i+8>>2],b=w[i>>2],t=w[i+4>>2],u>2]=w[i+12>>2],w[n+8>>2]=c,w[n+4>>2]=t,w[n>>2]=b),(0|(l=l+1|0))!=(0|e););},cn,zi,function(A){_f(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},ai,Ke,function(A,r){A|=0,r|=0;var f=m(0),e=0,i=0,n=m(0);i=o[A+76>>2]<<2,f=w[i+r>>2],e=i,i=A+20|0,n=m(w[A+68>>2]*m(f/w[e+i>>2])),w[A+68>>2]=n,e=o[A+72>>2]<<2,f=m(w[e+r>>2]/w[i+e>>2]),e=o[A+80>>2]<<2,f=m(w[A+64>>2]*m(m(f+m(w[e+r>>2]/w[i+e>>2]))*m(.5))),w[A+64>>2]=f,w[A+60>>2]=f/m(N(m(m(f*f)+m(n*n)))),We(A,r)},function(A,r,f){A|=0,r=m(r),f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);S=e=S-96|0,o[e+44>>2]=0,o[e+48>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+52>>2]=1065353216,o[(i=e- -64|0)>>2]=0,o[i+4>>2]=0,o[e+76>>2]=0,o[e+80>>2]=0,o[e+72>>2]=1065353216,o[e+84>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=1065353216,Zn[o[o[A>>2]+8>>2]](A,e+32|0,e+16|0,e),c=w[e+24>>2],b=w[e+8>>2],a=w[e+16>>2],t=w[e>>2],u=w[e+20>>2],l=w[e+4>>2],n=m(Zn[o[o[A>>2]+48>>2]](A)),o[f+12>>2]=0,r=m(r*m(.0833333283662796)),a=m(n+m(m(t-a)*m(.5))),a=m(a+a),a=m(a*a),t=m(n+m(m(l-u)*m(.5))),t=m(t+t),t=m(t*t),w[f+8>>2]=r*m(a+t),n=m(n+m(m(b-c)*m(.5))),n=m(n+n),n=m(n*n),w[f+4>>2]=r*m(a+n),w[f>>2]=r*m(t+n),S=e+96|0},function(){return 7581},function(A){o[8+(A|=0)>>2]=0,o[A+12>>2]=0,o[A>>2]=0,o[A+4>>2]=1065353216},an,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return te(A,r,f),w[r+28>>2]=w[A+36>>2],w[r+32>>2]=w[A+40>>2],w[r+36>>2]=w[A+44>>2],w[r+40>>2]=w[A+48>>2],w[r+12>>2]=w[A+20>>2],w[r+16>>2]=w[A+24>>2],w[r+20>>2]=w[A+28>>2],w[r+24>>2]=w[A+32>>2],e=w[A+52>>2],o[r+48>>2]=0,w[r+44>>2]=e,A=o[A+76>>2],o[r+56>>2]=0,o[r+52>>2]=A,9042},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=0,b=m(0),u=m(0);a=m(w[r+68>>2]*m(.5)),e=o[r+72>>2],c=(i=o[r+76>>2])<<2,n=w[f+8>>2],u=m(n*n),n=w[f>>2],t=m(n*n),n=w[f+4>>2];A:{if(w[c+f>>2]>m(w[r+60>>2]*m(N(m(u+m(t+m(n*n)))))))o[(e<<2)+A>>2]=0,w[A+c>>2]=a,c=o[r+80>>2];else{if(n=w[(e<<2)+f>>2],c=o[r+80>>2],t=w[(c<<2)+f>>2],(b=m(N(m(m(n*n)+m(t*t)))))>m(1.1920928955078125e-7)){u=n,n=m(w[r+64>>2]/b),w[(e<<2)+A>>2]=u*n,w[(i<<2)+A>>2]=-a,a=m(t*n);break A}o[(e<<2)+A>>2]=0,w[(i<<2)+A>>2]=-a}a=m(0)}w[(c<<2)+A>>2]=a,m(Zn[o[o[r>>2]+48>>2]](r))!=m(0)&&(a=w[f+4>>2],n=w[f>>2],t=w[f+8>>2],b=m(Zn[o[o[r>>2]+48>>2]](r)),u=n=(r=m(m(t*t)+m(m(n*n)+m(a*a)))>2]=w[A>>2]+m(b*m(u*n)),w[A+4>>2]=w[A+4>>2]+m(b*m(a*n)),w[A+8>>2]=w[A+8>>2]+m(b*m(t*n)))},function(A,r,f){A|=0,r|=0,f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=0,b=m(0),u=m(0);a=m(w[r+68>>2]*m(.5)),e=o[r+72>>2],c=(i=o[r+76>>2])<<2,n=w[f+8>>2],b=m(n*n),n=w[f>>2],t=m(n*n),n=w[f+4>>2];A:{if(w[c+f>>2]>m(w[r+60>>2]*m(N(m(b+m(t+m(n*n)))))))o[(e<<2)+A>>2]=0,w[A+c>>2]=a,f=o[r+80>>2];else{if(n=w[(e<<2)+f>>2],c=f,f=o[r+80>>2],t=w[c+(f<<2)>>2],(u=m(N(m(m(n*n)+m(t*t)))))>m(1.1920928955078125e-7)){b=n,n=m(w[r+64>>2]/u),w[(e<<2)+A>>2]=b*n,w[(i<<2)+A>>2]=-a,a=m(t*n);break A}o[(e<<2)+A>>2]=0,w[(i<<2)+A>>2]=-a}a=m(0)}w[(f<<2)+A>>2]=a},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=0,a=0,t=0,c=m(0),b=0,u=m(0),l=0,s=m(0),k=0,d=0,v=m(0);if((0|e)>0)for(n=S-16|0;;){c=m(w[A+68>>2]*m(.5)),b=o[A+72>>2],i=w[8+(a=(d=l<<4)+r|0)>>2],t=o[A+76>>2]<<2,s=m(i*i),i=w[a>>2],u=m(i*i),i=w[a+4>>2];A:{if(w[a+t>>2]>m(w[A+60>>2]*m(N(m(s+m(u+m(i*i)))))))o[(b<<2)+n>>2]=0,w[n+t>>2]=c,b=o[A+80>>2];else{if(i=w[a+(k=b<<2)>>2],b=o[A+80>>2],u=w[a+(b<<2)>>2],(v=m(N(m(m(i*i)+m(u*u)))))>m(1.1920928955078125e-7)){s=i,i=m(w[A+64>>2]/v),w[n+k>>2]=s*i,w[n+t>>2]=-c,c=m(u*i);break A}o[n+k>>2]=0,w[n+t>>2]=-c}c=m(0)}if(w[(b<<2)+n>>2]=c,t=o[n+12>>2],o[8+(a=f+d|0)>>2]=o[n+8>>2],o[a+12>>2]=t,t=o[n+4>>2],o[a>>2]=o[n>>2],o[a+4>>2]=t,(0|(l=l+1|0))==(0|e))break}},hn,hn,on,te,ri,Ir,function(A,r){A|=0;var f,e=0;e=o[4+(r|=0)>>2],f=o[A+100>>2],o[f+4>>2]=o[r>>2],o[f+8>>2]=e,e=o[r+12>>2],o[f+12>>2]=o[r+8>>2],o[f+16>>2]=e,vf(A)},function(A){return o[100+(A|=0)>>2]+4|0},function(A,r,f){A|=0,r=m(r),f|=0;var e,i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0);S=e=S-96|0,n=m(Zn[o[o[A>>2]+48>>2]](A)),o[e+44>>2]=0,o[e+48>>2]=0,o[e+56>>2]=0,o[e+60>>2]=0,o[e+52>>2]=1065353216,o[(i=e- -64|0)>>2]=0,o[i+4>>2]=0,o[e+76>>2]=0,o[e+80>>2]=0,o[e+72>>2]=1065353216,o[e+84>>2]=0,o[e+88>>2]=0,o[e+92>>2]=0,o[e+36>>2]=0,o[e+40>>2]=0,o[e+32>>2]=1065353216,Zn[o[o[A>>2]+8>>2]](A,e+32|0,e+16|0,e),c=w[e+24>>2],b=w[e+8>>2],a=w[e+16>>2],t=w[e>>2],u=w[e+20>>2],l=w[e+4>>2],o[f+12>>2]=0,r=m(r*m(.0833333283662796)),a=m(n+m(m(t-a)*m(.5))),a=m(a+a),a=m(a*a),t=m(n+m(m(l-u)*m(.5))),t=m(t+t),t=m(t*t),w[f+8>>2]=r*m(a+t),n=m(n+m(m(b-c)*m(.5))),n=m(n+n),n=m(n*n),w[f+4>>2]=r*m(a+n),w[f>>2]=r*m(t+n),S=e+96|0},function(){return 6671},Rf,function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0);S=e=S-80|0,o[A>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,n=w[f+8>>2],t=w[f>>2],a=w[f+4>>2],(i=m(m(n*n)+m(m(t*t)+m(a*a))))>2],i=m(t*i)),o[e+52>>2]=0,o[e+56>>2]=0,w[e+76>>2]=a,w[e+72>>2]=n,w[e+68>>2]=c,o[e+44>>2]=0,o[e+48>>2]=0,w[e+64>>2]=i,o[e+60>>2]=-581039253,o[e+40>>2]=20076,o[e+32>>2]=1566444395,o[e+36>>2]=0,o[e+24>>2]=1566444395,o[e+28>>2]=1566444395,r=o[r+100>>2],o[e+16>>2]=-581039253,o[e+20>>2]=0,o[e+8>>2]=-581039253,o[e+12>>2]=-581039253,Zn[o[o[r>>2]+8>>2]](r,e+40|0,e+8|0,e+24|0),r=o[e+56>>2],o[A+8>>2]=o[e+52>>2],o[A+12>>2]=r,r=o[e+48>>2],o[A>>2]=o[e+44>>2],o[A+4>>2]=r,S=e+80|0},function(A,r,f,e){A|=0,r|=0,f|=0;var i,n=0,a=0,t=0,c=0,b=0;if(S=i=S-80|0,!((0|(e|=0))<=0)){if(e>>>0>=8)for(b=-8&e;o[12+((n=c<<4)+f|0)>>2]=-581039253,o[12+((16|n)+f|0)>>2]=-581039253,o[12+((32|n)+f|0)>>2]=-581039253,o[12+((48|n)+f|0)>>2]=-581039253,o[12+((64|n)+f|0)>>2]=-581039253,o[12+((80|n)+f|0)>>2]=-581039253,o[12+((96|n)+f|0)>>2]=-581039253,o[12+((112|n)+f|0)>>2]=-581039253,c=c+8|0,(0|b)!=(0|(a=a+8|0)););if(a=7&e)for(;o[12+((c<<4)+f|0)>>2]=-581039253,c=c+1|0,(0|a)!=(0|(t=t+1|0)););if(!((0|e)<=0))for(n=i- -64|0,c=0;o[i+40>>2]=20076,o[i+52>>2]=0,o[i+56>>2]=0,o[i+44>>2]=0,o[i+48>>2]=0,o[i+60>>2]=-581039253,t=o[12+(b=(a=c<<4)+r|0)>>2],o[n+8>>2]=o[b+8>>2],o[n+12>>2]=t,t=o[b+4>>2],o[n>>2]=o[b>>2],o[n+4>>2]=t,o[i+32>>2]=1566444395,o[i+36>>2]=0,o[i+24>>2]=1566444395,o[i+28>>2]=1566444395,t=o[A+100>>2],o[i+16>>2]=-581039253,o[i+20>>2]=0,o[i+8>>2]=-581039253,o[i+12>>2]=-581039253,Zn[o[o[t>>2]+8>>2]](t,i+40|0,i+8|0,i+24|0),t=o[i+56>>2],o[8+(a=f+a|0)>>2]=o[i+52>>2],o[a+12>>2]=t,t=o[i+48>>2],o[a>>2]=o[i+44>>2],o[a+4>>2]=t,(0|(c=c+1|0))!=(0|e););}S=i+80|0},cn,cn,Qi,zi,cn,Qi,Zi,en,vn,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0);i=w[A+20>>2],n=w[A+32>>2],a=w[A+24>>2],t=w[A+28>>2],i<(e=m(m(n*w[r+8>>2])+m(m(a*w[r>>2])+m(t*w[r+4>>2]))))&&(w[A+20>>2]=e,f=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=f,f=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=f,i=e),(e=m(m(n*w[r+24>>2])+m(m(a*w[r+16>>2])+m(t*w[r+20>>2]))))>i?(w[A+20>>2]=e,f=o[r+28>>2],o[A+12>>2]=o[r+24>>2],o[A+16>>2]=f,f=o[r+20>>2],o[A+4>>2]=o[r+16>>2],o[A+8>>2]=f):e=i,e<(i=m(m(n*w[r+40>>2])+m(m(a*w[r+32>>2])+m(t*w[r+36>>2]))))&&(w[A+20>>2]=i,f=o[r+44>>2],o[A+12>>2]=o[r+40>>2],o[A+16>>2]=f,f=o[r+36>>2],o[A+4>>2]=o[r+32>>2],o[A+8>>2]=f)},ai,of,Df,function(A,r,f){A|=0,r=m(r),f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);n=w[A+44>>2],e=w[A+40>>2],c=w[A+36>>2],b=m(Zn[o[o[A>>2]+48>>2]](A)),e=m(e+m(Zn[o[o[A>>2]+48>>2]](A))),u=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(r*m(.5)),a=m(r*m(.25)),t=m(r/m(12)),r=m(b+c);A:{switch(o[A+60>>2]){case 0:n=i,i=m(e*e),e=m(n*i),i=r=m(m(t*m(r*m(r*m(4))))+m(a*i));break A;case 2:r=m(r*r),i=m(i*r),e=m(u+n),r=e=m(m(t*m(e*m(e*m(4))))+m(a*r));break A}n=i,i=m(r*r),r=m(n*i),i=e=m(m(t*m(e*m(e*m(4))))+m(a*i))}o[f+12>>2]=0,w[f+8>>2]=i,w[f+4>>2]=r,w[f>>2]=e},function(){return 9276},Te,xf,an,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return te(A,r,f),w[r+28>>2]=w[A+36>>2],w[r+32>>2]=w[A+40>>2],w[r+36>>2]=w[A+44>>2],w[r+40>>2]=w[A+48>>2],w[r+12>>2]=w[A+20>>2],w[r+16>>2]=w[A+24>>2],w[r+20>>2]=w[A+28>>2],w[r+24>>2]=w[A+32>>2],e=w[A+52>>2],o[r+48>>2]=0,w[r+44>>2]=e,A=o[A+60>>2],o[r+56>>2]=0,o[r+52>>2]=A,8921},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=0,c=m(0),b=m(0);S=e=S-16|0,Zn[o[o[r>>2]+68>>2]](e,r,f),t=o[e+12>>2],o[A+8>>2]=o[e+8>>2],o[A+12>>2]=t,t=o[e+4>>2],o[A>>2]=o[e>>2],o[A+4>>2]=t,m(Zn[o[o[r>>2]+48>>2]](r))!=m(0)&&(n=w[f+4>>2],i=w[f>>2],a=w[f+8>>2],c=m(Zn[o[o[r>>2]+48>>2]](r)),b=i=(r=m(m(a*a)+m(m(i*i)+m(n*n)))>2]=w[A>>2]+m(c*m(b*i)),w[A+4>>2]=w[A+4>>2]+m(c*m(n*i)),w[A+8>>2]=w[A+8>>2]+m(c*m(a*i))),S=e+16|0},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),o=m(0);e=w[r+40>>2],i=w[r+36>>2],n=w[f>>2],a=w[f+8>>2],(t=m(N(m(m(n*n)+m(a*a)))))==m(0)||(i=m(i/t),o=m(a*i),i=m(n*i)),e=w[f+4>>2]>2]=o,w[A+4>>2]=e,w[A>>2]=i},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=m(0),a=m(0),t=m(0),o=0,c=m(0),b=0,u=m(0);if((0|e)>0)for(;n=w[A+40>>2],a=w[A+36>>2],c=w[(i=(b=o<<4)+r|0)>>2],t=w[i+8>>2],(u=m(N(m(m(c*c)+m(t*t)))))==m(0)?(t=m(0),n=w[i+4>>2]>2]>2]=t,w[i+4>>2]=n,w[i>>2]=a,(0|(o=o+1|0))!=(0|e););},function(A){A|=0;var r=m(0),f=m(0);return r=w[A+36>>2],f=m(Zn[o[o[A>>2]+48>>2]](A)),m(Zn[o[o[A>>2]+48>>2]](A)),m(Zn[o[o[A>>2]+48>>2]](A)),m(m(r+f))},en,hn,en,ai,Mf,ye,Li,Ti,function(){return 1038},Qi,function(A){return o[(A|=0)>>2]=20488,0|A},function(A){o[(A|=0)>>2]=20488,A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0);u=w[r+56>>2],k=w[r+36>>2],d=w[r+40>>2],l=w[r+52>>2],t=w[r+20>>2],n=w[A+120>>2],c=w[A+28>>2],v=w[A+44>>2],a=w[r+24>>2],i=w[A+124>>2],b=w[A+32>>2],h=w[A+48>>2],B=w[r+32>>2],s=w[r+48>>2],Z=w[r>>2],G=w[r+4>>2],E=w[r+8>>2],W=w[r+16>>2],N=w[A+116>>2],p=w[A+24>>2],F=w[A+40>>2],R=m(Zn[o[o[A>>2]+48>>2]](A)),Y=m(Zn[o[o[A>>2]+48>>2]](A)),V=m(Zn[o[o[A>>2]+48>>2]](A)),o[f+12>>2]=0,i=m(m(i*m(h-b))*m(.5)),b=m(i*m(Q(a))),a=m(m(N*m(F-p))*m(.5)),n=m(m(n*m(v-c))*m(.5)),t=m(Y+m(b+m(m(a*m(Q(W)))+m(n*m(Q(t)))))),w[f+4>>2]=l-t,c=m(R+m(m(i*m(Q(E)))+m(m(a*m(Q(Z)))+m(n*m(Q(G)))))),w[f>>2]=s-c,i=m(V+m(m(i*m(Q(d)))+m(m(a*m(Q(B)))+m(n*m(Q(k)))))),w[f+8>>2]=u-i,o[e+12>>2]=0,w[e+8>>2]=u+i,w[e+4>>2]=l+t,w[e>>2]=s+c},function(A,r){A|=0;var f=0;f=o[4+(r|=0)>>2],o[A+116>>2]=o[r>>2],o[A+120>>2]=f,f=o[r+12>>2],o[A+124>>2]=o[r+8>>2],o[A+128>>2]=f},function(A){return 116+(A|=0)|0},Pe,function(){return 9334},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n,a,t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=0,d=0,h=0,B=0,Z=0,G=0,E=0;S=i=S-48|0,t=w[A+48>>2],c=w[A+32>>2],l=m(m(1)/w[A+124>>2]),s=w[A- -64>>2],d=((b=t<(b=c>(b=m(m(l*w[e+8>>2])+s))?c:b)?t:b)(l=m(m(l*w[f+8>>2])+s))?c:l)?t:c)>2],c=w[A+28>>2],l=m(m(1)/w[A+120>>2]),s=w[A+60>>2],d=((b=t<(b=c>(b=m(m(l*w[e+4>>2])+s))?c:b)?t:b)(l=m(m(l*w[f+4>>2])+s))?c:l)?t:c)>2],c=w[A+24>>2],l=m(m(1)/w[A+116>>2]),s=w[A+56>>2],d=((b=t<(b=c>(b=m(m(l*w[e>>2])+s))?c:b)?t:b)(l=m(m(l*w[f>>2])+s))?c:l)?t:c)>2]-1|0,Z=o[A+72>>2]-1|0;A:{r:switch(o[A+112>>2]){case 0:k=(0|B)<(0|k)?B:k,h=(0|G)>0?G:0,Z=(0|Z)>(0|n)?n:Z,E=(0|a)>0?a:0;break A;case 1:k=(0|B)<(0|k)?B:k,h=(0|G)>0?G:0,Z=(0|e)<(0|Z)?e:Z,E=(0|f)>0?f:0;break A;case 2:break r;default:break A}k=(0|k)>(0|n)?n:k,h=(0|a)>0?a:0,Z=(0|e)<(0|Z)?e:Z,E=(0|f)>0?f:0}if(!((0|Z)<=(0|E)|(0|h)>=(0|k)))for(;;){for(G=1&h,l=m(0|(B=h+1|0)),s=m(0|h),f=E;;){A:{r:{if(e=f,!(!(!v[A+110|0]||G)|v[A+108|0]|(f+h&1?0:v[A+109|0]))){b=m(Zn[o[o[A>>2]+68>>2]](A,e,h));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+12>>2]=0,t=m(s-m(t*m(.5))),c=m(m(0|e)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+12>>2]=0,t=m(b-t),c=m(m(0|e)-m(c*m(.5))),b=m(s-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+12>>2]=0,c=m(b-c),t=m(m(0|e)-m(t*m(.5))),b=m(s-m(u*m(.5)));break f}t=w[i+4>>2],c=w[i>>2],b=w[i+8>>2]}w[i>>2]=c*w[A+116>>2],w[i+4>>2]=t*w[A+120>>2],w[i+8>>2]=b*w[A+124>>2],b=m(Zn[o[o[A>>2]+68>>2]](A,e,B));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+28>>2]=0,t=m(l-m(t*m(.5))),c=m(m(0|e)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+28>>2]=0,t=m(b-t),c=m(m(0|e)-m(c*m(.5))),b=m(l-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+28>>2]=0,c=m(b-c),t=m(m(0|e)-m(t*m(.5))),b=m(l-m(u*m(.5)));break f}t=w[i+20>>2],c=w[i+16>>2],b=w[i+24>>2]}w[i+16>>2]=c*w[A+116>>2],w[i+20>>2]=t*w[A+120>>2],w[i+24>>2]=b*w[A+124>>2],f=e+1|0,b=m(Zn[o[o[A>>2]+68>>2]](A,f,h));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+44>>2]=0,t=m(s-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+44>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(s-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+44>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(s-m(u*m(.5)));break f}t=w[i+36>>2],c=w[i+32>>2],b=w[i+40>>2]}w[i+32>>2]=c*w[A+116>>2],w[i+36>>2]=t*w[A+120>>2],w[i+40>>2]=b*w[A+124>>2],Zn[o[o[r>>2]+8>>2]](r,i,e,h),b=m(Zn[o[o[A>>2]+68>>2]](A,f,h));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+12>>2]=0,t=m(s-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+12>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(s-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+12>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(s-m(u*m(.5)));break f}t=w[i+4>>2],c=w[i>>2],b=w[i+8>>2]}w[i>>2]=c*w[A+116>>2],w[i+4>>2]=t*w[A+120>>2],w[i+8>>2]=b*w[A+124>>2],b=m(Zn[o[o[A>>2]+68>>2]](A,f,B));f:switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+44>>2]=0,t=m(l-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break A;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+44>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(l-m(u*m(.5)));break A;case 0:break f;default:break r}t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+44>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(l-m(u*m(.5)));break A}b=m(Zn[o[o[A>>2]+68>>2]](A,e,h));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+12>>2]=0,t=m(s-m(t*m(.5))),c=m(m(0|e)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+12>>2]=0,t=m(b-t),c=m(m(0|e)-m(c*m(.5))),b=m(s-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+12>>2]=0,c=m(b-c),t=m(m(0|e)-m(t*m(.5))),b=m(s-m(u*m(.5)));break f}t=w[i+4>>2],c=w[i>>2],b=w[i+8>>2]}w[i>>2]=c*w[A+116>>2],w[i+4>>2]=t*w[A+120>>2],w[i+8>>2]=b*w[A+124>>2],b=m(Zn[o[o[A>>2]+68>>2]](A,e,B));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+28>>2]=0,t=m(l-m(t*m(.5))),c=m(m(0|e)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+28>>2]=0,t=m(b-t),c=m(m(0|e)-m(c*m(.5))),b=m(l-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+28>>2]=0,c=m(b-c),t=m(m(0|e)-m(t*m(.5))),b=m(l-m(u*m(.5)));break f}t=w[i+20>>2],c=w[i+16>>2],b=w[i+24>>2]}w[i+16>>2]=c*w[A+116>>2],w[i+20>>2]=t*w[A+120>>2],w[i+24>>2]=b*w[A+124>>2],f=e+1|0,b=m(Zn[o[o[A>>2]+68>>2]](A,f,B));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+44>>2]=0,t=m(l-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+44>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(l-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+44>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(l-m(u*m(.5)));break f}t=w[i+36>>2],c=w[i+32>>2],b=w[i+40>>2]}w[i+32>>2]=c*w[A+116>>2],w[i+36>>2]=t*w[A+120>>2],w[i+40>>2]=b*w[A+124>>2],Zn[o[o[r>>2]+8>>2]](r,i,e,h),b=m(Zn[o[o[A>>2]+68>>2]](A,f,B));f:{switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+28>>2]=0,t=m(l-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break f;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+28>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(l-m(u*m(.5)));break f;case 0:t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+28>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(l-m(u*m(.5)));break f}t=w[i+20>>2],c=w[i+16>>2],b=w[i+24>>2]}w[i+16>>2]=c*w[A+116>>2],w[i+20>>2]=t*w[A+120>>2],w[i+24>>2]=b*w[A+124>>2],b=m(Zn[o[o[A>>2]+68>>2]](A,f,h));f:switch(o[A+112>>2]){case 2:c=w[A+88>>2],t=w[A+92>>2],u=w[A+64>>2],o[i+44>>2]=0,t=m(s-m(t*m(.5))),c=m(m(0|f)-m(c*m(.5))),b=m(b-u);break A;case 1:c=w[A+88>>2],u=w[A+92>>2],t=w[A+60>>2],o[i+44>>2]=0,t=m(b-t),c=m(m(0|f)-m(c*m(.5))),b=m(s-m(u*m(.5)));break A;case 0:break f;default:break r}t=w[A+88>>2],u=w[A+92>>2],c=w[A+56>>2],o[i+44>>2]=0,c=m(b-c),t=m(m(0|f)-m(t*m(.5))),b=m(s-m(u*m(.5)));break A}t=w[i+36>>2],c=w[i+32>>2],b=w[i+40>>2]}if(w[i+32>>2]=c*w[A+116>>2],w[i+36>>2]=t*w[A+120>>2],w[i+40>>2]=b*w[A+124>>2],Zn[o[o[r>>2]+8>>2]](r,i,e,h),(0|f)==(0|Z))break}if((0|k)==(0|(h=B)))break}S=i+48|0},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);switch(o[A+104>>2]){case 0:return m(w[o[A+100>>2]+(G(o[A+72>>2],f)+r<<2)>>2]);case 5:return m(m(w[A+96>>2]*m(v[o[A+100>>2]+(G(o[A+72>>2],f)+r|0)|0])));case 3:e=m(w[A+96>>2]*m(t[o[A+100>>2]+(G(o[A+72>>2],f)+r<<1)>>1]))}return m(e)},function(A){return 0|nf(A|=0)},ii,function(A,r,f,e){return 0|vA(A|=0,r|=0,f|=0,e|=0)},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),c=m(0),b=0,u=0,l=m(0),s=0,k=0,d=0,h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=0,N=0,p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=0;if(n=w[r+40>>2],c=w[r+36>>2],i=w[r+24>>2],B=w[r+20>>2],u=o[A+8>>2],p=w[u+44>>2],F=w[u+40>>2],R=w[u+12>>2],Y=w[u+8>>2],Z=w[r+32>>2],G=w[r+16>>2],h=w[r+8>>2],Q=w[r+4>>2],E=w[r>>2],V=w[u+36>>2],g=w[u+4>>2],r=o[A+4>>2],(0|(A=o[r+4>>2]))==o[r+8>>2]&&!((0|(W=A?A<<1:1))<=(0|A))){if(W?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](W<<4,16),A=o[r+4>>2]):u=0,!((0|A)<=0)){if(1!=(0|A))for(D=-2&A;d=(k=s<<4)+u|0,b=k+o[r+12>>2]|0,N=o[b+4>>2],o[d>>2]=o[b>>2],o[d+4>>2]=N,N=o[b+12>>2],o[d+8>>2]=o[b+8>>2],o[d+12>>2]=N,k=(b=16|k)+u|0,b=b+o[r+12>>2]|0,d=o[b+4>>2],o[k>>2]=o[b>>2],o[k+4>>2]=d,d=o[b+12>>2],o[k+8>>2]=o[b+8>>2],o[k+12>>2]=d,s=s+2|0,(0|(X=X+2|0))!=(0|D););1&A&&(s=(A=s<<4)+u|0,A=A+o[r+12>>2]|0,b=o[A+4>>2],o[s>>2]=o[A>>2],o[s+4>>2]=b,b=o[A+12>>2],o[s+8>>2]=o[A+8>>2],o[s+12>>2]=b)}!(A=o[r+12>>2])||!A|!v[r+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[r+12>>2]=u,a[r+16|0]=1,o[r+8>>2]=W,A=o[r+4>>2]}A=o[r+12>>2]+(A<<4)|0,o[A+12>>2]=f<<21|e,l=n>(l=i>(l=h>m(-0xde0b6b000000000)?h:m(-0xde0b6b000000000))?i:l)?n:l,h=h=m(0)?~~n>>>0:0,t[A+4>>1]=65534&e,n=(n=(n=Q>m(-0xde0b6b000000000)?Q:m(-0xde0b6b000000000))B?B:i)>c?c:i))=m(0)?~~c>>>0:0,t[A+2>>1]=65534&b,c=(c=(c=E>m(-0xde0b6b000000000)?E:m(-0xde0b6b000000000))G?G:i)>Z?Z:i))=m(0)?~~i>>>0:0,t[A>>1]=65534&b,f=(i=m(m(m((f?m(l+m(.0010000000474974513)):l)-R)*p)+m(1)))=m(0)?~~i>>>0:0,t[A+10>>1]=1|f,f=(n=m(m(m((e?m(n+m(.0010000000474974513)):n)-Y)*F)+m(1)))=m(0)?~~n>>>0:0,t[A+8>>1]=1|f,f=(n=m(m(m((u?m(c+m(.0010000000474974513)):c)-g)*V)+m(1)))=m(0)?~~n>>>0:0,t[A+6>>1]=1|f,o[r+4>>2]=o[r+4>>2]+1},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,t=m(0),c=m(0),b=0,u=0,l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=0,p=0,F=0,R=0,Y=0;if(c=w[r+44>>2],k=w[r+40>>2],d=w[r+36>>2],l=w[r+28>>2],h=w[r+24>>2],B=w[r+20>>2],Z=w[r+32>>2],G=w[r+16>>2],s=w[r+12>>2],Q=w[r+8>>2],E=w[r+4>>2],W=w[r>>2],i=o[A+4>>2],(0|(r=o[i+4>>2]))==o[i+8>>2]&&!((0|(N=r?r<<1:1))<=(0|r))){if(N&&(o[8488]=o[8488]+1,p=0|Zn[o[8290]](N<<6,16),r=o[i+4>>2]),!((0|r)<=0)){if(1!=(0|r))for(Y=-2&r;n=(b=F<<6)+p|0,A=o[i+12>>2]+b|0,u=o[A+4>>2],o[n>>2]=o[A>>2],o[n+4>>2]=u,u=o[A+60>>2],o[n+56>>2]=o[A+56>>2],o[n+60>>2]=u,u=o[A+52>>2],o[n+48>>2]=o[A+48>>2],o[n+52>>2]=u,u=o[A+44>>2],o[n+40>>2]=o[A+40>>2],o[n+44>>2]=u,u=o[A+36>>2],o[n+32>>2]=o[A+32>>2],o[n+36>>2]=u,u=o[A+28>>2],o[n+24>>2]=o[A+24>>2],o[n+28>>2]=u,u=o[A+20>>2],o[n+16>>2]=o[A+16>>2],o[n+20>>2]=u,u=o[A+12>>2],o[n+8>>2]=o[A+8>>2],o[n+12>>2]=u,n=(A=64|b)+p|0,A=A+o[i+12>>2]|0,b=o[A+4>>2],o[n>>2]=o[A>>2],o[n+4>>2]=b,b=o[A+12>>2],o[n+8>>2]=o[A+8>>2],o[n+12>>2]=b,b=o[A+20>>2],o[n+16>>2]=o[A+16>>2],o[n+20>>2]=b,b=o[A+28>>2],o[n+24>>2]=o[A+24>>2],o[n+28>>2]=b,b=o[A+36>>2],o[n+32>>2]=o[A+32>>2],o[n+36>>2]=b,b=o[A+44>>2],o[n+40>>2]=o[A+40>>2],o[n+44>>2]=b,b=o[A+52>>2],o[n+48>>2]=o[A+48>>2],o[n+52>>2]=b,b=o[A+60>>2],o[n+56>>2]=o[A+56>>2],o[n+60>>2]=b,F=F+2|0,(0|(R=R+2|0))!=(0|Y););1&r&&(r=(A=F<<6)+p|0,A=A+o[i+12>>2]|0,n=o[A+4>>2],o[r>>2]=o[A>>2],o[r+4>>2]=n,n=o[A+60>>2],o[r+56>>2]=o[A+56>>2],o[r+60>>2]=n,n=o[A+52>>2],o[r+48>>2]=o[A+48>>2],o[r+52>>2]=n,n=o[A+44>>2],o[r+40>>2]=o[A+40>>2],o[r+44>>2]=n,n=o[A+36>>2],o[r+32>>2]=o[A+32>>2],o[r+36>>2]=n,n=o[A+28>>2],o[r+24>>2]=o[A+24>>2],o[r+28>>2]=n,n=o[A+20>>2],o[r+16>>2]=o[A+16>>2],o[r+20>>2]=n,n=o[A+12>>2],o[r+8>>2]=o[A+8>>2],o[r+12>>2]=n)}!(A=o[i+12>>2])||!A|!v[i+16|0]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),o[i+12>>2]=p,a[i+16|0]=1,o[i+8>>2]=N,r=o[i+4>>2]}A=o[i+12>>2]+(r<<6)|0,o[A+40>>2]=e,o[A+36>>2]=f,o[A+32>>2]=-1,t=(t=s>m(0)?s:m(0))>2]=c>t?c:t,t=(t=Q>m(-0xde0b6b000000000)?Q:m(-0xde0b6b000000000))>2]=tm(-0xde0b6b000000000)?E:m(-0xde0b6b000000000))>2]=tm(-0xde0b6b000000000)?W:m(-0xde0b6b000000000))>2]=t>2]=ch?h:c,w[A+8>>2]=c>k?k:c,c=(c=EB?B:c,w[A+4>>2]=c>d?d:c,c=(c=WG?G:c,w[A>>2]=c>Z?Z:c,o[i+4>>2]=o[i+4>>2]+1},uf,function(A){uf(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},hn,function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=0,a=0,t=0,c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0,d=0,v=m(0),h=0,B=m(0),Z=0;if(S=e=S-2048|0,o[A>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0,i=w[f+8>>2],c=w[f>>2],l=w[f+4>>2],(b=m(m(i*i)+m(m(c*c)+m(l*l))))>2]+96>>2]](r))>0)for(l=m(-0xde0b6b000000000);;){if(n=128,((0|Zn[o[o[r>>2]+96>>2]](r))-d|0)>127||(0|(n=(0|Zn[o[o[r>>2]+96>>2]](r))-d|0))>0){if(f=0,!(t=1==(0|n)))for(u=-2&n,a=0;Zn[o[o[r>>2]+108>>2]](r,f,(f<<4)+e|0),k=1|f,Zn[o[o[r>>2]+108>>2]](r,k,(k<<4)+e|0),f=f+2|0,(0|u)!=(0|(a=a+2|0)););if((k=1&n)&&Zn[o[o[r>>2]+108>>2]](r,f,(f<<4)+e|0),t)f=0,a=-1,i=m(-34028234663852886e22);else for(Z=-2&n,f=0,a=-1,i=m(-34028234663852886e22),n=0;t=(b=m(m(w[8+(t=(f<<4)+e|0)>>2]*s)+m(m(w[t>>2]*c)+m(v*w[t+4>>2]))))>i,i=(u=(B=m(m(w[8+(u=((h=1|f)<<4)+e|0)>>2]*s)+m(m(w[u>>2]*c)+m(v*w[u+4>>2]))))>(i=t?b:i))?B:i,a=u?h:t?f:a,f=f+2|0,(0|Z)!=(0|(n=n+2|0)););k&&(i=(n=(b=m(m(w[8+(n=(f<<4)+e|0)>>2]*s)+m(m(w[n>>2]*c)+m(v*w[n+4>>2]))))>i)?b:i,a=n?f:a)}else i=m(-34028234663852886e22),a=-1;if(i>l&&(n=o[12+(f=(a<<4)+e|0)>>2],o[A+8>>2]=o[f+8>>2],o[A+12>>2]=n,n=o[f+4>>2],o[A>>2]=o[f>>2],o[A+4>>2]=n,l=i),d=d+128|0,!((0|Zn[o[o[r>>2]+96>>2]](r))>(0|d)))break}S=e+2048|0},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,a=0,t=0,c=m(0),b=0,u=0,l=0,s=m(0),k=0,d=0,v=0,h=0,B=m(0),Z=m(0),G=m(0),Q=0,E=m(0),W=0;if(S=i=S-2048|0,!((0|e)<=0)){if(e>>>0>=8)for(l=-8&e;o[12+((n=a<<4)+f|0)>>2]=-581039253,o[12+((16|n)+f|0)>>2]=-581039253,o[12+((32|n)+f|0)>>2]=-581039253,o[12+((48|n)+f|0)>>2]=-581039253,o[12+((64|n)+f|0)>>2]=-581039253,o[12+((80|n)+f|0)>>2]=-581039253,o[12+((96|n)+f|0)>>2]=-581039253,o[12+((112|n)+f|0)>>2]=-581039253,a=a+8|0,(0|l)!=(0|(b=b+8|0)););if(n=7&e)for(;o[12+((a<<4)+f|0)>>2]=-581039253,a=a+1|0,(0|n)!=(0|(t=t+1|0)););if(!((0|e)<=0))for(;;){if((0|Zn[o[o[A>>2]+96>>2]](A))>0)for(h=(n=v<<4)+r|0,l=f+n|0,k=0;;){if(t=128,((0|Zn[o[o[A>>2]+96>>2]](A))-k|0)>127||(0|(t=(0|Zn[o[o[A>>2]+96>>2]](A))-k|0))>0){if(n=0,!(b=1==(0|t)))for(u=-2&t,a=0;Zn[o[o[A>>2]+108>>2]](A,n,(n<<4)+i|0),d=1|n,Zn[o[o[A>>2]+108>>2]](A,d,(d<<4)+i|0),n=n+2|0,(0|u)!=(0|(a=a+2|0)););if((d=1&t)&&Zn[o[o[A>>2]+108>>2]](A,n,(n<<4)+i|0),s=w[h+8>>2],B=w[h+4>>2],Z=w[h>>2],b)n=0,t=-1,c=m(-34028234663852886e22);else for(W=-2&t,n=0,t=-1,c=m(-34028234663852886e22),b=0;a=(G=m(m(w[8+(a=(n<<4)+i|0)>>2]*s)+m(m(w[a>>2]*Z)+m(B*w[a+4>>2]))))>c,c=(u=(E=m(m(w[8+(u=((Q=1|n)<<4)+i|0)>>2]*s)+m(m(w[u>>2]*Z)+m(B*w[u+4>>2]))))>(c=a?G:c))?E:c,t=u?Q:a?n:t,n=n+2|0,(0|W)!=(0|(b=b+2|0)););d&&(c=(a=(s=m(m(w[8+(a=(n<<4)+i|0)>>2]*s)+m(m(w[a>>2]*Z)+m(B*w[a+4>>2]))))>c)?s:c,t=a?n:t)}else c=m(-34028234663852886e22),t=-1;if(w[l+12>>2]>2]=o[n+8>>2],t=o[n+4>>2],o[l>>2]=o[n>>2],o[l+4>>2]=t,w[l+12>>2]=c),k=k+128|0,!((0|Zn[o[o[A>>2]+96>>2]](A))>(0|k)))break}if((0|(v=v+1|0))==(0|e))break}}S=i+2048|0},hn,function(A,r){A|=0,r|=0;var f,e=m(0);S=f=S-96|0,We(A,r),a[A+96|0]=1,v[34128]||(o[8509]=0,o[8510]=0,o[8508]=1065353216,o[8511]=0,o[8512]=0,o[8514]=0,o[8515]=0,o[8513]=1065353216,o[8516]=0,o[8517]=0,o[8521]=0,o[8522]=0,o[8520]=-1082130432,o[8518]=1065353216,o[8519]=0,o[8523]=0,o[8524]=0,o[8526]=0,o[8527]=0,o[8525]=-1082130432,o[8528]=0,o[8529]=0,o[8530]=-1082130432,o[8531]=0,a[34128]=1),r=Af(f,0,96),Zn[o[o[A>>2]+76>>2]](A,34032,r,6),e=w[A+52>>2],w[A+80>>2]=e+w[r>>2],w[A+64>>2]=w[r+48>>2]-e,w[A+84>>2]=e+w[r+20>>2],w[A+68>>2]=w[r+68>>2]-e,w[A+88>>2]=e+w[r+40>>2],w[A+72>>2]=w[r+88>>2]-e,S=r+96|0},en,ai,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0);i=o[A+40>>2],n=w[i+32>>2],a=w[A+32>>2],c=w[i+48>>2],u=w[i+28>>2],t=w[A+28>>2],l=w[i+44>>2],s=w[i+24>>2],G=w[i+40>>2],b=w[A+24>>2],k=m(Zn[o[o[i>>2]+48>>2]](i)),R=w[r+52>>2],h=w[r+24>>2],E=w[r+20>>2],d=w[r+56>>2],v=w[r+40>>2],B=w[r+36>>2],Y=w[r+48>>2],W=w[r+8>>2],N=w[r+4>>2],p=w[r>>2],F=w[r+16>>2],Z=w[r+32>>2],o[f+12>>2]=0,V=d,n=m(n*a),c=m(c*a),d=a<=m(0)?n:c,n=a>=m(0)?n:c,a=m(m(d+n)*m(.5)),c=m(s*b),s=m(G*b),G=b<=m(0)?c:s,c=b>=m(0)?c:s,b=m(m(G+c)*m(.5)),u=m(u*t),l=m(l*t),s=t<=m(0)?u:l,u=t>=m(0)?u:l,t=m(m(s+u)*m(.5)),l=m(V+m(m(v*a)+m(m(Z*b)+m(B*t)))),n=m(k+m(m(d-n)*m(.5))),d=m(n*m(Q(v))),v=m(k+m(m(G-c)*m(.5))),k=m(k+m(m(s-u)*m(.5))),B=m(d+m(m(v*m(Q(Z)))+m(k*m(Q(B))))),w[f+8>>2]=l-B,Z=m(R+m(m(a*h)+m(m(b*F)+m(t*E)))),h=m(m(n*m(Q(h)))+m(m(v*m(Q(F)))+m(k*m(Q(E))))),w[f+4>>2]=Z-h,a=m(Y+m(m(a*W)+m(m(b*p)+m(t*N)))),t=m(m(n*m(Q(W)))+m(m(v*m(Q(p)))+m(k*m(Q(N))))),w[f>>2]=a-t,o[e+12>>2]=0,w[e+8>>2]=B+l,w[e+4>>2]=h+Z,w[e>>2]=t+a},ye,Li,Ti,function(){return 9293},function(){return 76},function(A,r,f){var e;return r|=0,f|=0,e=o[40+(A|=0)>>2],Zn[o[o[e>>2]+56>>2]](e,r,f),o[r+4>>2]=22,w[r+60>>2]=w[A+24>>2],w[r- -64>>2]=w[A+28>>2],w[r+68>>2]=w[A+32>>2],w[r+72>>2]=w[A+36>>2],9012},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0);S=i=S+-64|0,o[i+44>>2]=r,o[i+40>>2]=21460,r=o[A+36>>2],o[i+56>>2]=o[A+32>>2],o[i+60>>2]=r,r=o[A+28>>2],o[i+48>>2]=o[A+24>>2],o[i+52>>2]=r,a=w[A+32>>2],n=w[A+28>>2],t=w[A+24>>2],c=m(m(1)/t),b=w[f>>2],u=w[e>>2],w[i+24>>2]=c*(t>=m(0)?b:u),l=m(m(1)/n),s=w[f+4>>2],k=w[e+4>>2],w[i+28>>2]=l*(n>=m(0)?s:k),d=w[e+8>>2],v=w[f+8>>2],o[i+36>>2]=0,o[i+20>>2]=0,w[i+12>>2]=l*(n<=m(0)?s:k),w[i+8>>2]=c*(t<=m(0)?b:u),n=m(m(1)/a),w[i+32>>2]=n*(a>=m(0)?v:d),w[i+16>>2]=n*(a<=m(0)?v:d),A=o[A+40>>2],Zn[o[o[A>>2]+64>>2]](A,i+40|0,i+24|0,i+8|0),S=i- -64|0},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);S=i=S-48|0,c=w[A+12>>2],b=w[A+16>>2],n=w[r+4>>2],a=w[r+8>>2],u=w[A+8>>2],t=w[r>>2],o[i+12>>2]=0,w[i>>2]=t*u,w[i+8>>2]=a*b,w[i+4>>2]=n*c,n=w[r+20>>2],a=w[r+24>>2],t=w[r+16>>2],o[i+28>>2]=0,w[i+24>>2]=b*a,w[i+20>>2]=c*n,w[i+16>>2]=u*t,n=w[r+36>>2],a=w[r+40>>2],t=w[r+32>>2],o[i+44>>2]=0,w[i+40>>2]=b*a,w[i+36>>2]=c*n,w[i+32>>2]=u*t,A=o[A+4>>2],Zn[o[o[A>>2]+8>>2]](A,i,f,e),S=i+48|0},ai,Mf,function(A,r,f){A|=0,r=m(r),f|=0;var e=m(0),i=m(0);e=m(Zn[o[o[A>>2]+48>>2]](A)),i=m(Zn[o[o[A>>2]+48>>2]](A)),o[f+12>>2]=0,r=m(i*m(e*m(r*m(.4000000059604645)))),w[f+8>>2]=r,w[f+4>>2]=r,w[f>>2]=r},function(){return 9315},pi,function(A){return m(m(w[36+(A|=0)>>2]*w[A+20>>2]))},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=0,c=m(0),b=m(0);S=e=S-16|0,Zn[o[o[r>>2]+68>>2]](e,r,f),t=o[e+12>>2],o[A+8>>2]=o[e+8>>2],o[A+12>>2]=t,t=o[e+4>>2],o[A>>2]=o[e>>2],o[A+4>>2]=t,n=w[f+4>>2],i=w[f>>2],a=w[f+8>>2],c=m(Zn[o[o[r>>2]+48>>2]](r)),b=i=(r=m(m(a*a)+m(m(i*i)+m(n*n)))>2]=w[A>>2]+m(c*m(b*i)),w[A+4>>2]=w[A+4>>2]+m(c*m(n*i)),w[A+8>>2]=w[A+8>>2]+m(c*m(a*i)),S=e+16|0},function(A){o[(A|=0)>>2]=0,o[A+4>>2]=0,o[A+8>>2]=0,o[A+12>>2]=0},function(A,r,f,e){(0|(e|=0))>0&&Af(f|=0,0,e<<4)},en,ai,function(A,r,f,e){e|=0,o[8+(f|=0)>>2]=-581039253,o[f+12>>2]=0,o[f>>2]=-581039253,o[f+4>>2]=-581039253,o[e+8>>2]=1566444395,o[e+12>>2]=0,o[e>>2]=1566444395,o[e+4>>2]=1566444395},function(A,r){A|=0;var f=0;f=o[4+(r|=0)>>2],o[A+76>>2]=o[r>>2],o[A+80>>2]=f,f=o[r+12>>2],o[A+84>>2]=o[r+8>>2],o[A+88>>2]=f},function(A){return 76+(A|=0)|0},Pe,function(){return 9322},tn,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return te(A,r,f),w[r+12>>2]=w[A+76>>2],w[r+16>>2]=w[A+80>>2],w[r+20>>2]=w[A+84>>2],w[r+24>>2]=w[A+88>>2],w[r+28>>2]=w[A+56>>2],w[r+32>>2]=w[A+60>>2],w[r+36>>2]=w[A- -64>>2],w[r+40>>2]=w[A+68>>2],e=w[A+72>>2],o[r+48>>2]=0,w[r+44>>2]=e,9058},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),E=m(0),W=m(0),p=m(0),F=m(0);S=i=S-48|0,k=w[f+8>>2],b=w[e+8>>2],v=w[f+4>>2],h=w[e+4>>2],u=w[f>>2],l=w[e>>2],n=w[A- -64>>2],m(Q(n))>m(.7071067690849304)?(c=w[A+60>>2],a=m(m(c*c)+m(n*n)),t=m(m(1)/m(N(a))),s=m(a*t),G=m(c*t),a=w[A+56>>2],B=m(G*m(-a)),d=m(t*m(-n)),E=m(a*d)):(a=w[A+56>>2],c=w[A+60>>2],s=m(m(a*a)+m(c*c)),t=m(m(1)/m(N(s))),E=m(s*t),W=m(t*m(-c)),B=m(n*W),d=m(a*t),s=m(d*m(-n))),t=w[A+72>>2],o[i+44>>2]=0,o[i+28>>2]=0,Z=m(m(b+k)*m(.5)),p=m(m(l+u)*m(.5)),F=m(m(h+v)*m(.5)),t=m(m(m(n*Z)+m(m(a*p)+m(F*c)))-t),Z=m(Z-m(n*t)),n=m(m(b-k)*m(.5)),b=m(n*n),n=m(m(l-u)*m(.5)),u=m(n*n),n=m(m(h-v)*m(.5)),n=m(N(m(b+m(u+m(n*n))))),b=m(n*G),v=m(Z-b),k=m(n*E),h=m(v-k),w[i+40>>2]=h,u=m(F-m(c*t)),l=m(n*d),d=m(u-l),c=m(n*B),B=m(d-c),w[i+36>>2]=B,b=m(b+Z),w[i+24>>2]=b-k,u=m(l+u),w[i+20>>2]=u-c,o[i+12>>2]=0,a=m(p-m(a*t)),t=m(n*W),l=m(a-t),n=m(n*s),s=m(l-n),w[i+32>>2]=s,a=m(t+a),w[i+16>>2]=a-n,t=m(k+b),w[i+8>>2]=t,b=m(c+u),w[i+4>>2]=b,a=m(n+a),w[i>>2]=a,Zn[o[o[r>>2]+8>>2]](r,i,0,0),o[i+44>>2]=0,w[i+40>>2]=t,w[i+36>>2]=b,o[i+28>>2]=0,w[i+24>>2]=k+v,w[i+20>>2]=c+d,w[i+32>>2]=a,w[i+16>>2]=n+l,o[i+12>>2]=0,w[i+8>>2]=h,w[i+4>>2]=B,w[i>>2]=s,Zn[o[o[r>>2]+8>>2]](r,i,0,1),S=i+48|0},ri,function(A,r,f,e){Ir(A|=0,r|=0,f|=0,e|=0)},function(){return 10242},function(A){return o[100+(A|=0)>>2]},function(A){return 0|((A=o[100+(A|=0)>>2]-2|0)>>>0<=2?o[21920+(A<<2)>>2]:0)},function(A,r,f,e){r|=0,f|=0,e|=0;A:{r:{f:switch(o[100+(A|=0)>>2]-2|0){case 0:r=o[A+108>>2],o[f>>2]=o[A+104>>2],o[f+4>>2]=r,r=o[A+116>>2],o[f+8>>2]=o[A+112>>2],o[f+12>>2]=r,A=A+120|0;break r;case 1:e:switch(0|r){case 0:r=o[A+108>>2],o[f>>2]=o[A+104>>2],o[f+4>>2]=r,r=o[A+116>>2],o[f+8>>2]=o[A+112>>2],o[f+12>>2]=r,A=A+120|0;break r;case 1:r=o[A+132>>2],o[f+8>>2]=o[A+128>>2],o[f+12>>2]=r,r=o[A+124>>2],o[f>>2]=o[A+120>>2],o[f+4>>2]=r,A=A+136|0;break r;case 2:break e;default:break A}r=o[A+148>>2],o[f+8>>2]=o[A+144>>2],o[f+12>>2]=r,r=o[A+140>>2],o[f>>2]=o[A+136>>2],o[f+4>>2]=r,A=A+104|0;break r;case 2:break f;default:break A}f:switch(0|r){case 0:r=o[A+108>>2],o[f>>2]=o[A+104>>2],o[f+4>>2]=r,r=o[A+116>>2],o[f+8>>2]=o[A+112>>2],o[f+12>>2]=r,A=A+120|0;break r;case 1:r=o[A+132>>2],o[f+8>>2]=o[A+128>>2],o[f+12>>2]=r,r=o[A+124>>2],o[f>>2]=o[A+120>>2],o[f+4>>2]=r,A=A+136|0;break r;case 2:r=o[A+148>>2],o[f+8>>2]=o[A+144>>2],o[f+12>>2]=r,r=o[A+140>>2],o[f>>2]=o[A+136>>2],o[f+4>>2]=r,A=A+104|0;break r;case 3:r=o[A+108>>2],o[f>>2]=o[A+104>>2],o[f+4>>2]=r,r=o[A+116>>2],o[f+8>>2]=o[A+112>>2],o[f+12>>2]=r,A=A+152|0;break r;case 4:r=o[A+132>>2],o[f+8>>2]=o[A+128>>2],o[f+12>>2]=r,r=o[A+124>>2],o[f>>2]=o[A+120>>2],o[f+4>>2]=r,A=A+152|0;break r;case 5:break f;default:break A}r=o[A+148>>2],o[f+8>>2]=o[A+144>>2],o[f+12>>2]=r,r=o[A+140>>2],o[f>>2]=o[A+136>>2],o[f+4>>2]=r,A=A+152|0}r=o[A+4>>2],o[e>>2]=o[A>>2],o[e+4>>2]=r,r=o[A+12>>2],o[e+8>>2]=o[A+8>>2],o[e+12>>2]=r}},function(A,r,f){f|=0,r=o[116+(A=((r|=0)<<4)+(A|=0)|0)>>2],o[f+8>>2]=o[A+112>>2],o[f+12>>2]=r,r=o[A+108>>2],o[f>>2]=o[A+104>>2],o[f+4>>2]=r},function(A){return 0|(4==(0|(A=o[100+(A|=0)>>2]))?4:(3==(0|A))<<1)},Qi,Zi,function(){return 0},Be,function(A){Be(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i,n=0,a=0,t=0,c=0,b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),B=0,Q=0,E=0,W=0;if(S=f=S-80|0,(0|(i=0|Zn[o[o[A>>2]+28>>2]](A)))>0)for(b=w[A+12>>2],u=w[A+8>>2],l=w[A+4>>2];;){Zn[o[o[A>>2]+16>>2]](A,f+76|0,f+52|0,f- -64|0,f+56|0,f+72|0,f+68|0,f+48|0,f+60|0,W);A:{r:switch(o[f+64>>2]){case 0:f:switch(o[f+60>>2]-2|0){case 0:if(e=0,o[f+48>>2]<=0)break A;for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,o[n>>2])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+12>>2]=0,w[f+8>>2]=b*d,w[f+4>>2]=u*k,w[f>>2]=l*s,a=t+G(c,o[n+4>>2])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+28>>2]=0,w[f+24>>2]=b*d,w[f+20>>2]=u*k,w[f+16>>2]=l*s,n=t+G(c,o[n+8>>2])|0,s=w[n>>2],k=w[n+4>>2],d=w[n+8>>2],o[f+44>>2]=0,w[f+40>>2]=b*d,w[f+36>>2]=u*k,w[f+32>>2]=l*s,Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);break A;case 1:if(e=0,o[f+48>>2]<=0)break A;for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,h[n>>1])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+12>>2]=0,w[f+8>>2]=b*d,w[f+4>>2]=u*k,w[f>>2]=l*s,a=t+G(c,h[n+2>>1])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+28>>2]=0,w[f+24>>2]=b*d,w[f+20>>2]=u*k,w[f+16>>2]=l*s,n=t+G(c,h[n+4>>1])|0,s=w[n>>2],k=w[n+4>>2],d=w[n+8>>2],o[f+44>>2]=0,w[f+40>>2]=b*d,w[f+36>>2]=u*k,w[f+32>>2]=l*s,Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);break A;case 3:break f;default:break A}if(e=0,o[f+48>>2]<=0)break A;for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,v[0|n])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+12>>2]=0,w[f+8>>2]=b*d,w[f+4>>2]=u*k,w[f>>2]=l*s,a=t+G(c,v[n+1|0])|0,s=w[a>>2],k=w[a+4>>2],d=w[a+8>>2],o[f+28>>2]=0,w[f+24>>2]=b*d,w[f+20>>2]=u*k,w[f+16>>2]=l*s,n=t+G(c,v[n+2|0])|0,s=w[n>>2],k=w[n+4>>2],d=w[n+8>>2],o[f+44>>2]=0,w[f+40>>2]=b*d,w[f+36>>2]=u*k,w[f+32>>2]=l*s,Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);break A;case 1:break r;default:break A}r:switch(o[f+60>>2]-2|0){case 0:if(e=0,o[f+48>>2]<=0)break A;for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,o[n>>2])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+12>>2]=0,w[f+8>>2]=b*m(E),w[f+4>>2]=u*m(Q),w[f>>2]=l*m(B),a=t+G(c,o[n+4>>2])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+28>>2]=0,w[f+24>>2]=b*m(E),w[f+20>>2]=u*m(Q),w[f+16>>2]=l*m(B),n=t+G(c,o[n+8>>2])|0,B=Z[n>>3],Q=Z[n+8>>3],E=Z[n+16>>3],o[f+44>>2]=0,w[f+40>>2]=b*m(E),w[f+36>>2]=u*m(Q),w[f+32>>2]=l*m(B),Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);break A;case 1:if(e=0,o[f+48>>2]<=0)break A;for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,h[n>>1])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+12>>2]=0,w[f+8>>2]=b*m(E),w[f+4>>2]=u*m(Q),w[f>>2]=l*m(B),a=t+G(c,h[n+2>>1])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+28>>2]=0,w[f+24>>2]=b*m(E),w[f+20>>2]=u*m(Q),w[f+16>>2]=l*m(B),n=t+G(c,h[n+4>>1])|0,B=Z[n>>3],Q=Z[n+8>>3],E=Z[n+16>>3],o[f+44>>2]=0,w[f+40>>2]=b*m(E),w[f+36>>2]=u*m(Q),w[f+32>>2]=l*m(B),Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);break A;case 3:break r;default:break A}if(e=0,!(o[f+48>>2]<=0))for(;t=o[f+76>>2],c=o[f+56>>2],n=o[f+72>>2]+G(o[f+68>>2],e)|0,a=t+G(c,v[0|n])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+12>>2]=0,w[f+8>>2]=b*m(E),w[f+4>>2]=u*m(Q),w[f>>2]=l*m(B),a=t+G(c,v[n+1|0])|0,B=Z[a>>3],Q=Z[a+8>>3],E=Z[a+16>>3],o[f+28>>2]=0,w[f+24>>2]=b*m(E),w[f+20>>2]=u*m(Q),w[f+16>>2]=l*m(B),n=t+G(c,v[n+2|0])|0,B=Z[n>>3],Q=Z[n+8>>3],E=Z[n+16>>3],o[f+44>>2]=0,w[f+40>>2]=b*m(E),w[f+36>>2]=u*m(Q),w[f+32>>2]=l*m(B),Zn[o[o[r>>2]+8>>2]](r,f,W,e),(0|(e=e+1|0))>2];);}if(Zn[o[o[A>>2]+24>>2]](A,W),(0|i)==(0|(W=W+1|0)))break}S=f+80|0},$f,$f,dn,dn,Mi,dn,dn,function(A){return 1==o[48+(A|=0)>>2]|0},function(A,r,f){A|=0,f|=0;var e=0;e=o[4+(r|=0)>>2],o[A+52>>2]=o[r>>2],o[A+56>>2]=e,e=o[r+12>>2],o[A+60>>2]=o[r+8>>2],o[A+64>>2]=e,r=o[f+4>>2],o[A+68>>2]=o[f>>2],o[A+72>>2]=r,r=o[f+12>>2],o[A+76>>2]=o[f+8>>2],o[A+80>>2]=r,o[A+48>>2]=1},function(A,r,f){r|=0,f|=0;var e=0;e=o[56+(A|=0)>>2],o[r>>2]=o[A+52>>2],o[r+4>>2]=e,e=o[A+64>>2],o[r+8>>2]=o[A+60>>2],o[r+12>>2]=e,r=o[A+80>>2],o[f+8>>2]=o[A+76>>2],o[f+12>>2]=r,r=o[A+72>>2],o[f>>2]=o[A+68>>2],o[f+4>>2]=r},function(){return 28},function(A,r,f){r|=0,f|=0;var e,i=0,n=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,B=0,m=0,Q=0,E=0,W=0,N=0,p=0;if(S=e=S-32|0,i=0|Zn[o[o[(A|=0)>>2]+28>>2]](A),o[r>>2]=0,o[r+20>>2]=i,i){if(Q=0|Zn[o[o[f>>2]+16>>2]](f,32,i),l=o[Q+8>>2],N=r,p=0|Zn[o[o[f>>2]+28>>2]](f,l),o[N>>2]=p,(0|(W=0|Zn[o[o[A>>2]+28>>2]](A)))>0)for(;;){Zn[o[o[A>>2]+16>>2]](A,e+28|0,e+4|0,e+16|0,e+8|0,e+24|0,e+20|0,e,e+12|0,m),i=o[e>>2],o[l+24>>2]=i,n=o[e+4>>2],o[l>>2]=0,o[l+4>>2]=0,o[l+28>>2]=n,o[l+8>>2]=0,o[l+12>>2]=0,o[l+16>>2]=0,o[l+20>>2]=0;A:{r:switch(o[e+12>>2]-2|0){case 0:if(!i)break A;if(n=0|Zn[o[o[f>>2]+16>>2]](f,4,G(i,3)),s=o[n+8>>2],N=l,p=0|Zn[o[o[f>>2]+28>>2]](f,s),o[N+8>>2]=p,o[e>>2]>0)for(i=0,d=o[e+24>>2];b=s+G(i,12)|0,c=d+G(o[e+20>>2],i)|0,o[b>>2]=o[c>>2],o[b+4>>2]=o[c+4>>2],o[b+8>>2]=o[c+8>>2],(0|(i=i+1|0))>2];);Zn[o[o[f>>2]+20>>2]](f,n,8582,1497453121,o[n+8>>2]);break A;case 1:if(!i)break A;if(b=0|Zn[o[o[f>>2]+16>>2]](f,8,i),s=o[b+8>>2],N=l,p=0|Zn[o[o[f>>2]+28>>2]](f,s),o[N+12>>2]=p,i=0,o[e>>2]>0)for(;n=s+(i<<3)|0,c=o[e+24>>2]+G(o[e+20>>2],i)|0,t[n>>1]=h[c>>1],t[n+2>>1]=h[c+2>>1],c=h[c+4>>1],t[n+6>>1]=0,t[n+4>>1]=c,(0|(i=i+1|0))>2];);Zn[o[o[f>>2]+20>>2]](f,b,8647,1497453121,o[b+8>>2]);break A;case 3:break r;default:break A}if(i){if(b=0|Zn[o[o[f>>2]+16>>2]](f,4,i),s=o[b+8>>2],N=l,p=0|Zn[o[o[f>>2]+28>>2]](f,s),o[N+16>>2]=p,i=0,o[e>>2]>0)for(;n=s+(i<<2)|0,c=o[e+24>>2]+G(o[e+20>>2],i)|0,a[0|n]=v[0|c],a[n+1|0]=v[c+1|0],c=v[c+2|0],a[n+3|0]=0,a[n+2|0]=c,(0|(i=i+1|0))>2];);Zn[o[o[f>>2]+20>>2]](f,b,8674,1497453121,o[b+8>>2])}}A:{r:switch(o[e+16>>2]){case 0:if(!(i=o[e+4>>2]))break A;if(B=0|Zn[o[o[f>>2]+16>>2]](f,16,i),b=o[B+8>>2],N=l,p=0|Zn[o[o[f>>2]+28>>2]](f,b),o[N>>2]=p,!((0|(c=o[e+4>>2]))<=0)){if(i=0,s=o[e+8>>2],d=o[e+28>>2],1!=(0|c))for(E=-2&c,n=0;k=b+(i<<4)|0,u=d+G(i,s)|0,w[k>>2]=w[u>>2],w[k+4>>2]=w[u+4>>2],w[k+8>>2]=w[u+8>>2],k=b+((u=1|i)<<4)|0,u=d+G(u,s)|0,w[k>>2]=w[u>>2],w[k+4>>2]=w[u+4>>2],w[k+8>>2]=w[u+8>>2],i=i+2|0,(0|E)!=(0|(n=n+2|0)););1&c&&(n=b+(i<<4)|0,i=d+G(i,s)|0,w[n>>2]=w[i>>2],w[n+4>>2]=w[i+4>>2],w[n+8>>2]=w[i+8>>2])}Zn[o[o[f>>2]+20>>2]](f,B,8881,1497453121,o[B+8>>2]);break A;case 1:break r;default:break A}if(i=o[e+4>>2]){if(B=0|Zn[o[o[f>>2]+16>>2]](f,32,i),b=o[B+8>>2],N=l,p=0|Zn[o[o[f>>2]+28>>2]](f,b),o[N+4>>2]=p,!((0|(c=o[e+4>>2]))<=0)){if(i=0,s=o[e+8>>2],d=o[e+28>>2],1!=(0|c))for(E=-2&c,n=0;k=b+(i<<5)|0,u=d+G(i,s)|0,Z[k>>3]=Z[u>>3],Z[k+8>>3]=Z[u+8>>3],Z[k+16>>3]=Z[u+16>>3],k=b+((u=1|i)<<5)|0,u=d+G(u,s)|0,Z[k>>3]=Z[u>>3],Z[k+8>>3]=Z[u+8>>3],Z[k+16>>3]=Z[u+16>>3],i=i+2|0,(0|E)!=(0|(n=n+2|0)););1&c&&(n=b+(i<<5)|0,i=d+G(i,s)|0,Z[n>>3]=Z[i>>3],Z[n+8>>3]=Z[i+8>>3],Z[n+16>>3]=Z[i+16>>3])}Zn[o[o[f>>2]+20>>2]](f,B,9120,1497453121,o[B+8>>2])}}if(Zn[o[o[A>>2]+24>>2]](A,m),l=l+32|0,(0|W)==(0|(m=m+1|0)))break}Zn[o[o[f>>2]+20>>2]](f,Q,8597,1497453121,o[Q+8>>2])}return o[r+24>>2]=0,w[r+4>>2]=w[A+4>>2],w[r+8>>2]=w[A+8>>2],w[r+12>>2]=w[A+12>>2],w[r+16>>2]=w[A+16>>2],S=e+32|0,9186},Bf,function(A){(A=Bf(A|=0))&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r){r|=0;var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0;A:{if(v[165+(A|=0)|0]){if(o[(s=A+92|0)>>2]>=(0|r))break A;if(r?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](r<<4,16)):n=0,!((0|(i=o[A+88>>2]))<=0)){if(1!=(0|i))for(u=-2&i;c=(t=e<<4)+n|0,f=t+o[A+96>>2]|0,l=o[f+4>>2],o[c>>2]=o[f>>2],o[c+4>>2]=l,l=o[f+12>>2],o[c+8>>2]=o[f+8>>2],o[c+12>>2]=l,t=(f=16|t)+n|0,f=f+o[A+96>>2]|0,c=o[f+4>>2],o[t>>2]=o[f>>2],o[t+4>>2]=c,c=o[f+12>>2],o[t+8>>2]=o[f+8>>2],o[t+12>>2]=c,e=e+2|0,(0|u)!=(0|(b=b+2|0)););1&i&&(i=(e<<=4)+n|0,e=e+o[A+96>>2]|0,f=o[e+4>>2],o[i>>2]=o[e>>2],o[i+4>>2]=f,f=o[e+12>>2],o[i+8>>2]=o[e+8>>2],o[i+12>>2]=f)}!(e=o[A+96>>2])||!e|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](e)),o[A+96>>2]=n,a[A+100|0]=1}else{if(o[(s=A+112|0)>>2]>=(0|r))break A;r?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](r<<2,16)):n=0,i=o[A+116>>2];r:{f:{if((0|(t=o[A+108>>2]))>0){if(t>>>0>=4)for(c=-4&t;w[(f=e<<2)+n>>2]=w[f+i>>2],w[(u=4|f)+n>>2]=w[i+u>>2],w[(u=8|f)+n>>2]=w[i+u>>2],w[(f|=12)+n>>2]=w[f+i>>2],e=e+4|0,(0|c)!=(0|(b=b+4|0)););if(f=3&t)for(;w[(b=e<<2)+n>>2]=w[i+b>>2],e=e+1|0,(0|f)!=(0|(l=l+1|0)););if(v[A+120|0])break f;break r}if(!i|!v[A+120|0])break r}i&&(o[8489]=o[8489]+1,Zn[o[8291]](i))}o[A+116>>2]=n,a[A+120|0]=1}o[s>>2]=r}},function(A,r){r|=0;var f=0,e=0,i=0,n=0,c=0,b=0,u=0,l=0,s=0,k=0;A:{if(v[164+(A|=0)|0]){if(o[(s=A+132|0)>>2]>=(0|r))break A;r?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](r<<2,16)):i=0,e=o[A+136>>2];r:{f:{if((0|(n=o[A+128>>2]))>0){if(n>>>0>=4)for(k=-4&n;o[(f=c<<2)+i>>2]=o[e+f>>2],o[(b=4|f)+i>>2]=o[e+b>>2],o[(b=8|f)+i>>2]=o[e+b>>2],o[(f|=12)+i>>2]=o[e+f>>2],c=c+4|0,(0|k)!=(0|(u=u+4|0)););if(f=3&n)for(;o[(n=c<<2)+i>>2]=o[e+n>>2],c=c+1|0,(0|f)!=(0|(l=l+1|0)););if(v[A+140|0])break f;break r}if(!e|!v[A+140|0])break r}e&&(o[8489]=o[8489]+1,Zn[o[8291]](e))}o[A+136>>2]=i,a[A+140|0]=1}else{if(o[(s=A+152|0)>>2]>=(0|r))break A;r?(o[8488]=o[8488]+1,i=0|Zn[o[8290]](r<<1,16)):i=0,e=o[A+156>>2];r:{f:{if((0|(n=o[A+148>>2]))>0){if(n>>>0>=4)for(k=-4&n;t[(f=c<<1)+i>>1]=h[e+f>>1],t[(b=2|f)+i>>1]=h[e+b>>1],t[(b=4|f)+i>>1]=h[e+b>>1],t[(f|=6)+i>>1]=h[e+f>>1],c=c+4|0,(0|k)!=(0|(u=u+4|0)););if(f=3&n)for(;t[(n=c<<1)+i>>1]=h[e+n>>1],c=c+1|0,(0|f)!=(0|(l=l+1|0)););if(v[A+160|0])break f;break r}if(!e|!v[A+160|0])break r}e&&(o[8489]=o[8489]+1,Zn[o[8291]](e))}o[A+156>>2]=i,a[A+160|0]=1}o[s>>2]=r}},en,ai,Nr,function(){return 9302},function(A,r,f,e){var i;A|=0,r|=0,f|=0,e|=0,S=i=S-48|0,o[i+12>>2]=r,o[i+8>>2]=22384,r=o[f+12>>2],o[i+24>>2]=o[f+8>>2],o[i+28>>2]=r,r=o[f+4>>2],o[i+16>>2]=o[f>>2],o[i+20>>2]=r,r=o[e+12>>2],o[i+40>>2]=o[e+8>>2],o[i+44>>2]=r,r=o[e+4>>2],o[i+32>>2]=o[e>>2],o[i+36>>2]=r,A=o[A+56>>2],Zn[o[o[A>>2]+8>>2]](A,i+8|0,f,e),S=i+48|0},vn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=m(0),a=0,t=m(0),c=m(0),b=0,u=0;c=(i=w[r>>2])<(n=w[r+16>>2])?i:n,t=w[r+32>>2],w[A+24>>2]<(t>c?c:t)||w[(t<((a=i>n)?i:n)?!a<<4:32)+r>>2]>2]||(c=(i=w[r+8>>2])<(n=w[(a=r+24|0)>>2])?i:n,t=w[(b=r+40|0)>>2],w[A+32>>2]<(t>c?c:t)||(u=a,w[(t<((a=i>n)?i:n)?a?r+8:u:b)>>2]>2]||(c=(i=w[r+4>>2])<(n=w[(a=r+20|0)>>2])?i:n,t=w[(b=r+36|0)>>2],w[A+28>>2]<(t>c?c:t)||(u=a,w[(t<((a=i>n)?i:n)?a?r+4:u:b)>>2]>2]||(A=o[A+4>>2],Zn[o[o[A>>2]+8>>2]](A,r,f,e))))))},vn,function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0);i=w[A+84>>2],n=w[A+96>>2],a=w[A+88>>2],t=w[A+92>>2],i<(e=m(m(n*w[r+8>>2])+m(m(a*w[r>>2])+m(t*w[r+4>>2]))))&&(w[A+84>>2]=e,f=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=f,f=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=f,i=e),(e=m(m(n*w[r+24>>2])+m(m(a*w[r+16>>2])+m(t*w[r+20>>2]))))>i?(w[A+84>>2]=e,f=o[r+28>>2],o[A+12>>2]=o[r+24>>2],o[A+16>>2]=f,f=o[r+20>>2],o[A+4>>2]=o[r+16>>2],o[A+8>>2]=f):e=i,e<(i=m(m(n*w[r+40>>2])+m(m(a*w[r+32>>2])+m(t*w[r+36>>2]))))&&(w[A+84>>2]=i,f=o[r+44>>2],o[A+12>>2]=o[r+40>>2],o[A+16>>2]=f,f=o[r+36>>2],o[A+4>>2]=o[r+32>>2],o[A+8>>2]=f)},en,vn,HA,vn,zi,zi,function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e);var i=0;w[A+36>>2]>e&&(a[A+40|0]=1,i=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=i,i=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=i,r=o[f+4>>2],o[A+20>>2]=o[f>>2],o[A+24>>2]=r,r=o[f+12>>2],o[A+28>>2]=o[f+8>>2],o[A+32>>2]=r,w[A+36>>2]=e)},vn,IA,function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=0,c=m(0),b=m(0),u=m(0),l=m(0);S=e=S-32|0,t=o[f+12>>2],o[e+24>>2]=o[f+8>>2],o[e+28>>2]=t,t=o[f+4>>2],o[e+16>>2]=o[f>>2],o[e+20>>2]=t,i=w[e+24>>2],n=w[e+16>>2],a=w[e+20>>2],m(m(i*i)+m(m(n*n)+m(a*a)))>2]=0,a=m(-1),n=m(-1),i=m(-1)),c=i,i=m(m(1)/m(N(m(m(i*i)+m(m(n*n)+m(a*a)))))),w[e+24>>2]=c*i,w[e+20>>2]=a*i,w[e+16>>2]=n*i,NA(e,r,e+16|0);A:{switch(o[r+4>>2]){case 8:i=m(w[r+36>>2]*w[r+20>>2]);break A;case 0:case 1:case 4:case 5:case 10:case 11:case 13:i=w[r+52>>2];break A}i=m(Zn[o[o[r>>2]+48>>2]](r))}n=w[e>>2],a=w[e+16>>2],c=w[e+4>>2],b=w[e+20>>2],u=w[e+8>>2],l=w[e+24>>2],o[A+12>>2]=0,w[A+8>>2]=u+m(i*l),w[A+4>>2]=c+m(i*b),w[A>>2]=n+m(i*a),S=e+32|0},NA,en,vn,function(A,r,f,e,i,n,t,c,b,u){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,t|=0,c|=0,b|=0,u|=0;var l,s,k=m(0),d=m(0),h=0,Z=0,Q=0,E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=0,X=m(0),D=0,C=0,J=0,x=0,y=m(0),M=0,H=0,I=0,T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),$=m(0),K=m(0),q=0,_=m(0);S=A=S-80|0,k=w[i+52>>2],d=w[n+52>>2],E=w[i+56>>2],p=w[n+56>>2],W=w[i+48>>2],F=w[n+48>>2],o[A+76>>2]=0,w[A+64>>2]=F-W,w[A+72>>2]=p-E,w[A+68>>2]=d-k,S=Q=S-19040|0,rr(f,l=i,e,n,s=A+8|0,i=Q+18912|0,1),o[(r=Q+18668|0)>>2]=0,o[r+4>>2]=0,o[Q+18660>>2]=0,o[Q+18664>>2]=0,o[Q+18896>>2]=0,o[Q+18900>>2]=0,o[Q+18908>>2]=2,o[Q+18676>>2]=0,k=w[(r=A- -64|0)>>2],d=w[r+4>>2],E=w[r+8>>2],o[Q+32>>2]=0,w[Q+28>>2]=-E,w[Q+24>>2]=-d,w[Q+20>>2]=-k;A:{r:{f:switch(bA(Q+18532|0,i,Q+20|0)-1|0){case 0:for(o[Q+68>>2]=0,o[Q+72>>2]=0,o[Q+76>>2]=0,o[Q+18512>>2]=0,o[Q+20>>2]=9,o[Q+18516>>2]=0,o[Q+18520>>2]=0,o[Q+60>>2]=0,o[Q+64>>2]=0,i=0;h=G(255-i|0,56),o[4204+(u=h+(Q+20|0)|0)>>2]=D,o[u+4200>>2]=0,u=u+4156|0,D&&(o[D+44>>2]=u),o[Q+18524>>2]=u,D=(Z=Q+4176|0)+G(254-i|0,56)|0,o[D+44>>2]=0,o[D+48>>2]=u,o[44+(h+Z|0)>>2]=D,o[Q+18524>>2]=D,256!=(0|(i=i+2|0)););o[Q+18528>>2]=256,k=w[r>>2],d=w[r+4>>2],E=w[r+8>>2],D=0,o[Q+16>>2]=0,w[Q+12>>2]=-E,w[Q+8>>2]=-d,w[Q+4>>2]=-k,h=Q+20|0,S=J=S-32|0;e:{if(Z=o[372+(q=Q+18532|0)>>2],!(B[Z+32>>2]<2)&&dA(q)){if(r=o[h+18496>>2]){for(u=o[h+18508>>2],i=o[h+18500>>2];(g=o[r+48>>2])&&(o[g+44>>2]=o[r+44>>2]),(g=o[r+44>>2])&&(o[g+48>>2]=o[r+48>>2]),o[h+18496>>2]==(0|r)&&(o[h+18496>>2]=o[r+48>>2]),o[r+44>>2]=0,o[r+48>>2]=o[h+18504>>2],(g=o[h+18504>>2])&&(o[g+44>>2]=r),i=i-1|0,o[h+18504>>2]=r,u=u+1|0,r=o[h+18496>>2];);o[h+18508>>2]=u,o[h+18500>>2]=i}if(o[h+18492>>2]=0,o[h>>2]=0,u=o[Z>>2],i=o[Z+12>>2],k=w[i+16>>2],p=m(w[u+16>>2]-k),r=o[Z+4>>2],d=w[i+20>>2],W=m(w[r+20>>2]-d),g=o[Z+8>>2],E=w[i+24>>2],F=m(w[g+24>>2]-E),R=m(w[u+20>>2]-d),Y=m(w[r+24>>2]-E),V=m(w[g+16>>2]-k),E=m(w[u+24>>2]-E),k=m(w[r+16>>2]-k),d=m(w[g+20>>2]-d),m(m(m(m(p*W)*F)+m(m(m(m(m(R*Y)*V)+m(m(E*k)*d))-m(m(Y*p)*d))-m(m(k*R)*F)))-m(m(W*E)*V))>2]=u,o[Z>>2]=r,L=o[Z+16>>2],o[Z+16>>2]=o[Z+20>>2],o[Z+20>>2]=L,i=u):(i=r,r=u),i=lr(h,r,i,g,1),g=lr(h,o[Z+4>>2],o[Z>>2],o[Z+12>>2],1),C=lr(h,o[Z+8>>2],o[Z+4>>2],o[Z+12>>2],1),x=lr(h,o[Z>>2],o[Z+8>>2],o[Z+12>>2],1),4==o[h+18500>>2]){if(u=o[h+18496>>2],r=o[u+48>>2])for(k=w[u+16>>2],k=m(k*k);d=w[r+16>>2],u=(Z=(d=m(d*d))>2];);for(M=o[u+28>>2],H=o[u+24>>2],I=o[u+20>>2],k=w[u+16>>2],Y=w[u+12>>2],p=w[u+8>>2],d=w[u+4>>2],E=w[u>>2],o[i+32>>2]=g,a[i+52|0]=0,o[g+32>>2]=i,a[g+52|0]=0,o[i+36>>2]=C,a[i+53|0]=0,o[C+32>>2]=i,a[C+52|0]=1,o[i+40>>2]=x,a[i+54|0]=0,o[x+32>>2]=i,a[x+52|0]=2,o[g+36>>2]=x,a[g+53|0]=2,o[x+40>>2]=g,a[x+54|0]=1,o[g+40>>2]=C,a[g+54|0]=1,o[C+36>>2]=g,a[C+53|0]=2,a[C+54|0]=1,o[C+40>>2]=x,o[x+36>>2]=C,a[x+53|0]=2,o[h>>2]=0,i=0;;){i:{n:{if(!((Z=o[h+18492>>2])>>>0<=127)){o[h>>2]=6;break i}if(r=0,o[J+12>>2]=0,o[J+4>>2]=0,o[J+8>>2]=0,o[h+18492>>2]=Z+1,i=i+1|0,a[u+55|0]=i,W=w[u+8>>2],F=w[u>>2],R=w[u+4>>2],o[72+(Z=h+(Z<<5)|0)>>2]=0,y=W,W=m(m(1)/m(N(m(m(W*W)+m(m(F*F)+m(R*R)))))),w[Z+68>>2]=y*W,w[Z- -64>>2]=R*W,w[(g=Z+60|0)>>2]=F*W,Yr(J+16|0,q,g),C=o[J+28>>2],o[Z+84>>2]=o[J+24>>2],o[Z+88>>2]=C,C=o[J+20>>2],o[Z+76>>2]=o[J+16>>2],o[Z+80>>2]=C,!(m(m(m(w[u+8>>2]*w[Z+84>>2])+m(m(w[u>>2]*w[Z+76>>2])+m(w[u+4>>2]*w[Z+80>>2])))-w[u+16>>2])>m(9999999747378752e-20))){o[h>>2]=7;break i}for(;;){if(!(Z=Tr(h,i,g,o[32+((r<<2)+u|0)>>2],v[52+(r+u|0)|0],J+4|0)))break n;if(C=r>>>0<2,r=r+1|0,!C)break}}if(Z&B[J+12>>2]>2){if(r=o[J+4>>2],Z=o[J+8>>2],o[r+36>>2]=Z,a[r+53|0]=2,o[Z+40>>2]=r,a[Z+54|0]=1,(r=o[u+48>>2])&&(o[r+44>>2]=o[u+44>>2]),(r=o[u+44>>2])&&(o[r+48>>2]=o[u+48>>2]),o[h+18496>>2]==(0|u)&&(o[h+18496>>2]=o[u+48>>2]),o[h+18500>>2]=o[h+18500>>2]-1,o[u+44>>2]=0,o[u+48>>2]=o[h+18504>>2],(r=o[h+18504>>2])&&(o[r+44>>2]=u),o[h+18504>>2]=u,o[h+18508>>2]=o[h+18508>>2]+1,u=o[h+18496>>2],r=o[u+48>>2])for(k=w[u+16>>2],k=m(k*k);d=w[r+16>>2],u=(Z=(d=m(d*d))>2];);if(M=o[u+28>>2],H=o[u+24>>2],I=o[u+20>>2],k=w[u+16>>2],Y=w[u+12>>2],p=w[u+8>>2],d=w[u+4>>2],E=w[u>>2],255!=(0|i))continue}else o[h>>2]=4}break}w[h+56>>2]=k,w[h+40>>2]=E,o[h+4>>2]=I,w[h+52>>2]=Y,w[h+48>>2]=p,w[h+44>>2]=d,o[h+36>>2]=3,o[h+12>>2]=M,o[h+8>>2]=H,E=m(E*k),W=m(w[H+16>>2]-E),d=m(d*k),F=m(w[M+20>>2]-d),R=m(w[M+16>>2]-E),Y=m(w[H+20>>2]-d),V=m(m(W*F)-m(R*Y)),k=m(p*k),p=m(w[M+24>>2]-k),y=F,F=m(w[H+24>>2]-k),Y=m(m(Y*p)-m(y*F)),p=m(m(F*R)-m(p*W)),p=m(N(m(m(V*V)+m(m(Y*Y)+m(p*p))))),w[h+20>>2]=p,W=m(w[M+16>>2]-E),F=m(w[I+20>>2]-d),R=m(w[I+16>>2]-E),Y=m(w[M+20>>2]-d),V=m(m(W*F)-m(R*Y)),X=m(V*V),y=Y,Y=m(w[I+24>>2]-k),V=F,F=m(w[M+24>>2]-k),V=m(m(y*Y)-m(V*F)),W=m(m(F*R)-m(Y*W)),W=m(N(m(X+m(m(V*V)+m(W*W))))),w[h+24>>2]=W,F=m(w[I+16>>2]-E),R=m(w[H+20>>2]-d),E=m(w[H+16>>2]-E),d=m(w[I+20>>2]-d),Y=m(m(F*R)-m(E*d)),y=d,d=m(w[H+24>>2]-k),k=m(w[I+24>>2]-k),R=m(m(y*d)-m(R*k)),k=m(m(k*E)-m(d*F)),d=m(N(m(m(Y*Y)+m(m(R*R)+m(k*k))))),k=m(d+m(p+W)),w[h+28>>2]=d/k,w[h+24>>2]=W/k,w[h+20>>2]=p/k,r=o[h>>2];break e}}r=8,o[h>>2]=8,k=m(0),E=m(1),d=m(0),p=w[Q+12>>2],W=w[Q+4>>2],F=w[Q+8>>2],(R=m(N(m(m(p*p)+m(m(W*W)+m(F*F))))))>m(0)&&(E=m(m(1)/R),d=m(E*m(-p)),k=m(E*m(-F)),E=m(E*m(-W))),o[h+52>>2]=0,o[h+56>>2]=0,w[h+48>>2]=d,w[h+44>>2]=k,w[h+40>>2]=E,o[h+36>>2]=1,i=o[Z>>2],o[h+20>>2]=1065353216,o[h+4>>2]=i}if(S=J+32|0,9==(0|r))break r;if(o[Q+56>>2])for(u=Q+24|0,E=m(0),d=m(0),k=m(0);r=o[Q+19032>>2],h=o[Q+19036>>2],i=o[Q+18912>>2]+(h>>1)|0,Z=D<<2,Zn[0|(1&h?o[r+o[i>>2]>>2]:r)](Q+4|0,i,o[Z+u>>2]),p=w[40+(Q+Z|0)>>2],E=m(E+m(p*w[Q+12>>2])),d=m(d+m(p*w[Q+8>>2])),k=m(k+m(w[Q+4>>2]*p)),(D=D+1|0)>>>0>2];);else k=m(0),d=m(0),E=m(0);D=1,o[s>>2]=1,p=w[l+52>>2],W=w[l+24>>2],F=w[l+20>>2],R=w[l+56>>2],Y=w[l+40>>2],V=w[l+36>>2],X=w[l+48>>2],T=w[l+8>>2],U=w[l>>2],j=w[l+4>>2],z=w[l+16>>2],P=w[l+32>>2],o[s+16>>2]=0,w[s+12>>2]=R+m(m(E*Y)+m(m(k*P)+m(d*V))),w[s+8>>2]=p+m(m(E*W)+m(m(k*z)+m(d*F))),w[s+4>>2]=X+m(m(E*T)+m(m(k*U)+m(d*j))),Y=w[l+52>>2],V=w[l+20>>2],X=w[l+24>>2],T=w[l+56>>2],U=w[l+36>>2],j=w[l+40>>2],z=w[l+48>>2],P=w[l+8>>2],O=w[l>>2],$=w[l+4>>2],K=w[l+16>>2],_=w[l+32>>2],W=w[Q- -64>>2],F=w[Q+68>>2],R=w[Q+60>>2],p=w[Q+76>>2],o[s+48>>2]=0,o[s+32>>2]=0,w[s+52>>2]=-p,w[s+44>>2]=-F,w[s+40>>2]=-W,w[s+36>>2]=-R,E=m(E-m(p*F)),k=m(k-m(R*p)),d=m(d-m(p*W)),w[s+28>>2]=T+m(m(j*E)+m(m(_*k)+m(U*d))),w[s+24>>2]=Y+m(m(E*X)+m(m(k*K)+m(d*V))),w[s+20>>2]=z+m(m(E*P)+m(m(k*O)+m(d*$)));break A;case 1:break f;default:break A}o[s>>2]=2;break A}o[s>>2]=3}S=Q+19040|0;A:{if(!D){if(k=m(0),d=m(0),E=m(0),p=m(0),W=m(0),F=m(0),S=i=S-544|0,rr(f,l,e,n,A+8|0,r=i+384|0,0),o[i+140>>2]=0,o[i+144>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+368>>2]=0,o[i+372>>2]=0,o[i+380>>2]=2,o[i+148>>2]=0,f=bA(i+4|0,r,A- -64|0))o[A+8>>2]=1==(0|f)?1:2;else{if(e=o[i+376>>2],o[e+32>>2])for(n=0;R=w[16+(h=e+(u=n<<2)|0)>>2],r=o[i+504>>2],Z=i+528|0,Q=o[i+508>>2],e=o[i+384>>2]+(Q>>1)|0,Zn[0|(1&Q?o[r+o[e>>2]>>2]:r)](Z,e,o[h>>2]),r=o[u+o[i+376>>2]>>2],Y=m(-w[r+8>>2]),V=m(-w[r+4>>2]),X=m(-w[r>>2]),r=o[i+504>>2],e=o[i+508>>2],u=o[i+388>>2]+(e>>1)|0,r=1&e?o[r+o[u>>2]>>2]:r,k=m(k+m(R*w[i+536>>2])),E=m(E+m(R*w[i+532>>2])),d=m(d+m(R*w[i+528>>2])),o[i+524>>2]=0,w[i+520>>2]=m(w[i+432>>2]*Y)+m(m(w[i+424>>2]*X)+m(w[i+428>>2]*V)),w[i+516>>2]=m(w[i+416>>2]*Y)+m(m(w[i+408>>2]*X)+m(w[i+412>>2]*V)),w[i+512>>2]=m(w[i+400>>2]*Y)+m(m(w[i+392>>2]*X)+m(w[i+396>>2]*V)),Zn[0|r](Z,u,i+512|0),Y=w[i+536>>2],V=w[i+528>>2],X=w[i+532>>2],F=m(F+m(R*m(m(m(Y*w[i+480>>2])+m(m(V*w[i+472>>2])+m(X*w[i+476>>2])))+w[i+496>>2]))),W=m(W+m(R*m(m(m(Y*w[i+464>>2])+m(m(V*w[i+456>>2])+m(X*w[i+460>>2])))+w[i+492>>2]))),p=m(p+m(R*m(m(m(Y*w[i+448>>2])+m(m(V*w[i+440>>2])+m(X*w[i+444>>2])))+w[i+488>>2]))),n=n+1|0,e=o[i+376>>2],n>>>0>2];);R=w[l+52>>2],Y=w[l+24>>2],V=w[l+20>>2],X=w[l+56>>2],T=w[l+40>>2],U=w[l+36>>2],j=w[l+16>>2],z=w[l+32>>2],P=w[l+48>>2],O=w[l+8>>2],$=w[l>>2],K=w[l+4>>2],o[A+24>>2]=0,w[A+12>>2]=P+m(m(k*O)+m(m(d*$)+m(E*K))),w[A+20>>2]=X+m(m(k*T)+m(m(d*z)+m(E*U))),w[A+16>>2]=R+m(m(k*Y)+m(m(d*j)+m(E*V))),Y=w[l+52>>2],V=w[l+24>>2],X=w[l+20>>2],T=w[l+56>>2],U=w[l+40>>2],j=w[l+36>>2],z=w[l+48>>2],P=w[l+8>>2],O=w[l>>2],$=w[l+4>>2],K=w[l+16>>2],_=w[l+32>>2],k=m(k-F),d=m(d-p),E=m(E-W),R=m(N(m(m(k*k)+m(m(d*d)+m(E*E))))),w[A+60>>2]=R,o[A+56>>2]=0,o[A+40>>2]=0,y=k,k=R>m(9999999747378752e-20)?m(m(1)/R):m(1),w[A+52>>2]=y*k,w[A+48>>2]=E*k,w[A+44>>2]=d*k,w[A+36>>2]=T+m(m(F*U)+m(m(p*_)+m(W*j))),w[A+32>>2]=Y+m(m(F*V)+m(m(p*K)+m(W*X))),w[A+28>>2]=z+m(m(F*P)+m(m(p*O)+m(W*$)))}if(S=i+544|0,f)break A}r=o[A+16>>2],o[c>>2]=o[A+12>>2],o[c+4>>2]=r,r=o[A+24>>2],o[c+8>>2]=o[A+20>>2],o[c+12>>2]=r,r=o[A+40>>2],o[b+8>>2]=o[A+36>>2],o[b+12>>2]=r,r=o[A+32>>2],o[b>>2]=o[A+28>>2],o[b+4>>2]=r,r=o[A+56>>2],o[t+8>>2]=o[A+52>>2],o[t+12>>2]=r,r=o[A+48>>2],o[t>>2]=o[A+44>>2],o[t+4>>2]=r}return S=A+80|0,0|D},vn,eA,vn,function(A,r,f,e,i,n,t,c,b,u){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,t|=0,c|=0,b|=0,u|=0;var l=m(0),s=m(0),k=m(0),d=m(0),h=0,B=m(0),Z=0,G=m(0),Q=m(0),E=m(0),W=0,N=0,p=0,F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=m(0),C=0,J=0;for(S=A=S-4240|0,J=o[f+4>>2]-17>>>0<=1?o[e+4>>2]-17>>>0<2:J;JA(),l=w[34152+(Z=p<<4)>>2],d=w[Z+34144>>2],s=w[Z+34148>>2],G=w[i+32>>2],Q=w[i>>2],E=w[i+16>>2],B=w[i+36>>2],F=w[i+4>>2],R=w[i+20>>2],Y=w[i+40>>2],k=w[i+8>>2],V=w[i+24>>2],o[12+(W=Z+(A+1264|0)|0)>>2]=0,g=k,k=m(-d),w[W+8>>2]=m(m(g*k)-m(V*s))-m(Y*l),w[W+4>>2]=m(m(F*k)-m(R*s))-m(B*l),w[W>>2]=m(m(Q*k)-m(E*s))-m(G*l),k=w[n+32>>2],G=w[n>>2],Q=w[n+16>>2],E=w[n+36>>2],B=w[n+4>>2],F=w[n+20>>2],R=w[n+40>>2],Y=w[n+8>>2],V=w[n+24>>2],o[12+(Z=Z+(A+272|0)|0)>>2]=0,w[Z+8>>2]=m(R*l)+m(m(Y*d)+m(s*V)),w[Z+4>>2]=m(E*l)+m(m(B*d)+m(s*F)),w[Z>>2]=m(k*l)+m(m(G*d)+m(s*Q)),42!=(0|(p=p+1|0)););if(Z=42,(0|(C=0|Zn[o[o[f>>2]+84>>2]](f)))>0)for(W=A+3256|0,p=0;Zn[o[o[f>>2]+88>>2]](f,p,A+3248|0),k=w[i+8>>2],G=w[i>>2],Q=w[i+4>>2],E=w[i+24>>2],B=w[i+16>>2],F=w[i+20>>2],l=w[W>>2],s=w[A+3248>>2],d=w[A+3252>>2],w[W>>2]=m(w[i+40>>2]*l)+m(m(w[i+32>>2]*s)+m(d*w[i+36>>2])),o[A+3260>>2]=0,w[A+3252>>2]=m(E*l)+m(m(B*s)+m(d*F)),w[A+3248>>2]=m(k*l)+m(m(G*s)+m(Q*d)),JA(),X=o[W+4>>2],o[(N=34152+(h=Z<<4)|0)>>2]=o[W>>2],o[N+4>>2]=X,X=o[A+3252>>2],o[(N=h+34144|0)>>2]=o[A+3248>>2],o[N+4>>2]=X,G=w[i+40>>2],Q=w[i+8>>2],E=w[i+24>>2],B=w[i+36>>2],F=w[i+4>>2],R=w[i+20>>2],s=w[i+32>>2],l=w[i>>2],Y=w[i+16>>2],o[12+(N=h+(A+1264|0)|0)>>2]=0,d=w[A+3248>>2],k=m(-d),D=m(l*k),l=w[A+3252>>2],g=s,s=w[W>>2],w[N>>2]=m(D-m(Y*l))-m(g*s),w[N+4>>2]=m(m(F*k)-m(R*l))-m(B*s),w[N+8>>2]=m(m(Q*k)-m(E*l))-m(G*s),k=w[n+32>>2],G=w[n>>2],Q=w[n+16>>2],E=w[n+36>>2],B=w[n+4>>2],F=w[n+20>>2],R=w[n+40>>2],Y=w[n+8>>2],V=w[n+24>>2],o[12+(h=h+(A+272|0)|0)>>2]=0,w[h+8>>2]=m(R*s)+m(m(Y*d)+m(l*V)),w[h+4>>2]=m(E*s)+m(m(B*d)+m(l*F)),w[h>>2]=m(k*s)+m(m(G*d)+m(l*Q)),Z=Z+1|0,(0|C)!=(0|(p=p+1|0)););if((0|(C=0|Zn[o[o[e>>2]+84>>2]](e)))>0)for(W=A+3256|0,p=0;Zn[o[o[e>>2]+88>>2]](e,p,A+3248|0),k=w[n+8>>2],G=w[n>>2],Q=w[n+4>>2],E=w[n+24>>2],B=w[n+16>>2],F=w[n+20>>2],l=w[W>>2],s=w[A+3248>>2],d=w[A+3252>>2],w[W>>2]=m(w[n+40>>2]*l)+m(m(w[n+32>>2]*s)+m(d*w[n+36>>2])),o[A+3260>>2]=0,w[A+3252>>2]=m(E*l)+m(m(B*s)+m(d*F)),w[A+3248>>2]=m(k*l)+m(m(G*s)+m(Q*d)),JA(),X=o[W+4>>2],o[(N=34152+(h=Z<<4)|0)>>2]=o[W>>2],o[N+4>>2]=X,X=o[A+3252>>2],o[(N=h+34144|0)>>2]=o[A+3248>>2],o[N+4>>2]=X,G=w[i+40>>2],Q=w[i+8>>2],E=w[i+24>>2],B=w[i+36>>2],F=w[i+4>>2],R=w[i+20>>2],s=w[i+32>>2],l=w[i>>2],Y=w[i+16>>2],o[12+(N=h+(A+1264|0)|0)>>2]=0,d=w[A+3248>>2],k=m(-d),D=m(l*k),l=w[A+3252>>2],g=s,s=w[W>>2],w[N>>2]=m(D-m(Y*l))-m(g*s),w[N+4>>2]=m(m(F*k)-m(R*l))-m(B*s),w[N+8>>2]=m(m(Q*k)-m(E*l))-m(G*s),k=w[n+32>>2],G=w[n>>2],Q=w[n+16>>2],E=w[n+36>>2],B=w[n+4>>2],F=w[n+20>>2],R=w[n+40>>2],Y=w[n+8>>2],V=w[n+24>>2],o[12+(h=h+(A+272|0)|0)>>2]=0,w[h+8>>2]=m(R*s)+m(m(Y*d)+m(l*V)),w[h+4>>2]=m(E*s)+m(m(B*d)+m(l*F)),w[h>>2]=m(k*s)+m(m(G*d)+m(l*Q)),Z=Z+1|0,(0|C)!=(0|(p=p+1|0)););if(Zn[o[o[f>>2]+76>>2]](f,A+1264|0,A+3248|0,Z),Zn[o[o[e>>2]+76>>2]](e,A+272|0,A+2256|0,Z),(0|Z)<=0)k=m(0xde0b6b000000000),l=m(0),s=m(0),d=m(0),F=m(0);else for(p=0,k=m(0xde0b6b000000000),F=m(0),d=m(0),s=m(0),l=m(0);JA(),W=p<<4,G=J?m(0):w[W+34152>>2],Q=w[W+34144>>2],E=w[W+34148>>2],+m(m(G*G)+m(m(Q*Q)+m(E*E)))>.01&&(B=w[8+(h=W+(A+2256|0)|0)>>2],R=w[h>>2],Y=w[h+4>>2],V=w[8+(h=W+(A+3248|0)|0)>>2],D=w[h>>2],g=w[h+4>>2],(B=m(m(G*m(J?0:m(m(m(B*w[n+40>>2])+m(m(R*w[n+32>>2])+m(Y*w[n+36>>2])))+w[n+56>>2])-m(m(m(V*w[i+40>>2])+m(m(D*w[i+32>>2])+m(g*w[i+36>>2])))+w[i+56>>2])))+m(m(Q*m(m(m(m(B*w[n+8>>2])+m(m(R*w[n>>2])+m(Y*w[n+4>>2])))+w[n+48>>2])-m(m(m(V*w[i+8>>2])+m(m(D*w[i>>2])+m(g*w[i+4>>2])))+w[i+48>>2])))+m(E*m(m(m(m(B*w[n+24>>2])+m(m(R*w[n+16>>2])+m(Y*w[n+20>>2])))+w[n+52>>2])-m(m(m(V*w[i+24>>2])+m(m(D*w[i+16>>2])+m(g*w[i+20>>2])))+w[i+52>>2]))))))>2],l=Q,s=E,d=G,k=B)),(0|(p=p+1|0))!=(0|Z););return oe(f),oe(e),Z=0,k>2],B=w[i+56>>2],R=w[i+48>>2],e=o[i+12>>2],o[(f=A- -64|0)>>2]=o[i+8>>2],o[f+4>>2]=e,f=o[i+4>>2],o[A+56>>2]=o[i>>2],o[A+60>>2]=f,f=o[i+28>>2],o[A+80>>2]=o[i+24>>2],o[A+84>>2]=f,f=o[i+20>>2],o[A+72>>2]=o[i+16>>2],o[A+76>>2]=f,f=o[i+40>>2],e=o[i+44>>2],p=o[i+32>>2],i=o[i+36>>2],o[A+116>>2]=0,o[A+96>>2]=f,o[A+100>>2]=e,k=m(k+m(m(G+Q)+m(.5))),w[A+112>>2]=B+m(d*k),w[A+108>>2]=E+m(s*k),o[A+88>>2]=p,o[A+92>>2]=i,w[A+104>>2]=R+m(l*k),f=o[n+12>>2],o[A+128>>2]=o[n+8>>2],o[A+132>>2]=f,f=o[n+4>>2],o[A+120>>2]=o[n>>2],o[A+124>>2]=f,f=o[n+28>>2],o[A+144>>2]=o[n+24>>2],o[A+148>>2]=f,f=o[n+20>>2],o[A+136>>2]=o[n+16>>2],o[A+140>>2]=f,f=o[n+44>>2],o[A+160>>2]=o[n+40>>2],o[A+164>>2]=f,f=o[n+36>>2],o[A+152>>2]=o[n+32>>2],o[A+156>>2]=f,f=o[n+60>>2],o[A+176>>2]=o[n+56>>2],o[A+180>>2]=f,f=o[n+52>>2],o[A+168>>2]=o[n+48>>2],o[A+172>>2]=f,o[A+184>>2]=1566444395,a[A+52|0]=0,o[A+12>>2]=23028,o[r+16>>2]=0,w[r+12>>2]=-d,w[r+8>>2]=-s,w[r+4>>2]=-l,eA(r,A+56|0,A+12|0,u,0),(r=v[A+52|0])&&(G=w[A+36>>2],Q=w[A+40>>2],E=w[A+32>>2],B=w[A+48>>2],o[c+12>>2]=0,k=m(k-B),w[c+8>>2]=Q-m(d*k),w[c+4>>2]=G-m(s*k),w[c>>2]=E-m(l*k),f=o[A+44>>2],o[b+8>>2]=o[A+40>>2],o[b+12>>2]=f,f=o[A+36>>2],o[b>>2]=o[A+32>>2],o[b+4>>2]=f,w[t+12>>2]=F,w[t+8>>2]=d,w[t+4>>2]=s,w[t>>2]=l),Z=!!(0|r)),S=A+4240|0,0|Z},vn,zi,zi,function(A,r,f,e){A|=0,r|=0,f|=0,e=m(e);var i=0;i=o[r+4>>2],o[A+4>>2]=o[r>>2],o[A+8>>2]=i,i=o[r+12>>2],o[A+12>>2]=o[r+8>>2],o[A+16>>2]=i,r=o[f+4>>2],o[A+20>>2]=o[f>>2],o[A+24>>2]=r,r=o[f+12>>2],o[A+28>>2]=o[f+8>>2],o[A+32>>2]=r,a[A+40|0]=1,w[A+36>>2]=e},hn,hn,vn,ZA,Ei,_e,Bn,function(){},function(A,r){r|=0;var f=0,e=0;fA(A|=0,o[A+28>>2]+4|0,o[A+32>>2]+4|0),o[r>>2]=0,o[r+4>>2]=0,e=2;A:{r:{switch(0|(f=o[A+956>>2])){case 0:break A;case 4:break r}e=1}o[r>>2]=e,f=e}switch(v[A+792|0]&&(f=f+1|0,o[r>>2]=f),v[A+798|0]&&(f=f+1|0,o[r>>2]=f),e=2,o[A+960>>2]){default:e=1;case 4:f=f+e|0,o[r>>2]=f;case 0:}switch(v[A+793|0]&&(f=f+1|0,o[r>>2]=f),v[A+799|0]&&(f=f+1|0,o[r>>2]=f),e=2,o[A+964>>2]){default:e=1;case 4:f=f+e|0,o[r>>2]=f;case 0:}switch(v[A+794|0]&&(f=f+1|0,o[r>>2]=f),v[A+800|0]&&(o[r>>2]=f+1),Rr(A,0),f=2,o[A+1052>>2]){default:f=1;case 4:o[r>>2]=o[r>>2]+f;case 0:}switch(v[A+996|0]&&(o[r>>2]=o[r>>2]+1),v[A+1016|0]&&(o[r>>2]=o[r>>2]+1),Rr(A,1),f=2,o[A+1140>>2]){default:f=1;case 4:o[r>>2]=o[r>>2]+f;case 0:}switch(v[A+1084|0]&&(o[r>>2]=o[r>>2]+1),v[A+1104|0]&&(o[r>>2]=o[r>>2]+1),f=2,Rr(A,2),o[A+1228>>2]){default:f=1;case 4:o[r>>2]=o[r>>2]+f;case 0:}v[A+1172|0]&&(o[r>>2]=o[r>>2]+1),v[A+1192|0]&&(o[r>>2]=o[r>>2]+1)},function(A,r){A|=0,r|=0;var f,e,i,n,t,c,b,u,l,s,k,d,h,B,Z,Q,E,W,N,p,F,R,Y,V,g,X,D,C=0,J=0,x=0,y=0,M=0,H=0,I=0,T=m(0),U=0;for(e=r,i=(C=o[A+28>>2])+4|0,n=(r=o[A+32>>2])+4|0,t=C+372|0,c=r+372|0,b=C+388|0,u=r+388|0,S=M=S-16|0,(A=o[(f=A)+1232>>2]-1|0)>>>0>4?(H=1,A=2):(x=o[23648+(A<<=2)>>2],H=o[A+23628>>2],A=o[A+23608>>2]),J=G(x,88)+f|0,o[J+1052>>2]|v[J+996|0]|v[1016+(G(x,88)+f|0)|0]&&(r=o[4+(I=1388+(C=(x<<4)+f|0)|0)>>2],o[M+8>>2]=o[I>>2],o[M+12>>2]=r,r=o[4+(I=C+1380|0)>>2],o[M>>2]=o[I>>2],o[M+4>>2]=r,1&(r=o[f+1456>>2]>>12+(x<<2))||(w[984+(G(x,88)+f|0)>>2]=w[o[e+32>>2]>>2]),2&r||(w[980+(G(x,88)+f|0)>>2]=w[e+4>>2]),4&r||(w[992+(G(x,88)+f|0)>>2]=w[o[e+32>>2]>>2]),8&r||(w[988+(G(x,88)+f|0)>>2]=w[e+4>>2]),I=YA(f,J+968|0,i,n,t,c,b,u,e,0,M,1,0)),x=G(H,88)+f|0,o[x+1052>>2]|v[x+996|0]|v[1016+(G(H,88)+f|0)|0]&&(r=o[4+(C=1388+(J=(H<<4)+f|0)|0)>>2],o[M+8>>2]=o[C>>2],o[M+12>>2]=r,r=o[4+(C=J+1380|0)>>2],o[M>>2]=o[C>>2],o[M+4>>2]=r,1&(r=o[f+1456>>2]>>12+(H<<2))||(w[984+(G(H,88)+f|0)>>2]=w[o[e+32>>2]>>2]),2&r||(w[980+(G(H,88)+f|0)>>2]=w[e+4>>2]),4&r||(w[992+(G(H,88)+f|0)>>2]=w[o[e+32>>2]>>2]),8&r||(w[988+(G(H,88)+f|0)>>2]=w[e+4>>2]),I=YA(f,x+968|0,i,n,t,c,b,u,e,I,M,1,0)+I|0),x=G(A,88)+f|0,o[x+1052>>2]|v[x+996|0]|v[1016+(G(A,88)+f|0)|0]&&(r=o[4+(C=1388+(J=(A<<4)+f|0)|0)>>2],o[M+8>>2]=o[C>>2],o[M+12>>2]=r,r=o[4+(C=J+1380|0)>>2],o[M>>2]=o[C>>2],o[M+4>>2]=r,1&(r=o[f+1456>>2]>>12+(A<<2))||(w[984+(G(A,88)+f|0)>>2]=w[o[e+32>>2]>>2]),2&r||(w[980+(G(A,88)+f|0)>>2]=w[e+4>>2]),4&r||(w[992+(G(A,88)+f|0)>>2]=w[o[e+32>>2]>>2]),8&r||(w[988+(G(A,88)+f|0)>>2]=w[e+4>>2]),I=YA(f,x+968|0,i,n,t,c,b,u,e,I,M,1,0)+I|0),J=0,S=r=(S=M+16|0)-112|0,o[r+44>>2]=1063675494,o[r+48>>2]=0,o[r+36>>2]=1045220557,o[r+40>>2]=0,k=f+760|0,d=f+776|0,l=e+4|0,h=f+728|0,B=f+744|0,Z=f+1268|0,Q=f+1252|0,E=f+1236|0,W=f+876|0,N=f+892|0,p=f+696|0,F=f+860|0,R=f+840|0,Y=f+820|0,V=f+804|0,g=f+924|0,X=f+908|0,D=f+940|0,M=f+712|0,s=f+680|0;;){if(C=v[112+(J+s|0)|0],(x=o[276+(H=s+(y=J<<2)|0)>>2])||(A=C,C=1,A||(C=0,v[798+(f+J|0)|0]))){T=w[y+M>>2],o[r+108>>2]=x,w[r+32>>2]=T,w[r+104>>2]=w[y+D>>2],w[r+96>>2]=w[y+X>>2],T=w[y+g>>2],a[r+52|0]=C,w[r+100>>2]=T,A=f+J|0,a[r+64|0]=v[A+795|0],w[r+68>>2]=w[y+V>>2],a[r+72|0]=v[A+798|0],w[r+76>>2]=w[y+Y>>2],a[r+80|0]=v[A+836|0],w[r+84>>2]=w[y+R>>2],a[r+88|0]=v[A+856|0],w[r+92>>2]=w[y+F>>2],w[r+28>>2]=w[y+p>>2],w[r+24>>2]=w[H>>2],w[r+60>>2]=w[y+N>>2],w[r+56>>2]=w[y+W>>2],w[r+8>>2]=w[y+E>>2],w[r+12>>2]=w[y+Q>>2],T=w[y+Z>>2],o[r+20>>2]=0,w[r+16>>2]=T,C=o[f+1456>>2]>>y,w[r+40>>2]=w[(1&C?y+B:o[e+32>>2])>>2],w[r+36>>2]=w[(2&C?y+h:l)>>2],w[r+48>>2]=w[(4&C?y+d:o[e+32>>2])>>2],w[r+44>>2]=w[(8&C?y+k:l)>>2],H=1,x=J?J-1|0:2,C=1;A:{r:{f:{e:switch(A=J+1|0,J=G(J>>>0<2?A:J-2|0,88)+f|0,o[J+1052>>2]-1|0){case 0:case 1:break A;case 3:break f;case 2:break e;default:break r}C=(U=+w[J+1040>>2])<-.001|U>.001;break A}if(+w[J+1040>>2]<-.001)break A;C=+w[J+1044>>2]>.001;break A}C=0}A:{r:{f:{e:switch(J=G(x,88)+f|0,o[J+1052>>2]-1|0){case 0:case 1:break r;case 3:break f;case 2:break e;default:break A}if((U=+w[J+1040>>2])<-.001|U>.001)break r;break A}if(!(+w[J+1040>>2]<-.001||+w[J+1044>>2]>.001))break A}H=0}I=YA(f,r+24|0,i,n,t,c,b,u,e,I,r+8|0,0,C?H:1)+I|0}else A=J+1|0;if(3==(0|(J=A)))break}S=r+112|0},mi,function(A,r,f,e){A|=0,r|=0,f=m(f);var i=0;A:{r:{if((e|=0)>>>0<=2){f:switch(r-1|0){case 1:r=728+((e<<2)+A|0)|0,i=2;break r;case 3:r=744+((e<<2)+A|0)|0,i=1;break r;case 0:r=760+((e<<2)+A|0)|0,i=8;break r;case 2:break f;default:break A}r=776+((e<<2)+A|0)|0}else{if((i=e-3|0)>>>0>2)break A;f:switch(r-1|0){case 1:r=980+(G(i,88)+A|0)|0,i=2;break r;case 3:r=984+(G(i,88)+A|0)|0,i=1;break r;case 0:r=988+(G(i,88)+A|0)|0,i=8;break r;case 2:break f;default:break A}r=992+(G(i,88)+A|0)|0}i=4}w[r>>2]=f,o[A+1456>>2]=o[A+1456>>2]|i<<(e<<2)}},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);A:{r:if(f>>>0<=2){f:switch(r-1|0){case 1:A=728+((f<<2)+A|0)|0;break r;case 3:A=744+((f<<2)+A|0)|0;break r;case 0:A=760+((f<<2)+A|0)|0;break r;case 2:break f;default:break A}A=776+((f<<2)+A|0)|0}else{if((f=f-3|0)>>>0>2)break A;f:switch(r-1|0){case 1:A=980+(G(f,88)+A|0)|0;break r;case 3:A=984+(G(f,88)+A|0)|0;break r;case 0:A=988+(G(f,88)+A|0)|0;break r;case 2:break f;default:break A}A=992+(G(f,88)+A|0)|0}e=w[A>>2]}return m(e)},function(){return 644},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);return hr(A,r,f),w[r+52>>2]=w[A+48>>2],w[r+56>>2]=w[A+52>>2],w[r+60>>2]=w[A+56>>2],w[r- -64>>2]=w[A+60>>2],w[r+68>>2]=w[A- -64>>2],w[r+72>>2]=w[A+68>>2],w[r+76>>2]=w[A+72>>2],w[r+80>>2]=w[A+76>>2],w[r+84>>2]=w[A+80>>2],w[r+88>>2]=w[A+84>>2],w[r+92>>2]=w[A+88>>2],w[r+96>>2]=w[A+92>>2],w[r+100>>2]=w[A+96>>2],w[r+104>>2]=w[A+100>>2],w[r+108>>2]=w[A+104>>2],w[r+112>>2]=w[A+108>>2],w[r+116>>2]=w[A+112>>2],w[r+120>>2]=w[A+116>>2],w[r+124>>2]=w[A+120>>2],w[r+128>>2]=w[A+124>>2],w[r+132>>2]=w[A+128>>2],w[r+136>>2]=w[A+132>>2],w[r+140>>2]=w[A+136>>2],w[r+144>>2]=w[A+140>>2],w[r+148>>2]=w[A+144>>2],w[r+152>>2]=w[A+148>>2],w[r+156>>2]=w[A+152>>2],w[r+160>>2]=w[A+156>>2],w[r+164>>2]=w[A+160>>2],w[r+168>>2]=w[A+164>>2],w[r+172>>2]=w[A+168>>2],w[r+176>>2]=w[A+172>>2],w[r+428>>2]=w[A+968>>2],w[r+412>>2]=w[A+972>>2],w[r+444>>2]=w[A+976>>2],w[r+460>>2]=w[A+980>>2],w[r+476>>2]=w[A+984>>2],w[r+492>>2]=w[A+988>>2],w[r+508>>2]=w[A+992>>2],w[r+524>>2]=w[A+1e3>>2],w[r+540>>2]=w[A+1004>>2],w[r+556>>2]=w[A+1012>>2],w[r+572>>2]=w[A+1020>>2],w[r+588>>2]=w[A+1028>>2],w[r+604>>2]=w[A+1036>>2],w[r+432>>2]=w[A+1056>>2],w[r+416>>2]=w[A+1060>>2],w[r+448>>2]=w[A+1064>>2],w[r+464>>2]=w[A+1068>>2],w[r+480>>2]=w[A+1072>>2],w[r+496>>2]=w[A+1076>>2],w[r+512>>2]=w[A+1080>>2],w[r+528>>2]=w[A+1088>>2],w[r+544>>2]=w[A+1092>>2],w[r+560>>2]=w[A+1100>>2],w[r+576>>2]=w[A+1108>>2],w[r+592>>2]=w[A+1116>>2],w[r+608>>2]=w[A+1124>>2],w[r+436>>2]=w[A+1144>>2],w[r+420>>2]=w[A+1148>>2],w[r+452>>2]=w[A+1152>>2],w[r+468>>2]=w[A+1156>>2],w[r+484>>2]=w[A+1160>>2],w[r+500>>2]=w[A+1164>>2],w[r+516>>2]=w[A+1168>>2],w[r+532>>2]=w[A+1176>>2],w[r+548>>2]=w[A+1180>>2],w[r+564>>2]=w[A+1188>>2],w[r+580>>2]=w[A+1196>>2],w[r+596>>2]=w[A+1204>>2],e=w[A+1212>>2],o[r+440>>2]=0,w[r+612>>2]=e,o[r+616>>2]=0,o[r+600>>2]=0,o[r+584>>2]=0,o[r+568>>2]=0,o[r+552>>2]=0,o[r+536>>2]=0,o[r+520>>2]=0,o[r+504>>2]=0,o[r+488>>2]=0,o[r+472>>2]=0,o[r+456>>2]=0,o[r+424>>2]=0,a[r+620|0]=v[A+996|0],a[r+624|0]=v[A+1008|0],a[r+628|0]=v[A+1016|0],a[r+632|0]=v[A+1024|0],a[r+636|0]=v[A+1032|0],a[r+621|0]=v[A+1084|0],a[r+625|0]=v[A+1096|0],a[r+629|0]=v[A+1104|0],a[r+633|0]=v[A+1112|0],a[r+637|0]=v[A+1120|0],a[r+622|0]=v[A+1172|0],a[r+626|0]=v[A+1184|0],a[r+630|0]=v[A+1192|0],a[r+634|0]=v[A+1200|0],f=v[A+1208|0],a[r+639|0]=0,a[r+635|0]=0,a[r+631|0]=0,a[r+627|0]=0,a[r+623|0]=0,a[r+638|0]=f,w[r+196>>2]=w[A+680>>2],w[r+200>>2]=w[A+684>>2],w[r+204>>2]=w[A+688>>2],w[r+208>>2]=w[A+692>>2],w[r+180>>2]=w[A+696>>2],w[r+184>>2]=w[A+700>>2],w[r+188>>2]=w[A+704>>2],w[r+192>>2]=w[A+708>>2],w[r+212>>2]=w[A+712>>2],w[r+216>>2]=w[A+716>>2],w[r+220>>2]=w[A+720>>2],w[r+224>>2]=w[A+724>>2],w[r+228>>2]=w[A+728>>2],w[r+232>>2]=w[A+732>>2],w[r+236>>2]=w[A+736>>2],w[r+240>>2]=w[A+740>>2],w[r+244>>2]=w[A+744>>2],w[r+248>>2]=w[A+748>>2],w[r+252>>2]=w[A+752>>2],w[r+256>>2]=w[A+756>>2],w[r+260>>2]=w[A+760>>2],w[r+264>>2]=w[A+764>>2],w[r+268>>2]=w[A+768>>2],w[r+272>>2]=w[A+772>>2],w[r+276>>2]=w[A+776>>2],w[r+280>>2]=w[A+780>>2],w[r+284>>2]=w[A+784>>2],w[r+288>>2]=w[A+788>>2],w[r+292>>2]=w[A+876>>2],w[r+296>>2]=w[A+880>>2],w[r+300>>2]=w[A+884>>2],w[r+304>>2]=w[A+888>>2],w[r+308>>2]=w[A+892>>2],w[r+312>>2]=w[A+896>>2],w[r+316>>2]=w[A+900>>2],w[r+320>>2]=w[A+904>>2],w[r+324>>2]=w[A+804>>2],w[r+328>>2]=w[A+808>>2],w[r+332>>2]=w[A+812>>2],w[r+336>>2]=w[A+816>>2],w[r+340>>2]=w[A+820>>2],w[r+344>>2]=w[A+824>>2],w[r+348>>2]=w[A+828>>2],w[r+352>>2]=w[A+832>>2],w[r+356>>2]=w[A+840>>2],w[r+360>>2]=w[A+844>>2],w[r+364>>2]=w[A+848>>2],w[r+368>>2]=w[A+852>>2],w[r+372>>2]=w[A+860>>2],w[r+376>>2]=w[A+864>>2],w[r+380>>2]=w[A+868>>2],w[r+384>>2]=w[A+872>>2],a[r+388|0]=v[A+792|0],a[r+392|0]=v[A+795|0],a[r+396|0]=v[A+798|0],a[r+400|0]=v[A+836|0],a[r+404|0]=v[A+856|0],a[r+389|0]=v[A+793|0],a[r+393|0]=v[A+796|0],a[r+397|0]=v[A+799|0],a[r+401|0]=v[A+837|0],a[r+405|0]=v[A+857|0],a[r+390|0]=v[A+794|0],a[r+394|0]=v[A+797|0],a[r+398|0]=v[A+800|0],a[r+402|0]=v[A+838|0],f=v[A+858|0],a[r+407|0]=0,a[r+403|0]=0,a[r+399|0]=0,a[r+395|0]=0,a[r+391|0]=0,a[r+406|0]=f,A=o[A+1232>>2],o[r+408>>2]=0,o[r+640>>2]=A,8612},Ei,_e,_e,function(A){A|=0;var r,f=0,e=m(0),i=0,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=0,B=m(0),Z=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=0,O=0,L=0,$=m(0),K=m(0),q=m(0),_=0;if(S=r=S-48|0,v[A+738|0]){if(o[A+744>>2]=0,o[A+36>>2]=0,!v[A+736|0])for(n=w[A+672>>2],f=o[A+32>>2],t=w[A+664>>2],c=w[A+668>>2],B=m(m(m(n*w[f+44>>2])+m(m(t*w[f+36>>2])+m(c*w[f+40>>2])))+w[f+60>>2]),a=w[A+608>>2],i=o[A+28>>2],e=w[A+600>>2],u=w[A+604>>2],k=m(m(m(a*w[i+44>>2])+m(m(e*w[i+36>>2])+m(u*w[i+40>>2])))+w[i+60>>2]),b=m(B-k),W=m(m(m(n*w[f+12>>2])+m(m(t*w[f+4>>2])+m(c*w[f+8>>2])))+w[f+52>>2]),p=m(m(m(a*w[i+12>>2])+m(m(e*w[i+4>>2])+m(u*w[i+8>>2])))+w[i+52>>2]),l=m(W-p),C=m(m(m(n*w[f+28>>2])+m(m(t*w[f+20>>2])+m(c*w[f+24>>2])))+w[f+56>>2]),J=m(m(m(a*w[i+28>>2])+m(m(e*w[i+20>>2])+m(u*w[i+24>>2])))+w[i+56>>2]),t=m(C-J),(n=m(m(b*b)+m(m(l*l)+m(t*t))))>m(1.1920928955078125e-7)?(c=m(m(1)/m(N(n))),n=m(b*c),w[r+8>>2]=n,t=m(t*c),w[r+4>>2]=t,c=m(l*c),w[r>>2]=c):(o[r+8>>2]=0,o[r>>2]=1065353216,o[r+4>>2]=0,c=m(1),t=m(0),n=m(0)),o[r+12>>2]=0,m(Q(n))>m(.7071067690849304)?(a=m(m(t*t)+m(n*n)),b=m(m(1)/m(N(a))),a=m(a*b),e=m(b*m(-n)),u=m(e*c),n=m(t*b),t=m(n*m(-c)),b=m(0)):(e=m(m(c*c)+m(t*t)),a=m(m(1)/m(N(e))),u=m(e*a),b=m(a*m(-t)),t=m(n*b),e=m(c*a),a=m(e*m(-n)),n=m(0)),w[r+40>>2]=u,w[r+36>>2]=t,w[r+20>>2]=e,w[r+32>>2]=a,w[r+24>>2]=n,w[r+16>>2]=b;x=w[f+404>>2],U=w[i+404>>2],g=w[i+36>>2],X=w[i+4>>2],D=w[i+20>>2],s=w[i+40>>2],F=w[i+8>>2],E=w[i+24>>2],d=w[i+44>>2],Z=w[i+12>>2],R=w[i+56>>2],Y=w[i+28>>2],V=w[i+60>>2],M=w[i+52>>2],H=w[f+36>>2],I=w[f+4>>2],j=w[f+20>>2],l=w[f+40>>2],z=w[f+8>>2],q=w[f+24>>2],n=w[f+44>>2],c=w[f+12>>2],t=w[f+56>>2],u=w[f+28>>2],a=w[f+52>>2],e=w[f+60>>2],_=o[4+(O=(P<<4)+r|0)>>2],h=G(P,84)+A|0,o[(L=h+48|0)>>2]=o[O>>2],o[L+4>>2]=_,L=o[O+12>>2],o[h+56>>2]=o[O+8>>2],o[h+60>>2]=L,o[h+92>>2]=0,o[h+76>>2]=0,y=n,b=m(C-t),n=w[h+48>>2],$=m(W-a),t=w[h+52>>2],a=m(m(b*n)-m($*t)),T=c,K=m(B-e),c=w[h+56>>2],e=m(m(K*t)-m(b*c)),b=u,u=m(m($*c)-m(K*n)),b=m(m(y*a)+m(m(T*e)+m(b*u))),w[h+88>>2]=b,l=m(m(l*a)+m(m(z*e)+m(q*u))),w[h+84>>2]=l,a=m(m(H*a)+m(m(I*e)+m(j*u))),w[h+80>>2]=a,y=d,u=m(p-M),d=m(J-R),e=m(m(t*u)-m(n*d)),T=m(d*c),d=m(k-V),t=m(T-m(t*d)),n=m(m(d*n)-m(c*u)),c=m(m(y*e)+m(m(Z*t)+m(Y*n))),w[h+72>>2]=c,u=m(m(s*e)+m(m(F*t)+m(E*n))),w[h+68>>2]=u,n=m(m(g*e)+m(m(X*t)+m(D*n))),w[h- -64>>2]=n,t=w[i+464>>2],e=w[i+460>>2],g=w[i+456>>2],o[h+108>>2]=0,g=m(n*g),w[h+96>>2]=g,e=m(u*e),w[h+100>>2]=e,t=m(c*t),w[h+104>>2]=t,X=w[f+464>>2],D=w[f+460>>2],s=w[f+456>>2],o[h+124>>2]=0,s=m(a*s),w[h+112>>2]=s,D=m(l*D),w[h+116>>2]=D,X=m(b*X),w[h+120>>2]=X,w[h+128>>2]=m(x+m(U+m(m(t*c)+m(m(g*n)+m(u*e)))))+m(m(X*b)+m(m(s*a)+m(l*D))),3!=(0|(P=P+1|0)););n=w[A+576>>2],t=w[A+560>>2],c=w[A+592>>2],m(Q(c))>m(.7071067690849304)?(a=m(m(n*n)+m(c*c)),b=m(m(1)/m(N(a))),e=m(b*m(-c)),u=m(t*e),l=m(n*b),B=m(l*m(-t)),k=m(0),a=m(a*b)):(e=m(m(t*t)+m(n*n)),a=m(m(1)/m(N(e))),u=m(e*a),k=m(a*m(-n)),B=m(c*k),l=m(0),e=m(t*a),a=m(e*m(-c))),f=o[A+32>>2],Z=w[f+36>>2],R=w[f+20>>2],d=w[f+40>>2],Y=w[f+8>>2],V=w[f+24>>2],E=w[f+44>>2],M=w[f+12>>2],H=w[f+28>>2],i=o[A+28>>2],W=w[i+44>>2],p=w[i+36>>2],C=w[i+40>>2],J=w[i+12>>2],x=w[i+8>>2],U=w[i+28>>2],g=w[i+20>>2],X=w[i+24>>2],I=w[f+4>>2],D=w[i+4>>2],o[A+308>>2]=0,o[A+312>>2]=0,o[A+300>>2]=0,o[A+304>>2]=0,o[A+344>>2]=0,o[A+328>>2]=0,b=m(m(W*l)+m(m(p*k)+m(e*C))),s=m(m(J*l)+m(m(D*k)+m(e*x))),e=m(m(U*l)+m(m(g*k)+m(e*X))),l=m(m(W*b)+m(m(J*s)+m(U*e))),w[A+324>>2]=l,k=m(m(C*b)+m(m(x*s)+m(X*e))),w[A+320>>2]=k,F=m(m(p*b)+m(m(D*s)+m(g*e))),w[A+316>>2]=F,s=m(-s),E=m(m(m(M*s)-m(H*e))-m(E*b)),w[A+340>>2]=E,d=m(m(m(Y*s)-m(V*e))-m(d*b)),w[A+336>>2]=d,e=m(m(m(I*s)-m(R*e))-m(Z*b)),w[A+332>>2]=e,b=w[i+460>>2],s=w[i+464>>2],Z=w[i+456>>2],o[A+360>>2]=0,s=m(l*s),w[A+356>>2]=s,b=m(k*b),w[A+352>>2]=b,Z=m(F*Z),w[A+348>>2]=Z,R=w[f+460>>2],Y=w[f+464>>2],V=w[f+456>>2],o[A+376>>2]=0,Y=m(E*Y),w[A+372>>2]=Y,R=m(d*R),w[A+368>>2]=R,V=m(e*V),w[A+364>>2]=V,w[A+380>>2]=m(m(s*l)+m(m(Z*F)+m(k*b)))+m(m(Y*E)+m(m(V*e)+m(d*R))),F=w[i+36>>2],E=w[i+20>>2],s=w[i+40>>2],d=w[i+8>>2],Z=w[i+24>>2],k=w[i+44>>2],R=w[i+12>>2],Y=w[i+28>>2],V=w[f+36>>2],M=w[f+20>>2],H=w[f+40>>2],I=w[f+8>>2],j=w[f+24>>2],z=w[f+44>>2],e=w[f+12>>2],q=w[f+28>>2],$=w[i+4>>2],K=w[f+4>>2],o[A+392>>2]=0,o[A+396>>2]=0,o[A+384>>2]=0,o[A+388>>2]=0,o[A+428>>2]=0,o[A+412>>2]=0,b=m(m(J*u)+m(m(D*a)+m(B*x))),l=m(-b),y=m(e*l),e=m(m(U*u)+m(m(g*a)+m(B*X))),a=m(m(W*u)+m(m(p*a)+m(B*C))),u=m(m(y-m(q*e))-m(z*a)),w[A+424>>2]=u,B=m(m(m(I*l)-m(j*e))-m(H*a)),w[A+420>>2]=B,l=m(m(m(K*l)-m(M*e))-m(V*a)),w[A+416>>2]=l,k=m(m(k*a)+m(m(R*b)+m(e*Y))),w[A+408>>2]=k,s=m(m(s*a)+m(m(d*b)+m(e*Z))),w[A+404>>2]=s,a=m(m(F*a)+m(m($*b)+m(e*E))),w[A+400>>2]=a,e=w[i+460>>2],b=w[i+464>>2],F=w[i+456>>2],o[A+444>>2]=0,b=m(k*b),w[A+440>>2]=b,e=m(s*e),w[A+436>>2]=e,F=m(a*F),w[A+432>>2]=F,E=w[f+460>>2],d=w[f+464>>2],Z=w[f+456>>2],o[A+460>>2]=0,d=m(u*d),w[A+456>>2]=d,E=m(B*E),w[A+452>>2]=E,Z=m(l*Z),w[A+448>>2]=Z,w[A+464>>2]=m(m(b*k)+m(m(F*a)+m(s*e)))+m(m(d*u)+m(m(Z*l)+m(B*E))),B=w[i+36>>2],k=w[i+20>>2],l=w[i+40>>2],s=w[i+8>>2],F=w[i+24>>2],b=w[i+44>>2],E=w[i+12>>2],d=w[i+28>>2],Z=w[f+36>>2],R=w[f+20>>2],Y=w[f+40>>2],V=w[f+8>>2],M=w[f+24>>2],H=w[f+44>>2],a=w[f+12>>2],I=w[f+28>>2],j=w[i+4>>2],z=w[f+4>>2],o[A+476>>2]=0,o[A+480>>2]=0,o[A+468>>2]=0,o[A+472>>2]=0,o[A+512>>2]=0,o[A+496>>2]=0,e=m(m(J*c)+m(m(D*t)+m(n*x))),u=m(-e),y=m(a*u),a=m(m(U*c)+m(m(g*t)+m(n*X))),n=m(m(W*c)+m(m(p*t)+m(n*C))),t=m(m(y-m(I*a))-m(H*n)),w[A+508>>2]=t,c=m(m(m(V*u)-m(M*a))-m(Y*n)),w[A+504>>2]=c,u=m(m(m(z*u)-m(R*a))-m(Z*n)),w[A+500>>2]=u,b=m(m(b*n)+m(m(E*e)+m(a*d))),w[A+492>>2]=b,l=m(m(l*n)+m(m(s*e)+m(a*F))),w[A+488>>2]=l,n=m(m(B*n)+m(m(j*e)+m(a*k))),w[A+484>>2]=n,a=w[i+460>>2],e=w[i+464>>2],B=w[i+456>>2],o[A+528>>2]=0,e=m(b*e),w[A+524>>2]=e,a=m(l*a),w[A+520>>2]=a,B=m(n*B),w[A+516>>2]=B,k=w[f+460>>2],W=w[f+464>>2],p=w[f+456>>2],o[A+724>>2]=0,o[A+544>>2]=0,W=m(t*W),w[A+540>>2]=W,k=m(c*k),w[A+536>>2]=k,p=m(u*p),w[A+532>>2]=p,w[A+548>>2]=m(m(e*b)+m(m(B*n)+m(l*a)))+m(m(W*t)+m(m(p*u)+m(c*k))),n=w[A+652>>2],t=w[A+620>>2],c=w[A+636>>2],b=m(m(w[f+44>>2]*n)+m(m(w[f+36>>2]*t)+m(c*w[f+40>>2]))),l=w[i+44>>2],a=w[A+584>>2],B=w[i+36>>2],e=w[A+552>>2],u=w[A+568>>2],k=w[i+40>>2],d=m(b*m(m(l*a)+m(m(B*e)+m(u*k)))),W=m(m(w[f+12>>2]*n)+m(m(w[f+4>>2]*t)+m(c*w[f+8>>2]))),p=w[i+12>>2],C=w[i+4>>2],J=w[i+8>>2],y=m(W*m(m(p*a)+m(m(C*e)+m(u*J)))),x=w[i+28>>2],T=m(x*a),a=w[i+20>>2],s=m(a*e),e=w[i+24>>2],T=m(T+m(s+m(u*e))),u=m(m(w[f+28>>2]*n)+m(m(w[f+20>>2]*t)+m(c*w[f+24>>2]))),n=w[A+588>>2],t=w[A+556>>2],c=w[A+572>>2],n=m(zr(m(d+m(y+m(T*u))),m(m(b*m(m(l*n)+m(m(B*t)+m(k*c))))+m(m(W*m(m(p*n)+m(m(C*t)+m(J*c))))+m(m(m(x*n)+m(m(a*t)+m(e*c)))*u))))*w[A+732>>2]),w[A+728>>2]=n,Jf(A+688|0,n),i=A,f=o[A+28>>2],c=w[A+592>>2],a=w[A+560>>2],e=w[A+576>>2],n=m(m(w[f+44>>2]*c)+m(m(w[f+36>>2]*a)+m(e*w[f+40>>2]))),t=m(m(w[f+12>>2]*c)+m(m(w[f+4>>2]*a)+m(e*w[f+8>>2]))),c=m(m(w[f+28>>2]*c)+m(m(w[f+20>>2]*a)+m(e*w[f+24>>2]))),A=o[A+32>>2],w[i+720>>2]=m(1)/m(m(m(n*m(m(n*w[f+364>>2])+m(m(w[f+332>>2]*t)+m(c*w[f+348>>2]))))+m(m(t*m(m(w[f+356>>2]*n)+m(m(t*w[f+324>>2])+m(c*w[f+340>>2]))))+m(c*m(m(w[f+360>>2]*n)+m(m(w[f+328>>2]*t)+m(c*w[f+344>>2]))))))+m(m(n*m(m(n*w[A+364>>2])+m(m(w[A+332>>2]*t)+m(c*w[A+348>>2]))))+m(m(t*m(m(w[A+356>>2]*n)+m(m(t*w[A+324>>2])+m(c*w[A+340>>2]))))+m(c*m(m(w[A+360>>2]*n)+m(m(w[A+328>>2]*t)+m(c*w[A+344>>2])))))))}S=r+48|0},function(A,r){A|=0,r|=0;var f=m(0),e=0,i=0,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0);A:{if(v[A+738|0])o[r>>2]=0,A=0;else{if(o[r>>2]=5,o[r+4>>2]=1,e=o[A+32>>2],f=w[A+652>>2],n=w[A+620>>2],a=w[A+636>>2],l=m(m(w[e+44>>2]*f)+m(m(w[e+36>>2]*n)+m(a*w[e+40>>2]))),i=o[A+28>>2],s=w[i+44>>2],t=w[A+584>>2],k=w[i+36>>2],c=w[A+552>>2],b=w[A+568>>2],d=w[i+40>>2],E=m(l*m(m(s*t)+m(m(k*c)+m(b*d)))),h=m(m(w[e+12>>2]*f)+m(m(w[e+4>>2]*n)+m(a*w[e+8>>2]))),B=w[i+12>>2],Z=w[i+4>>2],G=w[i+8>>2],W=m(h*m(m(B*t)+m(m(Z*c)+m(b*G)))),Q=w[i+28>>2],u=m(Q*t),t=w[i+20>>2],N=m(t*c),c=w[i+24>>2],u=m(u+m(N+m(b*c))),b=m(m(w[e+28>>2]*f)+m(m(w[e+20>>2]*n)+m(a*w[e+24>>2]))),f=w[A+588>>2],n=w[A+556>>2],a=w[A+572>>2],f=m(zr(m(E+m(W+m(u*b))),m(m(l*m(m(s*f)+m(m(k*n)+m(d*a))))+m(m(h*m(m(B*f)+m(m(Z*n)+m(G*a))))+m(m(m(Q*f)+m(m(t*n)+m(c*a)))*b))))*w[A+732>>2]),w[A+728>>2]=f,Jf(A+688|0,f),!(v[A+716|0]|v[A+737|0]))break A;o[r>>2]=o[r>>2]+1,A=o[r+4>>2]-1|0}o[r+4>>2]=A}},function(A,r){A|=0,r|=0;var f,e,i=0,n=0,t=m(0),c=0,b=m(0),u=m(0),l=0,s=m(0),k=m(0),d=m(0),h=m(0),B=m(0),Z=m(0),Q=0,E=m(0),W=m(0),p=m(0),F=m(0),R=0,Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=0,H=0,I=m(0),T=m(0),U=m(0),j=0,z=m(0),P=m(0),O=m(0),S=m(0),L=m(0),$=m(0),K=m(0),q=m(0),_=m(0),AA=m(0),rA=m(0),fA=m(0),eA=m(0),iA=m(0),nA=0,aA=0,tA=m(0),oA=m(0),cA=m(0),bA=m(0),uA=m(0),lA=0,sA=0,kA=0;if(f=(n=o[A+32>>2])+388|0,e=(i=o[A+28>>2])+388|0,n=n+4|0,i=i+4|0,v[A+739|0]){t=w[o[A+32>>2]+404>>2],$=w[o[A+28>>2]+404>>2],k=(k=m(t+$))>m(0)?m(t/k):m(.5),B=m(m(1)-k),W=w[A+672>>2],E=w[n+40>>2],u=w[A+664>>2],p=w[n+32>>2],d=w[n+36>>2],b=w[A+668>>2],Z=w[n+56>>2],tA=m(m(m(W*E)+m(m(u*p)+m(d*b)))+Z),U=J=m(tA-Z),Z=w[A+592>>2],s=w[i+40>>2],h=w[A+560>>2],X=w[i+32>>2],V=w[A+576>>2],D=w[i+36>>2],P=m(m(Z*s)+m(m(h*X)+m(V*D))),F=w[A+656>>2],T=m(F*E),E=w[A+624>>2],z=m(E*p),p=w[A+640>>2],O=m(T+m(z+m(p*d))),T=d=m(m(P*k)+m(O*B)),S=m(d*d),Y=w[i+8>>2],C=w[i>>2],y=w[i+4>>2],L=m(m(Z*Y)+m(m(h*C)+m(y*V))),g=w[n+8>>2],K=w[n>>2],q=w[n+4>>2],_=m(m(F*g)+m(m(E*K)+m(q*p))),d=m(m(L*k)+m(_*B)),I=w[i+24>>2],x=w[i+16>>2],z=V,V=w[i+20>>2],fA=m(m(Z*I)+m(m(h*x)+m(z*V))),z=w[n+24>>2],AA=w[n+16>>2],Z=p,p=w[n+20>>2],eA=m(m(F*z)+m(m(E*AA)+m(Z*p))),F=m(m(fA*k)+m(eA*B)),E=m(m(1)/m(N(m(S+m(m(d*d)+m(F*F)))))),Z=m(T*E),T=m(J*Z),h=w[n+48>>2],K=m(h+m(m(W*g)+m(m(u*K)+m(q*b)))),J=m(K-h),h=m(d*E),b=m(m(W*z)+m(m(u*AA)+m(p*b))),W=w[n+52>>2],q=m(b+W),p=m(q-W),W=m(F*E),u=m(T+m(m(J*h)+m(p*W))),d=m(Z*u),z=m(U-d),b=w[A+608>>2],F=w[A+600>>2],E=w[A+604>>2],g=w[i+56>>2],AA=m(m(m(b*s)+m(m(F*X)+m(D*E)))+g),g=m(AA-g),T=w[i+48>>2],oA=m(T+m(m(b*Y)+m(m(F*C)+m(y*E)))),T=m(oA-T),U=m(m(b*I)+m(m(F*x)+m(V*E))),b=w[i+52>>2],cA=m(U+b),S=m(cA-b),b=m(m(Z*g)+m(m(T*h)+m(S*W))),rA=m(Z*b),d=m(rA-d),F=m(z-m(B*d)),E=m(W*u),bA=m(p-E),iA=m(W*b),U=m(iA-E),E=m(bA-m(B*U)),u=m(h*u),uA=m(J-u),b=m(h*b),u=m(b-u),p=m(uA-m(B*u)),rA=m(g-rA),d=m(rA+m(k*d)),S=m(S-iA),J=m(S+m(k*U)),b=m(T-b),g=m(b+m(k*u)),n=!(tm(1.1920928955078125e-7)?(s=m(m(1)/m(N(u))),u=m(t*s),t=m($*s),b=m(b*s)):(u=w[A+588>>2],t=m(u*Y),Y=w[A+556>>2],b=m(Y*C),C=w[A+572>>2],b=m(t+m(b+m(y*C))),t=m(m(u*I)+m(m(Y*x)+m(C*V))),u=m(m(u*s)+m(m(Y*X)+m(C*D)))),Q=o[r+24>>2],c=o[r+12>>2],w[c+8>>2]=m(g*t)-m(b*J),w[c+4>>2]=m(d*b)-m(u*g),w[c>>2]=m(J*u)-m(t*d),i=o[r+20>>2],w[i+8>>2]=-m(m(p*t)-m(b*E)),w[i+4>>2]=-m(m(F*b)-m(u*p)),w[i>>2]=-m(m(E*u)-m(t*F)),X=m(m(Z*b)-m(u*h)),V=m(m(W*u)-m(t*Z)),s=m(m(p*X)-m(V*E)),D=m(m(h*t)-m(b*W)),Y=m(m(F*V)-m(D*p)),C=m(m(E*D)-m(X*F)),y=m(m(g*X)-m(V*J)),I=m(m(d*V)-m(D*g)),x=m(m(J*D)-m(X*d)),(nA=!(M=v[A+716|0]))|n||(y=m(k*y),I=m(k*I),x=m(k*x),Y=m(B*Y),C=m(B*C),s=m(B*s)),w[8+(R=(l=Q<<2)+c|0)>>2]=y,w[R+4>>2]=I,w[R>>2]=x,w[i+l>>2]=-C,w[i+((j=Q+1|0)<<2)>>2]=-Y,w[i+((aA=Q+2|0)<<2)>>2]=-s,s=m(m(p*W)+m(h*m(-E))),p=m(m(F*h)+m(Z*m(-p))),F=m(m(E*Z)+m(W*m(-F))),E=m(m(g*W)+m(h*m(-J))),g=m(m(d*h)+m(Z*m(-g))),d=m(m(J*Z)+m(W*m(-d))),n||(E=m(k*E),g=m(k*g),d=m(k*d),p=m(B*p),F=m(B*F),s=m(B*s)),B=m(-W),J=m(-h),Y=m(-Z),w[8+(n=c+(lA=Q<<3)|0)>>2]=E,w[n+4>>2]=g,w[n>>2]=d,w[i+((R=Q<<1)<<2)>>2]=-F,w[i+((sA=1|R)<<2)>>2]=-p,w[i+((kA=R+2|0)<<2)>>2]=-s,k=w[(8&v[A+748|0]?A+756:r+4)>>2],v[A+736|0]?(p=m(-D),F=m(-X),s=m(-V),g=m(-u),d=m(-t),E=m(-b),n=o[r+28>>2]):(x=w[r>>2],n=o[r+8>>2],w[n+8>>2]=u,w[n+4>>2]=t,w[n>>2]=b,w[8+(H=n+l|0)>>2]=D,w[H+4>>2]=X,w[H>>2]=V,w[8+(n=n+lA|0)>>2]=Z,w[n+4>>2]=W,w[n>>2]=h,n=o[r+16>>2],g=m(-u),w[n+8>>2]=g,d=m(-t),w[n+4>>2]=d,E=m(-b),w[n>>2]=E,H=Q<<2,s=m(-V),w[H+n>>2]=s,F=m(-X),w[n+(j<<2)>>2]=F,p=m(-D),w[n+(aA<<2)>>2]=p,w[(R<<=2)+n>>2]=J,w[n+(sA<<2)>>2]=B,w[n+(kA<<2)>>2]=Y,n=o[r+28>>2],C=m(tA-AA),y=m(K-oA),I=m(q-cA),x=m(k*x),w[n>>2]=m(m(u*C)+m(m(b*y)+m(I*t)))*x,w[n+H>>2]=m(m(D*C)+m(m(V*y)+m(I*X)))*x,w[n+R>>2]=x*m(m(Z*C)+m(m(h*y)+m(I*W)))),Q=G(Q,12),w[Q+c>>2]=b,w[(R=Q+8|0)+c>>2]=u,w[(H=Q+4|0)+c>>2]=t,w[(l<<=2)+c>>2]=V,w[(j=4|l)+c>>2]=X,w[(aA=8|l)+c>>2]=D,w[i+Q>>2]=E,w[i+R>>2]=g,w[i+H>>2]=d,w[i+l>>2]=s,w[i+j>>2]=F,w[i+aA>>2]=p,s=m(m(L*eA)-m(_*fA)),d=m(s*u),u=m(m(fA*O)-m(eA*P)),p=m(u*b),b=m(m(P*_)-m(O*L)),d=m(d+m(p+m(b*t))),t=m(k*w[r>>2]),w[n+Q>>2]=d*t,w[n+l>>2]=m(m(s*D)+m(m(u*V)+m(b*X)))*t;A:{if(M)R=0!=v[A+737|0],n=(t=m(w[A+708>>2]*w[A+732>>2]))>m(0)?1:2;else{if(!v[A+737|0])break A;t=m(0),R=1,n=0}if(Q=G(o[r+24>>2],5),w[(l=Q<<2)+c>>2]=h,w[(H=l+8|0)+c>>2]=Z,w[(j=c)+(c=l+4|0)>>2]=W,w[i+H>>2]=Y,w[i+c>>2]=B,w[i+l>>2]=J,B=ve(i=A+688|0),u=de(i),i=o[r+28>>2],o[l+i>>2]=0,k=2&(l=o[A+748>>2])?w[A+764>>2]:k,!R|!((c=u!=B)|nA)||(4&l&&(w[o[r+32>>2]+(Q<<2)>>2]=w[A+752>>2]),B=Lf(w[A+728>>2],B,u,w[A+680>>2],m(k*w[r>>2])),i=o[r+28>>2],w[(R=i+(l=Q<<2)|0)>>2]=m(m(B*w[A+680>>2])*w[A+732>>2])+w[R>>2],w[l+o[r+36>>2]>>2]=-w[A+684>>2],w[l+o[r+40>>2]>>2]=w[A+684>>2]),M){w[(i=(l=Q<<2)+i|0)>>2]=m(m(k*w[r>>2])*t)+w[i>>2],1&a[A+748|0]&&(w[l+o[r+32>>2]>>2]=w[A+760>>2]),c?(c=o[r+36>>2]+(Q<<2)|0,1!=(0|n)?(o[c>>2]=-8388609,t=m(0)):(o[c>>2]=0,t=m(34028234663852886e22))):(o[o[r+36>>2]+(Q<<2)>>2]=-8388609,t=m(34028234663852886e22)),w[o[r+40>>2]+(Q<<2)>>2]=t;r:if((k=w[A+704>>2])>m(0)){t=m(m(m(w[e+8>>2]*Z)+m(m(w[e>>2]*h)+m(w[e+4>>2]*W)))-m(m(w[f+8>>2]*Z)+m(m(w[f>>2]*h)+m(W*w[f+4>>2]))));f:{if(1==(0|n)){if(!(tw[i>>2])break f;break r}if(!(t>m(0)))break r;if(!((t=m(t*m(-k)))>2]))break r}w[i>>2]=t}w[i>>2]=w[A+700>>2]*w[i>>2]}}}else{u=w[A+656>>2],C=w[n+40>>2],$=m(u*C),b=w[A+624>>2],y=w[n+32>>2],s=w[A+640>>2],I=w[n+36>>2],tA=m(m(b*y)+m(s*I)),x=w[n+24>>2],K=m(u*x),P=w[n+16>>2],O=w[n+20>>2],q=m(m(b*P)+m(s*O)),X=w[A+592>>2],t=w[i+40>>2],z=m(X*t),V=w[A+560>>2],k=w[i+32>>2],D=w[A+576>>2],B=w[i+36>>2],AA=m(m(V*k)+m(D*B)),F=w[A+588>>2],T=m(F*t),E=w[A+556>>2],p=w[A+572>>2],oA=m(m(E*k)+m(p*B)),d=w[A+584>>2],cA=m(d*t),J=w[A+552>>2],g=w[A+568>>2],S=m(m(J*k)+m(g*B)),Z=w[i+24>>2],rA=m(X*Z),h=w[i+16>>2],W=w[i+20>>2],bA=m(m(V*h)+m(D*W)),Y=w[A+672>>2],U=m(Y*C),C=w[A+664>>2],L=m(C*y),y=w[A+668>>2],I=m(m(U+m(L+m(I*y)))+w[n+56>>2]),x=m(m(m(Y*x)+m(m(C*P)+m(O*y)))+w[n+52>>2]),P=w[A+608>>2],O=w[A+600>>2],L=w[A+604>>2],_=w[i+56>>2],fA=m(m(m(P*t)+m(m(O*k)+m(B*L)))+_),t=w[i+52>>2],eA=m(m(m(P*Z)+m(m(O*h)+m(W*L)))+t),U=b,b=w[n>>2],iA=w[n+4>>2],U=m(m(U*b)+m(iA*s)),s=w[n+8>>2],uA=m(u*s),k=w[i>>2],B=w[i+4>>2],V=m(m(V*k)+m(B*D)),u=w[i+8>>2],D=m(X*u),b=m(w[n+48>>2]+m(m(Y*s)+m(m(C*b)+m(iA*y)))),s=w[i+48>>2],X=m(s+m(m(P*u)+m(m(O*k)+m(B*L)))),Q=o[r+24>>2],(R=v[A+736|0])||(c=o[r+8>>2],o[c>>2]=1065353216,o[(l=4+(Q<<2)|0)+c>>2]=1065353216,o[(M=8+(Q<<3)|0)+c>>2]=1065353216,c=o[r+16>>2],o[c>>2]=-1082130432,o[c+l>>2]=-1082130432,o[c+M>>2]=-1082130432,_=w[i+56>>2],s=w[i+48>>2],t=w[i+52>>2]),i=o[r+12>>2],o[i+12>>2]=0,Y=m(fA-_),w[i+4>>2]=Y,o[i>>2]=0,t=m(eA-t),w[i+8>>2]=-t,o[12+(c=(l=Q<<2)+i|0)>>2]=0,s=m(X-s),w[c+8>>2]=s,o[c+4>>2]=0,w[c>>2]=-Y,o[8+(c=(M=Q<<3)+i|0)>>2]=0,o[c+12>>2]=0,w[c+4>>2]=-s,w[c>>2]=t,t=w[n+48>>2],s=w[n+56>>2],Y=w[n+52>>2],c=o[r+20>>2],o[c+12>>2]=0,o[c>>2]=0,Y=m(x-Y),w[c+8>>2]=Y,s=m(I-s),w[c+4>>2]=-s,o[12+(n=c+l|0)>>2]=0,t=m(b-t),w[n+8>>2]=-t,o[n+4>>2]=0,w[n>>2]=s,o[8+(n=c+M|0)>>2]=0,o[n+12>>2]=0,w[n+4>>2]=t,w[n>>2]=-Y,Y=w[(8&v[A+748|0]?A+756:r+4)>>2],t=m(Y*w[r>>2]),n=o[r+28>>2],R||(w[n>>2]=t*m(b-X),w[n+l>>2]=t*m(x-eA),w[n+(Q<<3)>>2]=t*m(I-fA)),l=G(Q,12),b=m(m(d*u)+m(m(J*k)+m(g*B))),w[l+i>>2]=b,M=l+8|0,s=m(cA+S),w[M+i>>2]=s,H=l+4|0,X=m(m(d*Z)+m(m(J*h)+m(g*W))),w[H+i>>2]=X,R=Q<<4,u=m(m(F*u)+m(m(E*k)+m(B*p))),w[R+i>>2]=u,nA=4|R,h=m(m(F*Z)+m(m(E*h)+m(p*W))),w[nA+i>>2]=h,j=8|R,W=m(T+oA),w[j+i>>2]=W,w[c+l>>2]=-b,w[c+M>>2]=-s,w[c+H>>2]=-X,w[c+R>>2]=-u,w[c+nA>>2]=-h,w[c+j>>2]=-W,k=m(D+V),Z=m(K+q),V=m(uA+U),B=m(rA+bA),D=m(m(k*Z)-m(V*B)),p=m(D*s),s=m($+tA),d=Z,Z=m(z+AA),F=m(m(B*s)-m(d*Z)),d=m(F*b),b=m(m(Z*V)-m(s*k)),w[n+l>>2]=m(p+m(d+m(X*b)))*t,w[n+R>>2]=m(m(D*W)+m(m(F*u)+m(h*b)))*t;A:{if(R=v[A+716|0])M=0!=v[A+737|0],n=(t=m(w[A+708>>2]*w[A+732>>2]))>m(0)?1:2;else{if(!v[A+737|0])break A;t=m(0),M=1,n=0}if(Q=G(Q,5),w[(l=Q<<2)+i>>2]=k,w[(H=l+8|0)+i>>2]=Z,w[(j=i)+(i=l+4|0)>>2]=B,w[c+H>>2]=-Z,w[i+c>>2]=-B,w[c+l>>2]=-k,h=ve(i=A+688|0),W=de(i),i=o[r+28>>2],o[l+i>>2]=0,u=2&(l=o[A+748>>2])?w[A+764>>2]:Y,!M|!((c=h!=W)|!R)||(4&l&&(w[o[r+32>>2]+(Q<<2)>>2]=w[A+752>>2]),h=Lf(w[A+728>>2],h,W,w[A+680>>2],m(u*w[r>>2])),i=o[r+28>>2],w[(M=i+(l=Q<<2)|0)>>2]=m(m(h*w[A+680>>2])*w[A+732>>2])+w[M>>2],w[l+o[r+36>>2]>>2]=-w[A+684>>2],w[l+o[r+40>>2]>>2]=w[A+684>>2]),R){w[(i=(l=Q<<2)+i|0)>>2]=m(m(u*w[r>>2])*t)+w[i>>2],1&a[A+748|0]&&(w[l+o[r+32>>2]>>2]=w[A+760>>2]),c?(c=o[r+36>>2]+(Q<<2)|0,1!=(0|n)?(o[c>>2]=-8388609,t=m(0)):(o[c>>2]=0,t=m(34028234663852886e22))):(o[o[r+36>>2]+(Q<<2)>>2]=-8388609,t=m(34028234663852886e22)),w[o[r+40>>2]+(Q<<2)>>2]=t;r:if((h=w[A+704>>2])>m(0)){t=m(m(m(w[e+8>>2]*Z)+m(m(w[e>>2]*k)+m(B*w[e+4>>2])))-m(m(w[f+8>>2]*Z)+m(m(w[f>>2]*k)+m(B*w[f+4>>2]))));f:{if(1==(0|n)){if(!(tw[i>>2])break f;break r}if(!(t>m(0)))break r;if(!((t=m(t*m(-h)))>2]))break r}w[i>>2]=t}w[i>>2]=w[A+700>>2]*w[i>>2]}}}},function(A,r,f,e){A|=0,r|=0,f=m(f);A:{r:switch(1+(e|=0)|0){case 0:case 6:break r;default:break A}r:{f:switch(r-1|0){case 1:e=A+764|0,r=2;break r;case 3:e=A+760|0,r=1;break r;case 2:e=A+752|0,r=4;break r;case 0:break f;default:break A}e=A+756|0,r=8}w[e>>2]=f,o[A+748>>2]=r|o[A+748>>2]}},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);A:{r:switch(f+1|0){case 0:case 6:break r;default:break A}r:switch(r-1|0){case 1:return m(w[A+764>>2]);case 3:return m(w[A+760>>2]);case 2:return m(w[A+752>>2]);case 0:break r;default:break A}e=w[A+756>>2]}return m(e)},function(){return 220},function(A,r,f){A|=0,r|=0,f|=0;var e=0,i=m(0);return hr(A,r,f),w[r+52>>2]=w[A+552>>2],w[r+56>>2]=w[A+556>>2],w[r+60>>2]=w[A+560>>2],w[r- -64>>2]=w[A+564>>2],w[r+68>>2]=w[A+568>>2],w[r+72>>2]=w[A+572>>2],w[r+76>>2]=w[A+576>>2],w[r+80>>2]=w[A+580>>2],w[r+84>>2]=w[A+584>>2],w[r+88>>2]=w[A+588>>2],w[r+92>>2]=w[A+592>>2],w[r+96>>2]=w[A+596>>2],w[r+100>>2]=w[A+600>>2],w[r+104>>2]=w[A+604>>2],w[r+108>>2]=w[A+608>>2],w[r+112>>2]=w[A+612>>2],w[r+116>>2]=w[A+616>>2],w[r+120>>2]=w[A+620>>2],w[r+124>>2]=w[A+624>>2],w[r+128>>2]=w[A+628>>2],w[r+132>>2]=w[A+632>>2],w[r+136>>2]=w[A+636>>2],w[r+140>>2]=w[A+640>>2],w[r+144>>2]=w[A+644>>2],w[r+148>>2]=w[A+648>>2],w[r+152>>2]=w[A+652>>2],w[r+156>>2]=w[A+656>>2],w[r+160>>2]=w[A+660>>2],w[r+164>>2]=w[A+664>>2],w[r+168>>2]=w[A+668>>2],w[r+172>>2]=w[A+672>>2],w[r+176>>2]=w[A+676>>2],o[r+184>>2]=v[A+736|0],o[r+188>>2]=v[A+737|0],w[r+196>>2]=w[A+684>>2],w[r+192>>2]=w[A+680>>2],o[r+180>>2]=v[A+740|0],e=r,i=ve(f=A+688|0),w[e+200>>2]=i,e=r,i=de(f),w[e+204>>2]=i,w[r+208>>2]=w[A+696>>2],w[r+212>>2]=w[A+700>>2],w[r+216>>2]=w[A+704>>2],8751},function(A){return o[748+(A|=0)>>2]},_e,function(A){A|=0;var r,f,e,i=0,n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=0,Q=0,E=m(0),W=0,N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0),H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=0;for(o[A+36>>2]=0,o[(i=8+(e=S-16|0)|0)>>2]=0,o[i+4>>2]=0,o[e>>2]=0,o[e+4>>2]=0,r=o[A+32>>2],f=o[A+28>>2];o[(W=(Z<<2)+e|0)>>2]=1065353216,z=w[r+404>>2],P=w[f+404>>2],s=w[f+56>>2],k=w[f+20>>2],N=w[f+24>>2],p=w[f+28>>2],F=w[f+60>>2],R=w[f+44>>2],Y=w[f+36>>2],V=w[f+40>>2],B=w[f+52>>2],u=w[A+308>>2],g=w[f+12>>2],a=w[A+300>>2],X=w[f+4>>2],d=w[A+304>>2],D=w[f+8>>2],t=w[r+56>>2],C=w[r+20>>2],v=w[r+24>>2],h=w[r+28>>2],c=w[r+52>>2],J=w[r+12>>2],x=w[r+4>>2],y=w[r+8>>2],M=w[r+60>>2],b=w[A+324>>2],H=w[r+44>>2],l=w[A+316>>2],I=w[r+36>>2],n=w[A+320>>2],T=w[r+40>>2],O=o[e+4>>2],i=G(Z,84)+A|0,o[(Q=i+48|0)>>2]=o[e>>2],o[Q+4>>2]=O,Q=o[e+12>>2],o[i+56>>2]=o[e+8>>2],o[i+60>>2]=Q,o[i+92>>2]=0,o[i+76>>2]=0,U=m(m(t+m(m(b*h)+m(m(l*C)+m(v*n))))-t),t=w[i+48>>2],j=m(m(c+m(m(b*J)+m(m(l*x)+m(y*n))))-c),c=w[i+52>>2],E=m(m(U*t)-m(j*c)),n=m(m(M+m(m(b*H)+m(m(l*I)+m(T*n))))-M),b=w[i+56>>2],l=m(m(n*c)-m(U*b)),n=m(m(j*b)-m(n*t)),h=m(m(H*E)+m(m(J*l)+m(h*n))),w[i+88>>2]=h,v=m(m(T*E)+m(m(y*l)+m(v*n))),w[i+84>>2]=v,l=m(m(I*E)+m(m(x*l)+m(C*n))),w[i+80>>2]=l,B=m(m(B+m(m(u*g)+m(m(a*X)+m(D*d))))-B),s=m(m(s+m(m(u*p)+m(m(a*k)+m(N*d))))-s),n=m(m(c*B)-m(t*s)),a=m(m(F+m(m(u*R)+m(m(a*Y)+m(V*d))))-F),u=m(m(s*b)-m(c*a)),a=m(m(a*t)-m(b*B)),d=m(m(R*n)+m(m(g*u)+m(p*a))),w[i+72>>2]=d,b=m(m(V*n)+m(m(D*u)+m(N*a))),w[i+68>>2]=b,u=m(m(Y*n)+m(m(X*u)+m(k*a))),w[i- -64>>2]=u,a=w[f+464>>2],n=w[f+460>>2],t=w[f+456>>2],o[i+108>>2]=0,t=m(u*t),w[i+96>>2]=t,n=m(b*n),w[i+100>>2]=n,a=m(d*a),w[i+104>>2]=a,c=w[r+464>>2],s=w[r+460>>2],k=w[r+456>>2],o[i+124>>2]=0,k=m(l*k),w[i+112>>2]=k,s=m(v*s),w[i+116>>2]=s,c=m(h*c),w[i+120>>2]=c,w[i+128>>2]=m(z+m(P+m(m(a*d)+m(m(t*u)+m(b*n)))))+m(m(c*h)+m(m(k*l)+m(v*s))),o[W>>2]=0,3!=(0|(Z=Z+1|0)););},function(A,r){r|=0,A=v[344+(A|=0)|0]?0:3,o[r+4>>2]=A,o[r>>2]=A},function(A,r){A|=0,r|=0;var f,e,i,n,a,t=0,c=0,b=0,u=m(0),l=m(0),s=0,k=m(0),d=m(0),v=m(0),h=m(0),B=m(0),Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0);b=o[A+28>>2],c=o[A+32>>2],t=o[r+8>>2],o[t>>2]=1065353216,e=o[r+24>>2],o[t+(n=4+(f=e<<2)|0)>>2]=1065353216,o[t+(a=8+(i=e<<3)|0)>>2]=1065353216,h=w[b+24>>2],B=w[b+28>>2],Z=w[b+40>>2],l=w[A+304>>2],d=w[b+44>>2],u=w[A+308>>2],v=w[b+12>>2],G=w[b+4>>2],Q=w[b+8>>2],E=w[b+20>>2],W=w[b+36>>2],k=w[A+300>>2],t=o[r+12>>2],o[t+12>>2]=0,o[t>>2]=0,Z=m(m(d*u)+m(m(W*k)+m(l*Z))),w[t+4>>2]=Z,h=m(m(B*u)+m(m(E*k)+m(l*h))),w[t+8>>2]=-h,o[12+(s=t+f|0)>>2]=0,B=m(m(v*u)+m(m(G*k)+m(Q*l))),w[s+8>>2]=B,o[s+4>>2]=0,w[s>>2]=-Z,o[8+(t=t+i|0)>>2]=0,o[t+12>>2]=0,w[t+4>>2]=-B,w[t>>2]=h,t=o[r+16>>2],o[t>>2]=-1082130432,o[t+n>>2]=-1082130432,o[t+a>>2]=-1082130432,v=w[c+40>>2],G=w[c+44>>2],d=w[c+24>>2],l=w[A+320>>2],Q=w[c+28>>2],u=w[A+324>>2],E=w[c+12>>2],W=w[c+4>>2],N=w[c+8>>2],p=w[c+36>>2],F=w[c+20>>2],k=w[A+316>>2],t=o[r+20>>2],o[t+12>>2]=0,o[t>>2]=0,d=m(m(Q*u)+m(m(F*k)+m(l*d))),w[t+8>>2]=d,v=m(m(G*u)+m(m(p*k)+m(l*v))),w[t+4>>2]=-v,o[12+(s=t+f|0)>>2]=0,l=m(m(E*u)+m(m(W*k)+m(N*l))),w[s+8>>2]=-l,o[s+4>>2]=0,w[s>>2]=v,o[8+(t=t+i|0)>>2]=0,o[t+12>>2]=0,w[t+4>>2]=l,w[t>>2]=-d,t=o[r+28>>2],s=o[A+332>>2],u=m(w[(1&s?A+336:r+4)>>2]*w[r>>2]),w[t>>2]=u*m(m(m(l+w[c+52>>2])-B)-w[b+52>>2]),w[t+f>>2]=u*m(m(m(d+w[c+56>>2])-h)-w[b+56>>2]),w[t+i>>2]=u*m(m(m(v+w[c+60>>2])-Z)-w[b+60>>2]),b=e<<1,2&s&&(c=o[r+32>>2],w[c>>2]=w[A+340>>2],w[c+f>>2]=w[A+340>>2],w[c+(b<<2)>>2]=w[A+340>>2]),(u=w[A+356>>2])>m(0)&&(k=m(-u),w[o[r+36>>2]>>2]=k,w[o[r+40>>2]>>2]=u,(l=w[A+356>>2])>m(0)&&(w[(c=e<<2)+o[r+36>>2]>>2]=k,w[c+o[r+40>>2]>>2]=u,l=w[A+356>>2]),l>m(0)&&(w[(b<<=2)+o[r+36>>2]>>2]=k,w[b+o[r+40>>2]>>2]=u)),w[r+48>>2]=w[A+352>>2]},function(A,r,f,e){A|=0,r|=0,f=m(f);A:if(-1==(0|(e|=0))){r:{f:switch(r-1|0){case 0:case 1:e=A+336|0,r=1;break r;case 2:case 3:break f;default:break A}e=A+340|0,r=2}w[e>>2]=f,o[A+332>>2]=r|o[A+332>>2]}},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0);e=m(34028234663852886e22);A:if(-1==(0|f)){r:switch(r-1|0){case 0:case 1:return m(w[A+336>>2]);case 2:case 3:break r;default:break A}e=w[A+340>>2]}return m(e)},nn,function(A,r,f){return hr(A|=0,r|=0,f|=0),w[r+52>>2]=w[A+300>>2],w[r+56>>2]=w[A+304>>2],w[r+60>>2]=w[A+308>>2],w[r- -64>>2]=w[A+312>>2],w[r+68>>2]=w[A+316>>2],w[r+72>>2]=w[A+320>>2],w[r+76>>2]=w[A+324>>2],w[r+80>>2]=w[A+328>>2],8718},function(A){return o[332+(A|=0)>>2]},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0);return a=w[f+100>>2],t=w[f+24>>2],c=w[f+16>>2],b=w[f+20>>2],i=w[f+108>>2],e=m(m(m(w[f+112>>2]-m(a*w[f+116>>2]))-m(m(m(m(t*w[A+72>>2])+m(m(c*w[A+64>>2])+m(b*w[A+68>>2])))+m(m(w[f+8>>2]*w[A+88>>2])+m(m(w[f>>2]*w[A+80>>2])+m(w[f+4>>2]*w[A+84>>2]))))*i))-m(m(m(m(w[f+56>>2]*w[r+72>>2])+m(m(w[f+48>>2]*w[r+64>>2])+m(w[f+52>>2]*w[r+68>>2])))+m(m(w[f+40>>2]*w[r+88>>2])+m(m(w[f+32>>2]*w[r+80>>2])+m(w[f+36>>2]*w[r+84>>2]))))*i)),((i=m(a+e))<(n=w[f+120>>2])||(n=w[f+124>>2])>2]=i,o[A+240>>2]&&(w[A+64>>2]=m(w[A+112>>2]*m(e*m(c*w[A+128>>2])))+w[A+64>>2],w[A+68>>2]=m(m(e*m(b*w[A+132>>2]))*w[A+116>>2])+w[A+68>>2],w[A+72>>2]=m(m(e*m(t*w[A+136>>2]))*w[A+120>>2])+w[A+72>>2],i=w[f+72>>2],n=w[f+68>>2],w[A+80>>2]=m(m(e*w[A+96>>2])*w[f+64>>2])+w[A+80>>2],a=w[A+104>>2],w[A+84>>2]=m(n*m(e*w[A+100>>2]))+w[A+84>>2],w[A+88>>2]=m(i*m(e*a))+w[A+88>>2]),o[r+240>>2]&&(i=w[f+56>>2],n=w[f+52>>2],w[r+64>>2]=m(w[r+112>>2]*m(e*m(w[f+48>>2]*w[r+128>>2])))+w[r+64>>2],w[r+68>>2]=m(m(e*m(n*w[r+132>>2]))*w[r+116>>2])+w[r+68>>2],w[r+72>>2]=m(m(e*m(i*w[r+136>>2]))*w[r+120>>2])+w[r+72>>2],i=w[f+88>>2],n=w[f+84>>2],w[r+80>>2]=m(m(e*w[r+96>>2])*w[f+80>>2])+w[r+80>>2],a=w[r+104>>2],w[r+84>>2]=m(n*m(e*w[r+100>>2]))+w[r+84>>2],w[r+88>>2]=m(i*m(e*a))+w[r+88>>2]),m(e)},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0);return i=w[f+100>>2],t=w[f+24>>2],c=w[f+16>>2],b=w[f+20>>2],n=w[f+108>>2],n=m(m(m(w[f+112>>2]-m(i*w[f+116>>2]))-m(m(m(m(t*w[A+72>>2])+m(m(c*w[A+64>>2])+m(b*w[A+68>>2])))+m(m(w[f+8>>2]*w[A+88>>2])+m(m(w[f>>2]*w[A+80>>2])+m(w[f+4>>2]*w[A+84>>2]))))*n))-m(m(m(m(w[f+56>>2]*w[r+72>>2])+m(m(w[f+48>>2]*w[r+64>>2])+m(w[f+52>>2]*w[r+68>>2])))+m(m(w[f+40>>2]*w[r+88>>2])+m(m(w[f+32>>2]*w[r+80>>2])+m(w[f+36>>2]*w[r+84>>2]))))*n)),e=(u=m(i+n))<(a=w[f+120>>2]),w[f+100>>2]=e?a:u,i=e?m(a-i):n,o[A+240>>2]&&(w[A+64>>2]=m(w[A+112>>2]*m(i*m(c*w[A+128>>2])))+w[A+64>>2],w[A+68>>2]=m(m(i*m(b*w[A+132>>2]))*w[A+116>>2])+w[A+68>>2],w[A+72>>2]=m(m(i*m(t*w[A+136>>2]))*w[A+120>>2])+w[A+72>>2],n=w[f+72>>2],a=w[f+68>>2],w[A+80>>2]=m(m(i*w[A+96>>2])*w[f+64>>2])+w[A+80>>2],t=w[A+104>>2],w[A+84>>2]=m(a*m(i*w[A+100>>2]))+w[A+84>>2],w[A+88>>2]=m(n*m(i*t))+w[A+88>>2]),o[r+240>>2]&&(n=w[f+56>>2],a=w[f+52>>2],w[r+64>>2]=m(w[r+112>>2]*m(i*m(w[f+48>>2]*w[r+128>>2])))+w[r+64>>2],w[r+68>>2]=m(m(i*m(a*w[r+132>>2]))*w[r+116>>2])+w[r+68>>2],w[r+72>>2]=m(m(i*m(n*w[r+136>>2]))*w[r+120>>2])+w[r+72>>2],n=w[f+88>>2],a=w[f+84>>2],w[r+80>>2]=m(m(i*w[r+96>>2])*w[f+80>>2])+w[r+80>>2],t=w[r+104>>2],w[r+84>>2]=m(a*m(i*w[r+100>>2]))+w[r+84>>2],w[r+88>>2]=m(n*m(i*t))+w[r+88>>2]),m(i)},function(A,r,f){A|=0,r|=0,f|=0;var e=m(0),i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=0;return(i=w[f+128>>2])!=m(0)&&(o[8792]=o[8792]+1,e=w[f+96>>2],n=m(i-m(e*w[f+116>>2])),a=w[f+24>>2],t=w[f+16>>2],c=w[f+20>>2],i=w[f+108>>2],i=m(m(n-m(m(m(m(a*w[A+152>>2])+m(m(t*w[A+144>>2])+m(c*w[A+148>>2])))+m(m(w[f+8>>2]*w[A+168>>2])+m(m(w[f>>2]*w[A+160>>2])+m(w[f+4>>2]*w[A+164>>2]))))*i))-m(m(m(m(w[f+56>>2]*w[r+152>>2])+m(m(w[f+48>>2]*w[r+144>>2])+m(w[f+52>>2]*w[r+148>>2])))+m(m(w[f+40>>2]*w[r+168>>2])+m(m(w[f+32>>2]*w[r+160>>2])+m(w[f+36>>2]*w[r+164>>2]))))*i)),u=(b=m(e+i))<(n=w[f+120>>2]),w[f+96>>2]=u?n:b,e=u?m(n-e):i,o[A+240>>2]&&(w[A+144>>2]=m(w[A+112>>2]*m(e*m(t*w[A+128>>2])))+w[A+144>>2],w[A+148>>2]=m(m(e*m(c*w[A+132>>2]))*w[A+116>>2])+w[A+148>>2],w[A+152>>2]=m(m(e*m(a*w[A+136>>2]))*w[A+120>>2])+w[A+152>>2],i=w[f+72>>2],n=w[f+68>>2],w[A+160>>2]=m(m(e*w[A+96>>2])*w[f+64>>2])+w[A+160>>2],a=w[A+104>>2],w[A+164>>2]=m(n*m(e*w[A+100>>2]))+w[A+164>>2],w[A+168>>2]=m(i*m(e*a))+w[A+168>>2]),o[r+240>>2]&&(i=w[f+56>>2],n=w[f+52>>2],w[r+144>>2]=m(w[r+112>>2]*m(e*m(w[f+48>>2]*w[r+128>>2])))+w[r+144>>2],w[r+148>>2]=m(m(e*m(n*w[r+132>>2]))*w[r+116>>2])+w[r+148>>2],w[r+152>>2]=m(m(e*m(i*w[r+136>>2]))*w[r+120>>2])+w[r+152>>2],i=w[f+88>>2],n=w[f+84>>2],w[r+160>>2]=m(m(e*w[r+96>>2])*w[f+80>>2])+w[r+160>>2],a=w[r+104>>2],w[r+164>>2]=m(n*m(e*w[r+100>>2]))+w[r+164>>2],w[r+168>>2]=m(i*m(e*a))+w[r+168>>2])),m(e)},Gr,function(A){Gr(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},zi,function(A,r,f,e,i,n,a,t,c,b){return A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,a|=0,t|=0,c|=0,b|=0,S=b=S-16|0,Zn[o[8294]](5413),m(Zn[o[o[A>>2]+44>>2]](A,r,f,e,i,n,a,t,c)),m(Zn[o[o[A>>2]+48>>2]](A,r,f,e,i,n,a,t,c)),m(Zn[o[o[A>>2]+36>>2]](A,r,f,t)),Zn[o[8295]](),S=b+16|0,m(m(0))},zi,function(A){o[232+(A|=0)>>2]=0},sn,function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=m(0),n=0,t=m(0),c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0,d=m(0),h=0,B=0,Z=m(0),E=m(0),W=0,p=m(0),F=0,R=m(0),Y=0,V=m(0),g=0,X=m(0),D=m(0),C=m(0),J=0,x=m(0),y=0,M=0,H=0,I=0,T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=0,L=m(0),$=0,K=0,q=m(0),_=0,AA=m(0),rA=0,fA=m(0),eA=m(0),iA=0,nA=0,aA=0,tA=0,oA=m(0),cA=m(0),bA=m(0),uA=m(0),lA=m(0),kA=m(0),dA=m(0),vA=m(0),hA=m(0),BA=m(0),wA=m(0),ZA=m(0),GA=m(0),QA=m(0),EA=m(0),WA=m(0),NA=m(0),pA=m(0),FA=m(0),RA=m(0),YA=m(0),VA=m(0),gA=m(0),DA=m(0),CA=m(0),JA=m(0),xA=m(0),yA=m(0),MA=m(0),HA=m(0),IA=m(0),TA=m(0),UA=m(0),jA=m(0),zA=m(0),PA=m(0),OA=m(0);if((0|f)>0)for(;;){if(rA=0,S=W=S-80|0,_=o[(iA<<2)+r>>2],h=o[_+840>>2],M=sA(A,B=o[_+836>>2],w[e+12>>2]),H=sA(A,h,w[e+12>>2]),J=(n=o[A+16>>2])+G(M,244)|0,i=w[J+136>>2],l=m(i*i),i=w[J+128>>2],c=m(i*i),i=w[J+132>>2],!(m(l+m(c+m(i*i)))>2],l=m(i*i),i=w[J+128>>2],c=m(i*i),i=w[J+132>>2],m(l+m(c+m(i*i)))>2]))<=0))for($=n+G(H,244)|0,K=n+G(M,244)|0;;){if(F=G(rA,208)+_|0,w[F+84>>2]<=w[_+852>>2]){if(g=F+4|0,(0|(u=J=o[A+28>>2]))==o[A+32>>2]&&!((0|(Y=u?J<<1:1))<=(0|u))){if(Y?(o[8488]=o[8488]+1,k=0|Zn[o[8290]](G(Y,152),16),n=o[A+28>>2]):(k=0,n=J),!((0|n)<=0)){if(u=0,1!=(0|n))for(O=-2&n,y=0;pr((I=G(u,152))+k|0,I+o[A+36>>2]|0,152),pr((I=G(1|u,152))+k|0,I+o[A+36>>2]|0,152),u=u+2|0,(0|O)!=(0|(y=y+2|0)););1&n&&pr((n=G(u,152))+k|0,n+o[A+36>>2]|0,152)}!(n=o[A+36>>2])||!n|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](n)),o[A+36>>2]=k,a[A+40|0]=1,o[A+32>>2]=Y,u=o[A+28>>2]}o[A+28>>2]=u+1,n=o[A+36>>2]+G(J,152)|0,o[n+148>>2]=H,o[n+144>>2]=M,o[n+132>>2]=g,b=w[F+52>>2],t=w[F+56>>2],i=w[F+60>>2],c=w[B+52>>2],s=w[B+56>>2],d=w[B+60>>2],o[W+76>>2]=0,i=m(i-d),w[W+72>>2]=i,t=m(t-s),w[W+68>>2]=t,b=m(b-c),w[W+64>>2]=b,d=w[F+36>>2],s=w[F+40>>2],c=w[F+44>>2],l=w[h+52>>2],X=w[h+56>>2],E=w[h+60>>2],o[W+60>>2]=0,c=m(c-E),w[W+56>>2]=c,s=m(s-X),w[W+52>>2]=s,d=m(d-l),w[W+48>>2]=d,X=m(0),T=m(0),AA=m(0),oA=m(0),o[K+240>>2]&&(l=m(w[K+192>>2]+w[K+224>>2]),E=m(w[K+196>>2]+w[K+228>>2]),T=m(m(w[K+184>>2]+w[K+216>>2])+m(m(l*t)-m(b*E))),p=m(w[K+200>>2]+w[K+232>>2]),AA=m(m(w[K+180>>2]+w[K+212>>2])+m(m(p*b)-m(i*l))),oA=m(m(w[K+176>>2]+w[K+208>>2])+m(m(E*i)-m(t*p)))),cA=m(0),bA=m(0),o[$+240>>2]&&(i=m(w[$+192>>2]+w[$+224>>2]),t=m(w[$+196>>2]+w[$+228>>2]),X=m(m(w[$+184>>2]+w[$+216>>2])+m(m(i*s)-m(d*t))),b=m(w[$+200>>2]+w[$+232>>2]),cA=m(m(w[$+180>>2]+w[$+212>>2])+m(m(b*d)-m(c*i))),bA=m(m(w[$+176>>2]+w[$+208>>2])+m(m(t*c)-m(s*b)))),uA=w[F+76>>2],lA=w[(y=F+68|0)>>2],kA=w[F+72>>2],Y=W- -64|0,l=m(0),i=m(0),L=m(0),nA=(O=o[A+16>>2])+G(H,244)|0,u=o[nA+240>>2],aA=O+G(M,244)|0,k=o[aA+240>>2],w[W+44>>2]=w[e+28>>2],U=w[e+12>>2],C=w[e+36>>2],t=w[e+40>>2];A:if(6&(I=o[g+128>>2])){if(t=2&I?w[g+152>>2]:t,!(4&I))break A;C=w[g+156>>2]}else 8&I&&(b=m(U*w[g+152>>2]),t=(t=m(b+w[g+156>>2]))>2],c=w[g+68>>2],s=w[g+64>>2],d=w[Y+4>>2],E=m(m(b*c)-m(s*d)),Z=w[Y+8>>2],p=m(Z*s),s=w[g+72>>2],p=m(p-m(s*b)),Z=m(m(d*s)-m(c*Z)),b=m(0),c=m(0),k&&(c=m(m(m(w[k+364>>2]*E)+m(m(w[k+356>>2]*Z)+m(p*w[k+360>>2])))*w[k+612>>2]),b=m(m(m(w[k+348>>2]*E)+m(m(w[k+340>>2]*Z)+m(p*w[k+344>>2])))*w[k+608>>2]),i=m(m(m(w[k+332>>2]*E)+m(m(w[k+324>>2]*Z)+m(p*w[k+328>>2])))*w[k+604>>2])),w[n+64>>2]=i,o[n+76>>2]=0,w[n+72>>2]=c,w[n+68>>2]=b,s=w[W+48>>2],d=w[g+68>>2],V=w[g+64>>2],j=w[W+52>>2],R=m(m(s*d)-m(V*j)),z=w[W+56>>2],P=w[g+72>>2],V=m(m(z*V)-m(P*s)),j=m(m(j*P)-m(d*z)),s=m(0),d=m(0),u&&(s=m(-j),d=m(m(m(m(w[u+356>>2]*s)-m(w[u+360>>2]*V))-m(w[u+364>>2]*R))*w[u+612>>2]),l=m(m(m(m(w[u+324>>2]*s)-m(w[u+328>>2]*V))-m(w[u+332>>2]*R))*w[u+604>>2]),s=m(m(m(m(w[u+340>>2]*s)-m(w[u+344>>2]*V))-m(w[u+348>>2]*R))*w[u+608>>2])),w[n+80>>2]=l,o[n+92>>2]=0,w[n+88>>2]=d,w[n+84>>2]=s,z=w[W+44>>2],U=m(m(1)/U),x=m(U*t),k?(t=w[Y+4>>2],q=w[Y>>2],P=m(w[g+72>>2]*m(m(i*t)-m(q*b))),D=b,b=w[Y+8>>2],c=m(w[k+404>>2]+m(P+m(m(w[g+64>>2]*m(m(D*b)-m(t*c)))+m(m(m(c*q)-m(b*i))*w[g+68>>2]))))):c=m(0),u?(t=w[W+48>>2],b=w[W+52>>2],i=m(w[g+72>>2]*m(m(s*t)-m(l*b))),D=m(d*b),b=w[W+56>>2],l=m(w[u+404>>2]+m(i+m(m(w[g+64>>2]*m(D-m(s*b)))+m(m(m(l*b)-m(d*t))*w[g+68>>2]))))):l=m(0),w[n+108>>2]=z/m(x+m(c+l)),k?(tA=o[4+(I=g- -64|0)>>2],o[n+16>>2]=o[I>>2],o[n+20>>2]=tA,tA=o[I+12>>2],o[n+24>>2]=o[I+8>>2],o[n+28>>2]=tA,o[n+12>>2]=0,w[n+8>>2]=E,w[n+4>>2]=p,w[n>>2]=Z):(o[n>>2]=0,o[n+4>>2]=0,o[n+24>>2]=0,o[n+28>>2]=0,o[n+16>>2]=0,o[n+20>>2]=0,o[n+8>>2]=0,o[n+12>>2]=0),u?(i=w[g+64>>2],t=w[g+68>>2],b=w[g+72>>2],o[n+60>>2]=0,o[n+44>>2]=0,w[n+40>>2]=-R,w[n+36>>2]=-V,w[n+32>>2]=-j,w[n+56>>2]=-b,w[n+52>>2]=-t,w[n+48>>2]=-i):(o[n+32>>2]=0,o[n+36>>2]=0,o[n+56>>2]=0,o[n+60>>2]=0,o[n+48>>2]=0,o[n+52>>2]=0,o[n+40>>2]=0,o[n+44>>2]=0),b=m(0),c=m(0),s=m(0),d=m(0),k&&(i=w[k+388>>2],t=w[Y+4>>2],c=w[Y>>2],l=w[k+392>>2],d=m(m(m(i*t)-m(c*l))+w[k+380>>2]),E=w[k+396>>2],Z=m(E*c),c=w[Y+8>>2],s=m(m(Z-m(c*i))+w[k+376>>2]),c=m(m(m(l*c)-m(t*E))+w[k+372>>2])),Z=m(0),i=m(0),u&&(t=w[u+388>>2],b=w[W+52>>2],l=w[W+48>>2],E=w[u+392>>2],i=m(m(m(t*b)-m(l*E))+w[u+380>>2]),p=w[u+396>>2],Z=m(p*l),l=w[W+56>>2],Z=m(m(Z-m(l*t))+w[u+376>>2]),b=m(m(m(E*l)-m(b*p))+w[u+372>>2])),p=w[e+64>>2],dA=w[g+80>>2],vA=w[g+72>>2],hA=w[g+68>>2],BA=w[g+64>>2],w[n+104>>2]=w[g+84>>2],wA=w[e+96>>2],ZA=w[g+96>>2];A:if(4&v[e+72|0]){if(t=m(w[g+132>>2]*w[e+68>>2]),w[n+100>>2]=t,!k|!o[aA+240>>2]||(l=w[k+416>>2],E=w[n+24>>2],R=w[k+412>>2],V=w[n+20>>2],Y=O+G(M,244)|0,w[Y+64>>2]=m(w[Y+112>>2]*m(t*m(m(w[n+16>>2]*w[Y+128>>2])*w[k+408>>2])))+w[Y+64>>2],w[Y+68>>2]=m(m(t*m(R*m(V*w[Y+132>>2])))*w[Y+116>>2])+w[Y+68>>2],w[Y+72>>2]=m(m(t*m(l*m(E*w[Y+136>>2])))*w[Y+120>>2])+w[Y+72>>2],l=w[n+72>>2],E=w[n+68>>2],w[Y+80>>2]=m(m(t*w[Y+96>>2])*w[n+64>>2])+w[Y+80>>2],R=w[Y+104>>2],w[Y+84>>2]=m(E*m(t*w[Y+100>>2]))+w[Y+84>>2],w[Y+88>>2]=m(l*m(t*R))+w[Y+88>>2]),!u|!o[nA+240>>2])break A;k=O+G(H,244)|0,l=w[k+120>>2],E=w[u+416>>2],R=w[n+56>>2],V=w[k+136>>2],j=w[k+116>>2],z=w[u+412>>2],P=w[n+52>>2],q=w[k+132>>2],D=w[n+88>>2],fA=w[n+84>>2],eA=w[n+80>>2],t=w[n+100>>2],w[k+64>>2]=w[k+64>>2]+m(w[k+112>>2]*m(m(m(w[k+128>>2]*w[n+48>>2])*w[u+408>>2])*t)),w[k+80>>2]=w[k+80>>2]+m(eA*m(t*w[k+96>>2])),w[k+84>>2]=w[k+84>>2]+m(fA*m(t*w[k+100>>2])),w[k+88>>2]=w[k+88>>2]+m(D*m(t*w[k+104>>2])),w[k+68>>2]=w[k+68>>2]+m(j*m(t*m(z*m(q*P)))),w[k+72>>2]=w[k+72>>2]+m(l*m(t*m(E*m(V*R))))}else o[n+100>>2]=0;o[n+96>>2]=0,R=m(0),V=m(0),j=m(0),t=m(0),l=m(0),z=m(0),P=m(0),o[aA+240>>2]&&(u=O+G(M,244)|0,P=w[u+224>>2],l=w[u+232>>2],z=w[u+228>>2],V=w[u+216>>2],j=w[u+212>>2],t=w[u+208>>2]),q=m(0),D=m(0),fA=m(0),eA=m(0),o[nA+240>>2]&&(u=O+G(H,244)|0,L=w[u+224>>2],fA=w[u+232>>2],eA=w[u+228>>2],D=w[u+216>>2],q=w[u+212>>2],R=w[u+208>>2]),u=O+G(M,244)|0,GA=w[u+200>>2],QA=w[u+196>>2],EA=w[u+192>>2],WA=w[u+176>>2],NA=w[n+20>>2],pA=w[u+180>>2],FA=w[n+24>>2],RA=w[u+184>>2],u=O+G(H,244)|0,YA=w[u+176>>2],VA=w[n+52>>2],gA=w[u+180>>2],DA=w[n+56>>2],CA=w[u+184>>2],JA=w[u+192>>2],xA=w[n+36>>2],yA=w[u+196>>2],MA=w[n+40>>2],HA=w[u+200>>2],IA=w[n+8>>2],TA=w[n+4>>2],UA=w[n>>2],jA=w[n+16>>2],zA=w[n+48>>2],PA=w[n+32>>2],k=o[e+52>>2],OA=w[e+56>>2],E=w[n+108>>2],o[n+120>>2]=0,o[n+124>>2]=1343554297,w[n+116>>2]=x*E,u=(p=m(dA+p))>m(0),C=m(E*m(u?0:U*m(C*m(-p)))),k=!k|p>OA,w[n+128>>2]=k?m(0):C,i=m(m(vA*m(d-i))+m(m(BA*m(c-b))+m(m(s-Z)*hA))),i=m(Q(i))>2]=m(E*(u?m(i-m(p*U)):i))+(k?C:m(-0)),o[n+140>>2]=o[A+68>>2],w[F+92>>2]>m(0)&&(XA(A,y,M,H,J,w[F+96>>2]),b=w[y+8>>2],m(Q(b))>m(.7071067690849304)?(d=w[y+4>>2],i=m(m(d*d)+m(b*b)),c=m(m(1)/m(N(i))),s=m(i*c),i=m(c*m(-b)),l=w[y>>2],t=m(i*l),b=m(d*c),l=m(b*m(-l)),c=m(0)):(s=w[y>>2],c=w[y+4>>2],t=m(m(s*s)+m(c*c)),i=m(m(1)/m(N(t))),t=m(t*i),c=m(i*m(-c)),l=m(b*c),i=m(s*i),s=m(i*m(-b)),b=m(0)),d=m(m(1)/m(N(m(m(b*b)+m(m(c*c)+m(i*i)))))),b=m(b*d),w[W+36>>2]=b,i=m(i*d),w[W+32>>2]=i,c=m(c*d),w[W+28>>2]=c,E=m(m(1)/m(N(m(m(t*t)+m(m(s*s)+m(l*l)))))),d=m(t*E),w[W+20>>2]=d,t=m(l*E),w[W+16>>2]=t,s=m(s*E),w[W+12>>2]=s,(u=2&o[B+180>>2])&&(j=w[B+172>>2],l=w[B+44>>2],E=w[B+12>>2],p=w[B+28>>2],z=w[B+164>>2],Z=w[B+36>>2],R=w[B+4>>2],V=w[B+20>>2],P=w[B+168>>2],C=w[B+40>>2],L=w[B+8>>2],U=w[B+24>>2],o[W+40>>2]=0,x=l,l=m(j*m(m(l*b)+m(m(E*c)+m(i*p)))),D=Z,Z=m(z*m(m(Z*b)+m(m(R*c)+m(i*V)))),c=m(P*m(m(C*b)+m(m(L*c)+m(i*U)))),b=m(m(x*l)+m(m(D*Z)+m(C*c))),w[W+36>>2]=b,i=m(m(p*l)+m(m(V*Z)+m(U*c))),w[W+32>>2]=i,c=m(m(E*l)+m(m(R*Z)+m(L*c))),w[W+28>>2]=c),(k=2&o[h+180>>2])&&(j=w[h+172>>2],l=w[h+44>>2],E=w[h+12>>2],p=w[h+28>>2],z=w[h+164>>2],Z=w[h+36>>2],R=w[h+4>>2],V=w[h+20>>2],P=w[h+168>>2],C=w[h+40>>2],L=w[h+8>>2],U=w[h+24>>2],o[W+40>>2]=0,x=l,l=m(j*m(m(l*b)+m(m(E*c)+m(i*p)))),D=Z,Z=m(z*m(m(Z*b)+m(m(R*c)+m(V*i)))),c=m(P*m(m(C*b)+m(m(L*c)+m(i*U)))),b=m(m(x*l)+m(m(D*Z)+m(C*c))),w[W+36>>2]=b,i=m(m(p*l)+m(m(V*Z)+m(U*c))),w[W+32>>2]=i,c=m(m(E*l)+m(m(R*Z)+m(L*c))),w[W+28>>2]=c),u&&(j=w[B+172>>2],l=w[B+44>>2],E=w[B+12>>2],p=w[B+28>>2],z=w[B+164>>2],Z=w[B+36>>2],R=w[B+4>>2],V=w[B+20>>2],P=w[B+168>>2],C=w[B+40>>2],L=w[B+8>>2],U=w[B+24>>2],o[W+24>>2]=0,x=l,l=m(j*m(m(l*d)+m(m(E*s)+m(t*p)))),D=Z,Z=m(z*m(m(Z*d)+m(m(R*s)+m(t*V)))),s=m(P*m(m(C*d)+m(m(L*s)+m(t*U)))),d=m(m(x*l)+m(m(D*Z)+m(C*s))),w[W+20>>2]=d,t=m(m(p*l)+m(m(V*Z)+m(U*s))),w[W+16>>2]=t,s=m(m(E*l)+m(m(R*Z)+m(L*s))),w[W+12>>2]=s),k&&(j=w[h+172>>2],l=w[h+44>>2],E=w[h+12>>2],p=w[h+28>>2],z=w[h+164>>2],Z=w[h+36>>2],R=w[h+4>>2],V=w[h+20>>2],P=w[h+168>>2],C=w[h+40>>2],L=w[h+8>>2],U=w[h+24>>2],o[W+24>>2]=0,x=l,l=m(j*m(m(l*d)+m(m(E*s)+m(t*p)))),D=Z,Z=m(z*m(m(Z*d)+m(m(R*s)+m(V*t)))),s=m(P*m(m(C*d)+m(m(L*s)+m(t*U)))),d=m(m(x*l)+m(m(D*Z)+m(C*s))),w[W+20>>2]=d,t=m(m(p*l)+m(m(V*Z)+m(U*s))),w[W+16>>2]=t,s=m(m(E*l)+m(m(R*Z)+m(L*s))),w[W+12>>2]=s),+m(N(m(m(b*b)+m(m(c*c)+m(i*i)))))>.001&&XA(A,W+28|0,M,H,J,w[F+92>>2]),+m(N(m(m(d*d)+m(m(s*s)+m(t*t)))))>.001&&XA(A,W+12|0,M,H,J,w[F+92>>2]));A:if(1&a[F+132|0]&&32&v[e+72|0])mA(A,F+172|0,M,H,J,g,W- -64|0,W+48|0,i=w[W+44>>2],e,w[F+148>>2],w[F+164>>2]),16&v[e+72|0]&&mA(A,F+188|0,M,H,J,g,W- -64|0,W+48|0,i,e,w[F+152>>2],w[F+164>>2]);else{if(l=w[y>>2],i=w[y+4>>2],b=w[y+8>>2],o[F+184>>2]=0,c=m(T-X),d=m(oA-bA),s=m(AA-cA),t=m(m(uA*c)+m(m(lA*d)+m(s*kA))),c=m(c-m(b*t)),w[F+180>>2]=c,s=m(s-m(t*i)),w[F+176>>2]=s,u=F+172|0,d=m(d-m(t*l)),w[u>>2]=d,!(64&v[e+72|0])&&(t=m(m(c*c)+m(m(d*d)+m(s*s))))>m(1.1920928955078125e-7)){if(b=m(m(1)/m(N(t))),i=m(c*b),w[u+8>>2]=i,t=m(s*b),w[u+4>>2]=t,b=m(d*b),w[u>>2]=b,1&a[B+180|0]&&(V=w[B+172>>2],c=w[B+44>>2],s=w[B+12>>2],d=w[B+28>>2],C=w[B+164>>2],l=w[B+36>>2],X=w[B+4>>2],E=w[B+20>>2],T=w[B+168>>2],p=w[B+40>>2],Z=w[B+8>>2],R=w[B+24>>2],o[u+12>>2]=0,x=c,c=m(V*m(m(c*i)+m(m(s*b)+m(t*d)))),D=l,l=m(C*m(m(l*i)+m(m(X*b)+m(t*E)))),b=m(T*m(m(p*i)+m(m(Z*b)+m(t*R)))),i=m(m(x*c)+m(m(D*l)+m(p*b))),w[u+8>>2]=i,t=m(m(d*c)+m(m(E*l)+m(R*b))),w[u+4>>2]=t,b=m(m(s*c)+m(m(X*l)+m(Z*b))),w[u>>2]=b),1&a[h+180|0]&&(V=w[h+172>>2],c=w[h+44>>2],s=w[h+12>>2],d=w[h+28>>2],C=w[h+164>>2],l=w[h+36>>2],X=w[h+4>>2],E=w[h+20>>2],T=w[h+168>>2],p=w[h+40>>2],Z=w[h+8>>2],R=w[h+24>>2],o[u+12>>2]=0,x=c,c=m(V*m(m(c*i)+m(m(s*b)+m(t*d)))),D=l,l=m(C*m(m(l*i)+m(m(X*b)+m(E*t)))),i=m(T*m(m(p*i)+m(m(Z*b)+m(t*R)))),w[u+8>>2]=m(x*c)+m(m(D*l)+m(p*i)),w[u+4>>2]=m(d*c)+m(m(E*l)+m(R*i)),w[u>>2]=m(s*c)+m(m(X*l)+m(Z*i))),mA(A,u,M,H,J,g,W- -64|0,W+48|0,V=w[W+44>>2],e,m(0),m(0)),!(16&v[e+72|0]))break A;i=w[u+4>>2],t=w[y+4>>2],b=w[y>>2],c=w[u+8>>2],s=w[u>>2],d=w[y+8>>2],o[F+200>>2]=0,l=m(m(s*t)-m(b*i)),X=m(m(i*d)-m(t*c)),t=m(m(c*b)-m(d*s)),b=m(m(1)/m(N(m(m(l*l)+m(m(X*X)+m(t*t)))))),i=m(l*b),w[F+196>>2]=i,t=m(t*b),w[F+192>>2]=t,u=F+188|0,b=m(X*b),w[u>>2]=b,1&a[B+180|0]&&(C=w[B+172>>2],c=w[B+44>>2],s=w[B+12>>2],d=w[B+28>>2],T=w[B+164>>2],l=w[B+36>>2],X=w[B+4>>2],E=w[B+20>>2],AA=w[B+168>>2],p=w[B+40>>2],Z=w[B+8>>2],R=w[B+24>>2],o[u+12>>2]=0,x=c,c=m(C*m(m(c*i)+m(m(s*b)+m(t*d)))),D=l,l=m(T*m(m(l*i)+m(m(X*b)+m(t*E)))),b=m(AA*m(m(p*i)+m(m(Z*b)+m(t*R)))),i=m(m(x*c)+m(m(D*l)+m(p*b))),w[u+8>>2]=i,t=m(m(d*c)+m(m(E*l)+m(R*b))),w[u+4>>2]=t,b=m(m(s*c)+m(m(X*l)+m(Z*b))),w[u>>2]=b),1&a[h+180|0]&&(C=w[h+172>>2],c=w[h+44>>2],s=w[h+12>>2],d=w[h+28>>2],T=w[h+164>>2],l=w[h+36>>2],X=w[h+4>>2],E=w[h+20>>2],AA=w[h+168>>2],p=w[h+40>>2],Z=w[h+8>>2],R=w[h+24>>2],o[u+12>>2]=0,x=c,c=m(C*m(m(c*i)+m(m(s*b)+m(t*d)))),D=l,l=m(T*m(m(l*i)+m(m(X*b)+m(E*t)))),i=m(AA*m(m(p*i)+m(m(Z*b)+m(t*R)))),w[u+8>>2]=m(x*c)+m(m(D*l)+m(p*i)),w[u+4>>2]=m(d*c)+m(m(E*l)+m(R*i)),w[u>>2]=m(s*c)+m(m(X*l)+m(Z*i))),mA(A,u,M,H,J,g,W- -64|0,W+48|0,V,e,m(0),m(0));break A}if(k=F+188|0,m(Q(b))>m(.7071067690849304)?(c=m(m(i*i)+m(b*b)),t=m(m(1)/m(N(c))),d=m(c*t),c=m(t*m(-b)),s=m(l*c),i=m(i*t),X=m(i*m(-l)),t=m(0)):(t=m(m(l*l)+m(i*i)),c=m(m(1)/m(N(t))),s=m(t*c),t=m(c*m(-i)),X=m(b*t),c=m(l*c),d=m(c*m(-b)),i=m(0)),w[u+8>>2]=i,w[u+4>>2]=c,w[u>>2]=t,w[k+8>>2]=s,w[k+4>>2]=X,w[k>>2]=d,1&a[B+180|0]&&(V=w[B+172>>2],b=w[B+44>>2],s=w[B+12>>2],d=w[B+28>>2],C=w[B+164>>2],l=w[B+36>>2],X=w[B+4>>2],E=w[B+20>>2],T=w[B+168>>2],p=w[B+40>>2],Z=w[B+8>>2],R=w[B+24>>2],o[u+12>>2]=0,x=b,b=m(V*m(m(b*i)+m(m(s*t)+m(c*d)))),D=l,l=m(C*m(m(l*i)+m(m(X*t)+m(E*c)))),t=m(T*m(m(p*i)+m(m(Z*t)+m(c*R)))),i=m(m(x*b)+m(m(D*l)+m(p*t))),w[u+8>>2]=i,c=m(m(d*b)+m(m(E*l)+m(R*t))),w[u+4>>2]=c,t=m(m(s*b)+m(m(X*l)+m(Z*t))),w[u>>2]=t),1&a[h+180|0]&&(V=w[h+172>>2],b=w[h+44>>2],s=w[h+12>>2],d=w[h+28>>2],C=w[h+164>>2],l=w[h+36>>2],X=w[h+4>>2],E=w[h+20>>2],T=w[h+168>>2],p=w[h+40>>2],Z=w[h+8>>2],R=w[h+24>>2],o[u+12>>2]=0,x=b,b=m(V*m(m(b*i)+m(m(s*t)+m(c*d)))),D=l,l=m(C*m(m(l*i)+m(m(X*t)+m(E*c)))),i=m(T*m(m(p*i)+m(m(Z*t)+m(c*R)))),w[u+8>>2]=m(x*b)+m(m(D*l)+m(p*i)),w[u+4>>2]=m(d*b)+m(m(E*l)+m(R*i)),w[u>>2]=m(s*b)+m(m(X*l)+m(Z*i))),mA(A,u,M,H,J,g,W- -64|0,W+48|0,V=w[W+44>>2],e,m(0),m(0)),16&(u=o[e+72>>2])&&(1&a[B+180|0]&&(p=w[B+172>>2],i=w[B+44>>2],t=w[B+12>>2],b=w[B+28>>2],C=w[B+164>>2],c=w[B+36>>2],s=w[B+4>>2],d=w[B+20>>2],T=w[B+168>>2],l=w[B+40>>2],X=w[B+8>>2],E=w[B+24>>2],o[k+12>>2]=0,x=i,D=p,i=w[k+8>>2],p=w[k>>2],Z=w[k+4>>2],R=m(D*m(m(x*i)+m(m(t*p)+m(b*Z)))),D=c,c=m(C*m(m(c*i)+m(m(s*p)+m(d*Z)))),i=m(T*m(m(l*i)+m(m(X*p)+m(Z*E)))),w[k+8>>2]=m(x*R)+m(m(D*c)+m(l*i)),w[k+4>>2]=m(b*R)+m(m(d*c)+m(E*i)),w[k>>2]=m(t*R)+m(m(s*c)+m(X*i))),1&a[h+180|0]&&(p=w[h+172>>2],i=w[h+44>>2],t=w[h+12>>2],b=w[h+28>>2],C=w[h+164>>2],c=w[h+36>>2],s=w[h+4>>2],d=w[h+20>>2],T=w[h+168>>2],l=w[h+40>>2],X=w[h+8>>2],E=w[h+24>>2],o[k+12>>2]=0,x=i,D=p,i=w[k+8>>2],p=w[k>>2],Z=w[k+4>>2],R=m(D*m(m(x*i)+m(m(t*p)+m(b*Z)))),D=c,c=m(C*m(m(c*i)+m(m(s*p)+m(d*Z)))),i=m(T*m(m(l*i)+m(m(X*p)+m(Z*E)))),w[k+8>>2]=m(x*R)+m(m(D*c)+m(l*i)),w[k+4>>2]=m(b*R)+m(m(d*c)+m(E*i)),w[k>>2]=m(t*R)+m(m(s*c)+m(X*i))),mA(A,k,M,H,J,g,W- -64|0,W+48|0,V,e,m(0),m(0)),u=o[e+72>>2]),80&~u)break A;o[F+132>>2]=1|o[F+132>>2]}k=o[A+76>>2],O=o[n+140>>2];A:if(4&(I=o[e+72>>2])){if(Y=o[A+16>>2],J=o[240+(Y+G(H,244)|0)>>2],u=o[240+(Y+G(M,244)|0)>>2],F=k+G(O,152)|0,i=m(w[g+136>>2]*w[e+68>>2]),w[F+100>>2]=i,u&&(b=w[u+416>>2],c=w[F+24>>2],s=w[u+412>>2],d=w[F+20>>2],n=Y+G(M,244)|0,t=w[u+404>>2],w[n+64>>2]=m(m(i*m(m(t*w[F+16>>2])*w[u+408>>2]))*w[n+112>>2])+w[n+64>>2],w[n+68>>2]=m(m(i*m(s*m(t*d)))*w[n+116>>2])+w[n+68>>2],w[n+72>>2]=m(m(i*m(b*m(t*c)))*w[n+120>>2])+w[n+72>>2],t=w[F+72>>2],b=w[F+68>>2],w[n+80>>2]=m(m(i*w[n+96>>2])*w[F+64>>2])+w[n+80>>2],c=w[n+104>>2],w[n+84>>2]=m(b*m(i*w[n+100>>2]))+w[n+84>>2],w[n+88>>2]=m(t*m(i*c))+w[n+88>>2]),J&&(y=k+G(O,152)|0,b=w[y+88>>2],c=w[y+84>>2],s=w[y+80>>2],d=w[J+416>>2],l=w[y+56>>2],X=w[J+412>>2],E=w[y+52>>2],n=Y+G(H,244)|0,t=w[J+404>>2],i=w[F+100>>2],w[n+64>>2]=w[n+64>>2]+m(m(m(m(t*w[y+48>>2])*w[J+408>>2])*i)*w[n+112>>2]),w[n+68>>2]=w[n+68>>2]+m(m(i*m(X*m(t*E)))*w[n+116>>2]),w[n+72>>2]=w[n+72>>2]+m(m(i*m(d*m(t*l)))*w[n+120>>2]),w[n+80>>2]=w[n+80>>2]+m(s*m(i*w[n+96>>2])),t=w[n+104>>2],w[n+84>>2]=w[n+84>>2]+m(c*m(i*w[n+100>>2])),w[n+88>>2]=w[n+88>>2]+m(b*m(t*i))),!(16&I))break A;if(F=k+G(y=O+1|0,152)|0,i=m(w[g+140>>2]*w[e+68>>2]),w[F+100>>2]=i,u&&(b=w[F+24>>2],c=w[F+20>>2],n=Y+G(M,244)|0,t=w[u+404>>2],w[n+64>>2]=m(m(i*m(t*w[F+16>>2]))*w[n+112>>2])+w[n+64>>2],w[n+68>>2]=m(m(i*m(t*c))*w[n+116>>2])+w[n+68>>2],w[n+72>>2]=m(m(i*m(t*b))*w[n+120>>2])+w[n+72>>2],t=w[F+72>>2],b=w[F+68>>2],w[n+80>>2]=m(m(i*w[n+96>>2])*w[F+64>>2])+w[n+80>>2],c=w[n+104>>2],w[n+84>>2]=m(b*m(i*w[n+100>>2]))+w[n+84>>2],w[n+88>>2]=m(t*m(i*c))+w[n+88>>2]),!J)break A;u=k+G(y,152)|0,b=w[u+88>>2],c=w[u+84>>2],s=w[u+56>>2],d=w[u+52>>2],l=w[u+48>>2],t=w[J+404>>2],n=Y+G(H,244)|0,i=w[F+100>>2],w[n+80>>2]=w[n+80>>2]+m(w[u+80>>2]*m(w[n+96>>2]*i)),w[n+64>>2]=w[n+64>>2]+m(m(i*m(t*l))*w[n+112>>2]),w[n+68>>2]=w[n+68>>2]+m(m(i*m(t*d))*w[n+116>>2]),w[n+72>>2]=w[n+72>>2]+m(m(i*m(t*s))*w[n+120>>2]),t=w[n+104>>2],w[n+84>>2]=w[n+84>>2]+m(c*m(i*w[n+100>>2])),w[n+88>>2]=w[n+88>>2]+m(b*m(t*i))}else n=k+G(O,152)|0,o[n+100>>2]=0,16&I&&(o[n+252>>2]=0);u=o[_+844>>2]}if(!((0|(rA=rA+1|0))<(0|u)))break}if(S=W+80|0,(0|(iA=iA+1|0))==(0|f))break}},function(A,r,f,e,i,n,a,t){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,t|=0;var c=m(0),b=m(0);A:if(o[t+52>>2]&&!((0|(r=o[t+20>>2]))<=0||(f=0,(0|(e=o[A+28>>2]))<=0)))for(;;){if(i=0,c=m(0),(0|e)>0){for(;n=o[A+16>>2],r=o[A+36>>2]+G(o[o[A+116>>2]+(i<<2)>>2],152)|0,b=m(Zn[o[A+220>>2]](n+G(o[r+144>>2],244)|0,G(o[r+148>>2],244)+n|0,r)),c=m(m(b*b)+c),(0|(i=i+1|0))!=(0|e););r=o[t+20>>2]}if((r-1|0)<=(0|f)|w[t+92>>2]>=c)break A;if((0|(f=f+1|0))>=(0|r))break A;e=o[A+28>>2]}},function(A,r,f,e){A|=0,r|=0,f|=0,e|=0;var i=0,n=m(0),t=0,c=m(0),b=0,u=m(0),l=m(0),s=0,k=m(0),d=m(0),h=0,B=0;if(4&(f=o[e+72>>2])&&!((0|(r=o[A+28>>2]))<=0))if(s=o[A+76>>2],b=o[A+36>>2],16&f)for(f=0;i=b+G(f,152)|0,t=o[i+132>>2],w[t+132>>2]=w[i+100>>2],i=s+G(o[i+140>>2],152)|0,w[t+136>>2]=w[i+100>>2],w[t+140>>2]=w[i+252>>2],(0|r)!=(0|(f=f+1|0)););else{if(f=0,1!=(0|r))for(B=-2&r;t=b+G(f,152)|0,h=o[t+132>>2],w[h+132>>2]=w[t+100>>2],w[h+136>>2]=w[100+(s+G(o[t+140>>2],152)|0)>>2],t=b+G(1|f,152)|0,h=o[t+132>>2],w[h+132>>2]=w[t+100>>2],w[h+136>>2]=w[100+(s+G(o[t+140>>2],152)|0)>>2],f=f+2|0,(0|B)!=(0|(i=i+2|0)););1&r&&(r=b+G(f,152)|0,f=o[r+132>>2],w[f+132>>2]=w[r+100>>2],w[f+136>>2]=w[100+(s+G(o[r+140>>2],152)|0)>>2])}if((0|(B=o[A+48>>2]))>0)for(h=o[A+56>>2],s=0;f=h+G(s,152)|0,i=o[f+132>>2],(r=o[i+44>>2])&&(b=o[i+28>>2],u=w[b+416>>2],l=w[f+24>>2],k=w[b+412>>2],d=w[f+20>>2],n=w[f+100>>2],c=m(m(1)/w[e+12>>2]),w[r>>2]=w[r>>2]+m(m(m(w[f+16>>2]*n)*w[b+408>>2])*c),w[r+4>>2]=m(m(k*m(n*d))*c)+w[r+4>>2],w[r+8>>2]=m(m(u*m(n*l))*c)+w[r+8>>2],t=o[i+32>>2],u=w[t+416>>2],l=w[f+56>>2],k=w[t+412>>2],d=w[f+52>>2],n=w[f+100>>2],c=m(m(1)/w[e+12>>2]),w[r+32>>2]=w[r+32>>2]+m(m(m(w[f+48>>2]*n)*w[t+408>>2])*c),w[r+36>>2]=m(m(k*m(n*d))*c)+w[r+36>>2],w[r+40>>2]=m(m(u*m(n*l))*c)+w[r+40>>2],u=w[b+612>>2],l=w[f+8>>2],k=w[b+608>>2],d=w[f+4>>2],n=w[f+100>>2],c=m(m(1)/w[e+12>>2]),w[r+16>>2]=w[r+16>>2]+m(m(m(w[f>>2]*w[b+604>>2])*n)*c),w[r+20>>2]=m(m(n*m(d*k))*c)+w[r+20>>2],w[r+24>>2]=m(m(n*m(l*u))*c)+w[r+24>>2],u=w[t+612>>2],l=w[f+40>>2],k=w[t+608>>2],d=w[f+36>>2],n=w[f+100>>2],c=m(m(1)/w[e+12>>2]),w[r+48>>2]=w[r+48>>2]+m(m(m(w[f+32>>2]*w[t+604>>2])*n)*c),w[r+52>>2]=m(m(n*m(d*k))*c)+w[r+52>>2],w[r+56>>2]=m(m(n*m(l*u))*c)+w[r+56>>2]),n=w[f+100>>2],w[i+36>>2]=n,w[i+16>>2]<=m(Q(n))&&(a[i+20|0]=0),(0|B)!=(0|(s=s+1|0)););if((0|(s=o[A+8>>2]))>0)for(i=o[A+16>>2],t=0;;){if(b=G(t,244),f=o[240+(r=b+i|0)>>2]){if(o[e+52>>2]){k=w[e+12>>2],n=w[e+60>>2],S=f=S-80|0;A:if(o[r+240>>2]){if(w[r+176>>2]=w[r+64>>2]+w[r+176>>2],w[r+192>>2]=w[r+80>>2]+w[r+192>>2],w[r+180>>2]=w[r+68>>2]+w[r+180>>2],w[r+184>>2]=w[r+72>>2]+w[r+184>>2],w[r+196>>2]=w[r+84>>2]+w[r+196>>2],w[r+200>>2]=w[r+88>>2]+w[r+200>>2],l=w[r+160>>2],!(w[r+144>>2]!=m(0)|w[r+148>>2]!=m(0))&w[r+152>>2]==m(0)){if(c=w[r+168>>2],u=w[r+164>>2],!(l!=m(0)|u!=m(0))&&c==m(0))break A}else c=w[r+168>>2],u=w[r+164>>2];o[f+12>>2]=0,w[f+8>>2]=c*n,w[f+4>>2]=u*n,w[f>>2]=l*n,tr(r,r+144|0,f,k,f+16|0),i=o[f+28>>2],o[r+8>>2]=o[f+24>>2],o[r+12>>2]=i,i=o[f+20>>2],o[r>>2]=o[f+16>>2],o[r+4>>2]=i,i=o[f+44>>2],o[r+24>>2]=o[f+40>>2],o[r+28>>2]=i,i=o[f+36>>2],o[r+16>>2]=o[f+32>>2],o[r+20>>2]=i,i=o[f+52>>2],o[r+32>>2]=o[f+48>>2],o[r+36>>2]=i,i=o[f+60>>2],o[r+40>>2]=o[f+56>>2],o[r+44>>2]=i,i=o[f+68>>2],o[r+48>>2]=o[f+64>>2],o[r+52>>2]=i,i=o[f+76>>2],o[r+56>>2]=o[f+72>>2],o[r+60>>2]=i}S=f+80|0,i=o[A+16>>2],n=w[176+(r=b+i|0)>>2],f=o[r+240>>2]}else n=m(w[r+64>>2]+w[r+176>>2]),w[r+176>>2]=n,w[r+192>>2]=w[r+80>>2]+w[r+192>>2],w[r+180>>2]=w[r+68>>2]+w[r+180>>2],w[r+184>>2]=w[r+72>>2]+w[r+184>>2],w[r+196>>2]=w[r+84>>2]+w[r+196>>2],w[r+200>>2]=w[r+88>>2]+w[r+200>>2];c=w[212+(r=i+b|0)>>2],u=w[r+180>>2],l=w[r+216>>2],k=w[r+184>>2],d=w[r+208>>2],o[f+384>>2]=0,w[f+372>>2]=n+d,o[f+304>>2]=o[f+304>>2]+1,w[f+380>>2]=k+l,w[f+376>>2]=u+c,r=b+o[A+16>>2]|0,n=w[r+228>>2],c=w[r+196>>2],u=w[r+232>>2],l=w[r+200>>2],k=w[r+224>>2],d=w[r+192>>2],r=o[r+240>>2],o[r+400>>2]=0,w[r+388>>2]=d+k,w[r+396>>2]=l+u,w[r+392>>2]=c+n,o[r+304>>2]=o[r+304>>2]+1,o[e+52>>2]&&(f=b+o[A+16>>2]|0,r=o[f+240>>2],o[r+304>>2]=o[r+304>>2]+1,i=o[f+12>>2],o[r+12>>2]=o[f+8>>2],o[r+16>>2]=i,i=o[f+4>>2],o[r+4>>2]=o[f>>2],o[r+8>>2]=i,i=o[f+28>>2],o[r+28>>2]=o[f+24>>2],o[r+32>>2]=i,i=o[f+20>>2],o[r+20>>2]=o[f+16>>2],o[r+24>>2]=i,i=o[f+36>>2],o[r+36>>2]=o[f+32>>2],o[r+40>>2]=i,i=o[f+44>>2],o[r+44>>2]=o[f+40>>2],o[r+48>>2]=i,i=o[f+60>>2],o[r+60>>2]=o[f+56>>2],o[r+64>>2]=i,i=o[f+52>>2],o[r+52>>2]=o[f+48>>2],o[r+56>>2]=i),i=o[A+16>>2],o[o[240+(b+i|0)>>2]+212>>2]=-1,s=o[A+8>>2]}if(!((0|s)>(0|(t=t+1|0))))break}return(o[A+28>>2]&o[A+32>>2])<0&&(!(r=o[A+36>>2])||!r|!v[A+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+40|0]=1,o[A+32>>2]=0,o[A+36>>2]=0),o[A+28>>2]=0,(o[A+48>>2]&o[A+52>>2])<0&&(!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+60|0]=1,o[A+52>>2]=0,o[A+56>>2]=0),o[A+48>>2]=0,(o[A+68>>2]&o[A+72>>2])<0&&(!(r=o[A+76>>2])||!r|!v[A+80|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+80|0]=1,o[A+72>>2]=0,o[A+76>>2]=0),o[A+68>>2]=0,(o[A+88>>2]&o[A+92>>2])<0&&(!(r=o[A+96>>2])||!r|!v[A+100|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+100|0]=1,o[A+92>>2]=0,o[A+96>>2]=0),o[A+88>>2]=0,(o[A+8>>2]&o[A+12>>2])<0&&(!(r=o[A+16>>2])||!r|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),a[A+20|0]=1,o[A+12>>2]=0,o[A+16>>2]=0),o[A+8>>2]=0,m(m(0))},function(A,r,f,e,i,n,t,c,b,u){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,t|=0,c|=0,b|=0,u|=0;var l=m(0),s=0,k=0,d=0,h=m(0),B=m(0),Z=0,Q=0;if(1&a[b+72|0]){if(u=o[A+68>>2],k=o[A+28>>2],(0|(s=o[A+48>>2]))>0){if(f=G(o[A+232>>2],1664525)+1013904223|0,1!=(0|s)&&(i=o[A+136>>2],e=o[i+4>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n^=n>>>4,n=i+((1&((n^=n>>>2)>>>1^n))<<2)|0,o[i+4>>2]=o[n>>2],o[n>>2]=e,2!=(0|s)&&(e=o[i+8>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n=i+((((n^=n>>>4)>>>2^n)>>>0)%3<<2)|0,o[i+8>>2]=o[n>>2],o[n>>2]=e,3!=(0|s)&&(e=4,n=o[i+12>>2],d=(f=G(f,1664525)+1013904223|0)^f>>>16,d^=d>>>8,d=i+((3&((d^=d>>>4)>>>2^d))<<2)|0,o[i+12>>2]=o[d>>2],o[d>>2]=n,4!=(0|s)))))for(;Q=o[(n=i+(e<<2)|0)>>2],Z=n,n=f=G(f,1664525)+1013904223|0,e>>>0>65535||(n=d=f>>>16^f,e>>>0>255||(n=d^=d>>>8,e>>>0>15||(n=d^d>>>4))),n=((n>>>0)%((e=e+1|0)>>>0)<<2)+i|0,o[Z>>2]=o[n>>2],o[n>>2]=Q,(0|e)!=(0|s););o[A+232>>2]=f}if(!(o[b+20>>2]<=(0|r))){if((0|k)>0){if(f=G(o[A+232>>2],1664525)+1013904223|0,1!=(0|k)&&(i=o[A+116>>2],e=o[i+4>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n^=n>>>4,n=i+((1&((n^=n>>>2)>>>1^n))<<2)|0,o[i+4>>2]=o[n>>2],o[n>>2]=e,2!=(0|k)&&(e=o[i+8>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n=i+((((n^=n>>>4)>>>2^n)>>>0)%3<<2)|0,o[i+8>>2]=o[n>>2],o[n>>2]=e,3!=(0|k)&&(e=4,n=o[i+12>>2],s=(f=G(f,1664525)+1013904223|0)^f>>>16,s^=s>>>8,s=i+((3&((s^=s>>>4)>>>2^s))<<2)|0,o[i+12>>2]=o[s>>2],o[s>>2]=n,4!=(0|k)))))for(;d=o[(n=i+(e<<2)|0)>>2],Z=n,n=f=G(f,1664525)+1013904223|0,e>>>0>65535||(n=s=f>>>16^f,e>>>0>255||(n=s^=s>>>8,e>>>0>15||(n=s^s>>>4))),n=((n>>>0)%((e=e+1|0)>>>0)<<2)+i|0,o[Z>>2]=o[n>>2],o[n>>2]=d,(0|e)!=(0|k););o[A+232>>2]=f}if(!((0|u)<=0)){if(f=G(o[A+232>>2],1664525)+1013904223|0,1!=(0|u)&&(i=o[A+156>>2],e=o[i+4>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n^=n>>>4,n=i+((1&((n^=n>>>2)>>>1^n))<<2)|0,o[i+4>>2]=o[n>>2],o[n>>2]=e,2!=(0|u)&&(e=o[i+8>>2],n=(f=G(f,1664525)+1013904223|0)^f>>>16,n^=n>>>8,n=i+((((n^=n>>>4)>>>2^n)>>>0)%3<<2)|0,o[i+8>>2]=o[n>>2],o[n>>2]=e,3!=(0|u)&&(e=4,n=o[i+12>>2],k=(f=G(f,1664525)+1013904223|0)^f>>>16,k^=k>>>8,k=i+((3&((k^=k>>>4)>>>2^k))<<2)|0,o[i+12>>2]=o[k>>2],o[k>>2]=n,4!=(0|u)))))for(;s=o[(n=i+(e<<2)|0)>>2],d=n,n=f=G(f,1664525)+1013904223|0,e>>>0>65535||(n=k=f>>>16^f,e>>>0>255||(n=k^=k>>>8,e>>>0>15||(n=k^k>>>4))),n=((n>>>0)%((e=e+1|0)>>>0)<<2)+i|0,o[d>>2]=o[n>>2],o[n>>2]=s,(0|e)!=(0|u););o[A+232>>2]=f}}}if((0|(i=o[A+48>>2]))>0)for(e=0;f=o[A+56>>2]+G(o[o[A+136>>2]+(e<<2)>>2],152)|0,o[f+136>>2]>(0|r)&&(i=o[A+16>>2],l=m(Zn[o[A+212>>2]](i+G(o[f+144>>2],244)|0,i+G(o[f+148>>2],244)|0,f)),B=m(m(l*l)+B),i=o[A+48>>2]),(0|i)>(0|(e=e+1|0)););if(!(o[b+20>>2]<=(0|r))){if((0|c)>0)for(e=0;f=o[(r=(e<<2)+t|0)>>2],v[f+20|0]&&(f=sA(A,o[f+28>>2],w[b+12>>2]),i=sA(A,o[o[r>>2]+32>>2],w[b+12>>2]),r=o[r>>2],n=G(f,244),f=o[A+16>>2],Zn[o[o[r>>2]+24>>2]](r,n+f|0,f+G(i,244)|0,w[b+12>>2])),(0|c)!=(0|(e=e+1|0)););i=o[A+28>>2];A:if(512&(r=o[b+72>>2])){if((0|i)<=0)break A;for(e=r>>>4&1,f=0;n=o[A+16>>2],r=o[A+36>>2]+G(o[o[A+116>>2]+(f<<2)>>2],152)|0,l=m(Zn[o[A+216>>2]](n+G(o[r+144>>2],244)|0,n+G(o[r+148>>2],244)|0,r)),B=m(m(l*l)+B),(n=(l=w[r+100>>2])>m(0))&&(t=f<>2]+G(o[t+o[A+156>>2]>>2],152)|0,h=w[r+104>>2],w[r+124>>2]=l*h,w[r+120>>2]=l*m(-h),c=o[A+16>>2],h=m(Zn[o[A+212>>2]](c+G(o[r+144>>2],244)|0,c+G(o[r+148>>2],244)|0,r)),B=m(m(h*h)+B),!n|!(16&o[b+72>>2])||(r=o[A+76>>2]+G(o[4+(t+o[A+156>>2]|0)>>2],152)|0,h=w[r+104>>2],w[r+124>>2]=l*h,w[r+120>>2]=l*m(-h),n=o[A+16>>2],l=m(Zn[o[A+212>>2]](n+G(o[r+144>>2],244)|0,n+G(o[r+148>>2],244)|0,r)),B=m(m(l*l)+B))),(0|i)!=(0|(f=f+1|0)););}else{if((0|i)>0)for(e=0;f=o[A+16>>2],r=o[A+36>>2]+G(o[o[A+116>>2]+(e<<2)>>2],152)|0,l=m(Zn[o[A+216>>2]](f+G(o[r+144>>2],244)|0,f+G(o[r+148>>2],244)|0,r)),B=m(m(l*l)+B),(0|i)!=(0|(e=e+1|0)););if(!((0|(e=o[A+68>>2]))<=0))for(f=0;r=o[A+76>>2]+G(o[o[A+156>>2]+(f<<2)>>2],152)|0,(l=w[100+(o[A+36>>2]+G(o[r+140>>2],152)|0)>>2])>m(0)&&(h=w[r+104>>2],w[r+124>>2]=l*h,w[r+120>>2]=l*m(-h),i=o[A+16>>2],l=m(Zn[o[A+212>>2]](i+G(o[r+144>>2],244)|0,i+G(o[r+148>>2],244)|0,r)),B=m(m(l*l)+B)),(0|e)!=(0|(f=f+1|0)););}if(!((0|(e=o[A+88>>2]))<=0))for(f=0;r=o[A+96>>2]+G(f,152)|0,(l=w[100+(o[A+36>>2]+G(o[r+140>>2],152)|0)>>2])>m(0)&&(h=l,l=(l=w[r+104>>2])<(h=m(h*l))?l:h,w[r+124>>2]=l,w[r+120>>2]=-l,i=o[A+16>>2],l=m(Zn[o[A+212>>2]](i+G(o[r+144>>2],244)|0,i+G(o[r+148>>2],244)|0,r)),B=m(m(l*l)+B)),(0|e)!=(0|(f=f+1|0)););}return m(B)},function(A,r,f,e,i,n,t,c,b){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,t|=0,c|=0,b|=0;var u,l=0,s=0,k=0,d=m(0),h=0,B=m(0),Z=m(0),E=m(0),W=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=0,D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=0,H=m(0),I=m(0),T=m(0),U=m(0),j=m(0),z=m(0),P=m(0),O=m(0),L=m(0),$=m(0),K=m(0),q=0,_=m(0),AA=0,rA=m(0),fA=0,eA=0,iA=0,nA=0,aA=m(0),tA=m(0),oA=m(0),cA=m(0),bA=m(0),uA=m(0),lA=m(0),kA=m(0),dA=m(0);if(S=u=S-256|0,o[A+188>>2]=-1,Zn[o[8294]](5384),(0|(b=o[c+72>>2]))!=o[A+224>>2]&&(o[A+224>>2]=b,o[A+220>>2]=957,o[A+216>>2]=956,o[A+212>>2]=955),b=0,o[A+184>>2]=0,!((0|f)<=0)){if(f>>>0>=4)for(l=-4&f;o[o[(k=b<<2)+r>>2]+212>>2]=-1,o[o[(4|k)+r>>2]+212>>2]=-1,o[o[(8|k)+r>>2]+212>>2]=-1,o[o[(12|k)+r>>2]+212>>2]=-1,b=b+4|0,(0|l)!=(0|(s=s+4|0)););if(k=3&f)for(l=0;o[o[(b<<2)+r>>2]+212>>2]=-1,b=b+1|0,(0|k)!=(0|(l=l+1|0)););}if((0|(k=o[A+12>>2]))<=(0|f)){if((k=f+1|0)?(o[8488]=o[8488]+1,b=0|Zn[o[8290]](G(k,244),16)):b=0,(0|(X=o[A+8>>2]))>0)for(s=0;l=(h=G(s,244))+b|0,h=h+o[A+16>>2]|0,M=o[h+4>>2],o[l>>2]=o[h>>2],o[l+4>>2]=M,M=o[h+12>>2],o[l+8>>2]=o[h+8>>2],o[l+12>>2]=M,M=o[h+28>>2],o[l+24>>2]=o[h+24>>2],o[l+28>>2]=M,M=o[h+20>>2],o[l+16>>2]=o[h+16>>2],o[l+20>>2]=M,M=o[h+44>>2],o[l+40>>2]=o[h+40>>2],o[l+44>>2]=M,M=o[h+36>>2],o[l+32>>2]=o[h+32>>2],o[l+36>>2]=M,M=o[h+52>>2],o[l+48>>2]=o[h+48>>2],o[l+52>>2]=M,M=o[h+60>>2],o[l+56>>2]=o[h+56>>2],o[l+60>>2]=M,pr(l- -64|0,h- -64|0,180),(0|X)!=(0|(s=s+1|0)););!(l=o[A+16>>2])||!l|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](l)),o[A+16>>2]=b,a[A+20|0]=1,o[A+12>>2]=k}if(Af(u+8|0,0,244),(0|(l=o[A+8>>2]))<0)for((0|k)<0&&(!(b=o[A+16>>2])||!b|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[A+20|0]=1,o[A+12>>2]=0,o[A+16>>2]=0),k=u+72|0;b=o[A+16>>2]+G(l,244)|0,o[b>>2]=0,o[b+4>>2]=0,o[b+8>>2]=0,o[b+12>>2]=0,s=o[u+36>>2],o[b+24>>2]=o[u+32>>2],o[b+28>>2]=s,s=o[u+28>>2],o[b+16>>2]=o[u+24>>2],o[b+20>>2]=s,s=o[u+44>>2],o[b+32>>2]=o[u+40>>2],o[b+36>>2]=s,s=o[u+52>>2],o[b+40>>2]=o[u+48>>2],o[b+44>>2]=s,s=o[u+60>>2],o[b+48>>2]=o[u+56>>2],o[b+52>>2]=s,s=o[u+68>>2],o[b+56>>2]=o[u+64>>2],o[b+60>>2]=s,pr(b- -64|0,k,180),l=l+1|0;);if(o[A+8>>2]=0,(0|f)>0)for(l=0;s=sA(A,o[(b=(l<<2)+r|0)>>2],w[c+12>>2]),!(b=o[b>>2])|!(2&o[b+252>>2])|w[b+404>>2]==m(0)||(h=o[A+16>>2],2&(k=o[b+564>>2])&&(Y=w[c+84>>2],d=w[b+396>>2],E=w[b+44>>2],p=w[b+40>>2],W=w[b+36>>2],B=w[b+392>>2],J=w[b+28>>2],Z=w[b+12>>2],F=w[b+464>>2],D=w[b+24>>2],x=w[b+8>>2],V=w[b+460>>2],I=w[b+20>>2],R=w[b+388>>2],C=w[b+4>>2],g=w[b+456>>2],o[u+20>>2]=0,H=F!=m(0)?m(m(1)/F):m(0),F=m(J*H),g=g!=m(0)?m(m(1)/g):m(0),y=m(I*g),V=V!=m(0)?m(m(1)/V):m(0),U=m(D*V),T=m(m(d*m(m(E*F)+m(m(W*y)+m(p*U))))+m(m(R*m(m(Z*F)+m(m(C*y)+m(x*U))))+m(B*m(m(J*F)+m(m(I*y)+m(D*U)))))),F=m(H*Z),y=m(g*C),U=m(V*x),y=m(m(d*m(m(E*F)+m(m(W*y)+m(p*U))))+m(m(R*m(m(Z*F)+m(m(C*y)+m(x*U))))+m(B*m(m(J*F)+m(m(I*y)+m(U*D)))))),F=m(m(R*T)-m(B*y)),w[u+16>>2]=F,$=E,E=m(H*E),H=W,W=m(g*W),g=p,p=m(V*p),E=m(m(d*m(m($*E)+m(m(H*W)+m(g*p))))+m(m(R*m(m(Z*E)+m(m(C*W)+m(x*p))))+m(B*m(m(J*E)+m(m(I*W)+m(D*p)))))),R=m(m(d*y)-m(R*E)),w[u+12>>2]=R,d=m(m(B*E)-m(T*d)),w[u+8>>2]=d,(B=m(m(F*F)+m(m(d*d)+m(R*R))))>m(Y*Y)&&(B=m(m(m(1)/m(N(B)))*Y),w[u+16>>2]=F*B,w[u+12>>2]=R*B,w[u+8>>2]=d*B),p=w[b+364>>2],W=w[b+332>>2],J=w[b+348>>2],Z=w[b+360>>2],D=w[b+328>>2],x=w[b+344>>2],k=h+G(s,244)|0,d=w[u+16>>2],B=w[u+8>>2],R=w[u+12>>2],E=w[c+12>>2],w[k+224>>2]=w[k+224>>2]-m(m(m(w[b+356>>2]*d)+m(m(w[b+324>>2]*B)+m(R*w[b+340>>2])))*E),w[k+228>>2]=w[k+228>>2]-m(E*m(m(Z*d)+m(m(D*B)+m(R*x)))),w[k+232>>2]=w[k+232>>2]-m(E*m(m(p*d)+m(m(W*B)+m(R*J)))),k=o[b+564>>2]),4&k&&(d=w[c+12>>2],B=w[b+396>>2],J=w[b+44>>2],Z=w[b+40>>2],D=w[b+36>>2],p=w[b+12>>2],x=w[b+8>>2],R=w[b+392>>2],I=w[b+28>>2],W=w[b+464>>2],C=w[b+24>>2],V=w[b+460>>2],Y=w[b+20>>2],E=w[b+388>>2],F=w[b+4>>2],g=w[b+456>>2],o[u+20>>2]=0,U=W!=m(0)?m(m(1)/W):m(0),T=m(J*U),j=g!=m(0)?m(m(1)/g):m(0),P=m(D*j),z=V!=m(0)?m(m(1)/V):m(0),L=m(Z*z),g=m(m(p*T)+m(m(F*P)+m(x*L))),W=m(U*I),V=m(j*Y),O=m(z*C),H=m(m(J*W)+m(m(D*V)+m(Z*O))),_=m(B*H),y=m(m(p*W)+m(m(F*V)+m(x*O))),K=m(E*y),V=m(m(I*W)+m(m(Y*V)+m(C*O))),W=m(_+m(K+m(R*V))),O=m(U*p),j=m(j*F),z=m(z*x),x=m(m(p*O)+m(m(F*j)+m(x*z))),U=m(g+m(m(W+m(m(g*m(0))+m(K-m(R*x))))*d)),F=m(m(J*T)+m(m(D*P)+m(Z*L))),K=m(g*E),T=m(m(I*T)+m(m(Y*P)+m(C*L))),P=m(R*T),p=m(m(B*F)+m(K+P)),C=m(m(I*O)+m(m(Y*j)+m(z*C))),I=m(C+m(m(m(P+m(m(C*m(0))-m(V*B)))+p)*d)),D=m(m(J*O)+m(m(D*j)+m(z*Z))),Y=m(B*D),z=m(R*C),J=m(Y+m(m(x*E)+z)),P=m(d*m(0)),Z=m(m(W+m(m(m(B*J)-m(p*E))*d))-m(P+W)),Y=m(H+m(m(J+m(m(Y+m(H*m(0)))-m(F*E)))*d)),j=m(D+m(m(m(m(F*R)+m(m(D*m(0))-_))-W)*d)),C=m(V+m(m(m(m(C*B)+m(V*m(0)))-m(T*E))*d)),L=m(m(I*Y)-m(j*C)),g=m(x+m(m(m(g*R)+m(m(x*m(0))-m(y*B)))*d)),F=m(F+m(m(m(F*m(0))+m(m(E*H)-m(D*R)))*d)),V=m(T+m(m(m(m(T*m(0))+m(m(E*V)-z))-J)*d)),T=m(m(C*F)-m(Y*V)),H=m(y+m(m(m(m(m(x*B)+m(y*m(0)))-K)-p)*d)),y=m(m(V*j)-m(F*I)),D=m(m(U*L)+m(m(g*T)+m(H*y))),x=m(Q(D))>m(1.1920928955078125e-7)?m(m(1)/D):D,D=m(m(J+m(m(m(R*p)-m(W*B))*d))-m(P+J)),d=m(m(m(m(m(E*W)-m(J*R))*d)+p)-m(P+p)),w[u+16>>2]=m(B-m(m(m(U*m(m(I*Z)-m(D*C)))+m(m(g*m(m(C*d)-m(Z*V)))+m(H*m(m(V*D)-m(d*I)))))*x))-B,w[u+12>>2]=m(R-m(m(m(U*m(m(D*Y)-m(j*Z)))+m(m(g*m(m(Z*F)-m(Y*d)))+m(H*m(m(d*j)-m(F*D)))))*x))-R,w[u+8>>2]=m(E-m(m(m(d*L)+m(m(D*T)+m(Z*y)))*x))-E,d=w[u+16>>2],B=w[u+12>>2],k=h+G(s,244)|0,w[k+224>>2]=w[u+8>>2]+w[k+224>>2],w[k+228>>2]=B+w[k+228>>2],w[k+232>>2]=d+w[k+232>>2],k=o[b+564>>2]),8&k&&(d=w[c+12>>2],S=k=S-16|0,C=w[b+464>>2],Y=w[b+460>>2],D=w[b+396>>2],x=w[b+392>>2],V=w[b+456>>2],I=w[b+388>>2],rf(b+4|0,k),B=w[k+4>>2],R=w[k>>2],E=w[k+12>>2],p=w[k+8>>2],o[u+20>>2]=0,Z=m(m(B*I)+m(m(E*D)-m(x*R))),F=m(m(p*D)+m(m(R*I)+m(x*B))),g=m(m(R*D)+m(m(E*x)-m(I*p))),y=m(m(p*x)+m(m(E*I)-m(D*B))),W=m(m(m(R*Z)+m(m(B*F)+m(E*g)))-m(p*y)),J=m(m(m(y*B)+m(m(F*p)+m(E*Z)))-m(g*R)),H=m(J*m(0)),Z=m(m(m(g*p)+m(m(F*R)+m(E*y)))-m(Z*B)),y=m(Z*m(0)),Y=Y!=m(0)?m(m(1)/Y):m(0),F=m(H+m(y+m(W*Y))),V=V!=m(0)?m(m(1)/V):m(0),U=m(m(m(m(m(y-m(W*V))+m(0))+F)*d)+m(0)),g=C!=m(0)?m(m(1)/C):m(0),T=m(W*m(0)),j=m(m(g*J)+m(y+T)),C=m(m(m(W*j)-m(F*J))*d),K=m(Z*m(-0)),P=m(m(m(m(K+m(m(V*J)+m(0)))-j)*d)+m(0)),z=m(m(m(m(T+m(m(0)-m(Y*J)))+j)*d)+m(0)),L=m(H+m(m(V*Z)+T)),O=m(m(m(m(m(H+m(0))-m(g*Z))+L)*d)+m(0)),$=m(J*m(-0)),_=m(m(m(m(m(g*W)+m($+m(0)))-F)*d)+m(0)),H=m(Y+m(m(K+m(H+m(Y*m(0))))*d)),K=m(m(z*O)-m(_*H)),T=m(V+m(m(T+m(m(V*m(0))+$))*d)),$=g,V=m(g*m(0)),g=m(W*m(-0)),V=m($+m(m(V+m(g+y))*d)),g=m(m(m(m(m(g+m(Y*Z))+m(0))-L)*d)+m(0)),$=m(m(H*V)-m(O*g)),rA=m(m(g*_)-m(V*z)),Y=m(m(U*K)+m(m(T*$)+m(P*rA))),y=m(Q(Y))>m(1.1920928955078125e-7)?m(m(1)/Y):Y,Y=m(m(m(J*L)-m(j*Z))*d),d=m(m(m(Z*F)-m(L*W))*d),W=m(W-m(m(m(U*m(m(C*O)-m(_*Y)))+m(m(T*m(m(Y*V)-m(O*d)))+m(P*m(m(d*_)-m(V*C)))))*y)),Z=m(Z-m(m(m(d*K)+m(m(C*$)+m(Y*rA)))*y)),d=m(J-m(m(m(U*m(m(z*Y)-m(C*H)))+m(m(T*m(m(H*d)-m(Y*g)))+m(P*m(m(g*C)-m(d*z)))))*y)),J=m(m(m(E*W)+m(p*Z))-m(R*d)),C=m(m(m(E*d)+m(R*W))-m(B*Z)),Y=m(m(m(m(-R)*Z)-m(W*B))-m(p*d)),d=m(m(m(E*Z)+m(B*d))-m(p*W)),w[u+16>>2]=m(m(R*J)+m(m(m(E*C)-m(p*Y))-m(B*d)))-D,w[u+12>>2]=m(m(d*p)+m(m(m(E*J)-m(Y*B))-m(C*R)))-x,w[u+8>>2]=m(m(C*B)+m(m(m(E*d)-m(Y*R))-m(J*p)))-I,S=k+16|0,d=w[u+16>>2],B=w[u+12>>2],b=h+G(s,244)|0,w[b+224>>2]=w[u+8>>2]+w[b+224>>2],w[b+228>>2]=B+w[b+228>>2],w[b+232>>2]=d+w[b+232>>2])),(0|(l=l+1|0))!=(0|f););if(!((0|t)<=0)){if(b=0,1!=(0|t))for(k=-2&t,r=0;f=o[(l=b<<2)+n>>2],Zn[o[o[f>>2]+8>>2]](f),o[f+36>>2]=0,f=o[(4|l)+n>>2],Zn[o[o[f>>2]+8>>2]](f),o[f+36>>2]=0,b=b+2|0,(0|k)!=(0|(r=r+2|0)););1&t&&(r=o[(b<<2)+n>>2],Zn[o[o[r>>2]+8>>2]](r),o[r+36>>2]=0)}if(!((0|t)<=(0|(r=o[A+168>>2]))|o[A+172>>2]>=(0|t))){if(t?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](t<<3,16),r=o[A+168>>2]):l=0,!((0|r)<=0)){if(s=0,b=0,r>>>0>=4)for(h=-4&r,f=0;X=(k=b<<3)+l|0,M=k+o[A+176>>2]|0,q=o[M+4>>2],o[X>>2]=o[M>>2],o[X+4>>2]=q,M=(X=8|k)+l|0,X=X+o[A+176>>2]|0,q=o[X+4>>2],o[M>>2]=o[X>>2],o[M+4>>2]=q,M=(X=16|k)+l|0,X=X+o[A+176>>2]|0,q=o[X+4>>2],o[M>>2]=o[X>>2],o[M+4>>2]=q,X=(k|=24)+l|0,k=k+o[A+176>>2]|0,M=o[k+4>>2],o[X>>2]=o[k>>2],o[X+4>>2]=M,b=b+4|0,(0|h)!=(0|(f=f+4|0)););if(r&=3)for(;k=(f=b<<3)+l|0,f=f+o[A+176>>2]|0,h=o[f+4>>2],o[k>>2]=o[f>>2],o[k+4>>2]=h,b=b+1|0,(0|r)!=(0|(s=s+1|0)););}!(r=o[A+176>>2])||!r|!v[A+180|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+176>>2]=l,a[A+180|0]=1,o[A+172>>2]=t}if(o[A+168>>2]=t,s=0,(0|t)>0)for(l=0;b=o[A+176>>2],r=o[(k=(l<<2)+n|0)>>2],(f=o[r+44>>2])&&(o[(r=f)>>2]=0,o[r+4>>2]=0,o[r+56>>2]=0,o[r+60>>2]=0,o[r+48>>2]=0,o[r+52>>2]=0,o[r+40>>2]=0,o[r+44>>2]=0,o[r+32>>2]=0,o[r+36>>2]=0,o[r+24>>2]=0,o[r+28>>2]=0,o[r+16>>2]=0,o[r+20>>2]=0,o[r+8>>2]=0,o[r+12>>2]=0,r=o[k>>2]),f=b+(l<<3)|0,v[r+20|0]?(Zn[o[o[r>>2]+16>>2]](r,f),r=o[f>>2]):(o[f>>2]=0,o[f+4>>2]=0,r=0),s=r+s|0,(0|(l=l+1|0))!=(0|t););if(!((0|s)<=(0|(r=o[A+48>>2]))|o[A+52>>2]>=(0|s))){if(s?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](G(s,152),16),r=o[A+48>>2]):l=0,!((0|r)<=0)){if(f=1&r,b=0,1!=(0|r))for(k=-2&r,r=0;pr((h=G(b,152))+l|0,h+o[A+56>>2]|0,152),pr((h=G(1|b,152))+l|0,h+o[A+56>>2]|0,152),b=b+2|0,(0|k)!=(0|(r=r+2|0)););f&&pr((r=G(b,152))+l|0,r+o[A+56>>2]|0,152)}!(r=o[A+56>>2])||!r|!v[A+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+56>>2]=l,a[A+60|0]=1,o[A+52>>2]=s}if(o[A+48>>2]=s,(0|t)>0)for(l=o[A+176>>2];;){if(nA=AA,o[(q=(iA=fA<<3)+l|0)>>2]){if(M=o[(eA=(fA<<2)+n|0)>>2],l=o[M+32>>2],s=o[A+56>>2],f=sA(A,h=o[M+28>>2],w[c+12>>2]),b=sA(A,l,w[c+12>>2]),k=o[M+24>>2],r=o[c+20>>2],(0|(k=(0|k)>0?k:r))>o[A+184>>2]&&(o[A+184>>2]=k),X=s+G(AA,152)|0,AA=o[A+16>>2],s=0,o[q>>2]>0){for(;r=Af(X+G(s,152)|0,0,152),o[r+120>>2]=-8388609,o[r+124>>2]=2139095039,o[r+148>>2]=b,o[r+144>>2]=f,o[r+96>>2]=0,o[r+100>>2]=0,o[r+136>>2]=k,(0|(s=s+1|0))>2];);r=o[c+20>>2]}if(f=G(f,244)+AA|0,o[f+64>>2]=0,o[f+68>>2]=0,o[f+144>>2]=0,o[f+148>>2]=0,o[f+88>>2]=0,o[f+92>>2]=0,o[f+80>>2]=0,o[f+84>>2]=0,o[f+72>>2]=0,o[f+76>>2]=0,o[f+152>>2]=0,o[f+156>>2]=0,o[f+160>>2]=0,o[f+164>>2]=0,o[f+168>>2]=0,o[f+172>>2]=0,b=G(b,244)+AA|0,o[b+88>>2]=0,o[b+92>>2]=0,o[b+80>>2]=0,o[b+84>>2]=0,o[b+72>>2]=0,o[b+76>>2]=0,o[b+64>>2]=0,o[b+68>>2]=0,o[b+144>>2]=0,o[b+148>>2]=0,o[b+152>>2]=0,o[b+156>>2]=0,o[b+160>>2]=0,o[b+164>>2]=0,o[b+168>>2]=0,o[b+172>>2]=0,w[u+8>>2]=m(1)/w[c+12>>2],d=w[c+32>>2],o[u+36>>2]=X+112,o[u+32>>2]=38,o[u+28>>2]=X+32,o[u+24>>2]=X+48,o[u+20>>2]=X,o[u+16>>2]=X+16,w[u+12>>2]=d,w[X+116>>2]=w[c+40>>2],d=w[c+4>>2],o[u+52>>2]=r,o[u+48>>2]=X+124,o[u+44>>2]=X+120,o[u+40>>2]=X+116,w[u+56>>2]=d,r=o[eA>>2],Zn[o[o[r>>2]+20>>2]](r,u+8|0),o[q>>2]>0)for(k=0;d=w[o[eA>>2]+16>>2],r=X+G(k,152)|0,d<=w[r+124>>2]&&(w[r+124>>2]=d),(d=m(-d))>=w[r+120>>2]&&(w[r+120>>2]=d),o[r+132>>2]=M,s=o[M+28>>2],E=w[s+332>>2],p=w[s+328>>2],W=w[s+608>>2],J=w[s+348>>2],Z=w[s+340>>2],D=w[s+344>>2],x=w[s+612>>2],I=w[s+364>>2],C=w[s+356>>2],Y=w[s+360>>2],F=w[s+604>>2],V=w[s+324>>2],d=w[r+8>>2],B=w[r>>2],R=w[r+4>>2],o[r+76>>2]=0,w[r+72>>2]=x*m(m(I*d)+m(m(C*B)+m(R*Y))),w[r+68>>2]=W*m(m(J*d)+m(m(Z*B)+m(R*D))),w[r+64>>2]=F*m(m(E*d)+m(m(V*B)+m(p*R))),s=o[M+32>>2],J=w[s+328>>2],Z=w[s+332>>2],D=w[s+608>>2],x=w[s+348>>2],I=w[s+340>>2],C=w[s+344>>2],E=w[s+612>>2],p=w[s+364>>2],W=w[s+356>>2],Y=w[s+360>>2],F=w[s+604>>2],V=w[s+324>>2],o[r+92>>2]=0,g=E,E=w[r+40>>2],$=m(p*E),p=w[r+32>>2],H=m(W*p),W=w[r+36>>2],w[r+88>>2]=g*m($+m(H+m(Y*W))),w[r+84>>2]=D*m(m(x*E)+m(m(I*p)+m(W*C))),w[r+80>>2]=F*m(m(Z*E)+m(m(V*p)+m(J*W))),J=m(0),Z=w[h+404>>2],D=w[r+24>>2],x=w[r+16>>2],I=w[r+20>>2],g=m(m(m(m(Z*D)*D)+m(m(m(Z*x)*x)+m(I*m(Z*I))))+m(m(d*m(m(d*w[h+364>>2])+m(m(B*w[h+356>>2])+m(R*w[h+360>>2]))))+m(m(B*m(m(d*w[h+332>>2])+m(m(B*w[h+324>>2])+m(R*w[h+328>>2]))))+m(R*m(m(d*w[h+348>>2])+m(m(B*w[h+340>>2])+m(R*w[h+344>>2]))))))),Z=w[l+404>>2],C=w[r+56>>2],Y=w[r+48>>2],F=w[r+52>>2],Z=m(m(g+m(m(m(Z*C)*C)+m(m(m(Z*Y)*Y)+m(F*m(Z*F)))))+m(m(E*m(m(E*w[l+364>>2])+m(m(p*w[l+356>>2])+m(W*w[l+360>>2]))))+m(m(p*m(m(E*w[l+332>>2])+m(m(p*w[l+324>>2])+m(W*w[l+328>>2]))))+m(W*m(m(E*w[l+348>>2])+m(m(p*w[l+340>>2])+m(W*w[l+344>>2]))))))),Z=m(Q(Z))>m(1.1920928955078125e-7)?m(m(1)/Z):m(0),w[r+108>>2]=Z,V=m(0),g=m(0),H=m(0),y=m(0),U=m(0),T=m(0),o[f+240>>2]&&(T=w[f+232>>2],U=w[f+228>>2],y=w[f+224>>2],g=w[f+212>>2],H=w[f+208>>2],V=w[f+216>>2]),j=m(0),P=m(0),z=m(0),L=m(0),O=m(0),o[b+240>>2]&&(O=w[b+232>>2],L=w[b+228>>2],z=w[b+224>>2],j=w[b+212>>2],P=w[b+208>>2],J=w[b+216>>2]),_=w[h+380>>2],K=w[h+372>>2],$=w[h+376>>2],rA=w[h+396>>2],aA=w[h+388>>2],tA=w[h+392>>2],oA=w[l+380>>2],cA=w[l+372>>2],bA=w[l+376>>2],uA=w[l+396>>2],lA=w[l+388>>2],kA=w[l+392>>2],dA=w[u+56>>2],o[r+100>>2]=0,w[r+112>>2]=m(Z*w[r+112>>2])+m(Z*m(m(0)-m(dA*m(m(m(m(D*m(V+_))+m(m(x*m(H+K))+m(I*m(g+$))))+m(m(d*m(T+rA))+m(m(B*m(y+aA))+m(R*m(U+tA)))))+m(m(m(C*m(J+oA))+m(m(Y*m(P+cA))+m(F*m(j+bA))))+m(m(E*m(O+uA))+m(m(p*m(z+lA))+m(W*m(L+kA))))))))),(0|(k=k+1|0))>2];);l=o[A+176>>2],r=o[iA+l>>2]}else r=0;if(AA=nA+r|0,(0|(fA=fA+1|0))==(0|t))break}if(Zn[o[o[A>>2]+28>>2]](A,e,i,c),i=o[A+68>>2],e=o[A+28>>2],!((0|(s=o[A+128>>2]))>=(0|(n=o[A+48>>2]))|(0|n)<=o[A+132>>2])){n?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](n<<2,16),s=o[A+128>>2]):l=0,r=o[A+136>>2];A:{r:{if((0|s)>0){if(f=0,b=0,s>>>0>=4)for(h=-4&s,k=0;o[(t=b<<2)+l>>2]=o[r+t>>2],o[(X=4|t)+l>>2]=o[r+X>>2],o[(X=8|t)+l>>2]=o[r+X>>2],o[(t|=12)+l>>2]=o[r+t>>2],b=b+4|0,(0|h)!=(0|(k=k+4|0)););if(t=3&s)for(;o[(k=b<<2)+l>>2]=o[r+k>>2],b=b+1|0,(0|t)!=(0|(f=f+1|0)););if(v[A+140|0])break r;break A}if(!r|!v[A+140|0])break A}r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}o[A+136>>2]=l,o[A+132>>2]=n,a[A+140|0]=1}if(o[A+128>>2]=n,16&v[c+72|0]){if(!((0|(s=o[A+108>>2]))>=(0|(c=e<<1))|(0|c)<=o[A+112>>2])){e?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](e<<3,16),s=o[A+108>>2]):l=0,r=o[A+116>>2];A:{r:{if((0|s)>0){if(f=0,b=0,s>>>0>=4)for(h=-4&s,k=0;o[(t=b<<2)+l>>2]=o[r+t>>2],o[(X=4|t)+l>>2]=o[r+X>>2],o[(X=8|t)+l>>2]=o[r+X>>2],o[(t|=12)+l>>2]=o[r+t>>2],b=b+4|0,(0|h)!=(0|(k=k+4|0)););if(t=3&s)for(;o[(k=b<<2)+l>>2]=o[r+k>>2],b=b+1|0,(0|t)!=(0|(f=f+1|0)););if(v[A+120|0])break r;break A}if(!r|!v[A+120|0])break A}r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}o[A+116>>2]=l,o[A+112>>2]=c,a[A+120|0]=1}o[A+108>>2]=c}else{if(!((0|e)<=(0|(s=o[A+108>>2]))|(0|e)<=o[A+112>>2])){e?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](e<<2,16),s=o[A+108>>2]):l=0,r=o[A+116>>2];A:{r:{if((0|s)>0){if(f=0,b=0,s>>>0>=4)for(c=-4&s,k=0;o[(t=b<<2)+l>>2]=o[r+t>>2],o[(h=4|t)+l>>2]=o[r+h>>2],o[(h=8|t)+l>>2]=o[r+h>>2],o[(t|=12)+l>>2]=o[r+t>>2],b=b+4|0,(0|c)!=(0|(k=k+4|0)););if(t=3&s)for(;o[(c=b<<2)+l>>2]=o[r+c>>2],b=b+1|0,(0|t)!=(0|(f=f+1|0)););if(v[A+120|0])break r;break A}if(!r|!v[A+120|0])break A}r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}o[A+116>>2]=l,o[A+112>>2]=e,a[A+120|0]=1}o[A+108>>2]=e}if(!((0|i)<=(0|(s=o[A+148>>2]))|(0|i)<=o[A+152>>2])){i?(o[8488]=o[8488]+1,l=0|Zn[o[8290]](i<<2,16),s=o[A+148>>2]):l=0,r=o[A+156>>2];A:{r:{if((0|s)>0){if(f=0,b=0,s>>>0>=4)for(c=-4&s,k=0;o[(t=b<<2)+l>>2]=o[r+t>>2],o[(h=4|t)+l>>2]=o[r+h>>2],o[(h=8|t)+l>>2]=o[r+h>>2],o[(t|=12)+l>>2]=o[r+t>>2],b=b+4|0,(0|c)!=(0|(k=k+4|0)););if(t=3&s)for(;o[(c=b<<2)+l>>2]=o[r+c>>2],b=b+1|0,(0|t)!=(0|(f=f+1|0)););if(v[A+160|0])break r;break A}if(!r|!v[A+160|0])break A}r&&(o[8489]=o[8489]+1,Zn[o[8291]](r))}o[A+156>>2]=l,o[A+152>>2]=i,a[A+160|0]=1}if(o[A+148>>2]=i,!((0|n)<=0)){if(f=o[A+136>>2],r=0,b=0,n>>>0>=8)for(t=-8&n,s=0;o[f+(b<<2)>>2]=b,o[f+((c=1|b)<<2)>>2]=c,o[f+((c=2|b)<<2)>>2]=c,o[f+((c=3|b)<<2)>>2]=c,o[f+((c=4|b)<<2)>>2]=c,o[f+((c=5|b)<<2)>>2]=c,o[f+((c=6|b)<<2)>>2]=c,o[f+((c=7|b)<<2)>>2]=c,b=b+8|0,(0|t)!=(0|(s=s+8|0)););if(n&=7)for(;o[f+(b<<2)>>2]=b,b=b+1|0,(0|n)!=(0|(r=r+1|0)););}if(!((0|e)<=0)){if(f=o[A+116>>2],r=0,b=0,e>>>0>=8)for(n=-8&e,s=0;o[f+(b<<2)>>2]=b,o[f+((t=1|b)<<2)>>2]=t,o[f+((t=2|b)<<2)>>2]=t,o[f+((t=3|b)<<2)>>2]=t,o[f+((t=4|b)<<2)>>2]=t,o[f+((t=5|b)<<2)>>2]=t,o[f+((t=6|b)<<2)>>2]=t,o[f+((t=7|b)<<2)>>2]=t,b=b+8|0,(0|n)!=(0|(s=s+8|0)););if(e&=7)for(;o[f+(b<<2)>>2]=b,b=b+1|0,(0|e)!=(0|(r=r+1|0)););}if(!((0|i)<=0)){if(A=o[A+156>>2],r=0,b=0,i>>>0>=8)for(f=-8&i,s=0;o[A+(b<<2)>>2]=b,o[A+((e=1|b)<<2)>>2]=e,o[A+((e=2|b)<<2)>>2]=e,o[A+((e=3|b)<<2)>>2]=e,o[A+((e=4|b)<<2)>>2]=e,o[A+((e=5|b)<<2)>>2]=e,o[A+((e=6|b)<<2)>>2]=e,o[A+((e=7|b)<<2)>>2]=e,b=b+8|0,(0|f)!=(0|(s=s+8|0)););if(f=7&i)for(;o[A+(b<<2)>>2]=b,b=b+1|0,(0|f)!=(0|(r=r+1|0)););}return Zn[o[8295]](),S=u+256|0,m(m(0))},function(A,r,f,e,i,n,a,t,c){A|=0,r|=0,f|=0,e|=0,i|=0,n|=0,a|=0,t|=0,c|=0;var b,u=0,l=0,s=m(0),k=0;S=b=S-16|0,Zn[o[8294]](4109),Zn[o[o[A>>2]+32>>2]](A,r,f,e,i,n,a,t,c);A:if(!((0|(l=(0|(u=o[A+184>>2]))>(0|(l=o[t+20>>2]))?u:l))<=0))for(k=l-1|0,u=0;;){if(s=m(Zn[o[o[A>>2]+40>>2]](A,u,r,f,e,i,n,a,t,c)),w[A+228>>2]=s,(0|u)>=(0|k)|w[t+92>>2]>=s)break A;if((0|l)==(0|(u=u+1|0)))break}return Zn[o[8295]](),S=b+16|0,m(m(0))},function(A){A|=0,o[8793]=24120,!(A=o[8932])||!A|!v[35732]||(o[8489]=o[8489]+1,Zn[o[8291]](A)),a[35732]=1,o[8930]=0,o[8931]=0,o[8932]=0,se(35172)},hn,Bn,tn,hr,function(A){var r;return o[(A|=0)>>2]=24120,!(r=o[A+556>>2])||!r|!v[A+560|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+556>>2]=0,a[A+560|0]=1,o[A+548>>2]=0,o[A+552>>2]=0,0|se(A)},function(A){var r;o[(A|=0)>>2]=24120,!(r=o[A+556>>2])||!r|!v[A+560|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+556>>2]=0,a[A+560|0]=1,o[A+548>>2]=0,o[A+552>>2]=0,(A=se(A))&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(){return 496},function(A,r,f){return nr(A|=0,r|=0,f|=0),w[r+264>>2]=w[A+324>>2],w[r+268>>2]=w[A+328>>2],w[r+272>>2]=w[A+332>>2],w[r+276>>2]=w[A+336>>2],w[r+280>>2]=w[A+340>>2],w[r+284>>2]=w[A+344>>2],w[r+288>>2]=w[A+348>>2],w[r+292>>2]=w[A+352>>2],w[r+296>>2]=w[A+356>>2],w[r+300>>2]=w[A+360>>2],w[r+304>>2]=w[A+364>>2],w[r+308>>2]=w[A+368>>2],w[r+312>>2]=w[A+372>>2],w[r+316>>2]=w[A+376>>2],w[r+320>>2]=w[A+380>>2],w[r+324>>2]=w[A+384>>2],w[r+328>>2]=w[A+388>>2],w[r+332>>2]=w[A+392>>2],w[r+336>>2]=w[A+396>>2],w[r+340>>2]=w[A+400>>2],w[r+456>>2]=w[A+404>>2],w[r+344>>2]=w[A+604>>2],w[r+348>>2]=w[A+608>>2],w[r+352>>2]=w[A+612>>2],w[r+356>>2]=w[A+616>>2],w[r+360>>2]=w[A+408>>2],w[r+364>>2]=w[A+412>>2],w[r+368>>2]=w[A+416>>2],w[r+372>>2]=w[A+420>>2],w[r+376>>2]=w[A+424>>2],w[r+380>>2]=w[A+428>>2],w[r+384>>2]=w[A+432>>2],w[r+388>>2]=w[A+436>>2],w[r+392>>2]=w[A+440>>2],w[r+396>>2]=w[A+444>>2],w[r+400>>2]=w[A+448>>2],w[r+404>>2]=w[A+452>>2],w[r+408>>2]=w[A+456>>2],w[r+412>>2]=w[A+460>>2],w[r+416>>2]=w[A+464>>2],w[r+420>>2]=w[A+468>>2],w[r+424>>2]=w[A+472>>2],w[r+428>>2]=w[A+476>>2],w[r+432>>2]=w[A+480>>2],w[r+436>>2]=w[A+484>>2],w[r+440>>2]=w[A+488>>2],w[r+444>>2]=w[A+492>>2],w[r+448>>2]=w[A+496>>2],w[r+452>>2]=w[A+500>>2],w[r+460>>2]=w[A+504>>2],w[r+464>>2]=w[A+508>>2],o[r+492>>2]=v[A+512|0],w[r+468>>2]=w[A+516>>2],w[r+472>>2]=w[A+520>>2],w[r+476>>2]=w[A+524>>2],w[r+480>>2]=w[A+528>>2],w[r+484>>2]=w[A+532>>2],w[r+488>>2]=w[A+536>>2],8697},function(A,r){var f,e,i=0,n=0,a=0,t=0;n=r|=0,a=0|Zn[o[o[(A|=0)>>2]+16>>2]](A),t=1,i=o[o[r>>2]+16>>2],e=0|Zn[i](0|n,0|a,0|t),t=r,a=e,n=0|Zn[o[o[A>>2]+20>>2]](A,o[e+8>>2],r),f=A,i=o[o[r>>2]+20>>2],Zn[i](0|t,0|a,0|n,1497645650,0|f)},gf,function(A){gf(A|=0),DA(A)},function(A,r,f){A|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0;if(!((0|(f=o[8+(r|=0)>>2]))<=0)){if(e=o[r+16>>2],1!=(0|f))for(t=-2&f;c=o[(b=i<<2)+e>>2],3&v[c+204|0]||(o[c+208>>2]=n,n=n+1|0),o[c+268>>2]=1065353216,o[c+212>>2]=-1,c=o[e+(4|b)>>2],3&v[c+204|0]||(o[c+208>>2]=n,n=n+1|0),o[c+268>>2]=1065353216,o[c+212>>2]=-1,i=i+2|0,(0|t)!=(0|(l=l+2|0)););1&f&&(f=o[e+(i<<2)>>2],3&v[f+204|0]||(o[f+208>>2]=n,n=n+1|0),o[f+268>>2]=1065353216,o[f+212>>2]=-1)}if(e=0,c=0,b=0,l=0,!((0|n)<=(0|(f=o[A+8>>2])))){if(o[A+12>>2]<(0|n)){if(n?(o[8488]=o[8488]+1,c=0|Zn[o[8290]](n<<3,16),i=o[A+8>>2]):i=f,!((0|i)<=0)){if(i>>>0>=4)for(d=-4&i;u=(t=e<<3)+c|0,s=t+o[A+16>>2]|0,k=o[s+4>>2],o[u>>2]=o[s>>2],o[u+4>>2]=k,s=(u=8|t)+c|0,u=u+o[A+16>>2]|0,k=o[u+4>>2],o[s>>2]=o[u>>2],o[s+4>>2]=k,s=(u=16|t)+c|0,u=u+o[A+16>>2]|0,k=o[u+4>>2],o[s>>2]=o[u>>2],o[s+4>>2]=k,u=(t|=24)+c|0,t=t+o[A+16>>2]|0,s=o[t+4>>2],o[u>>2]=o[t>>2],o[u+4>>2]=s,e=e+4|0,(0|d)!=(0|(b=b+4|0)););if(i&=3)for(;b=(t=e<<3)+c|0,t=t+o[A+16>>2]|0,d=o[t+4>>2],o[b>>2]=o[t>>2],o[b+4>>2]=d,e=e+1|0,(0|i)!=(0|(l=l+1|0)););}!(i=o[A+16>>2])||!i|!v[A+20|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+16>>2]=c,a[A+20|0]=1,o[A+12>>2]=n}if(i=~f+n|0,c=n-f&3)for(e=0;l=o[A+16>>2]+(f<<3)|0,o[l>>2]=0,o[l+4>>2]=0,f=f+1|0,(0|c)!=(0|(e=e+1|0)););if(!(i>>>0<3))for(;e=(i=f<<3)+o[A+16>>2]|0,o[e>>2]=0,o[e+4>>2]=0,e=i+o[A+16>>2]|0,o[e+8>>2]=0,o[e+12>>2]=0,e=i+o[A+16>>2]|0,o[e+16>>2]=0,o[e+20>>2]=0,i=i+o[A+16>>2]|0,o[i+24>>2]=0,o[i+28>>2]=0,(0|n)!=(0|(f=f+4|0)););}if(o[A+8>>2]=n,!((0|n)<=0)){if(i=o[A+16>>2],e=0,f=0,n>>>0>=4)for(l=-4&n,c=0;o[4+(t=i+(f<<3)|0)>>2]=1,o[t>>2]=f,o[4+(b=i+((t=1|f)<<3)|0)>>2]=1,o[b>>2]=t,o[4+(b=i+((t=2|f)<<3)|0)>>2]=1,o[b>>2]=t,o[4+(b=i+((t=3|f)<<3)|0)>>2]=1,o[b>>2]=t,f=f+4|0,(0|l)!=(0|(c=c+4|0)););if(n&=3)for(;o[4+(c=i+(f<<3)|0)>>2]=1,o[c>>2]=f,f=f+1|0,(0|n)!=(0|(e=e+1|0)););}if(i=0,r=o[r+68>>2],r=0|Zn[o[o[r>>2]+36>>2]](r),(c=0|Zn[o[o[r>>2]+36>>2]](r))&&(l=0|Zn[o[o[r>>2]+20>>2]](r),!((0|c)<=0)))for(A=o[A+16>>2];;){if(!(!(f=o[o[(r=l+(i<<4)|0)>>2]>>2])|7&v[f+204|0]||!(r=o[o[r+4>>2]>>2])|7&v[r+204|0])){if(r=o[r+208>>2],(0|(f=o[f+208>>2]))!=(0|(e=o[(n=A+(f<<3)|0)>>2])))for(;f=A+(e<<3)|0,o[n>>2]=o[f>>2],(0|(f=o[f>>2]))!=(0|(e=o[(n=A+(f<<3)|0)>>2])););if((0|(e=o[(n=A+(r<<3)|0)>>2]))!=(0|r))for(;r=A+(e<<3)|0,o[n>>2]=o[r>>2],(0|(r=o[r>>2]))!=(0|(e=o[(n=A+(r<<3)|0)>>2])););(0|r)!=(0|f)&&(o[(f=A+(f<<3)|0)>>2]=r,o[4+(r=A+(r<<3)|0)>>2]=o[r+4>>2]+o[f+4>>2])}if((0|c)==(0|(i=i+1|0)))break}},function(A,r){A|=0;var f,e=0,i=0,n=0,a=0,t=0,c=0,b=0;if((0|(f=o[8+(r|=0)>>2]))>0)for(i=o[A+16>>2],b=o[r+16>>2],A=0;;){if(e=o[(n<<2)+b>>2],3&v[e+204|0])o[e+208>>2]=-1,o[e+212>>2]=-2;else{if((0|(r=A))!=(0|(t=o[(a=(c=r<<3)+i|0)>>2])))for(;r=(t<<3)+i|0,o[a>>2]=o[r>>2],(0|(r=o[r>>2]))!=(0|(t=o[(a=(r<<3)+i|0)>>2])););o[e+208>>2]=r,o[4+(i+c|0)>>2]=n,o[e+212>>2]=-1,A=A+1|0}if((0|f)==(0|(n=n+1|0)))break}},gr,function(A){gr(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A){A|=0;var r,f=0,e=0,i=0,n=0,a=0;if(S=r=S-16|0,Zn[o[8294]](7902),gA(A),0|Zn[o[o[A>>2]+20>>2]](A)&&(f=0|Zn[o[o[A>>2]+20>>2]](A),6144&Zn[o[o[f>>2]+56>>2]](f)&&!((0|(f=0|Zn[o[o[A>>2]+104>>2]](A)))<=0)&&(e=f,1&f&&(e=f-1|0,n=A,a=0|Zn[o[o[A>>2]+108>>2]](A,e),i=o[o[A>>2]+172>>2],Zn[i](0|n,0|a)),1!=(0|f))))for(;f=e-1|0,a=A,n=0|Zn[o[o[A>>2]+108>>2]](A,f),i=o[o[A>>2]+172>>2],Zn[i](0|a,0|n),e=e-2|0,n=A,a=0|Zn[o[o[A>>2]+108>>2]](A,e),i=o[o[A>>2]+172>>2],Zn[i](0|n,0|a),f>>>0>1;);if(0|Zn[o[o[A>>2]+20>>2]](A)&&(f=0|Zn[o[o[A>>2]+20>>2]](A),16387&Zn[o[o[f>>2]+56>>2]](f)&&0|Zn[o[o[A>>2]+20>>2]](A)&&(f=0|Zn[o[o[A>>2]+20>>2]](A),!(!(0|Zn[o[o[f>>2]+56>>2]](f))|o[A+296>>2]<=0))))for(e=0;f=o[o[A+304>>2]+(e<<2)>>2],Zn[o[o[f>>2]+12>>2]](f,o[A+72>>2]),(0|(e=e+1|0))>2];);0|Zn[o[o[A>>2]+20>>2]](A)&&(A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+104>>2]](A)),Zn[o[8295]](),S=r+16|0},function(A,r,f,e){wr(A|=0,r|=0,f|=0,e|=0)},function(A,r){A|=0,!(r|=0)|!(2&o[r+252>>2])?ef(A,r):Zn[o[o[A>>2]+92>>2]](A,r)},function(A,r){A|=0;var f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0;if(Zn[o[o[(r|=0)>>2]+32>>2]](r),e=0|Zn[o[o[r>>2]+16>>2]](r,104,1),f=Af(o[e+8>>2],0,104),w[f+88>>2]=w[A+264>>2],w[f+92>>2]=w[A+268>>2],w[f+96>>2]=w[A+272>>2],w[f+100>>2]=w[A+276>>2],w[f>>2]=w[A+92>>2],w[f+4>>2]=w[A+96>>2],w[f+8>>2]=w[A+100>>2],w[f+12>>2]=w[A+104>>2],w[f+16>>2]=w[A+108>>2],w[f+20>>2]=w[A+116>>2],w[f+24>>2]=w[A+120>>2],w[f+28>>2]=w[A+124>>2],w[f+32>>2]=w[A+128>>2],w[f+36>>2]=w[A+132>>2],w[f+40>>2]=w[A+148>>2],w[f+44>>2]=w[A+152>>2],w[f+48>>2]=w[A+156>>2],w[f+52>>2]=w[A+160>>2],w[f+56>>2]=w[A+176>>2],w[f+60>>2]=w[A+180>>2],o[f+64>>2]=o[A+112>>2],o[f+68>>2]=o[A+164>>2],o[f+72>>2]=o[A+168>>2],o[f+76>>2]=o[A+172>>2],i=o[A+144>>2],o[f+84>>2]=0,o[f+80>>2]=i,Zn[o[o[r>>2]+20>>2]](r,e,8856,1145853764,f),hA(A,r),f=0,(0|(i=o[A+8>>2]))>0)for(;e=o[o[A+16>>2]+(f<<2)>>2],2&v[e+252|0]&&(a=r,t=0|Zn[o[o[e>>2]+16>>2]](e),c=1,n=o[o[r>>2]+16>>2],i=0|Zn[n](0|a,0|t,0|c),c=r,t=i,a=0|Zn[o[o[e>>2]+20>>2]](e,o[i+8>>2],r),b=1497645650,u=e,n=o[o[r>>2]+20>>2],Zn[n](0|c,0|t,0|a,0|b,0|u),i=o[A+8>>2]),(0|i)>(0|(f=f+1|0)););if(o[A+228>>2]>0)for(f=0;e=o[o[A+236>>2]+(f<<2)>>2],u=r,b=0|Zn[o[o[e>>2]+36>>2]](e),a=1,n=o[o[r>>2]+16>>2],i=0|Zn[n](0|u,0|b,0|a),a=r,b=i,u=0|Zn[o[o[e>>2]+40>>2]](e,o[i+8>>2],r),t=1397641027,c=e,n=o[o[r>>2]+20>>2],Zn[n](0|a,0|b,0|u,0|t,0|c),(0|(f=f+1|0))>2];);Zn[o[o[r>>2]+36>>2]](r)},function(A,r,f,e){A|=0,r=m(r),f|=0,e=m(e);var i=0,n=0,t=0,c=m(0),b=0,u=0;A:if(f){if(w[A+284>>2]=e,r=m(w[A+280>>2]+r),w[A+280>>2]=r,!(r>=e))break A;c=r,r=m(r/e),i=m(Q(r))>2]=c-m(m(0|i)*e)}else o[A+284>>2]=0,w[A+280>>2]=v[A+316|0]?m(0):r,e=r,f=i=!(m(Q(r))>2]+20>>2]](A)&&(t=0|Zn[o[o[A>>2]+20>>2]](A),b=35849,u=Zn[o[o[t>>2]+56>>2]](t)>>>4&1,a[0|b]=u);A:if(i){if(n=(0|f)>(0|i)?i:f,Zn[o[o[A>>2]+168>>2]](A,m(e*m(0|n))),Zn[o[o[A>>2]+176>>2]](A),(0|n)<=0)break A;if(1!=(0|n))for(t=-2&n,f=0;Zn[o[o[A>>2]+160>>2]](A,e),Zn[o[o[A>>2]+80>>2]](A),Zn[o[o[A>>2]+160>>2]](A,e),Zn[o[o[A>>2]+80>>2]](A),(0|t)!=(0|(f=f+2|0)););if(!(1&n))break A;Zn[o[o[A>>2]+160>>2]](A,e),Zn[o[o[A>>2]+80>>2]](A)}else Zn[o[o[A>>2]+80>>2]](A);return Zn[o[o[A>>2]+120>>2]](A),0|i},function(A,r,f){r|=0,f|=0;var e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0;if((0|(e=o[228+(A|=0)>>2]))==o[A+232>>2]&&!((0|(b=e?e<<1:1))<=(0|e))){if(b&&(o[8488]=o[8488]+1,t=0|Zn[o[8290]](b<<2,16),e=o[A+228>>2]),!((0|e)<=0)){if(e>>>0>=4)for(u=-4&e;o[(i=n<<2)+t>>2]=o[i+o[A+236>>2]>>2],o[(c=4|i)+t>>2]=o[c+o[A+236>>2]>>2],o[(c=8|i)+t>>2]=o[c+o[A+236>>2]>>2],o[(i|=12)+t>>2]=o[i+o[A+236>>2]>>2],n=n+4|0,(0|u)!=(0|(l=l+4|0)););if(i=3&e)for(;o[(u=n<<2)+t>>2]=o[u+o[A+236>>2]>>2],n=n+1|0,(0|i)!=(0|(s=s+1|0)););}!(n=o[A+236>>2])|!v[A+240|0]||(n&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),e=o[A+228>>2]),o[A+236>>2]=t,a[A+240|0]=1,o[A+232>>2]=b}o[o[A+236>>2]+(e<<2)>>2]=r,o[A+228>>2]=e+1,f&&(UA(o[r+28>>2],r),UA(o[r+32>>2],r))},function(A,r){r|=0;var f=0,e=0,i=0,n=0;A:if(!((0|(f=o[228+(A|=0)>>2]))<=0)){for(i=o[A+236>>2];;){if(o[(n=(e<<2)+i|0)>>2]!=(0|r)){if((0|f)!=(0|(e=e+1|0)))continue;break A}break}(0|f)<=(0|e)||(e=(f=f-1|0)<<2,o[n>>2]=o[e+i>>2],o[e+o[A+236>>2]>>2]=r,o[A+228>>2]=f)}Hr(o[r+28>>2],r),Hr(o[r+32>>2],r)},function(A,r){r|=0;var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if((0|(f=o[296+(A|=0)>>2]))==o[A+300>>2]&&!((0|(c=f?f<<1:1))<=(0|f))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),f=o[A+296>>2]),!((0|f)<=0)){if(f>>>0>=4)for(b=-4&f;o[(e=i<<2)+n>>2]=o[e+o[A+304>>2]>>2],o[(t=4|e)+n>>2]=o[t+o[A+304>>2]>>2],o[(t=8|e)+n>>2]=o[t+o[A+304>>2]>>2],o[(e|=12)+n>>2]=o[e+o[A+304>>2]>>2],i=i+4|0,(0|b)!=(0|(u=u+4|0)););if(e=3&f)for(;o[(b=i<<2)+n>>2]=o[b+o[A+304>>2]>>2],i=i+1|0,(0|e)!=(0|(l=l+1|0)););}!(i=o[A+304>>2])|!v[A+308|0]||(i&&(o[8489]=o[8489]+1,Zn[o[8291]](i)),f=o[A+296>>2]),o[A+304>>2]=n,a[A+308|0]=1,o[A+300>>2]=c}o[o[A+304>>2]+(f<<2)>>2]=r,o[A+296>>2]=f+1},function(A,r){r|=0;var f=0,e=0,i=0,n=0;A:if(!((0|(f=o[296+(A|=0)>>2]))<=0)){for(i=o[A+304>>2];;){if(o[(n=(e<<2)+i|0)>>2]!=(0|r)){if((0|f)!=(0|(e=e+1|0)))continue;break A}break}(0|f)<=(0|e)||(e=(f=f-1|0)<<2,o[n>>2]=o[e+i>>2],o[e+o[A+304>>2]>>2]=r,o[A+296>>2]=f)}},function(A,r){A|=0;var f=0,e=0,i=0;if(f=o[4+(r|=0)>>2],o[A+264>>2]=o[r>>2],o[A+268>>2]=f,f=o[r+12>>2],o[A+272>>2]=o[r+8>>2],o[A+276>>2]=f,(0|(f=o[A+248>>2]))>0)for(;;){A:{switch(i=o[o[A+256>>2]+(e<<2)>>2],o[i+220>>2]-2|0){case 0:case 3:break A}1&a[i+564|0]||(Of(i,r),f=o[A+248>>2])}if(!((0|f)>(0|(e=e+1|0))))break}},function(A,r){A|=0;var f=0;f=o[268+(r|=0)>>2],o[A>>2]=o[r+264>>2],o[A+4>>2]=f,f=o[r+276>>2],o[A+8>>2]=o[r+272>>2],o[A+12>>2]=f},function(A){A|=0;var r,f=0,e=0,i=m(0),n=0;S=r=S+-64|0;A:if(v[A+290|0]){if((0|(e=o[A+8>>2]))<=0)break A;for(;!(f=o[o[A+16>>2]+(n<<2)>>2])|!(2&o[f+252>>2])|!o[f+540>>2]|3&v[f+204|0]||(tr(e=f+68|0,f+132|0,f+148|0,i=v[A+316|0]&&(i=w[A+284>>2])!=m(0)?m(w[A+280>>2]-i):m(w[A+280>>2]*w[f+268>>2]),r),f=o[f+540>>2],Zn[o[o[f>>2]+12>>2]](f,r),e=o[A+8>>2]),(0|e)>(0|(n=n+1|0)););}else if(!((0|(e=o[A+248>>2]))<=0))for(;;){r:{switch(f=o[o[A+256>>2]+(n<<2)>>2],o[f+220>>2]-2|0){case 0:case 3:break r}!o[f+540>>2]|3&v[f+204|0]||(tr(e=f+68|0,f+132|0,f+148|0,i=v[A+316|0]&&(i=w[A+284>>2])!=m(0)?m(w[A+280>>2]-i):m(w[A+280>>2]*w[f+268>>2]),r),f=o[f+540>>2],Zn[o[o[f>>2]+12>>2]](f,r),e=o[A+248>>2])}if(!((0|e)>(0|(n=n+1|0))))break}S=r- -64|0},function(A,r){A|=0;var f=0,e=0,i=0,n=0,t=0,c=0,b=0,u=0,l=0;if(3&v[204+(r|=0)|0]|1&a[r+564|0]||Of(r,A+264|0),o[r+192>>2]){if(1&a[r+204|0])4!=(-2&o[r+220>>2])&&(o[r+220>>2]=2);else{if((0|(f=o[A+248>>2]))==o[A+252>>2]&&!((0|(c=f?f<<1:1))<=(0|f))){if(c&&(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),f=o[A+248>>2]),!((0|f)<=0)){if(f>>>0>=4)for(b=-4&f;o[(e=i<<2)+n>>2]=o[e+o[A+256>>2]>>2],o[(t=4|e)+n>>2]=o[t+o[A+256>>2]>>2],o[(t=8|e)+n>>2]=o[t+o[A+256>>2]>>2],o[(e|=12)+n>>2]=o[e+o[A+256>>2]>>2],i=i+4|0,(0|b)!=(0|(u=u+4|0)););if(e=3&f)for(;o[(b=i<<2)+n>>2]=o[b+o[A+256>>2]>>2],i=i+1|0,(0|e)!=(0|(l=l+1|0)););}!(i=o[A+256>>2])|!v[A+260|0]||(i&&(o[8489]=o[8489]+1,Zn[o[8291]](i)),f=o[A+248>>2]),o[A+256>>2]=n,a[A+260|0]=1,o[A+252>>2]=c}o[o[A+256>>2]+(f<<2)>>2]=r,o[A+248>>2]=f+1}f=r,r=3&o[r+204>>2],Zn[o[o[A>>2]+36>>2]](A,f,r?2:1,r?-3:-1)}},function(A,r,f,e){A|=0,f|=0,e|=0;var i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0;if(3&v[204+(r|=0)|0]|1&a[r+564|0]||Of(r,A+264|0),o[r+192>>2]){if(1&a[r+204|0])4!=(-2&o[r+220>>2])&&(o[r+220>>2]=2);else{if((0|(i=o[A+248>>2]))==o[A+252>>2]&&!((0|(u=i?i<<1:1))<=(0|i))){if(u&&(o[8488]=o[8488]+1,c=0|Zn[o[8290]](u<<2,16),i=o[A+248>>2]),!((0|i)<=0)){if(i>>>0>=4)for(l=-4&i;o[(n=t<<2)+c>>2]=o[n+o[A+256>>2]>>2],o[(b=4|n)+c>>2]=o[b+o[A+256>>2]>>2],o[(b=8|n)+c>>2]=o[b+o[A+256>>2]>>2],o[(n|=12)+c>>2]=o[n+o[A+256>>2]>>2],t=t+4|0,(0|l)!=(0|(s=s+4|0)););if(n=3&i)for(;o[(l=t<<2)+c>>2]=o[l+o[A+256>>2]>>2],t=t+1|0,(0|n)!=(0|(k=k+1|0)););}!(t=o[A+256>>2])|!v[A+260|0]||(t&&(o[8489]=o[8489]+1,Zn[o[8291]](t)),i=o[A+248>>2]),o[A+256>>2]=c,a[A+260|0]=1,o[A+252>>2]=u}o[o[A+256>>2]+(i<<2)>>2]=r,o[A+248>>2]=i+1}Zn[o[o[A>>2]+36>>2]](A,r,f,e)}},function(A,r){r|=0;var f=0,e=0,i=0,n=0;A:if(!((0|(f=o[248+(A|=0)>>2]))<=0)){for(i=o[A+256>>2];;){if(o[(n=(e<<2)+i|0)>>2]!=(0|r)){if((0|f)!=(0|(e=e+1|0)))continue;break A}break}(0|f)<=(0|e)||(e=(f=f-1|0)<<2,o[n>>2]=o[e+i>>2],o[e+o[A+256>>2]>>2]=r,o[A+248>>2]=f)}ef(A,r)},function(A,r){r|=0;var f=0;v[289+(A|=0)|0]&&(f=o[A+216>>2])&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),o[A+216>>2]=r,a[A+289|0]=0,o[o[A+212>>2]+8>>2]=r},function(A){return o[216+(A|=0)>>2]},function(A){return o[228+(A|=0)>>2]},ni,ni,un,function(A){var r=0,f=0;if(o[248+(A|=0)>>2]>0)for(;r=o[o[A+256>>2]+(f<<2)>>2],o[r+472>>2]=0,o[r+476>>2]=0,o[r+496>>2]=0,o[r+500>>2]=0,o[r+488>>2]=0,o[r+492>>2]=0,o[r+480>>2]=0,o[r+484>>2]=0,(0|(f=f+1|0))>2];);},ui,bi,ui,bi,function(A,r){A|=0,r=m(r);var f,e=0,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=0,k=0,d=m(0);if(S=f=S-16|0,Zn[o[8294]](5587),(0|(s=o[A+248>>2]))>0)for(;e=o[o[A+256>>2]+(k<<2)>>2],3&v[e+204|0]||(i=w[e+372>>2],l=w[e+504>>2],n=ur(m(m(1)-l),r),i=m(i*n),w[e+372>>2]=i,c=m(n*w[e+376>>2]),w[e+376>>2]=c,n=m(n*w[e+380>>2]),w[e+380>>2]=n,t=w[e+388>>2],d=w[e+508>>2],a=ur(m(m(1)-d),r),t=m(t*a),w[e+388>>2]=t,b=m(a*w[e+392>>2]),w[e+392>>2]=b,a=m(a*w[e+396>>2]),w[e+396>>2]=a,v[e+512|0]&&(!(w[e+524>>2]>m(m(a*a)+m(m(t*t)+m(b*b))))|!(w[e+520>>2]>m(m(n*n)+m(m(i*i)+m(c*c))))||(u=w[e+516>>2],a=m(a*u),w[e+396>>2]=a,b=m(b*u),w[e+392>>2]=b,t=m(t*u),w[e+388>>2]=t,n=m(n*u),w[e+380>>2]=n,c=m(c*u),w[e+376>>2]=c,i=m(i*u),w[e+372>>2]=i),(u=m(N(m(m(n*n)+m(m(i*i)+m(c*c))))))m(.004999999888241291)?(l=n,n=m(m(1)/u),w[e+380>>2]=l-m(m(l*n)*m(.004999999888241291)),w[e+376>>2]=c-m(m(c*n)*m(.004999999888241291)),w[e+372>>2]=i-m(m(i*n)*m(.004999999888241291))):(o[e+372>>2]=0,o[e+376>>2]=0,o[e+380>>2]=0,o[e+384>>2]=0)),(i=m(N(m(m(a*a)+m(m(t*t)+m(b*b))))))m(.004999999888241291)?(i=m(m(1)/i),w[e+396>>2]=a-m(m(a*i)*m(.004999999888241291)),w[e+392>>2]=b-m(m(b*i)*m(.004999999888241291)),w[e+388>>2]=t-m(m(t*i)*m(.004999999888241291))):(o[e+388>>2]=0,o[e+392>>2]=0,o[e+396>>2]=0,o[e+400>>2]=0))),hi(e,r,e+68|0),s=o[A+248>>2]),(0|(k=k+1|0))<(0|s););Zn[o[8295]](),S=f+16|0},function(A,r){A|=0,r=m(r);var f,e=0,i=0,n=0,a=m(0),t=0,c=m(0),b=m(0),u=0,l=m(0),s=m(0),k=0,d=m(0),h=m(0),B=m(0),Z=m(0),Q=0,E=m(0),W=m(0),N=m(0),p=0,F=m(0),R=m(0),Y=m(0),V=0,g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0),M=m(0);if(S=f=S-16|0,Zn[o[8294]](4190),(0|(u=o[A+248>>2]))>0){if(V=o[A+256>>2],S=e=S-304|0,(0|u)>0)for(;;){i=o[(k<<2)+V>>2],o[i+268>>2]=1065353216;A:{switch(o[i+220>>2]-2|0){case 0:case 3:break A}if(!(3&v[i+204|0])){hi(i,r,e+240|0);r:{if(v[A+44|0]&&(a=w[i+276>>2],(a=m(a*a))!=m(0)&&(c=m(w[e+296>>2]-w[i+60>>2]),l=m(c*c),c=m(w[e+288>>2]-w[i+52>>2]),b=m(c*c),c=m(w[e+292>>2]-w[i+56>>2]),a>2]+4>>2]<=19&&(o[8964]=o[8964]+1,n=o[A+68>>2],n=0|Zn[o[o[n>>2]+36>>2]](n),Q=o[A+24>>2],o[e+148>>2]=-1,o[e+152>>2]=0,o[e+140>>2]=1065353216,o[e+144>>2]=1,t=o[i+64>>2],o[e+164>>2]=o[i+60>>2],o[e+168>>2]=t,t=o[i+56>>2],o[e+156>>2]=o[i+52>>2],o[e+160>>2]=t,t=o[e+300>>2],o[e+180>>2]=o[e+296>>2],o[e+184>>2]=t,t=o[e+292>>2],o[e+172>>2]=o[e+288>>2],o[e+176>>2]=t,o[e+232>>2]=Q,o[e+228>>2]=n,o[e+224>>2]=0,o[e+136>>2]=24624,o[e+220>>2]=i,a=w[i+272>>2],Q=ae(e+76|0),o[Q>>2]=21520,o[e+104>>2]=1065353216,o[e+96>>2]=1065353216,o[e+100>>2]=1065353216,o[e+80>>2]=8,o[e+124>>2]=0,o[e+116>>2]=0,o[e+120>>2]=0,o[e+108>>2]=0,o[e+112>>2]=0,o[e+132>>2]=0,w[e+128>>2]=a,w[e+112>>2]=a,w[e+224>>2]=w[A+56>>2],n=o[i+188>>2],o[e+144>>2]=o[n+4>>2],o[e+148>>2]=o[n+8>>2],n=o[e+252>>2],o[e+16>>2]=o[e+248>>2],o[e+20>>2]=n,n=o[e+244>>2],o[e+8>>2]=o[e+240>>2],o[e+12>>2]=n,n=o[e+268>>2],o[e+32>>2]=o[e+264>>2],o[e+36>>2]=n,n=o[e+260>>2],o[e+24>>2]=o[e+256>>2],o[e+28>>2]=n,n=o[e+284>>2],o[e+48>>2]=o[e+280>>2],o[e+52>>2]=n,n=o[e+276>>2],o[e+40>>2]=o[e+272>>2],o[e+44>>2]=n,n=o[e+300>>2],o[e+64>>2]=o[e+296>>2],o[e+68>>2]=n,n=o[e+292>>2],o[e+56>>2]=o[e+288>>2],o[e+60>>2]=n,t=o[12+(n=i+4|0)>>2],o[e+16>>2]=o[n+8>>2],o[e+20>>2]=t,t=o[n+4>>2],o[e+8>>2]=o[n>>2],o[e+12>>2]=t,t=o[i+32>>2],o[e+32>>2]=o[i+28>>2],o[e+36>>2]=t,t=o[i+24>>2],o[e+24>>2]=o[i+20>>2],o[e+28>>2]=t,t=o[i+48>>2],o[e+48>>2]=o[i+44>>2],o[e+52>>2]=t,t=o[i+40>>2],o[e+40>>2]=o[i+36>>2],o[e+44>>2]=t,EA(A,Q,n,e+8|0,e+136|0,m(0)),o[e+152>>2]&&(a=w[e+140>>2])>2]=a,n=e+240|0,hi(i,m(a*r),n),o[i+268>>2]=0,LA(i,n),Zn[o[8295]]()}}if((0|u)==(0|(k=k+1|0)))break}S=e+304|0}if(v[A+291|0]){if(Zn[o[8294]](5549),(0|(e=o[A+324>>2]))>0)for(;;){if(u=o[o[A+332>>2]+(p<<2)>>2],o[u+844>>2]>0){for(e=o[u+840>>2],e=o[e+252>>2]<<30>>31&e,i=o[u+836>>2],i=o[i+252>>2]<<30>>31&i,k=0;(r=m(w[i+232>>2]*w[e+232>>2]))>m(0)&&(n=u+G(k,208)|0,(a=w[n+136>>2])!=m(0)&&(E=w[n+44>>2],g=w[e+60>>2],W=w[n+40>>2],X=w[e+56>>2],N=w[n+36>>2],D=w[e+52>>2],c=m(r*m(a*m(-w[n+76>>2]))),b=m(r*m(a*m(-w[n+72>>2]))),a=m(r*m(a*m(-w[n+68>>2]))),(r=w[i+404>>2])!=m(0)&&(d=w[n+56>>2],h=w[n+60>>2],B=w[n+52>>2],Z=m(a*w[i+408>>2]),w[i+372>>2]=m(r*Z)+w[i+372>>2],s=m(b*w[i+412>>2]),w[i+376>>2]=m(r*s)+w[i+376>>2],l=r,r=m(c*w[i+416>>2]),w[i+380>>2]=m(l*r)+w[i+380>>2],l=w[i+612>>2],F=w[i+364>>2],R=w[i+356>>2],C=w[i+360>>2],J=w[i+608>>2],x=w[i+348>>2],y=w[i+340>>2],M=w[i+344>>2],B=m(B-w[i+52>>2]),Y=m(d-w[i+56>>2]),d=m(m(B*s)-m(Z*Y)),h=m(h-w[i+60>>2]),s=m(m(Y*r)-m(s*h)),r=m(m(h*Z)-m(r*B)),w[i+388>>2]=m(m(m(w[i+332>>2]*d)+m(m(w[i+324>>2]*s)+m(r*w[i+328>>2])))*w[i+604>>2])+w[i+388>>2],w[i+392>>2]=m(J*m(m(x*d)+m(m(y*s)+m(r*M))))+w[i+392>>2],w[i+396>>2]=m(l*m(m(F*d)+m(m(R*s)+m(r*C))))+w[i+396>>2]),(r=w[e+404>>2])!=m(0)&&(a=m(w[e+408>>2]*m(-a)),w[e+372>>2]=m(r*a)+w[e+372>>2],b=m(w[e+412>>2]*m(-b)),w[e+376>>2]=m(r*b)+w[e+376>>2],l=r,r=m(w[e+416>>2]*m(-c)),w[e+380>>2]=m(l*r)+w[e+380>>2],Z=w[e+612>>2],s=w[e+364>>2],d=w[e+356>>2],h=w[e+360>>2],B=w[e+608>>2],l=w[e+348>>2],F=w[e+340>>2],R=w[e+344>>2],N=m(N-D),W=m(W-X),c=m(m(N*b)-m(a*W)),E=m(E-g),b=m(m(W*r)-m(b*E)),r=m(m(E*a)-m(r*N)),w[e+388>>2]=m(m(m(w[e+332>>2]*c)+m(m(w[e+324>>2]*b)+m(r*w[e+328>>2])))*w[e+604>>2])+w[e+388>>2],w[e+392>>2]=m(B*m(m(l*c)+m(m(F*b)+m(r*R))))+w[e+392>>2],w[e+396>>2]=m(Z*m(m(s*c)+m(m(d*b)+m(r*h))))+w[e+396>>2]))),(0|(k=k+1|0))>2];);e=o[A+324>>2]}if(!((0|(p=p+1|0))<(0|e)))break}Zn[o[8295]]()}Zn[o[8295]](),S=f+16|0},function(A){A|=0;var r,f=0,e=0,i=0,n=0,a=0,t=0,c=0,b=0,u=0;if(S=r=S-16|0,Zn[o[8294]](4554),f=o[A+220>>2],Zn[o[o[f>>2]+8>>2]](f,A,o[A+24>>2]),(0|(c=o[A+324>>2]))>0)for(b=o[A+332>>2],u=o[A+220>>2];;){if(f=o[b+(t<<2)>>2],(e=o[f+836>>2])&&!(!(f=o[f+840>>2])|3&o[e+204>>2]|3&v[f+204|0])){if(f=o[f+208>>2],i=o[u+16>>2],n=o[e+208>>2],(0|(e=o[(a=i+(n<<3)|0)>>2]))!=(0|n))for(;e=i+(e<<3)|0,o[a>>2]=o[e>>2],n=o[e>>2],(0|(e=o[(a=i+(n<<3)|0)>>2]))!=(0|n););if((0|(e=o[(a=i+(f<<3)|0)>>2]))!=(0|f))for(;f=i+(e<<3)|0,o[a>>2]=o[f>>2],(0|(f=o[f>>2]))!=(0|(e=o[(a=i+(f<<3)|0)>>2])););(0|f)!=(0|n)&&(o[(e=i+(n<<3)|0)>>2]=f,o[4+(f=i+(f<<3)|0)>>2]=o[f+4>>2]+o[e+4>>2])}if((0|c)==(0|(t=t+1|0)))break}if((0|(c=o[A+228>>2]))>0)for(b=o[A+236>>2],u=o[A+220>>2],a=0;;){if(f=o[b+(a<<2)>>2],v[f+20|0]&&(e=o[f+28>>2],!(3&v[e+204|0]||(f=o[f+32>>2],3&v[f+204|0])))){if(f=o[f+208>>2],i=o[u+16>>2],n=o[e+208>>2],(0|(t=o[(e=i+(n<<3)|0)>>2]))!=(0|n))for(;n=e,e=i+(t<<3)|0,o[n>>2]=o[e>>2],n=o[e>>2],(0|(t=o[(e=i+(n<<3)|0)>>2]))!=(0|n););if((0|(t=o[(e=i+(f<<3)|0)>>2]))!=(0|f))for(;f=i+(t<<3)|0,o[e>>2]=o[f>>2],(0|(f=o[f>>2]))!=(0|(t=o[(e=i+(f<<3)|0)>>2])););(0|f)!=(0|n)&&(o[(e=i+(n<<3)|0)>>2]=f,o[4+(f=i+(f<<3)|0)>>2]=o[f+4>>2]+o[e+4>>2])}if((0|c)==(0|(a=a+1|0)))break}f=o[A+220>>2],Zn[o[o[f>>2]+12>>2]](f,A),Zn[o[8295]](),S=r+16|0},function(A,r){A|=0,r|=0;var f,e,i,n,t,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0,w=0,Z=0,G=0,m=0,Q=0,E=0,W=0,N=0,p=0,F=0,R=0,Y=0,V=0;if(S=e=S-16|0,Zn[o[8294]](3645),!((0|(b=o[A+196>>2]))>=(0|(h=o[A+228>>2])))){if((0|h)>o[A+200>>2]){if(h?(o[8488]=o[8488]+1,s=0|Zn[o[8290]](h<<2,16),c=o[A+196>>2]):c=b,!((0|c)<=0)){if(c>>>0>=4)for(d=-4&c;o[(l=k<<2)+s>>2]=o[l+o[A+204>>2]>>2],o[(Z=4|l)+s>>2]=o[Z+o[A+204>>2]>>2],o[(Z=8|l)+s>>2]=o[Z+o[A+204>>2]>>2],o[(l|=12)+s>>2]=o[l+o[A+204>>2]>>2],k=k+4|0,(0|d)!=(0|(u=u+4|0)););if(c&=3)for(;o[(u=k<<2)+s>>2]=o[u+o[A+204>>2]>>2],k=k+1|0,(0|c)!=(0|(E=E+1|0)););}!(c=o[A+204>>2])||!c|!v[A+208|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),o[A+204>>2]=s,a[A+208|0]=1,o[A+200>>2]=h}if(c=h+~b|0,u=h-b&3)for(k=0;o[o[A+204>>2]+(b<<2)>>2]=0,b=b+1|0,(0|u)!=(0|(k=k+1|0)););if(!(c>>>0<3))for(;o[(c=b<<2)+o[A+204>>2]>>2]=0,o[4+(c+o[A+204>>2]|0)>>2]=0,o[8+(c+o[A+204>>2]|0)>>2]=0,o[12+(c+o[A+204>>2]|0)>>2]=0,(0|h)!=(0|(b=b+4|0)););}if(o[A+196>>2]=h,(0|Zn[o[o[A>>2]+104>>2]](A))>0)for(b=0;o[(c=b<<2)+o[A+204>>2]>>2]=o[c+o[A+236>>2]>>2],b=b+1|0,(0|Zn[o[o[A>>2]+104>>2]](A))>(0|b););if((0|(b=o[A+196>>2]))>=2&&yr(A+192|0,e+14|0,0,b-1|0),b=(b=0|Zn[o[o[A>>2]+104>>2]](A))?o[A+204>>2]:0,c=o[A+196>>2],Y=s=o[A+212>>2],V=0|Zn[o[o[A>>2]+20>>2]](A),o[Y+20>>2]=V,o[s+16>>2]=c,o[s+12>>2]=b,o[s+4>>2]=r,!((0|(c=o[s+32>>2]))>=0)){if(o[s+36>>2]<0&&(!(b=o[s+40>>2])||!b|!v[s+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[s+44|0]=1,o[s+36>>2]=0,o[s+40>>2]=0),u=0,b=c,h=0-c&3)for(;o[o[s+40>>2]+(b<<2)>>2]=0,b=b+1|0,(0|h)!=(0|(u=u+1|0)););if(!(c>>>0>4294967292))for(;o[(c=b<<2)+o[s+40>>2]>>2]=0,o[4+(c+o[s+40>>2]|0)>>2]=0,o[8+(c+o[s+40>>2]|0)>>2]=0,o[12+(c+o[s+40>>2]|0)>>2]=0,b=b+4|0;);}if(o[s+32>>2]=0,!((0|(c=o[s+52>>2]))>=0)){if(o[s+56>>2]<0&&(!(b=o[s+60>>2])||!b|!v[s- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[s+64|0]=1,o[s+56>>2]=0,o[s+60>>2]=0),u=0,b=c,h=0-c&3)for(;o[o[s+60>>2]+(b<<2)>>2]=0,b=b+1|0,(0|h)!=(0|(u=u+1|0)););if(!(c>>>0>4294967292))for(;o[(c=b<<2)+o[s+60>>2]>>2]=0,o[4+(c+o[s+60>>2]|0)>>2]=0,o[8+(c+o[s+60>>2]|0)>>2]=0,o[12+(c+o[s+60>>2]|0)>>2]=0,b=b+4|0;);}if(o[s+52>>2]=0,!((0|(c=o[s+72>>2]))>=0)){if(o[s+76>>2]<0&&(!(b=o[s+80>>2])||!b|!v[s+84|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[s+84|0]=1,o[s+76>>2]=0,o[s+80>>2]=0),u=0,b=c,h=0-c&3)for(;o[o[s+80>>2]+(b<<2)>>2]=0,b=b+1|0,(0|h)!=(0|(u=u+1|0)););if(!(c>>>0>4294967292))for(;o[(c=b<<2)+o[s+80>>2]>>2]=0,o[4+(c+o[s+80>>2]|0)>>2]=0,o[8+(c+o[s+80>>2]|0)>>2]=0,o[12+(c+o[s+80>>2]|0)>>2]=0,b=b+4|0;);}if(o[s+72>>2]=0,b=o[A+216>>2],c=o[A+24>>2],V=b,n=o[A+8>>2],t=0|Zn[o[o[c>>2]+36>>2]](c),Y=o[o[b>>2]+8>>2],Zn[Y](0|V,0|n,0|t),l=o[A+220>>2],Z=o[A+24>>2],f=o[A+212>>2],s=0,E=0,h=A,b=0,S=p=(S=i=S-16|0)-16|0,Zn[o[8294]](2381),!((0|(A=o[l+28>>2]))>=0)){if(o[l+32>>2]<0&&(!(c=o[l+36>>2])||!c|!v[l+40|0]||(o[8489]=o[8489]+1,Zn[o[8291]](c)),a[l+40|0]=1,o[l+32>>2]=0,o[l+36>>2]=0),u=0-(c=A)&3)for(;o[o[l+36>>2]+(c<<2)>>2]=0,c=c+1|0,(0|u)!=(0|(b=b+1|0)););if(!(A>>>0>4294967292))for(;o[(A=c<<2)+o[l+36>>2]>>2]=0,o[4+(A+o[l+36>>2]|0)>>2]=0,o[8+(A+o[l+36>>2]|0)>>2]=0,o[12+(A+o[l+36>>2]|0)>>2]=0,c=c+4|0;);}if(o[l+28>>2]=0,A=0,S=w=S-16|0,!((0|(k=o[4+(B=l+4|0)>>2]))<=0)){for(d=o[B+12>>2];;){if(b=A,(0|(c=o[(u=G=d+(A<<3)|0)>>2]))!=(0|A))for(;b=d+(c<<3)|0,o[u>>2]=o[b>>2],b=o[b>>2],(0|(c=o[(u=d+(b<<3)|0)>>2]))!=(0|b););if(o[G>>2]=b,(0|k)==(0|(A=A+1|0)))break}(0|k)<2||Qf(B,w+15|0,0,k-1|0)}if(S=w+16|0,(0|(B=o[l+8>>2]))>0)for(b=0;;){for(u=(k=(0|(c=(A=b)+1|0))<(0|B)?B:c)-1|0,G=o[l+16>>2],w=o[G+(A<<3)>>2];;){if((0|u)!=(0|(c=b))){if((0|w)==o[G+((b=c+1|0)<<3)>>2])continue}else c=u,b=k;break}A:if(!(Q=(0|A)>(0|c))){if(d=1,W=1&(k=1+(c-A|0)|0),m=o[h+16>>2],u=A,(0|A)!=(0|c))for(N=-2&k,k=0;R=o[m+(o[4+(F=G+(u<<3)|0)>>2]<<2)>>2],(0|w)==o[R+208>>2]&&(d=d&4!=(0|(d=o[R+220>>2]))&1!=(0|d)),F=o[m+(o[F+12>>2]<<2)>>2],(0|w)==o[F+208>>2]&&(d=d&4!=(0|(d=o[F+220>>2]))&1!=(0|d)),u=u+2|0,(0|N)!=(0|(k=k+2|0)););if(W&&(u=o[m+(o[4+(G+(u<<3)|0)>>2]<<2)>>2],(0|w)==o[u+208>>2]&&(d&=4!=(0|(u=o[u+220>>2]))&1!=(0|u))),d){if(Q)break A;for(;u=o[o[h+16>>2]+(o[4+(o[l+16>>2]+(A<<3)|0)>>2]<<2)>>2],(0|w)==o[u+208>>2]&4!=(-2&o[u+220>>2])&&(o[u+220>>2]=2),u=(0|A)==(0|c),A=A+1|0,!u;);}else for(;u=A,A=o[o[h+16>>2]+(o[4+(o[l+16>>2]+(A<<3)|0)>>2]<<2)>>2],(0|w)!=o[A+208>>2]|2!=o[A+220>>2]||(4!=(-2&o[A+220>>2])&&(o[A+220>>2]=3),o[A+224>>2]=0),A=u+1|0,(0|c)!=(0|u););}if(!((0|b)<(0|B)))break}if((0|(m=0|Zn[o[o[Z>>2]+36>>2]](Z)))>0)for(b=0;;){if(G=0|Zn[o[o[Z>>2]+40>>2]](Z,b),A=o[G+840>>2],c=o[G+836>>2],!(!(2!=o[c+220>>2]&&c)&(!A|2==o[A+220>>2]))&&(!(2&(u=o[c+204>>2]))|4&u|2==o[c+220>>2]||ze(A,0),!(2&(u=o[A+204>>2]))|4&u|2==o[A+220>>2]||ze(c,0),v[l+64|0]&&0|Zn[o[o[Z>>2]+28>>2]](Z,c,A))){if((0|(u=o[l+28>>2]))==o[l+32>>2]&&!((0|(B=u?u<<1:1))<=(0|u))){if(B?(o[8488]=o[8488]+1,A=0|Zn[o[8290]](B<<2,16),u=o[l+28>>2]):A=0,!((0|u)<=0)){if(d=0,c=0,u>>>0>=4)for(Q=-4&u,k=0;o[(w=c<<2)+A>>2]=o[w+o[l+36>>2]>>2],o[(W=4|w)+A>>2]=o[W+o[l+36>>2]>>2],o[(W=8|w)+A>>2]=o[W+o[l+36>>2]>>2],o[(w|=12)+A>>2]=o[w+o[l+36>>2]>>2],c=c+4|0,(0|Q)!=(0|(k=k+4|0)););if(k=3&u)for(;o[(w=c<<2)+A>>2]=o[w+o[l+36>>2]>>2],c=c+1|0,(0|k)!=(0|(d=d+1|0)););}!(c=o[l+36>>2])|!v[l+40|0]||(c&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),u=o[l+28>>2]),o[l+36>>2]=A,a[l+40|0]=1,o[l+32>>2]=B}o[o[l+36>>2]+(u<<2)>>2]=G,o[l+28>>2]=u+1}if((0|m)==(0|(b=b+1|0)))break}if(Zn[o[8295]](),S=p+16|0,G=o[l+8>>2],Zn[o[8294]](4539),v[l+64|0]){if((0|(Z=o[l+28>>2]))>=2&&xr(l+24|0,i+14|0,0,Z-1|0),!((0|G)<=0))for(A=1;;){for(w=o[o[l+16>>2]+(E<<3)>>2],d=1;;){if(b=o[l+16>>2]+(E<<3)|0,(0|w)==o[b>>2]){if(p=o[o[h+16>>2]+(o[b+4>>2]<<2)>>2],(0|(c=o[l+48>>2]))==o[l+52>>2]&&!((0|(m=c?c<<1:1))<=(0|c))){if(m?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](m<<2,16),c=o[l+48>>2]):u=0,!((0|c)<=0)){if(k=0,b=0,c>>>0>=4)for(W=-4&c,Q=0;o[(B=b<<2)+u>>2]=o[B+o[l+56>>2]>>2],o[(N=4|B)+u>>2]=o[N+o[l+56>>2]>>2],o[(N=8|B)+u>>2]=o[N+o[l+56>>2]>>2],o[(B|=12)+u>>2]=o[B+o[l+56>>2]>>2],b=b+4|0,(0|W)!=(0|(Q=Q+4|0)););if(B=3&c)for(;o[(Q=b<<2)+u>>2]=o[Q+o[l+56>>2]>>2],b=b+1|0,(0|B)!=(0|(k=k+1|0)););}!(b=o[l+56>>2])|!v[l+60|0]||(b&&(o[8489]=o[8489]+1,Zn[o[8291]](b)),c=o[l+48>>2]),o[l+56>>2]=u,a[l+60|0]=1,o[l+52>>2]=m}if(o[o[l+56>>2]+(c<<2)>>2]=p,o[l+48>>2]=c+1,d&=2==(0|(b=o[p+220>>2]))|5==(0|b),(0|G)>(0|(E=E+1|0)))continue}break}if(k=0,b=0,!((0|s)>=(0|Z))&&(B=o[l+36>>2],b=o[(u=B+(s<<2)|0)>>2],(0|(c=o[o[b+836>>2]+208>>2]))<0&&(c=o[o[b+840>>2]+208>>2]),b=0,(0|c)==(0|w))){for(k=(c=(0|(A=s+1|0))<(0|Z)?Z:A)-1|0,A=s;;){if((0|A)!=(0|k)){if(m=o[B+((A=A+1|0)<<2)>>2],(0|(b=o[o[m+836>>2]+208>>2]))<0&&(b=o[o[m+840>>2]+208>>2]),(0|b)==(0|w))continue}else A=c;break}k=A-s|0,b=u}if(d||Zn[o[o[f>>2]+8>>2]](f,o[l+56>>2],o[l+48>>2],b,k,w),!((0|(c=o[l+48>>2]))>=0)){if(o[l+52>>2]<0&&(!(b=o[l+56>>2])||!b|!v[l+60|0]||(o[8489]=o[8489]+1,Zn[o[8291]](b)),a[l+60|0]=1,o[l+52>>2]=0,o[l+56>>2]=0),u=0,b=c,d=0-c&3)for(;o[o[l+56>>2]+(b<<2)>>2]=0,b=b+1|0,(0|d)!=(0|(u=u+1|0)););if(!(c>>>0>4294967292))for(;o[(c=b<<2)+o[l+56>>2]>>2]=0,o[4+(c+o[l+56>>2]|0)>>2]=0,o[8+(c+o[l+56>>2]|0)>>2]=0,o[12+(c+o[l+56>>2]|0)>>2]=0,b=b+4|0;);}if(s=k?A:s,o[l+48>>2]=0,!((0|G)>(0|E)))break}}else A=0|Zn[o[o[Z>>2]+44>>2]](Z),b=0|Zn[o[o[Z>>2]+36>>2]](Z),Zn[o[o[f>>2]+8>>2]](f,o[h+16>>2],o[h+8>>2],A,b,-1);Zn[o[8295]](),S=i+16|0,or(o[h+212>>2]),A=o[h+216>>2],Zn[o[o[A>>2]+16>>2]](A,r,o[h+72>>2]),Zn[o[8295]](),S=e+16|0},function(A,r){A|=0,r=m(r);var f,e=0,i=m(0),n=0,a=m(0),t=0,c=m(0);if(S=f=S-16|0,Zn[o[8294]](7227),o[A+248>>2]>0)for(;;){A:if(e=o[o[A+256>>2]+(t<<2)>>2]){r:{f:{switch((n=o[e+220>>2])-2|0){case 0:case 2:break f}if(i=w[e+380>>2],a=m(i*i),i=w[e+372>>2],c=m(i*i),i=w[e+376>>2],a=m(a+m(c+m(i*i))),i=w[e+532>>2],a>2],a=m(i*i),i=w[e+388>>2],c=m(i*i),i=w[e+392>>2],a=m(a+m(c+m(i*i))),i=w[e+536>>2],a>2]=w[e+224>>2]+r;break r}o[e+224>>2]=0,4!=(-2&o[e+220>>2])&&(o[e+220>>2]=0),n=o[e+220>>2]}if(4==(0|n))break A}if(v[35849]||(i=w[8299])==m(0)|!(i>2])&2!=(-2&n))4!=(-2&o[e+220>>2])&&(o[e+220>>2]=1);else{if(3&v[e+204|0]){4!=(-2&o[e+220>>2])&&(o[e+220>>2]=2);break A}if(1==(0|n)&&(4!=(-2&o[e+220>>2])&&(o[e+220>>2]=3),n=o[e+220>>2]),2!=(0|n))break A;o[e+388>>2]=0,o[e+392>>2]=0,o[e+372>>2]=0,o[e+376>>2]=0,o[e+396>>2]=0,o[e+400>>2]=0,o[e+380>>2]=0,o[e+384>>2]=0,o[e+304>>2]=o[e+304>>2]+2}}if(!((0|(t=t+1|0))>2]))break}Zn[o[8295]](),S=f+16|0},function(A,r){A|=0,r=m(r);var f,e,i,n=0,a=0;if(S=f=S-16|0,Zn[o[8294]](5999),(n=o[A+84>>2])&&Zn[0|n](A,r),Zn[o[o[A>>2]+140>>2]](A,r),n=0,o[A+32>>2]=0,w[A+28>>2]=r,e=A,i=0|Zn[o[o[A>>2]+20>>2]](A),o[e+48>>2]=i,Zn[o[o[A>>2]+164>>2]](A,r),Zn[o[o[A>>2]+44>>2]](A),Zn[o[o[A>>2]+148>>2]](A),w[A+104>>2]=r,Zn[o[o[A>>2]+152>>2]](A,A+92|0),Zn[o[o[A>>2]+144>>2]](A,r),Zn[o[8294]](4095),o[A+296>>2]>0)for(;a=o[o[A+304>>2]+(n<<2)>>2],Zn[o[o[a>>2]+8>>2]](a,A,r),(0|(n=n+1|0))>2];);Zn[o[8295]](),Zn[o[o[A>>2]+156>>2]](A,r),(n=o[A+80>>2])&&Zn[0|n](A,r),Zn[o[8295]](),S=f+16|0},function(A,r){A|=0,r=m(r);var f,e,i=0,n=0,t=0,c=0,b=m(0),u=0,l=m(0),s=0,k=m(0),d=m(0),h=m(0),B=m(0),Z=0,Q=m(0),E=0,W=0,N=0,p=0,F=0,R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=0,M=m(0),H=0,I=m(0),T=m(0);if(S=e=S-16|0,Zn[o[8294]](3728),Zn[o[8294]](4613),o[A+324>>2]>0)for(;t=o[A+24>>2],Zn[o[o[t>>2]+16>>2]](t,o[o[A+332>>2]+(i<<2)>>2]),(0|(i=i+1|0))>2];);if(!(i=o[A+332>>2])||!i|!v[A+336|0]||(o[8489]=o[8489]+1,Zn[o[8291]](i)),o[A+332>>2]=0,a[A+336|0]=1,o[A+324>>2]=0,o[A+328>>2]=0,Zn[o[8295]](),(0|(f=o[A+248>>2]))>0){if(y=o[A+256>>2],S=i=S-512|0,(0|f)>0)for(;;){t=o[(N<<2)+y>>2],o[t+268>>2]=1065353216;A:{switch(o[t+220>>2]-2|0){case 0:case 3:break A}if(!(3&v[t+204|0])&&(hi(t,r,i+448|0),v[A+44|0]&&(b=w[t+276>>2],(b=m(b*b))!=m(0)&&(l=m(w[i+504>>2]-w[t+60>>2]),k=m(l*l),l=m(w[i+496>>2]-w[t+52>>2]),Q=m(l*l),l=m(w[i+500>>2]-w[t+56>>2]),b>2]+4>>2]<=19&&(o[8964]=o[8964]+1,n=o[A+68>>2],n=0|Zn[o[o[n>>2]+36>>2]](n),u=o[A+24>>2],o[i+356>>2]=-1,o[i+360>>2]=0,o[i+348>>2]=1065353216,o[i+352>>2]=1,c=o[t+64>>2],o[i+372>>2]=o[t+60>>2],o[i+376>>2]=c,c=o[t+56>>2],o[i+364>>2]=o[t+52>>2],o[i+368>>2]=c,c=o[i+508>>2],o[i+388>>2]=o[i+504>>2],o[i+392>>2]=c,c=o[i+500>>2],o[i+380>>2]=o[i+496>>2],o[i+384>>2]=c,o[i+440>>2]=u,o[i+436>>2]=n,o[i+432>>2]=0,o[i+344>>2]=24624,o[i+428>>2]=t,b=w[t+272>>2],u=ae(i+284|0),o[u>>2]=21520,o[i+312>>2]=1065353216,o[i+304>>2]=1065353216,o[i+308>>2]=1065353216,o[i+288>>2]=8,o[i+332>>2]=0,o[i+324>>2]=0,o[i+328>>2]=0,o[i+316>>2]=0,o[i+320>>2]=0,o[i+340>>2]=0,w[i+336>>2]=b,w[i+320>>2]=b,w[i+432>>2]=w[A+56>>2],n=o[t+188>>2],o[i+352>>2]=o[n+4>>2],o[i+356>>2]=o[n+8>>2],n=o[i+460>>2],o[i+224>>2]=o[i+456>>2],o[i+228>>2]=n,n=o[i+452>>2],o[i+216>>2]=o[i+448>>2],o[i+220>>2]=n,n=o[i+476>>2],o[i+240>>2]=o[i+472>>2],o[i+244>>2]=n,n=o[i+468>>2],o[i+232>>2]=o[i+464>>2],o[i+236>>2]=n,n=o[i+492>>2],o[i+256>>2]=o[i+488>>2],o[i+260>>2]=n,n=o[i+484>>2],o[i+248>>2]=o[i+480>>2],o[i+252>>2]=n,n=o[i+508>>2],o[i+272>>2]=o[i+504>>2],o[i+276>>2]=n,n=o[i+500>>2],o[i+264>>2]=o[i+496>>2],o[i+268>>2]=n,c=o[12+(n=t+4|0)>>2],o[i+224>>2]=o[n+8>>2],o[i+228>>2]=c,c=o[n+4>>2],o[i+216>>2]=o[n>>2],o[i+220>>2]=c,c=o[t+32>>2],o[i+240>>2]=o[t+28>>2],o[i+244>>2]=c,c=o[t+24>>2],o[i+232>>2]=o[t+20>>2],o[i+236>>2]=c,c=o[t+48>>2],o[i+256>>2]=o[t+44>>2],o[i+260>>2]=c,c=o[t+40>>2],o[i+248>>2]=o[t+36>>2],o[i+252>>2]=c,EA(A,u,n,i+216|0,i+344|0,m(0)),(n=o[i+360>>2])&&(b=w[i+348>>2])>2]-w[t+52>>2])),h=m(b*m(w[i+500>>2]-w[t+56>>2])),B=m(b*m(w[i+504>>2]-w[t+60>>2])),M=m(m(m(d*m(-w[i+396>>2]))-m(h*w[i+400>>2]))-m(B*w[i+404>>2])),u=o[A+24>>2],p=0|Zn[o[o[u>>2]+12>>2]](u,t,n),(0|(n=o[A+324>>2]))==o[A+328>>2]&&!((0|(W=n?n<<1:1))<=(0|n))){if(W?(o[8488]=o[8488]+1,u=0|Zn[o[8290]](W<<2,16),n=o[A+324>>2]):u=0,!((0|n)<=0)){if(F=0,c=0,n>>>0>=4)for(H=-4&n,Z=0;o[(s=c<<2)+u>>2]=o[s+o[A+332>>2]>>2],o[(E=4|s)+u>>2]=o[E+o[A+332>>2]>>2],o[(E=8|s)+u>>2]=o[E+o[A+332>>2]>>2],o[(s|=12)+u>>2]=o[s+o[A+332>>2]>>2],c=c+4|0,(0|H)!=(0|(Z=Z+4|0)););if(s=3&n)for(;o[(Z=c<<2)+u>>2]=o[Z+o[A+332>>2]>>2],c=c+1|0,(0|s)!=(0|(F=F+1|0)););}!(c=o[A+332>>2])|!v[A+336|0]||(c&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),n=o[A+324>>2]),o[A+332>>2]=u,a[A+336|0]=1,o[A+328>>2]=W}o[o[A+332>>2]+(n<<2)>>2]=p,o[A+324>>2]=n+1,n=o[i+360>>2],Y=w[n+20>>2],V=w[n+36>>2],g=w[n+40>>2],X=w[n+8>>2],D=w[n+24>>2],b=w[n+60>>2],I=w[n+52>>2],l=w[n+56>>2],C=w[n+44>>2],k=w[n+12>>2],J=w[n+28>>2],x=w[n+4>>2],Q=w[t+60>>2],R=w[t+52>>2],T=w[t+56>>2],o[i+16>>2]=0,o[i+20>>2]=0,o[i+8>>2]=0,o[i+12>>2]=0,o[i+36>>2]=0,B=m(B+Q),d=m(d+R),h=m(h+T),R=m(m(C*B)+m(m(k*d)+m(J*h))),Q=k,k=m(-I),w[i+32>>2]=R+m(m(m(Q*k)-m(J*l))-m(C*b)),w[i+28>>2]=m(m(B*g)+m(m(d*X)+m(h*D)))+m(m(m(X*k)-m(D*l))-m(g*b)),w[i+24>>2]=m(m(B*V)+m(m(d*x)+m(h*Y)))+m(m(m(x*k)-m(Y*l))-m(V*b)),n=o[i+408>>2],o[i+80>>2]=o[i+404>>2],o[i+84>>2]=n,n=o[i+400>>2],o[i+72>>2]=o[i+396>>2],o[i+76>>2]=n,w[i+88>>2]=M,o[i+100>>2]=0,o[i+104>>2]=0,o[i+92>>2]=0,o[i+96>>2]=0,o[i+172>>2]=0,o[i+164>>2]=0,o[i+168>>2]=0,o[i+156>>2]=0,o[i+160>>2]=0,o[i+148>>2]=0,o[i+152>>2]=0,o[i+140>>2]=0,o[i+144>>2]=0,o[i+132>>2]=0,o[i+136>>2]=0,o[i+124>>2]=0,o[i+128>>2]=0,n=G(wA(p,i+8|0),208)+p|0,o[n+100>>2]=0,b=(b=m(w[t+228>>2]*w[o[i+360>>2]+228>>2]))>2]=b>m(10)?m(10):b,u=o[t+56>>2],o[n+52>>2]=o[t+52>>2],o[n+56>>2]=u,u=o[t+64>>2],o[n+60>>2]=o[t+60>>2],o[n+64>>2]=u,o[n+48>>2]=0,w[n+44>>2]=B,w[n+40>>2]=h,w[n+36>>2]=d}Zn[o[8295]]()}}if((0|f)==(0|(N=N+1|0)))break}S=i+512|0}Zn[o[8295]](),S=e+16|0},function(A,r){A|=0,r=m(r);var f=0,e=0,i=0,n=m(0),a=0,t=m(0),c=m(0),b=m(0),u=m(0);if((0|(i=o[A+8>>2]))>0)for(;!(f=o[o[A+16>>2]+(a<<2)>>2])|!(2&o[f+252>>2])|!(2&v[f+204|0])|2==o[f+220>>2]||(S=i=S-32|0,r!=m(0)&&((e=o[f+540>>2])&&Zn[o[o[e>>2]+8>>2]](e,f+4|0),o[f+384>>2]=0,n=m(m(1)/r),w[f+380>>2]=n*m(w[f+60>>2]-w[f+124>>2]),w[f+376>>2]=n*m(w[f+56>>2]-w[f+120>>2]),w[f+372>>2]=n*m(w[f+52>>2]-w[f+116>>2]),jA(f+68|0,f+4|0,i+16|0,i+12|0),c=w[i+16>>2],b=w[i+20>>2],u=w[i+24>>2],t=w[i+12>>2],o[f+400>>2]=0,w[f+396>>2]=n*m(t*u),w[f+392>>2]=n*m(t*b),w[f+388>>2]=n*m(c*t),e=o[f+384>>2],o[f+140>>2]=o[f+380>>2],o[f+144>>2]=e,e=o[f+376>>2],o[f+132>>2]=o[f+372>>2],o[f+136>>2]=e,e=o[f+392>>2],o[f+148>>2]=o[f+388>>2],o[f+152>>2]=e,e=o[f+400>>2],o[f+156>>2]=o[f+396>>2],o[f+160>>2]=e,e=o[f+8>>2],o[f+68>>2]=o[f+4>>2],o[f+72>>2]=e,e=o[f+16>>2],o[f+76>>2]=o[f+12>>2],o[f+80>>2]=e,e=o[f+24>>2],o[f+84>>2]=o[f+20>>2],o[f+88>>2]=e,e=o[f+32>>2],o[f+92>>2]=o[f+28>>2],o[f+96>>2]=e,e=o[f+48>>2],o[f+108>>2]=o[f+44>>2],o[f+112>>2]=e,e=o[f+40>>2],o[f+100>>2]=o[f+36>>2],o[f+104>>2]=e,e=o[f+64>>2],o[f+124>>2]=o[f+60>>2],o[f+128>>2]=e,e=o[f+56>>2],o[f+116>>2]=o[f+52>>2],o[f+120>>2]=e),S=i+32|0,i=o[A+8>>2]),(0|(a=a+1|0))<(0|i););},function(A,r){A|=0,r|=0;var f,e=0,i=0,n=m(0),a=m(0),t=0,c=m(0),b=0,u=0,l=m(0),s=0,k=m(0),d=m(0),h=m(0),B=0,Z=m(0),G=m(0),Q=m(0),E=m(0),W=m(0),N=m(0),p=m(0),F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=m(0);S=f=S-352|0,e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+8>>2]](f+224|0,e),e=o[f+348>>2],o[f+216>>2]=o[f+344>>2],o[f+220>>2]=e,e=o[f+340>>2],o[f+208>>2]=o[f+336>>2],o[f+212>>2]=e,e=0|Zn[o[o[A>>2]+20>>2]](A),e=0|Zn[o[o[e>>2]+56>>2]](e),b=0|Zn[o[o[A>>2]+20>>2]](A),b=0|Zn[o[o[b>>2]+56>>2]](b);A:if(!((N=w[r+40>>2])<=m(0))){i=2048&e,u=4096&b;r:switch(o[r+4>>2]-3|0){case 0:if(o[f+156>>2]=0,o[f+160>>2]=0,o[f+168>>2]=0,o[f+172>>2]=0,o[f+164>>2]=1065353216,o[f+176>>2]=0,o[f+180>>2]=0,o[f+184>>2]=1065353216,o[f+188>>2]=0,o[f+148>>2]=0,o[f+152>>2]=0,o[f+144>>2]=1065353216,e=o[r+28>>2],l=w[e+52>>2],d=w[e+8>>2],h=w[e+12>>2],k=w[e+56>>2],Z=w[e+20>>2],G=w[e+24>>2],p=w[e+28>>2],Q=w[e+60>>2],E=w[e+36>>2],n=w[r+304>>2],W=w[e+40>>2],a=w[r+308>>2],F=w[e+44>>2],R=w[e+4>>2],c=w[r+300>>2],o[f+204>>2]=0,w[f+200>>2]=Q+m(m(a*F)+m(m(c*E)+m(n*W))),w[f+196>>2]=k+m(m(a*p)+m(m(c*Z)+m(n*G))),w[f+192>>2]=l+m(m(a*h)+m(m(c*R)+m(n*d))),e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+64>>2]](e,f+144|0,N),e=o[r+32>>2],l=w[e+52>>2],d=w[e+8>>2],h=w[e+12>>2],k=w[e+56>>2],Z=w[e+20>>2],G=w[e+24>>2],p=w[e+28>>2],Q=w[e+60>>2],E=w[e+36>>2],n=w[r+320>>2],W=w[e+40>>2],a=w[r+324>>2],F=w[e+44>>2],R=w[e+4>>2],c=w[r+316>>2],o[f+204>>2]=0,w[f+200>>2]=Q+m(m(a*F)+m(m(c*E)+m(n*W))),w[f+196>>2]=k+m(m(a*p)+m(m(c*Z)+m(n*G))),w[f+192>>2]=l+m(m(a*h)+m(m(c*R)+m(n*d))),!i)break A;A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+64>>2]](A,f+144|0,N);break A;case 1:if(e=o[r+28>>2],J=w[e+52>>2],n=w[e+8>>2],a=w[e+12>>2],p=w[r+568>>2],Q=w[r+584>>2],x=w[e+56>>2],y=w[e+60>>2],E=w[r+608>>2],W=w[r+600>>2],F=w[r+604>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],R=w[r+588>>2],Y=w[r+556>>2],V=w[r+572>>2],g=w[r+592>>2],h=w[e+44>>2],X=w[r+560>>2],k=w[e+36>>2],D=w[r+576>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+552>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+200>>2]=y+m(m(E*h)+m(m(W*k)+m(Z*F))),w[f+196>>2]=x+m(m(E*c)+m(m(W*l)+m(d*F))),o[f+156>>2]=0,w[f+176>>2]=m(Q*h)+m(m(C*k)+m(p*Z)),w[f+160>>2]=m(Q*c)+m(m(C*l)+m(p*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(Q*a)+m(m(C*G)+m(p*n)),w[f+192>>2]=J+m(m(E*a)+m(m(W*G)+m(n*F))),i?(e=0|Zn[o[o[A>>2]+20>>2]](A),b=f+144|0,Zn[o[o[e>>2]+64>>2]](e,b,N),e=o[r+32>>2],J=w[e+52>>2],x=w[e+56>>2],y=w[e+60>>2],p=w[r+672>>2],Q=w[r+664>>2],E=w[r+668>>2],n=w[e+8>>2],a=w[e+12>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],W=w[r+632>>2],F=w[r+648>>2],R=w[r+652>>2],Y=w[r+620>>2],V=w[r+636>>2],g=w[r+656>>2],h=w[e+44>>2],X=w[r+624>>2],k=w[e+36>>2],D=w[r+640>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+616>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,o[f+156>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+176>>2]=m(F*h)+m(m(C*k)+m(W*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+160>>2]=m(F*c)+m(m(C*l)+m(W*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(F*a)+m(m(C*G)+m(W*n)),w[f+200>>2]=y+m(m(p*h)+m(m(Q*k)+m(Z*E))),w[f+196>>2]=x+m(m(p*c)+m(m(Q*l)+m(d*E))),w[f+192>>2]=J+m(m(p*a)+m(m(Q*G)+m(n*E))),e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+64>>2]](e,b,N)):(e=o[r+32>>2],J=w[e+52>>2],x=w[e+56>>2],y=w[e+60>>2],p=w[r+672>>2],Q=w[r+664>>2],E=w[r+668>>2],n=w[e+8>>2],a=w[e+12>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],W=w[r+632>>2],F=w[r+648>>2],R=w[r+652>>2],Y=w[r+620>>2],V=w[r+636>>2],g=w[r+656>>2],h=w[e+44>>2],X=w[r+624>>2],k=w[e+36>>2],D=w[r+640>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+616>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,o[f+156>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+176>>2]=m(F*h)+m(m(C*k)+m(W*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+160>>2]=m(F*c)+m(m(C*l)+m(W*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(F*a)+m(m(C*G)+m(W*n)),w[f+200>>2]=y+m(m(p*h)+m(m(Q*k)+m(Z*E))),w[f+196>>2]=x+m(m(p*c)+m(m(Q*l)+m(d*E))),w[f+192>>2]=J+m(m(p*a)+m(m(Q*G)+m(n*E)))),!u|(n=ve(e=r+688|0))==(a=de(e)))break A;c=w[r+692>>2],w[f+64>>2]=w[f+152>>2],w[f+68>>2]=w[f+168>>2],o[f+76>>2]=0,w[f+72>>2]=w[f+184>>2],w[f+128>>2]=w[f+144>>2],w[f+132>>2]=w[f+160>>2],o[f+140>>2]=0,w[f+136>>2]=w[f+176>>2],r=0|Zn[o[o[A>>2]+20>>2]](A),A=c>m(0),Zn[o[o[r>>2]+68>>2]](r,f+192|0,f- -64|0,f+128|0,N,N,A?n:m(0),A?a:m(6.2831854820251465),f+208|0,A,m(10));break A;case 2:if(e=o[r+28>>2],J=w[e+52>>2],n=w[e+8>>2],a=w[e+12>>2],p=w[r+316>>2],Q=w[r+332>>2],x=w[e+56>>2],y=w[e+60>>2],E=w[r+356>>2],W=w[r+348>>2],F=w[r+352>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],R=w[r+336>>2],Y=w[r+304>>2],V=w[r+320>>2],g=w[r+340>>2],h=w[e+44>>2],X=w[r+308>>2],k=w[e+36>>2],D=w[r+324>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+300>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+200>>2]=y+m(m(E*h)+m(m(W*k)+m(Z*F))),w[f+196>>2]=x+m(m(E*c)+m(m(W*l)+m(d*F))),o[f+156>>2]=0,w[f+176>>2]=m(Q*h)+m(m(C*k)+m(p*Z)),w[f+160>>2]=m(Q*c)+m(m(C*l)+m(p*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(Q*a)+m(m(C*G)+m(p*n)),w[f+192>>2]=J+m(m(E*a)+m(m(W*G)+m(n*F))),i?(e=0|Zn[o[o[A>>2]+20>>2]](A),b=f+144|0,Zn[o[o[e>>2]+64>>2]](e,b,N),e=o[r+32>>2],J=w[e+52>>2],x=w[e+56>>2],y=w[e+60>>2],p=w[r+420>>2],Q=w[r+412>>2],E=w[r+416>>2],n=w[e+8>>2],a=w[e+12>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],W=w[r+380>>2],F=w[r+396>>2],R=w[r+400>>2],Y=w[r+368>>2],V=w[r+384>>2],g=w[r+404>>2],h=w[e+44>>2],X=w[r+372>>2],k=w[e+36>>2],D=w[r+388>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+364>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,o[f+156>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+176>>2]=m(F*h)+m(m(C*k)+m(W*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+160>>2]=m(F*c)+m(m(C*l)+m(W*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(F*a)+m(m(C*G)+m(W*n)),w[f+200>>2]=y+m(m(p*h)+m(m(Q*k)+m(Z*E))),w[f+196>>2]=x+m(m(p*c)+m(m(Q*l)+m(d*E))),w[f+192>>2]=J+m(m(p*a)+m(m(Q*G)+m(n*E))),e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+64>>2]](e,b,N)):(e=o[r+32>>2],J=w[e+52>>2],x=w[e+56>>2],y=w[e+60>>2],p=w[r+420>>2],Q=w[r+412>>2],E=w[r+416>>2],n=w[e+8>>2],a=w[e+12>>2],c=w[e+28>>2],l=w[e+20>>2],d=w[e+24>>2],W=w[r+380>>2],F=w[r+396>>2],R=w[r+400>>2],Y=w[r+368>>2],V=w[r+384>>2],g=w[r+404>>2],h=w[e+44>>2],X=w[r+372>>2],k=w[e+36>>2],D=w[r+388>>2],Z=w[e+40>>2],G=w[e+4>>2],C=w[r+364>>2],o[f+204>>2]=0,o[f+188>>2]=0,o[f+172>>2]=0,o[f+156>>2]=0,w[f+184>>2]=m(g*h)+m(m(X*k)+m(D*Z)),w[f+180>>2]=m(R*h)+m(m(Y*k)+m(V*Z)),w[f+176>>2]=m(F*h)+m(m(C*k)+m(W*Z)),w[f+168>>2]=m(g*c)+m(m(X*l)+m(D*d)),w[f+164>>2]=m(R*c)+m(m(Y*l)+m(V*d)),w[f+160>>2]=m(F*c)+m(m(C*l)+m(W*d)),w[f+152>>2]=m(g*a)+m(m(X*G)+m(n*D)),w[f+148>>2]=m(R*a)+m(m(Y*G)+m(n*V)),w[f+144>>2]=m(F*a)+m(m(C*G)+m(W*n)),w[f+200>>2]=y+m(m(p*h)+m(m(Q*k)+m(Z*E))),w[f+196>>2]=x+m(m(p*c)+m(m(Q*l)+m(d*E))),w[f+192>>2]=J+m(m(p*a)+m(m(Q*G)+m(n*E)))),!u)break A;for(B=r+300|0,e=f+192|0,df(f+128|0,r,m(6.0868353843688965),N),o[f+140>>2]=0,n=w[f+136>>2],a=w[f+128>>2],c=w[f+132>>2],w[f+136>>2]=m(m(n*w[f+184>>2])+m(m(a*w[f+176>>2])+m(c*w[f+180>>2])))+w[f+200>>2],w[f+132>>2]=m(m(n*w[f+168>>2])+m(m(a*w[f+160>>2])+m(c*w[f+164>>2])))+w[f+196>>2],w[f+128>>2]=m(m(n*w[f+152>>2])+m(m(a*w[f+144>>2])+m(c*w[f+148>>2])))+w[f+192>>2],b=0;df(i=f- -64|0,r,m(m(m(0|b)*m(6.283185005187988))*m(.03125)),N),o[f+76>>2]=0,n=w[f+72>>2],a=w[f+64>>2],c=w[f+68>>2],w[f+72>>2]=m(m(n*w[f+184>>2])+m(m(a*w[f+176>>2])+m(c*w[f+180>>2])))+w[f+200>>2],w[f+68>>2]=m(m(n*w[f+168>>2])+m(m(a*w[f+160>>2])+m(c*w[f+164>>2])))+w[f+196>>2],w[f+64>>2]=m(m(n*w[f+152>>2])+m(m(a*w[f+144>>2])+m(c*w[f+148>>2])))+w[f+192>>2],u=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[u>>2]+16>>2]](u,f+128|0,i,f+208|0),3&b||(i=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[i>>2]+16>>2]](i,e,f- -64|0,f+208|0)),i=o[f+76>>2],o[f+136>>2]=o[f+72>>2],o[f+140>>2]=i,i=o[f+68>>2],o[f+128>>2]=o[f+64>>2],o[f+132>>2]=i,32!=(0|(b=b+1|0)););n=w[r+512>>2],a=w[r+452>>2],b=o[r+32>>2],w[b+404>>2]>m(0)?Cr(f- -64|0,b+4|0,r+364|0):Cr(f- -64|0,o[r+28>>2]+4|0,B),r=o[f+76>>2],o[f+152>>2]=o[f+72>>2],o[f+156>>2]=r,r=o[f+68>>2],o[f+144>>2]=o[f+64>>2],o[f+148>>2]=r,r=o[f+92>>2],o[f+168>>2]=o[f+88>>2],o[f+172>>2]=r,r=o[f+84>>2],o[f+160>>2]=o[f+80>>2],o[f+164>>2]=r,r=o[f+108>>2],o[f+184>>2]=o[f+104>>2],o[f+188>>2]=r,r=o[f+100>>2],o[f+176>>2]=o[f+96>>2],o[f+180>>2]=r,r=o[f+124>>2],o[e+8>>2]=o[f+120>>2],o[e+12>>2]=r,r=o[f+116>>2],o[e>>2]=o[f+112>>2],o[e+4>>2]=r,r=o[e+12>>2],o[f+72>>2]=o[e+8>>2],o[f+76>>2]=r,r=o[e+4>>2],o[f+64>>2]=o[e>>2],o[f+68>>2]=r,w[f+48>>2]=w[f+144>>2],w[f+52>>2]=w[f+160>>2],o[f+60>>2]=0,w[f+56>>2]=w[f+176>>2],w[f+32>>2]=w[f+148>>2],w[f+36>>2]=w[f+164>>2],o[f+44>>2]=0,w[f+40>>2]=w[f+180>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+68>>2]](A,f- -64|0,f+48|0,f+32|0,N,N,m(m(-n)-a),m(a-n),f+208|0,1,m(10));break A;case 3:case 6:if(b=o[4+(e=r+1072|0)>>2],o[f+152>>2]=o[e>>2],o[f+156>>2]=b,e=o[r+1068>>2],o[f+144>>2]=o[r+1064>>2],o[f+148>>2]=e,b=o[4+(e=r+1088|0)>>2],o[f+168>>2]=o[e>>2],o[f+172>>2]=b,b=o[4+(e=r+1080|0)>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=b,B=o[4+(b=r+1104|0)>>2],o[f+184>>2]=o[b>>2],o[f+188>>2]=B,B=o[4+(b=r+1096|0)>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=B,t=o[4+(B=r+1120|0)>>2],o[f+200>>2]=o[B>>2],o[f+204>>2]=t,t=o[4+(B=r+1112|0)>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=t,i&&(i=0|Zn[o[o[A>>2]+20>>2]](A),t=f+144|0,Zn[o[o[i>>2]+64>>2]](i,t,N),s=o[4+(i=r+1136|0)>>2],o[f+152>>2]=o[i>>2],o[f+156>>2]=s,i=o[r+1132>>2],o[f+144>>2]=o[r+1128>>2],o[f+148>>2]=i,s=o[4+(i=r+1152|0)>>2],o[f+168>>2]=o[i>>2],o[f+172>>2]=s,s=o[4+(i=r+1144|0)>>2],o[f+160>>2]=o[i>>2],o[f+164>>2]=s,s=o[4+(i=r+1168|0)>>2],o[f+184>>2]=o[i>>2],o[f+188>>2]=s,s=o[4+(i=r+1160|0)>>2],o[f+176>>2]=o[i>>2],o[f+180>>2]=s,s=o[4+(i=r+1184|0)>>2],o[f+200>>2]=o[i>>2],o[f+204>>2]=s,s=o[4+(i=r+1176|0)>>2],o[f+192>>2]=o[i>>2],o[f+196>>2]=s,i=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[i>>2]+64>>2]](i,t,N)),!u)break A;u=o[12+(i=r+1064|0)>>2],o[f+152>>2]=o[i+8>>2],o[f+156>>2]=u,u=o[i+4>>2],o[f+144>>2]=o[i>>2],o[f+148>>2]=u,u=o[e+12>>2],o[f+168>>2]=o[e+8>>2],o[f+172>>2]=u,u=o[e+4>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=u,u=o[b+12>>2],o[f+184>>2]=o[b+8>>2],o[f+188>>2]=u,u=o[b+4>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=u,u=o[B+12>>2],o[f+200>>2]=o[B+8>>2],o[f+204>>2]=u,u=o[B+4>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=u,w[f+64>>2]=w[f+152>>2],w[f+68>>2]=w[f+168>>2],o[f+76>>2]=0,w[f+72>>2]=w[f+184>>2],w[f+128>>2]=w[f+144>>2],w[f+132>>2]=w[f+160>>2],o[f+140>>2]=0,w[f+136>>2]=w[f+176>>2],n=w[r+1e3>>2],a=w[r+996>>2],c=w[r+936>>2],l=w[r+932>>2],t=0|Zn[o[o[A>>2]+20>>2]](A),u=r+1176|0,Zn[o[o[t>>2]+72>>2]](t,u,f- -64|0,f+128|0,m(N*m(.8999999761581421)),l,c,a,n,f+208|0,m(10),1),o[f+140>>2]=0,w[f+136>>2]=w[f+180>>2],w[f+132>>2]=w[f+164>>2],w[f+128>>2]=w[f+148>>2],l=w[r+1196>>2],n=w[f+128>>2],a=Kr(c=w[r+1200>>2]),d=w[f+132>>2],h=$r(c),w[f+52>>2]=m(d*h)-m(a*n),c=Kr(l),k=w[f+136>>2],l=$r(l),w[f+56>>2]=m(k*l)+m(m(n*m(c*h))+m(d*m(c*a))),w[f+48>>2]=m(m(n*m(l*h))+m(d*m(l*a)))-m(c*k),s=o[4+(t=r+1136|0)>>2],o[f+152>>2]=o[t>>2],o[f+156>>2]=s,t=o[r+1132>>2],o[f+144>>2]=o[r+1128>>2],o[f+148>>2]=t,s=o[4+(t=r+1152|0)>>2],o[f+168>>2]=o[t>>2],o[f+172>>2]=s,s=o[4+(t=r+1144|0)>>2],o[f+160>>2]=o[t>>2],o[f+164>>2]=s,s=o[4+(t=r+1168|0)>>2],o[f+184>>2]=o[t>>2],o[f+188>>2]=s,s=o[4+(t=r+1160|0)>>2],o[f+176>>2]=o[t>>2],o[f+180>>2]=s,s=o[4+(t=r+1184|0)>>2],o[f+200>>2]=o[t>>2],o[f+204>>2]=s,t=o[u+4>>2],o[f+192>>2]=o[u>>2],o[f+196>>2]=t,o[f+44>>2]=0,w[f+40>>2]=-w[f+176>>2],w[f+36>>2]=-w[f+160>>2],w[f+32>>2]=-w[f+144>>2],(n=w[r+868>>2])>(a=w[r+872>>2])?(t=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[t>>2]+68>>2]](t,u,f+32|0,f+48|0,N,N,m(-3.1415927410125732),m(3.1415927410125732),f+208|0,0,m(10))):n>2]+20>>2]](A),Zn[o[o[t>>2]+68>>2]](t,u,f+32|0,f+48|0,N,N,n,a,f+208|0,1,m(10))),u=o[i+12>>2],o[f+152>>2]=o[i+8>>2],o[f+156>>2]=u,u=o[i+4>>2],o[f+144>>2]=o[i>>2],o[f+148>>2]=u,i=o[e+12>>2],o[f+168>>2]=o[e+8>>2],o[f+172>>2]=i,i=o[e+4>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=i,e=o[b+12>>2],o[f+184>>2]=o[b+8>>2],o[f+188>>2]=e,e=o[b+4>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=e,e=o[B+12>>2],o[f+200>>2]=o[B+8>>2],o[f+204>>2]=e,e=o[B+4>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=e,e=o[r+692>>2],o[f+24>>2]=o[r+688>>2],o[f+28>>2]=e,e=o[r+684>>2],o[f+16>>2]=o[r+680>>2],o[f+20>>2]=e,e=o[r+708>>2],o[f+8>>2]=o[r+704>>2],o[f+12>>2]=e,e=o[r+700>>2],o[f>>2]=o[r+696>>2],o[f+4>>2]=e,A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+80>>2]](A,f+16|0,f,f+144|0,f+208|0);break A;case 9:if(b=o[4+(e=r+1244|0)>>2],o[f+152>>2]=o[e>>2],o[f+156>>2]=b,e=o[r+1240>>2],o[f+144>>2]=o[r+1236>>2],o[f+148>>2]=e,b=o[4+(e=r+1260|0)>>2],o[f+168>>2]=o[e>>2],o[f+172>>2]=b,b=o[4+(e=r+1252|0)>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=b,B=o[4+(b=r+1276|0)>>2],o[f+184>>2]=o[b>>2],o[f+188>>2]=B,B=o[4+(b=r+1268|0)>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=B,t=o[4+(B=r+1292|0)>>2],o[f+200>>2]=o[B>>2],o[f+204>>2]=t,t=o[4+(B=r+1284|0)>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=t,i&&(i=0|Zn[o[o[A>>2]+20>>2]](A),t=f+144|0,Zn[o[o[i>>2]+64>>2]](i,t,N),s=o[4+(i=r+1308|0)>>2],o[f+152>>2]=o[i>>2],o[f+156>>2]=s,i=o[r+1304>>2],o[f+144>>2]=o[r+1300>>2],o[f+148>>2]=i,s=o[4+(i=r+1324|0)>>2],o[f+168>>2]=o[i>>2],o[f+172>>2]=s,s=o[4+(i=r+1316|0)>>2],o[f+160>>2]=o[i>>2],o[f+164>>2]=s,s=o[4+(i=r+1340|0)>>2],o[f+184>>2]=o[i>>2],o[f+188>>2]=s,s=o[4+(i=r+1332|0)>>2],o[f+176>>2]=o[i>>2],o[f+180>>2]=s,s=o[4+(i=r+1356|0)>>2],o[f+200>>2]=o[i>>2],o[f+204>>2]=s,s=o[4+(i=r+1348|0)>>2],o[f+192>>2]=o[i>>2],o[f+196>>2]=s,i=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[i>>2]+64>>2]](i,t,N)),!u)break A;u=o[12+(i=r+1236|0)>>2],o[f+152>>2]=o[i+8>>2],o[f+156>>2]=u,u=o[i+4>>2],o[f+144>>2]=o[i>>2],o[f+148>>2]=u,u=o[e+12>>2],o[f+168>>2]=o[e+8>>2],o[f+172>>2]=u,u=o[e+4>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=u,u=o[b+12>>2],o[f+184>>2]=o[b+8>>2],o[f+188>>2]=u,u=o[b+4>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=u,u=o[B+12>>2],o[f+200>>2]=o[B+8>>2],o[f+204>>2]=u,u=o[B+4>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=u,w[f+64>>2]=w[f+152>>2],w[f+68>>2]=w[f+168>>2],o[f+76>>2]=0,w[f+72>>2]=w[f+184>>2],w[f+128>>2]=w[f+144>>2],w[f+132>>2]=w[f+160>>2],o[f+140>>2]=0,w[f+136>>2]=w[f+176>>2],n=w[r+1148>>2],a=w[r+1144>>2],c=w[r+1060>>2],l=w[r+1056>>2],t=0|Zn[o[o[A>>2]+20>>2]](A),u=r+1348|0,Zn[o[o[t>>2]+72>>2]](t,u,f- -64|0,f+128|0,m(N*m(.8999999761581421)),l,c,a,n,f+208|0,m(10),1),o[f+140>>2]=0,h=w[f+180>>2],w[f+136>>2]=h,n=w[f+164>>2],w[f+132>>2]=n,a=w[f+148>>2],w[f+128>>2]=a,c=Kr(l=w[r+1372>>2]),l=$r(l),k=w[r+1368>>2],w[f+52>>2]=m(l*n)-m(c*a),d=Kr(k),k=$r(k),w[f+56>>2]=m(h*k)+m(m(a*m(d*l))+m(n*m(d*c))),w[f+48>>2]=m(m(a*m(k*l))+m(n*m(k*c)))-m(d*h),s=o[4+(t=r+1308|0)>>2],o[f+152>>2]=o[t>>2],o[f+156>>2]=s,t=o[r+1304>>2],o[f+144>>2]=o[r+1300>>2],o[f+148>>2]=t,s=o[4+(t=r+1324|0)>>2],o[f+168>>2]=o[t>>2],o[f+172>>2]=s,s=o[4+(t=r+1316|0)>>2],o[f+160>>2]=o[t>>2],o[f+164>>2]=s,s=o[4+(t=r+1340|0)>>2],o[f+184>>2]=o[t>>2],o[f+188>>2]=s,s=o[4+(t=r+1332|0)>>2],o[f+176>>2]=o[t>>2],o[f+180>>2]=s,s=o[4+(t=r+1356|0)>>2],o[f+200>>2]=o[t>>2],o[f+204>>2]=s,t=o[u+4>>2],o[f+192>>2]=o[u>>2],o[f+196>>2]=t,o[f+44>>2]=0,w[f+40>>2]=-w[f+176>>2],w[f+36>>2]=-w[f+160>>2],w[f+32>>2]=-w[f+144>>2],(n=w[r+968>>2])>(a=w[r+972>>2])?(t=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[t>>2]+68>>2]](t,u,f+32|0,f+48|0,N,N,m(-3.1415927410125732),m(3.1415927410125732),f+208|0,0,m(10))):n>2]+20>>2]](A),Zn[o[o[t>>2]+68>>2]](t,u,f+32|0,f+48|0,N,N,n,a,f+208|0,1,m(10))),u=o[i+12>>2],o[f+152>>2]=o[i+8>>2],o[f+156>>2]=u,u=o[i+4>>2],o[f+144>>2]=o[i>>2],o[f+148>>2]=u,i=o[e+12>>2],o[f+168>>2]=o[e+8>>2],o[f+172>>2]=i,i=o[e+4>>2],o[f+160>>2]=o[e>>2],o[f+164>>2]=i,e=o[b+12>>2],o[f+184>>2]=o[b+8>>2],o[f+188>>2]=e,e=o[b+4>>2],o[f+176>>2]=o[b>>2],o[f+180>>2]=e,e=o[B+12>>2],o[f+200>>2]=o[B+8>>2],o[f+204>>2]=e,e=o[B+4>>2],o[f+192>>2]=o[B>>2],o[f+196>>2]=e,e=o[r+692>>2],o[f+24>>2]=o[r+688>>2],o[f+28>>2]=e,e=o[r+684>>2],o[f+16>>2]=o[r+680>>2],o[f+20>>2]=e,e=o[r+708>>2],o[f+8>>2]=o[r+704>>2],o[f+12>>2]=e,e=o[r+700>>2],o[f>>2]=o[r+696>>2],o[f+4>>2]=e,A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+80>>2]](A,f+16|0,f,f+144|0,f+208|0);break A;case 4:break r;default:break A}e=o[r+836>>2],o[f+152>>2]=o[r+832>>2],o[f+156>>2]=e,e=o[r+828>>2],o[f+144>>2]=o[r+824>>2],o[f+148>>2]=e,e=o[r+852>>2],o[f+168>>2]=o[r+848>>2],o[f+172>>2]=e,e=o[r+844>>2],o[f+160>>2]=o[r+840>>2],o[f+164>>2]=e,e=o[r+868>>2],o[f+184>>2]=o[r+864>>2],o[f+188>>2]=e,e=o[r+860>>2],o[f+176>>2]=o[r+856>>2],o[f+180>>2]=e,e=o[r+884>>2],o[f+200>>2]=o[r+880>>2],o[f+204>>2]=e,e=o[r+876>>2],o[f+192>>2]=o[r+872>>2],o[f+196>>2]=e,i?(e=0|Zn[o[o[A>>2]+20>>2]](A),b=f+144|0,Zn[o[o[e>>2]+64>>2]](e,b,N),e=o[r+900>>2],o[f+152>>2]=o[r+896>>2],o[f+156>>2]=e,e=o[r+892>>2],o[f+144>>2]=o[r+888>>2],o[f+148>>2]=e,e=o[r+916>>2],o[f+168>>2]=o[r+912>>2],o[f+172>>2]=e,e=o[r+908>>2],o[f+160>>2]=o[r+904>>2],o[f+164>>2]=e,e=o[r+932>>2],o[f+184>>2]=o[r+928>>2],o[f+188>>2]=e,e=o[r+924>>2],o[f+176>>2]=o[r+920>>2],o[f+180>>2]=e,e=o[r+948>>2],o[f+200>>2]=o[r+944>>2],o[f+204>>2]=e,e=o[r+940>>2],o[f+192>>2]=o[r+936>>2],o[f+196>>2]=e,e=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[e>>2]+64>>2]](e,b,N)):(e=o[r+900>>2],o[f+152>>2]=o[r+896>>2],o[f+156>>2]=e,e=o[r+892>>2],o[f+144>>2]=o[r+888>>2],o[f+148>>2]=e,e=o[r+916>>2],o[f+168>>2]=o[r+912>>2],o[f+172>>2]=e,e=o[r+908>>2],o[f+160>>2]=o[r+904>>2],o[f+164>>2]=e,e=o[r+932>>2],o[f+184>>2]=o[r+928>>2],o[f+188>>2]=e,e=o[r+924>>2],o[f+176>>2]=o[r+920>>2],o[f+180>>2]=e,e=o[r+948>>2],o[f+200>>2]=o[r+944>>2],o[f+204>>2]=e,e=o[r+940>>2],o[f+192>>2]=o[r+936>>2],o[f+196>>2]=e),u&&(e=v[r+180|0],n=w[(e?824:888)+r>>2],d=w[48+(e=e?r+824|0:r+888|0)>>2],Q=w[e+8>>2],h=w[e+4>>2],k=w[e+52>>2],E=w[e+24>>2],a=w[e+16>>2],Z=w[e+20>>2],G=w[e+56>>2],W=w[e+40>>2],c=w[e+32>>2],p=w[e+36>>2],l=w[r+184>>2],o[f+76>>2]=0,W=m(W*m(0)),F=m(p*m(0)),w[f+72>>2]=G+m(W+m(m(l*c)+F)),E=m(E*m(0)),R=m(Z*m(0)),w[f+68>>2]=k+m(E+m(m(l*a)+R)),Q=m(Q*m(0)),Y=m(h*m(0)),w[f+64>>2]=d+m(Q+m(m(l*n)+Y)),l=w[r+188>>2],o[f+140>>2]=0,w[f+136>>2]=G+m(W+m(m(l*c)+F)),w[f+132>>2]=k+m(E+m(m(l*a)+R)),w[f+128>>2]=d+m(Q+m(m(l*n)+Y)),e=0|Zn[o[o[A>>2]+20>>2]](A),b=f+208|0,Zn[o[o[e>>2]+16>>2]](e,f- -64|0,f+128|0,b),o[f+60>>2]=0,w[f+56>>2]=c,w[f+52>>2]=a,w[f+48>>2]=n,o[f+44>>2]=0,w[f+40>>2]=p,w[f+36>>2]=Z,w[f+32>>2]=h,n=w[r+196>>2],a=w[r+192>>2],A=0|Zn[o[o[A>>2]+20>>2]](A),Zn[o[o[A>>2]+68>>2]](A,r+936|0,f+48|0,f+32|0,N,N,a,n,b,1,m(10)))}S=f+352|0},function(A){var r=0,f=0,e=0;if((0|(r=o[248+(A|=0)>>2]))>0)for(;;){A:{switch(e=o[o[A+256>>2]+(f<<2)>>2],o[e+220>>2]-2|0){case 0:case 3:break A}be(e),r=o[A+248>>2]}if(!((0|r)>(0|(f=f+1|0))))break}},dn,function(A,r){A|=0,r=m(r);var f,e=0,i=0;if(S=f=S-16|0,Zn[o[8294]](4095),o[A+296>>2]>0)for(;i=o[o[A+304>>2]+(e<<2)>>2],Zn[o[o[i>>2]+8>>2]](i,A,r),(0|(e=e+1|0))>2];);Zn[o[8295]](),S=f+16|0},function(A){var r=0;return o[(A|=0)>>2]=24508,!(r=o[A+80>>2])||!r|!v[A+84|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+80>>2]=0,a[A+84|0]=1,o[A+72>>2]=0,o[A+76>>2]=0,!(r=o[A+60>>2])||!r|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+60>>2]=0,a[A+64|0]=1,o[A+52>>2]=0,o[A+56>>2]=0,!(r=o[A+40>>2])||!r|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+40>>2]=0,a[A+44|0]=1,o[A+32>>2]=0,o[A+36>>2]=0,0|A},function(A){var r=0;o[(A|=0)>>2]=24508,!(r=o[A+80>>2])||!r|!v[A+84|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+80>>2]=0,a[A+84|0]=1,o[A+72>>2]=0,o[A+76>>2]=0,!(r=o[A+60>>2])||!r|!v[A- -64|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+60>>2]=0,a[A+64|0]=1,o[A+52>>2]=0,o[A+56>>2]=0,!(r=o[A+40>>2])||!r|!v[A+44|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),DA(A)},function(A,r,f,e,i,n){A|=0,r|=0,f|=0,e|=0,i|=0;var t=0,c=0,b=0,u=0,l=0,s=0,k=0,d=0,h=0,B=0,w=0,Z=0;A:{r:{f:{if((0|(n|=0))>=0){if((0|(b=o[A+16>>2]))>0)break f;break r}return n=o[A+8>>2],void m(Zn[o[o[n>>2]+12>>2]](n,r,f,e,i,o[A+12>>2],o[A+16>>2],o[A+4>>2],o[A+20>>2],o[A+24>>2]))}for(k=o[A+12>>2];;){if(u=o[(w=k+(t<<2)|0)>>2],(0|(c=o[o[u+28>>2]+208>>2]))<0&&(c=o[o[u+32>>2]+208>>2]),(0|n)==(0|c))break r;if((0|b)==(0|(t=t+1|0)))break}w=0;break A}if(!((0|t)>=(0|b))){if(l=1&(c=b-t|0),u=o[A+12>>2],(0|b)!=(t+1|0))for(b=-2&c,k=0;d=o[(s=u+(t<<2)|0)>>2],(0|(c=o[o[d+28>>2]+208>>2]))<0&&(c=o[o[d+32>>2]+208>>2]),t=t+2|0,h=((0|n)==(0|c))+h|0,s=o[s+4>>2],(0|(c=o[o[s+28>>2]+208>>2]))<0&&(c=o[o[s+32>>2]+208>>2]),h=((0|n)==(0|c))+h|0,(0|b)!=(0|(k=k+2|0)););l&&(c=o[u+(t<<2)>>2],(0|(t=o[o[c+28>>2]+208>>2]))<0&&(t=o[o[c+32>>2]+208>>2]),h=((0|n)==(0|t))+h|0)}}if(n=o[A+4>>2],o[n+80>>2]>=2){if((0|f)>0)for(t=o[A+36>>2],c=o[A+32>>2],u=0;;){if(d=(u<<2)+r|0,(0|t)==(0|c))if((0|(b=t?t<<1:1))<=(0|t))c=t;else{if(b?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](b<<2,16),t=o[A+32>>2]):n=0,c=t,!((0|t)<=0)){if(k=0,t=0,c>>>0>=4)for(Z=-4&c,l=0;o[(s=t<<2)+n>>2]=o[s+o[A+40>>2]>>2],o[(B=4|s)+n>>2]=o[B+o[A+40>>2]>>2],o[(B=8|s)+n>>2]=o[B+o[A+40>>2]>>2],o[(s|=12)+n>>2]=o[s+o[A+40>>2]>>2],t=t+4|0,(0|Z)!=(0|(l=l+4|0)););if(l=3&c)for(;o[(s=t<<2)+n>>2]=o[s+o[A+40>>2]>>2],t=t+1|0,(0|l)!=(0|(k=k+1|0)););}!(t=o[A+40>>2])|!v[A+44|0]||(t&&(o[8489]=o[8489]+1,Zn[o[8291]](t)),c=o[A+32>>2]),o[A+40>>2]=n,a[A+44|0]=1,o[A+36>>2]=b,t=b}if(o[o[A+40>>2]+(c<<2)>>2]=o[d>>2],c=c+1|0,o[A+32>>2]=c,(0|(u=u+1|0))==(0|f))break}if((0|i)>0)for(t=o[A+56>>2],c=o[A+52>>2],u=0;;){if(b=(u<<2)+e|0,(0|t)==(0|c))if((0|(r=t?t<<1:1))<=(0|t))c=t;else{if(r?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](r<<2,16),t=o[A+52>>2]):n=0,c=t,!((0|t)<=0)){if(k=0,t=0,c>>>0>=4)for(s=-4&c,l=0;o[(f=t<<2)+n>>2]=o[f+o[A+60>>2]>>2],o[(d=4|f)+n>>2]=o[d+o[A+60>>2]>>2],o[(d=8|f)+n>>2]=o[d+o[A+60>>2]>>2],o[(f|=12)+n>>2]=o[f+o[A+60>>2]>>2],t=t+4|0,(0|s)!=(0|(l=l+4|0)););if(f=3&c)for(;o[(l=t<<2)+n>>2]=o[l+o[A+60>>2]>>2],t=t+1|0,(0|f)!=(0|(k=k+1|0)););}!(f=o[A+60>>2])|!v[A+64|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),c=o[A+52>>2]),o[A+60>>2]=n,a[A+64|0]=1,o[A+56>>2]=r,t=r}if(o[o[A+60>>2]+(c<<2)>>2]=o[b>>2],c=c+1|0,o[A+52>>2]=c,(0|(u=u+1|0))==(0|i))break}if(h)for(t=o[A+76>>2],c=o[A+72>>2],u=0;;){if(e=(u<<2)+w|0,(0|t)==(0|c))if((0|(r=t?t<<1:1))<=(0|t))c=t;else{if(r?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](r<<2,16),t=o[A+72>>2]):n=0,c=t,!((0|t)<=0)){if(k=0,t=0,c>>>0>=4)for(i=-4&c,l=0;o[(f=t<<2)+n>>2]=o[f+o[A+80>>2]>>2],o[(b=4|f)+n>>2]=o[b+o[A+80>>2]>>2],o[(b=8|f)+n>>2]=o[b+o[A+80>>2]>>2],o[(f|=12)+n>>2]=o[f+o[A+80>>2]>>2],t=t+4|0,(0|i)!=(0|(l=l+4|0)););if(f=3&c)for(;o[(i=t<<2)+n>>2]=o[i+o[A+80>>2]>>2],t=t+1|0,(0|f)!=(0|(k=k+1|0)););}!(f=o[A+80>>2])|!v[A+84|0]||(f&&(o[8489]=o[8489]+1,Zn[o[8291]](f)),c=o[A+72>>2]),o[A+80>>2]=n,a[A+84|0]=1,o[A+76>>2]=r,t=r}if(o[o[A+80>>2]+(c<<2)>>2]=o[e>>2],c=c+1|0,o[A+72>>2]=c,(0|h)==(0|(u=u+1|0)))break}else c=o[A+72>>2];o[o[A+4>>2]+80>>2]<(o[A+52>>2]+c|0)&&or(A)}else t=o[A+8>>2],m(Zn[o[o[t>>2]+12>>2]](t,r,f,e,i,w,h,n,o[A+20>>2],o[A+24>>2]))},vn,function(A,r){A|=0;var f,e,i=0;return f=o[(r|=0)>>2],e=o[A+84>>2],!(o[r+8>>2]&o[A+8>>2])|!(o[A+12>>2]&o[r+4>>2])|(0|f)==(0|e)||(A=o[A+96>>2],i=0|Zn[o[o[A>>2]+28>>2]](A,e,f)),0|i},function(A,r,f){A|=0,r|=0,f|=0;var e=0,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0);return i=m(1),(0|(e=o[r>>2]))==o[A+84>>2]|4&v[e+204|0]|m(-w[A+88>>2])<=m(m(w[r+16>>2]*m(w[A+44>>2]-w[A+28>>2]))+m(m(w[r+8>>2]*m(w[A+36>>2]-w[A+20>>2]))+m(m(w[A+40>>2]-w[A+24>>2])*w[r+12>>2])))||(i=w[r+40>>2],o[A+16>>2]=e,w[A+4>>2]=i,f?(e=o[4+(f=r+8|0)>>2],o[A+52>>2]=o[f>>2],o[A+56>>2]=e,e=o[f+12>>2],o[A+60>>2]=o[f+8>>2],o[A+64>>2]=e):(t=w[e+12>>2],c=w[e+8>>2],b=w[e+28>>2],u=w[e+20>>2],l=w[e+24>>2],s=w[e+44>>2],k=w[e+36>>2],d=w[e+40>>2],h=w[e+4>>2],i=w[r+16>>2],n=w[r+8>>2],a=w[r+12>>2],o[A- -64>>2]=0,w[A+60>>2]=m(s*i)+m(m(k*n)+m(a*d)),w[A+56>>2]=m(b*i)+m(m(u*n)+m(a*l)),w[A+52>>2]=m(t*i)+m(m(h*n)+m(c*a))),f=o[r+28>>2],o[A+68>>2]=o[r+24>>2],o[A+72>>2]=f,f=o[r+36>>2],o[A+76>>2]=o[r+32>>2],o[A+80>>2]=f,i=w[r+40>>2]),m(i)},function(A){return 0|gr(A|=0)},function(A){(A=gr(A|=0))&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r){A|=0,r=m(r);var f,e,i=0,n=0,t=m(0),c=0,b=0,u=m(0),l=0,s=m(0),k=m(0),d=m(0),h=m(0),B=0,Z=m(0),Q=0,E=0,W=0,N=0,p=0,F=m(0),R=m(0),Y=m(0),V=m(0),g=m(0),X=m(0),D=m(0),C=m(0),J=m(0),x=m(0),y=0,M=m(0),H=m(0);if(S=f=S-512|0,Zn[o[8294]](3728),S=i=S-16|0,Zn[o[8294]](4613),o[A+324>>2]>0)for(;b=o[A+24>>2],Zn[o[o[b>>2]+16>>2]](b,o[o[A+332>>2]+(n<<2)>>2]),(0|(n=n+1|0))>2];);if(!(n=o[A+332>>2])||!n|!v[A+336|0]||(o[8489]=o[8489]+1,Zn[o[8291]](n)),o[A+332>>2]=0,a[A+336|0]=1,o[A+324>>2]=0,o[A+328>>2]=0,Zn[o[8295]](),S=i+16|0,(0|(e=o[A+248>>2]))>0)for(;;){n=o[o[A+256>>2]+(W<<2)>>2],o[n+268>>2]=1065353216;A:{switch(o[n+220>>2]-2|0){case 0:case 3:break A}if(!(3&v[n+204|0])&&(hi(n,r,f+444|0),v[A+44|0]&&(t=w[n+276>>2],(t=m(t*t))!=m(0)&&(u=m(w[f+500>>2]-w[n+60>>2]),s=m(u*u),u=m(w[f+492>>2]-w[n+52>>2]),Z=m(u*u),u=m(w[f+496>>2]-w[n+56>>2]),t>2]+4>>2]<=19&&(o[f+356>>2]=-1,o[f+360>>2]=0,o[f+348>>2]=1065353216,o[f+352>>2]=1,i=o[n+64>>2],o[f+372>>2]=o[n+60>>2],o[f+376>>2]=i,i=o[n+56>>2],o[f+364>>2]=o[n+52>>2],o[f+368>>2]=i,i=o[f+504>>2],o[f+388>>2]=o[f+500>>2],o[f+392>>2]=i,i=o[f+496>>2],o[f+380>>2]=o[f+492>>2],o[f+384>>2]=i,o[f+436>>2]=A,o[f+428>>2]=0,o[f+344>>2]=25104,o[f+432>>2]=n,t=w[n+272>>2],b=ae(f+284|0),o[b>>2]=21520,o[f+312>>2]=1065353216,o[f+304>>2]=1065353216,o[f+308>>2]=1065353216,o[f+288>>2]=8,o[f+332>>2]=0,o[f+324>>2]=0,o[f+328>>2]=0,o[f+316>>2]=0,o[f+320>>2]=0,o[f+340>>2]=0,w[f+336>>2]=t,w[f+320>>2]=t,i=o[n+188>>2],o[f+352>>2]=o[i+4>>2],o[f+356>>2]=o[i+8>>2],i=o[f+456>>2],o[f+224>>2]=o[f+452>>2],o[f+228>>2]=i,i=o[f+448>>2],o[f+216>>2]=o[f+444>>2],o[f+220>>2]=i,i=o[f+472>>2],o[f+240>>2]=o[f+468>>2],o[f+244>>2]=i,i=o[f+464>>2],o[f+232>>2]=o[f+460>>2],o[f+236>>2]=i,i=o[f+488>>2],o[f+256>>2]=o[f+484>>2],o[f+260>>2]=i,i=o[f+480>>2],o[f+248>>2]=o[f+476>>2],o[f+252>>2]=i,i=o[f+504>>2],o[f+272>>2]=o[f+500>>2],o[f+276>>2]=i,i=o[f+496>>2],o[f+264>>2]=o[f+492>>2],o[f+268>>2]=i,c=o[12+(i=n+4|0)>>2],o[f+224>>2]=o[i+8>>2],o[f+228>>2]=c,c=o[i+4>>2],o[f+216>>2]=o[i>>2],o[f+220>>2]=c,c=o[n+32>>2],o[f+240>>2]=o[n+28>>2],o[f+244>>2]=c,c=o[n+24>>2],o[f+232>>2]=o[n+20>>2],o[f+236>>2]=c,c=o[n+48>>2],o[f+256>>2]=o[n+44>>2],o[f+260>>2]=c,c=o[n+40>>2],o[f+248>>2]=o[n+36>>2],o[f+252>>2]=c,EA(A,b,i,f+216|0,f+344|0,m(0)),i=o[f+360>>2])){if(t=w[f+348>>2],k=m(m(w[f+492>>2]-w[n+52>>2])*t),d=m(m(w[f+496>>2]-w[n+56>>2])*t),h=m(t*m(w[f+500>>2]-w[n+60>>2])),x=m(m(m(k*m(-w[f+396>>2]))-m(d*w[f+400>>2]))-m(h*w[f+404>>2])),b=o[A+24>>2],N=0|Zn[o[o[b>>2]+12>>2]](b,n,i),(0|(i=o[A+324>>2]))==o[A+328>>2]&&!((0|(E=i?i<<1:1))<=(0|i))){if(E?(o[8488]=o[8488]+1,b=0|Zn[o[8290]](E<<2,16),i=o[A+324>>2]):b=0,!((0|i)<=0)){if(p=0,c=0,i>>>0>=4)for(y=-4&i,B=0;o[(l=c<<2)+b>>2]=o[l+o[A+332>>2]>>2],o[(Q=4|l)+b>>2]=o[Q+o[A+332>>2]>>2],o[(Q=8|l)+b>>2]=o[Q+o[A+332>>2]>>2],o[(l|=12)+b>>2]=o[l+o[A+332>>2]>>2],c=c+4|0,(0|y)!=(0|(B=B+4|0)););if(l=3&i)for(;o[(B=c<<2)+b>>2]=o[B+o[A+332>>2]>>2],c=c+1|0,(0|l)!=(0|(p=p+1|0)););}!(c=o[A+332>>2])|!v[A+336|0]||(c&&(o[8489]=o[8489]+1,Zn[o[8291]](c)),i=o[A+324>>2]),o[A+332>>2]=b,a[A+336|0]=1,o[A+328>>2]=E}o[o[A+332>>2]+(i<<2)>>2]=N,o[A+324>>2]=i+1,i=o[f+360>>2],R=w[i+20>>2],Y=w[i+36>>2],V=w[i+40>>2],g=w[i+8>>2],X=w[i+24>>2],t=w[i+60>>2],M=w[i+52>>2],u=w[i+56>>2],D=w[i+44>>2],s=w[i+12>>2],C=w[i+28>>2],J=w[i+4>>2],Z=w[n+60>>2],F=w[n+52>>2],H=w[n+56>>2],o[f+16>>2]=0,o[f+20>>2]=0,o[f+8>>2]=0,o[f+12>>2]=0,o[f+36>>2]=0,h=m(h+Z),k=m(k+F),d=m(d+H),F=m(m(D*h)+m(m(s*k)+m(C*d))),Z=s,s=m(-M),w[f+32>>2]=F+m(m(m(Z*s)-m(C*u))-m(D*t)),w[f+28>>2]=m(m(h*V)+m(m(k*g)+m(d*X)))+m(m(m(g*s)-m(X*u))-m(V*t)),w[f+24>>2]=m(m(h*Y)+m(m(k*J)+m(d*R)))+m(m(m(J*s)-m(R*u))-m(Y*t)),i=o[f+408>>2],o[f+80>>2]=o[f+404>>2],o[f+84>>2]=i,i=o[f+400>>2],o[f+72>>2]=o[f+396>>2],o[f+76>>2]=i,w[f+88>>2]=x,o[f+100>>2]=0,o[f+104>>2]=0,o[f+92>>2]=0,o[f+96>>2]=0,o[f+172>>2]=0,o[f+164>>2]=0,o[f+168>>2]=0,o[f+156>>2]=0,o[f+160>>2]=0,o[f+148>>2]=0,o[f+152>>2]=0,o[f+140>>2]=0,o[f+144>>2]=0,o[f+132>>2]=0,o[f+136>>2]=0,o[f+124>>2]=0,o[f+128>>2]=0,o[f+208>>2]=o[n+192>>2],o[f+212>>2]=o[f+428>>2],i=G(wA(N,f+8|0),208)+N|0,o[i+100>>2]=0,t=(t=m(w[n+228>>2]*w[o[f+360>>2]+228>>2]))>2]=t>m(10)?m(10):t,b=o[n+56>>2],o[i+52>>2]=o[n+52>>2],o[i+56>>2]=b,b=o[n+64>>2],o[i+60>>2]=o[n+60>>2],o[i+64>>2]=b,o[i+48>>2]=0,w[i+44>>2]=h,w[i+40>>2]=d,w[i+36>>2]=k}Zn[o[8295]]()}}if((0|e)==(0|(W=W+1|0)))break}Zn[o[8295]](),S=f+512|0},function(A){var r=0,f=0;if(o[248+(A|=0)>>2]>0)for(;;){A:{switch(r=o[o[A+256>>2]+(f<<2)>>2],o[r+220>>2]-2|0){case 0:case 3:break A}2&v[r+204|0]||(w[r+504>>2]!=m(1)?be(r):(o[r+472>>2]=0,o[r+476>>2]=0,o[r+480>>2]=0,o[r+484>>2]=0),w[r+508>>2]==m(1)&&(o[r+488>>2]=0,o[r+492>>2]=0,o[r+496>>2]=0,o[r+500>>2]=0))}if(!((0|(f=f+1|0))>2]))break}},en,vn,function(A,r,f){return A|=0,r|=0,A=0,!(o[8+(f|=0)>>2]&o[r+4>>2])|!(o[r+8>>2]&o[f+4>>2])||(r=o[r>>2],f=o[f>>2],1&a[r+204|0]&a[f+204|0]|2==o[r+220>>2]&2==o[f+220>>2]||(A=1)),0|A},en,vn,function(A,r,f){var e;return A|=0,r|=0,A=o[(f|=0)>>2],A=4==o[A+252>>2]?A:0,!(e=o[r>>2])|4!=o[e+252>>2]||Zn[o[o[e>>2]+28>>2]](e,f,r),A&&Zn[o[o[A>>2]+28>>2]](A,r,f),0},function(A,r,f,e){var i;return A|=0,r|=0,e|=0,A=o[(f|=0)>>2],A=4==o[A+252>>2]?A:0,!(i=o[r>>2])|4!=o[i+252>>2]||Zn[o[o[i>>2]+32>>2]](i,f,e,r),A&&Zn[o[o[A>>2]+32>>2]](A,r,e,f),0},zi,vn,function(A,r){A|=0;var f,e,i=0;return f=o[(r|=0)>>2],e=o[A+88>>2],!(o[r+8>>2]&o[A+8>>2])|!(o[A+12>>2]&o[r+4>>2])|(0|f)==(0|e)||(A=o[o[A+92>>2]+24>>2],i=0|Zn[o[o[A>>2]+28>>2]](A,e,f)),0|i},function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),v=m(0);return o[A+84>>2]=o[o[r+4>>2]+8>>2],w[A+4>>2]=w[r+40>>2],e=o[r>>2],o[A+16>>2]=e,f?(f=o[r+12>>2],o[A+52>>2]=o[r+8>>2],o[A+56>>2]=f,f=o[r+20>>2],o[A+60>>2]=o[r+16>>2],o[A+64>>2]=f):(t=w[e+8>>2],c=w[e+12>>2],b=w[e+20>>2],u=w[e+24>>2],l=w[e+28>>2],s=w[e+36>>2],k=w[e+40>>2],i=w[r+12>>2],d=w[e+44>>2],n=w[r+16>>2],v=w[e+4>>2],a=w[r+8>>2],o[A- -64>>2]=0,w[A+60>>2]=m(d*n)+m(m(s*a)+m(i*k)),w[A+56>>2]=m(l*n)+m(m(b*a)+m(i*u)),w[A+52>>2]=m(c*n)+m(m(v*a)+m(t*i))),f=o[r+28>>2],o[A+68>>2]=o[r+24>>2],o[A+72>>2]=f,f=o[r+36>>2],o[A+76>>2]=o[r+32>>2],o[A+80>>2]=f,m(w[r+40>>2])},ue,function(A){ue(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f){A|=0,f|=0;var e,i=0,n=0,t=0,c=0,b=0,u=0,l=0;e=o[(r|=0)>>2];A:{r:if(!((0|(f=o[A+328>>2]))<=0)){for(n=o[A+336>>2],r=0;;){if(o[n+(r<<2)>>2]!=(0|e)){if((0|f)!=(0|(r=r+1|0)))continue;break r}break}if((0|r)!=(0|f))break A}if(o[A+332>>2]==(0|f)&&!((0|(c=f?f<<1:1))<=(0|f))){if(c?(o[8488]=o[8488]+1,n=0|Zn[o[8290]](c<<2,16),f=o[A+328>>2]):n=0,!((0|f)<=0)){if(r=0,f>>>0>=4)for(b=-4&f;o[(i=r<<2)+n>>2]=o[i+o[A+336>>2]>>2],o[(t=4|i)+n>>2]=o[t+o[A+336>>2]>>2],o[(t=8|i)+n>>2]=o[t+o[A+336>>2]>>2],o[(i|=12)+n>>2]=o[i+o[A+336>>2]>>2],r=r+4|0,(0|b)!=(0|(u=u+4|0)););if(i=3&f)for(;o[(b=r<<2)+n>>2]=o[b+o[A+336>>2]>>2],r=r+1|0,(0|i)!=(0|(l=l+1|0)););}!(r=o[A+336>>2])|!v[A+340|0]||(r&&(o[8489]=o[8489]+1,Zn[o[8291]](r)),f=o[A+328>>2]),o[A+336>>2]=n,a[A+340|0]=1,o[A+332>>2]=c}o[o[A+336>>2]+(f<<2)>>2]=e,o[A+328>>2]=f+1}},function(A,r,f,e){r|=0,f|=0,e|=0;var i=0,n=0;A:if(!((0|(f=o[328+(A|=0)>>2]))<=0)){for(n=o[r>>2],e=o[A+336>>2],r=0;;){if(o[(i=(r<<2)+e|0)>>2]!=(0|n)){if((0|f)!=(0|(r=r+1|0)))continue;break A}break}(0|r)>=(0|f)||(r=f-1|0,o[i>>2]=o[(r<<2)+e>>2],o[A+328>>2]=r)}},Pf,function(A){Pf(A|=0),A&&(o[8489]=o[8489]+1,Zn[o[8291]](A))},function(A,r,f){r|=0,f|=0;var e,i=0,n=0,t=0,c=0,b=0,u=0,l=0,s=0,k=0;t=o[188+(A|=0)>>2],e=o[r>>2];A:{r:if(!((0|(i=o[A+328>>2]))<=0)){for(c=o[A+336>>2];;){if(o[c+(n<<2)>>2]!=(0|e)){if((0|(n=n+1|0))!=(0|i))continue;break r}break}if((0|i)!=(0|n))break A}if(k=f||t,o[A+332>>2]==(0|i)&&!((0|(c=i?i<<1:1))<=(0|i))){if(c?(o[8488]=o[8488]+1,f=0|Zn[o[8290]](c<<2,16),i=o[A+328>>2]):f=0,!((0|i)<=0)){if(n=0,i>>>0>=4)for(u=-4&i;o[(t=n<<2)+f>>2]=o[t+o[A+336>>2]>>2],o[(b=4|t)+f>>2]=o[b+o[A+336>>2]>>2],o[(b=8|t)+f>>2]=o[b+o[A+336>>2]>>2],o[(t|=12)+f>>2]=o[t+o[A+336>>2]>>2],n=n+4|0,(0|u)!=(0|(l=l+4|0)););if(t=3&i)for(;o[(u=n<<2)+f>>2]=o[u+o[A+336>>2]>>2],n=n+1|0,(0|t)!=(0|(s=s+1|0)););}!(n=o[A+336>>2])|!v[A+340|0]||(n&&(o[8489]=o[8489]+1,Zn[o[8291]](n)),i=o[A+328>>2]),o[A+336>>2]=f,a[A+340|0]=1,o[A+332>>2]=c}o[o[A+336>>2]+(i<<2)>>2]=e,o[A+328>>2]=i+1,A=o[A+344>>2],Zn[o[o[A>>2]+8>>2]](A,k,r)}},function(A,r,f,e){r|=0,f|=0,e|=0;var i=0,n=0,a=0,t=0,c=0;A:if(!((0|(i=o[328+(A|=0)>>2]))<=0)){for(t=e||o[A+188>>2],c=o[r>>2],n=o[A+336>>2],e=0;;){if(o[(a=(e<<2)+n|0)>>2]!=(0|c)){if((0|i)!=(0|(e=e+1|0)))continue;break A}break}(0|e)>=(0|i)||(e=i-1|0,o[a>>2]=o[(e<<2)+n>>2],o[A+328>>2]=e,A=o[A+344>>2],Zn[o[o[A>>2]+12>>2]](A,t,r,f))}},function(){a[35919]<0&&DA(o[8977]),a[35907]<0&&DA(o[8974]),a[35895]<0&&DA(o[8971]),a[35883]<0&&DA(o[8968])},function(A){var r;return o[(A|=0)>>2]=25340,!(r=o[A+124>>2])||!r|!v[A+128|0]||(o[8489]=o[8489]+1,Zn[o[8291]](r)),o[A+124>>2]=0,a[A+128|0]=1,o[A+116>>2]=0,o[A+120>>2]=0,0|A},hn,function(A){v[62+(A|=0)|0]&&(qA(A),qA(A),qA(A),qA(A))},dn,Di,Me,function(A){return m(m(m(w[156+(A|=0)>>2]*m(.5))+w[A+152>>2]))},Me,function(A){return m(w[o[8+(A|=0)>>2]+40>>2])},vn,function(A,r,f){A|=0,r|=0,f|=0;var e,i=m(0),n=m(0),a=m(0),t=m(0),c=m(0),b=m(0),u=m(0),l=m(0),s=m(0),k=m(0),d=m(0),h=m(0);return i=m(1),(0|(e=o[r>>2]))==o[A+88>>2]|4&v[e+204|0]||(o[A+84>>2]=o[o[r+4>>2]+8>>2],i=w[r+40>>2],o[A+16>>2]=e,w[A+4>>2]=i,f?(f=o[r+12>>2],o[A+52>>2]=o[r+8>>2],o[A+56>>2]=f,f=o[r+20>>2],o[A+60>>2]=o[r+16>>2],o[A+64>>2]=f):(t=w[e+8>>2],c=w[e+12>>2],b=w[e+20>>2],u=w[e+24>>2],l=w[e+28>>2],s=w[e+36>>2],k=w[e+40>>2],i=w[r+12>>2],d=w[e+44>>2],n=w[r+16>>2],h=w[e+4>>2],a=w[r+8>>2],o[A- -64>>2]=0,w[A+60>>2]=m(d*n)+m(m(s*a)+m(i*k)),w[A+56>>2]=m(l*n)+m(m(b*a)+m(i*u)),w[A+52>>2]=m(c*n)+m(m(h*a)+m(t*i))),f=o[r+28>>2],o[A+68>>2]=o[r+24>>2],o[A+72>>2]=f,f=o[r+36>>2],o[A+76>>2]=o[r+32>>2],o[A+80>>2]=f,i=w[r+40>>2]),m(i)},Or,en,vn,Bn,Bn,function(A,r){return 0|Ue(A|=0,r|=0,0)},vn,function(A,r,f){f|=0;var e,i=0;return S=e=S+-64|0,i=1,Ue(A|=0,r|=0,0)||(i=0,r&&(i=0,(r=qr(r,30100))&&(Af(e+12|0,0,52),o[e+56>>2]=1,o[e+20>>2]=-1,o[e+16>>2]=A,o[e+8>>2]=r,Zn[o[o[r>>2]+28>>2]](r,e+8|0,o[f>>2],1),1==(0|(A=o[e+32>>2]))&&(o[f>>2]=o[e+24>>2]),i=1==(0|A)))),S=e- -64|0,0|i},function(A,r,f,e,i,n){f|=0,e|=0,i|=0,n|=0,Ue(A|=0,o[8+(r|=0)>>2],n)&&Tf(r,f,e,i)},function(A,r,f,e,i){if(f|=0,e|=0,i|=0,Ue(A|=0,o[8+(r|=0)>>2],i))1==o[r+28>>2]|o[r+4>>2]!=(0|f)||(o[r+28>>2]=e);else A:if(Ue(A,o[r>>2],i)){if(!(o[r+16>>2]!=(0|f)&o[r+20>>2]!=(0|f))){if(1!=(0|e))break A;return void(o[r+32>>2]=1)}o[r+20>>2]=f,o[r+32>>2]=e,o[r+40>>2]=o[r+40>>2]+1,1!=o[r+36>>2]|2!=o[r+24>>2]||(a[r+54|0]=1),o[r+44>>2]=4}},function(A,r,f,e){f|=0,e|=0,Ue(A|=0,o[8+(r|=0)>>2],0)&&ie(r,f,e)},vn,function(A,r,f,e,i,n){f|=0,e|=0,i|=0,n|=0,Ue(A|=0,o[8+(r|=0)>>2],n)?Tf(r,f,e,i):(A=o[A+8>>2],Zn[o[o[A>>2]+20>>2]](A,r,f,e,i,n))},function(A,r,f,e,i){if(f|=0,e|=0,i|=0,Ue(A|=0,o[8+(r|=0)>>2],i))1==o[r+28>>2]|o[r+4>>2]!=(0|f)||(o[r+28>>2]=e);else A:{if(Ue(A,o[r>>2],i)){if(!(o[r+16>>2]!=(0|f)&o[r+20>>2]!=(0|f))){if(1!=(0|e))break A;return void(o[r+32>>2]=1)}o[r+32>>2]=e;r:if(4!=o[r+44>>2]){if(t[r+52>>1]=0,A=o[A+8>>2],Zn[o[o[A>>2]+20>>2]](A,r,f,f,1,i),v[r+53|0]){if(o[r+44>>2]=3,!v[r+52|0])break r;break A}o[r+44>>2]=4}if(o[r+20>>2]=f,o[r+40>>2]=o[r+40>>2]+1,1!=o[r+36>>2]|2!=o[r+24>>2])break A;return void(a[r+54|0]=1)}A=o[A+8>>2],Zn[o[o[A>>2]+24>>2]](A,r,f,e,i)}},function(A,r,f,e){f|=0,e|=0,Ue(A|=0,o[8+(r|=0)>>2],0)?ie(r,f,e):(A=o[A+8>>2],Zn[o[o[A>>2]+28>>2]](A,r,f,e))},vn,function(A,r,f,e,i,n){f|=0,e|=0,i|=0,n|=0;var c,b=0,u=0,l=0,s=0,k=0,d=0;if(Ue(A|=0,o[8+(r|=0)>>2],n))Tf(r,f,e,i);else{b=v[r+53|0],s=o[A+12>>2],a[r+53|0]=0,u=v[r+52|0],a[r+52|0]=0,Ce(c=A+16|0,r,f,e,i,n),b|=k=v[r+53|0],u|=d=v[r+52|0];A:if(!((l=A+24|0)>>>0>=(s=(s<<3)+c|0)>>>0))for(;;){if(v[r+54|0])break A;r:{if(d){if(1==o[r+24>>2])break A;if(2&v[A+8|0])break r;break A}if(k&&!(1&a[A+8|0]))break A}if(t[r+52>>1]=0,Ce(l,r,f,e,i,n),b|=k=v[r+53|0],u|=d=v[r+52|0],!(s>>>0>(l=l+8|0)>>>0))break}a[r+53|0]=!!(255&b),a[r+52|0]=!!(255&u)}},function(A,r,f,e,i){f|=0,e|=0,i|=0;var n=0,c=0,b=0;if(Ue(A|=0,o[8+(r|=0)>>2],i))1==o[r+28>>2]|o[r+4>>2]!=(0|f)||(o[r+28>>2]=e);else A:{if(Ue(A,o[r>>2],i)){if(!(o[r+16>>2]!=(0|f)&o[r+20>>2]!=(0|f))){if(1!=(0|e))break A;return void(o[r+32>>2]=1)}if(o[r+32>>2]=e,4!=o[r+44>>2]){b=(n=A+16|0)+(o[A+12>>2]<<3)|0,e=0;r:{f:{for(;!(n>>>0>=b>>>0||(t[r+52>>1]=0,Ce(n,r,f,f,1,i),v[r+54|0]));){e:if(v[r+53|0]){if(v[r+52|0]){if(e=1,1==o[r+24>>2])break f;if(c=1,2&v[A+8|0])break e;break f}if(c=1,!(1&a[A+8|0]))break f}n=n+8|0}if(A=4,!c)break r}A=3}if(o[r+44>>2]=A,1&e)break A}if(o[r+20>>2]=f,o[r+40>>2]=o[r+40>>2]+1,1!=o[r+36>>2]|2!=o[r+24>>2])break A;return void(a[r+54|0]=1)}if(c=o[A+12>>2],Je(b=A+16|0,r,f,e,i),!((n=A+24|0)>>>0>=(c=b+(c<<3)|0)>>>0))if(!(2&(A=o[A+8>>2]))&1!=o[r+36>>2]){if(!(1&A))for(;;){if(v[r+54|0]|1==o[r+36>>2])break A;if(Je(n,r,f,e,i),!(c>>>0>(n=n+8|0)>>>0))break A}for(;;){if(v[r+54|0]|1==o[r+36>>2]&1==o[r+24>>2])break A;if(Je(n,r,f,e,i),!(c>>>0>(n=n+8|0)>>>0))break}}else for(;;){if(v[r+54|0])break A;if(Je(n,r,f,e,i),!(c>>>0>(n=n+8|0)>>>0))break}}},function(A,r,f,e){f|=0,e|=0;var i,n=0;if(Ue(A|=0,o[8+(r|=0)>>2],0))ie(r,f,e);else{n=o[A+12>>2],Ge(i=A+16|0,r,f,e);A:if(!((A=A+24|0)>>>0>=(n=(n<<3)+i|0)>>>0))for(;;){if(Ge(A,r,f,e),v[r+54|0])break A;if(!(n>>>0>(A=A+8|0)>>>0))break}}},vn,function(A,r,f){A|=0,f|=0;var e,i=0,n=0,t=0;S=e=S+-64|0;A:if(Ue(r|=0,30416,0))o[f>>2]=0,i=1;else{r:{if(24&v[A+8|0])n=1;else{if(!r)break r;if(!(n=qr(r,30148)))break r;n=!!(24&v[n+8|0])}t=Ue(A,r,n)}if(t){if(i=1,!(A=o[f>>2]))break A;o[f>>2]=o[A>>2]}else{if(r){if(!(n=qr(r,30196)))break A;if((r=o[f>>2])&&(o[f>>2]=o[r>>2]),(t=o[n+8>>2])&~(r=o[A+8>>2])&7|r&~t&96)break A;if(i=1,Ue(o[A+12>>2],o[n+12>>2],0))break A;if(Ue(o[A+12>>2],30404,0)){if(!(A=o[n+12>>2]))break A;i=!qr(A,30248);break A}if(t=o[A+12>>2]){if(i=0,r=qr(t,30196)){if(!(1&a[A+8|0]))break A;A=o[n+12>>2],f=0;r:{f:{for(;;){if(i=0,!A)break r;if(!(A=qr(A,30196))|o[A+8>>2]&~o[r+8>>2])break f;if(i=1,Ue(o[r+12>>2],o[A+12>>2],0))break r;if(!(1&a[r+8|0]))break f;if(!(i=o[r+12>>2]))break f;if(!(r=qr(i,30196)))break;A=o[A+12>>2]}(r=qr(i,30308))&&(f=ke(r,o[A+12>>2]))}i=f}break A}if(r=qr(t,30308)){if(!(1&a[A+8|0]))break A;i=ke(r,o[n+12>>2]);break A}if(!(r=qr(t,30100)))break A;if(!(A=o[n+12>>2]))break A;if(!(A=qr(A,30100)))break A;Af(e+12|0,0,52),o[e+56>>2]=1,o[e+20>>2]=-1,o[e+16>>2]=r,o[e+8>>2]=A,Zn[o[o[A>>2]+28>>2]](A,e+8|0,o[f>>2],1),A=o[e+32>>2],!o[f>>2]|1!=(0|A)||(o[f>>2]=o[e+24>>2]),i=1==(0|A);break A}}i=0}}return S=e- -64|0,0|i}],wn.set=function(A,r){this[A]=r},wn.get=function(A){return this[A]},wn);function Gn(){return n.byteLength/65536|0}return{w:function(){var A=0;a[33218]=0,t[16608]=20565,a[33227]=2,o[8307]=1162103123,o[8310]=1314344772,a[33239]=4,a[33251]=4,a[33232]=0,a[33263]=6,a[33244]=0,o[8313]=v[9286]|v[9287]<<8|v[9288]<<16|v[9289]<<24,a[33258]=0,A=v[9290]|v[9291]<<8,a[33256]=A,a[33257]=A>>>8,o[8479]=0,o[8478]=327,tA(),o[8479]=o[8980],o[8980]=33912,a[35895]=4,t[17936]=20565,a[35883]=2,a[35907]=4,o[8971]=1162103123,a[35919]=6,o[8974]=1314344772,o[8977]=v[9286]|v[9287]<<8|v[9288]<<16|v[9289]<<24,A=v[9290]|v[9291]<<8,a[35912]=A,a[35913]=A>>>8,a[35874]=0,a[35888]=0,a[35900]=0,a[35914]=0,o[8981]=1066,o[8982]=0,Or(),o[8982]=o[8980],o[8980]=35924},x:iA,y:DA,z:Zn,A:function(A){var r=0,f=0,e=0;A:{r:{f:if(3&(A=f=o[4+(A|=0)>>2])){if(r=0,!v[0|f])break A;for(;;){if(!(3&(A=A+1|0)))break f;if(!v[0|A])break}break r}for(;r=A,A=A+4|0,!(~(e=o[r>>2])&e-16843009&-2139062144););for(;r=(A=r)+1|0,v[0|A];);}r=A-f|0}return 0|((r=iA(A=r+1|0))?pr(r,f,A):0)},B:function(){var A=0;if(A=o[8980])for(;Zn[o[A>>2]](),A=o[A+4>>2];);}}}(A)}(r)},instantiate:function(A,r){return{then:function(f){var e=new b.Module(A);f({instance:new b.Instance(e,r)})}}},RuntimeError:Error};t=[],"object"!=typeof b&&V("no native wasm support detected");var u,l,s,k,d,v,h,B,w=!1;function Z(){var A=c.buffer;e.HEAP8=u=new Int8Array(A),e.HEAP16=s=new Int16Array(A),e.HEAP32=d=new Int32Array(A),e.HEAPU8=l=new Uint8Array(A),e.HEAPU16=k=new Uint16Array(A),e.HEAPU32=v=new Uint32Array(A),e.HEAPF32=h=new Float32Array(A),e.HEAPF64=B=new Float64Array(A)}var G,m=e.INITIAL_MEMORY||16777216;m>=65536||V("INITIAL_MEMORY should be larger than STACK_SIZE, was "+m+"! (STACK_SIZE=65536)"),c=e.wasmMemory?e.wasmMemory:new b.Memory({initial:m/65536,maximum:32768}),Z(),m=c.buffer.byteLength;var Q=[],E=[],W=[];function N(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)A=e.preRun.shift(),Q.unshift(A);var A;y(Q)}function p(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)A=e.postRun.shift(),W.unshift(A);var A;y(W)}var F=0,R=null;function Y(){if(F--,e.monitorRunDependencies&&e.monitorRunDependencies(F),0==F&&R){var A=R;R=null,A()}}function V(A){e.onAbort&&e.onAbort(A),o(A="Aborted("+A+")"),w=!0,A+=". Build with -sASSERTIONS for more info.";var r=new b.RuntimeError(A);throw f(r),r}var g,X;function D(A){return A.startsWith("data:application/octet-stream;base64,")}function C(A){try{if(A==g&&t)return new Uint8Array(t);var r=br(A);if(r)return r;throw"both async and sync fetching of the wasm failed"}catch(A){V(A)}}function J(A){return t||"function"!=typeof fetch?Promise.resolve().then((()=>C(A))):fetch(A,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+A+"'";return r.arrayBuffer()})).catch((()=>C(A)))}function x(A,r,f){return J(A).then((A=>b.instantiate(A,r))).then((A=>A)).then(f,(A=>{o("failed to asynchronously prepare wasm: "+A),V(A)}))}function y(A){for(;A.length>0;)A.shift()(e)}function M(A){if(void 0===A)return"_unknown";var r=(A=A.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=48&&r<=57?`_${A}`:A}function H(A,r){return A=M(A),{[A]:function(){return r.apply(this,arguments)}}[A]}D(g="<<< WASM_BINARY_FILE >>>")||(X=g,g=e.locateFile?e.locateFile(X,a):a+X);var I=new function(){this.allocated=[void 0],this.freelist=[],this.get=function(A){return this.allocated[A]},this.has=function(A){return void 0!==this.allocated[A]},this.allocate=function(A){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=A,r},this.free=function(A){this.allocated[A]=void 0,this.freelist.push(A)}};function T(A,r){var f=H(r,(function(A){this.name=r,this.message=A;var f=new Error(A).stack;void 0!==f&&(this.stack=this.toString()+"\n"+f.replace(/^Error(:[^\n]*)?\n/,""))}));return f.prototype=Object.create(A.prototype),f.prototype.constructor=f,f.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},f}var U=void 0;function j(A){throw new U(A)}var z=A=>(A||j("Cannot use deleted val. handle = "+A),I.get(A).value),P=A=>{switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return I.allocate({refcount:1,value:A})}},O=void 0,S=void 0;function L(A){for(var r="",f=A;l[f];)r+=S[l[f++]];return r}var $=[];function K(){for(;$.length;){var A=$.pop();A.$$.deleteScheduled=!1,A.delete()}}var q=void 0;var _={};function AA(A,r){for(void 0===r&&j("ptr should not be undefined");A.baseClass;)r=A.upcast(r),A=A.baseClass;return r}var rA={};function fA(A){var r=dr(A),f=L(r);return kr(r),f}function eA(A,r){var f=rA[A];return void 0===f&&j(r+" has unknown type "+fA(A)),f}function iA(){}var nA=!1;function aA(A){A.smartPtr?A.smartPtrType.rawDestructor(A.smartPtr):A.ptrType.registeredClass.rawDestructor(A.ptr)}function tA(A){A.count.value-=1,0===A.count.value&&aA(A)}function oA(A,r,f){if(r===f)return A;if(void 0===f.baseClass)return null;var e=oA(A,r,f.baseClass);return null===e?null:f.downcast(e)}var cA={};function bA(A,r){return r=AA(A,r),_[r]}var uA=void 0;function lA(A){throw new uA(A)}function sA(A,r){return r.ptrType&&r.ptr||lA("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!=!!r.smartPtr&&lA("Both smartPtrType and smartPtr must be specified"),r.count={value:1},kA(Object.create(A,{$$:{value:r}}))}function kA(A){return"undefined"==typeof FinalizationRegistry?(kA=A=>A,A):(nA=new FinalizationRegistry((A=>{tA(A.$$)})),kA=A=>{var r=A.$$;if(r.smartPtr){var f={$$:r};nA.register(A,f,A)}return A},iA=A=>nA.unregister(A),kA(A))}function dA(A){switch(A){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${A}`)}}var vA={},hA={};function BA(A,r,f){function e(r){var e=f(r);e.length!==A.length&&lA("Mismatched type converter count");for(var i=0;i{rA.hasOwnProperty(A)?i[r]=rA[A]:(n.push(A),vA.hasOwnProperty(A)||(vA[A]=[]),vA[A].push((()=>{i[r]=rA[A],++a===n.length&&e(i)})))})),0===n.length&&e(i)}function wA(A,r,f={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=r.name;if(A||j(`type "${e}" must have a positive integer typeid pointer`),rA.hasOwnProperty(A)){if(f.ignoreDuplicateRegistrations)return;j(`Cannot register type '${e}' twice`)}if(rA[A]=r,delete hA[A],vA.hasOwnProperty(A)){var i=vA[A];delete vA[A],i.forEach((A=>A()))}}function ZA(A){j(A.$$.ptrType.registeredClass.name+" instance already deleted")}function GA(){}function mA(A,r,f){if(void 0===A[r].overloadTable){var e=A[r];A[r]=function(){return A[r].overloadTable.hasOwnProperty(arguments.length)||j(`Function '${f}' called with an invalid number of arguments (${arguments.length}) - expects one of (${A[r].overloadTable})!`),A[r].overloadTable[arguments.length].apply(this,arguments)},A[r].overloadTable=[],A[r].overloadTable[e.argCount]=e}}function QA(A,r,f){e.hasOwnProperty(A)?((void 0===f||void 0!==e[A].overloadTable&&void 0!==e[A].overloadTable[f])&&j(`Cannot register public name '${A}' twice`),mA(e,A,A),e.hasOwnProperty(f)&&j(`Cannot register multiple overloads of a function with the same number of arguments (${f})!`),e[A].overloadTable[f]=r):(e[A]=r,void 0!==f&&(e[A].numArguments=f))}function EA(A,r,f,e,i,n,a,t){this.name=A,this.constructor=r,this.instancePrototype=f,this.rawDestructor=e,this.baseClass=i,this.getActualType=n,this.upcast=a,this.downcast=t,this.pureVirtualFunctions=[]}function WA(A,r,f){for(;r!==f;)r.upcast||j(`Expected null or instance of ${f.name}, got an instance of ${r.name}`),A=r.upcast(A),r=r.baseClass;return A}function NA(A,r){if(null===r)return this.isReference&&j(`null is not a valid ${this.name}`),0;r.$$||j(`Cannot pass "${UA(r)}" as a ${this.name}`),r.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`);var f=r.$$.ptrType.registeredClass;return WA(r.$$.ptr,f,this.registeredClass)}function pA(A,r){var f;if(null===r)return this.isReference&&j(`null is not a valid ${this.name}`),this.isSmartPointer?(f=this.rawConstructor(),null!==A&&A.push(this.rawDestructor,f),f):0;r.$$||j(`Cannot pass "${UA(r)}" as a ${this.name}`),r.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&j(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var e=r.$$.ptrType.registeredClass;if(f=WA(r.$$.ptr,e,this.registeredClass),this.isSmartPointer)switch(void 0===r.$$.smartPtr&&j("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?f=r.$$.smartPtr:j(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:f=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)f=r.$$.smartPtr;else{var i=r.clone();f=this.rawShare(f,P((function(){i.delete()}))),null!==A&&A.push(this.rawDestructor,f)}break;default:j("Unsupporting sharing policy")}return f}function FA(A,r){if(null===r)return this.isReference&&j(`null is not a valid ${this.name}`),0;r.$$||j(`Cannot pass "${UA(r)}" as a ${this.name}`),r.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&j(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var f=r.$$.ptrType.registeredClass;return WA(r.$$.ptr,f,this.registeredClass)}function RA(A){return this.fromWireType(d[A>>2])}function YA(A,r,f,e,i,n,a,t,o,c,b){this.name=A,this.registeredClass=r,this.isReference=f,this.isConst=e,this.isSmartPointer=i,this.pointeeType=n,this.sharingPolicy=a,this.rawGetPointee=t,this.rawConstructor=o,this.rawShare=c,this.rawDestructor=b,i||void 0!==r.baseClass?this.toWireType=pA:e?(this.toWireType=NA,this.destructorFunction=null):(this.toWireType=FA,this.destructorFunction=null)}function VA(A,r,f){e.hasOwnProperty(A)||lA("Replacing nonexistant public symbol"),void 0!==e[A].overloadTable&&void 0!==f?e[A].overloadTable[f]=r:(e[A]=r,e[A].argCount=f)}function gA(A,r,f){var i=e["dynCall_"+A];return f&&f.length?i.apply(null,[r].concat(f)):i.call(null,r)}var XA=[];function DA(A){var r=XA[A];return r||(A>=XA.length&&(XA.length=A+1),XA[A]=r=G.get(A)),r}function CA(A,r,f){return A.includes("j")?gA(A,r,f):DA(r).apply(null,f)}function JA(A,r){var f,e,i,n=(A=L(A)).includes("j")?(f=A,e=r,i=[],function(){return i.length=0,Object.assign(i,arguments),CA(f,e,i)}):DA(r);return"function"!=typeof n&&j(`unknown function pointer with signature ${A}: ${r}`),n}var xA=void 0;function yA(A,r){var f=[],e={};throw r.forEach((function A(r){e[r]||rA[r]||(hA[r]?hA[r].forEach(A):(f.push(r),e[r]=!0))})),new xA(`${A}: `+f.map(fA).join([", "]))}function MA(A){for(;A.length;){var r=A.pop();A.pop()(r)}}function HA(A,r,f,e,i){var n=r.length;n<2&&j("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==r[1]&&null!==f,t=!1,o=1;o>2]);return f}function TA(A){A>=I.reserved&&0==--I.get(A).refcount&&I.free(A)}function UA(A){if(null===A)return"null";var r=typeof A;return"object"===r||"array"===r||"function"===r?A.toString():""+A}function jA(A,r){switch(r){case 2:return function(A){return this.fromWireType(h[A>>2])};case 3:return function(A){return this.fromWireType(B[A>>3])};default:throw new TypeError("Unknown float type: "+A)}}function zA(A,r,f){switch(r){case 0:return f?function(A){return u[A]}:function(A){return l[A]};case 1:return f?function(A){return s[A>>1]}:function(A){return k[A>>1]};case 2:return f?function(A){return d[A>>2]}:function(A){return v[A>>2]};default:throw new TypeError("Unknown integer type: "+A)}}function PA(A,r,f,e){if(!(e>0))return 0;for(var i=f,n=f+e-1,a=0;a=55296&&t<=57343&&(t=65536+((1023&t)<<10)|1023&A.charCodeAt(++a)),t<=127){if(f>=n)break;r[f++]=t}else if(t<=2047){if(f+1>=n)break;r[f++]=192|t>>6,r[f++]=128|63&t}else if(t<=65535){if(f+2>=n)break;r[f++]=224|t>>12,r[f++]=128|t>>6&63,r[f++]=128|63&t}else{if(f+3>=n)break;r[f++]=240|t>>18,r[f++]=128|t>>12&63,r[f++]=128|t>>6&63,r[f++]=128|63&t}}return r[f]=0,f-i}function OA(A){for(var r=0,f=0;f=55296&&e<=57343?(r+=4,++f):r+=3}return r}var SA="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function LA(A,r,f){for(var e=r+f,i=r;A[i]&&!(i>=e);)++i;if(i-r>16&&A.buffer&&SA)return SA.decode(A.subarray(r,i));for(var n="";r>10,56320|1023&c)}}else n+=String.fromCharCode((31&a)<<6|t)}else n+=String.fromCharCode(a)}return n}var $A="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function KA(A,r){for(var f=A,e=f>>1,i=e+r/2;!(e>=i)&&k[e];)++e;if((f=e<<1)-A>32&&$A)return $A.decode(l.subarray(A,f));for(var n="",a=0;!(a>=r/2);++a){var t=s[A+2*a>>1];if(0==t)break;n+=String.fromCharCode(t)}return n}function qA(A,r,f){if(void 0===f&&(f=2147483647),f<2)return 0;for(var e=r,i=(f-=2)<2*A.length?f/2:A.length,n=0;n>1]=a,r+=2}return s[r>>1]=0,r-e}function _A(A){return 2*A.length}function Ar(A,r){for(var f=0,e="";!(f>=r/4);){var i=d[A+4*f>>2];if(0==i)break;if(++f,i>=65536){var n=i-65536;e+=String.fromCharCode(55296|n>>10,56320|1023&n)}else e+=String.fromCharCode(i)}return e}function rr(A,r,f){if(void 0===f&&(f=2147483647),f<4)return 0;for(var e=r,i=e+f-4,n=0;n=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&A.charCodeAt(++n)),d[r>>2]=a,(r+=4)+4>i)break}return d[r>>2]=0,r-e}function fr(A){for(var r=0,f=0;f=55296&&e<=57343&&++f,r+=4}return r}var er={},ir=[];function nr(A,r){for(var f=new Array(A),e=0;e>2],"parameter "+e);return f}var ar=[];function tr(A){var r=A-c.buffer.byteLength+65535>>>16;try{return c.grow(r),Z(),1}catch(A){}}U=e.BindingError=T(Error,"BindingError"),I.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),I.reserved=I.allocated.length,e.count_emval_handles=function(){for(var A=0,r=I.reserved;r>4,f=(15&i)<<4|(n=t.indexOf(A.charAt(c++)))>>2,e=(3&n)<<6|(a=t.indexOf(A.charAt(c++))),o+=String.fromCharCode(r),64!==n&&(o+=String.fromCharCode(f)),64!==a&&(o+=String.fromCharCode(e))}while(c>n])},destructorFunction:null})},j:function(A,r,f,e,i,n,a,t,o,c,b,u,l){b=L(b),n=JA(i,n),t&&(t=JA(a,t)),c&&(c=JA(o,c)),l=JA(u,l);var s=M(b);QA(s,(function(){yA(`Cannot construct ${b} due to unbound types`,[e])})),BA([A,r,f],e?[e]:[],(function(r){var f,i;r=r[0],i=e?(f=r.registeredClass).instancePrototype:GA.prototype;var a=H(s,(function(){if(Object.getPrototypeOf(this)!==o)throw new U("Use 'new' to construct "+b);if(void 0===u.constructor_body)throw new U(b+" has no accessible constructor");var A=u.constructor_body[arguments.length];if(void 0===A)throw new U(`Tried to invoke ctor of ${b} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return A.apply(this,arguments)})),o=Object.create(i,{constructor:{value:a}});a.prototype=o;var u=new EA(b,a,o,l,f,n,t,c);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var k=new YA(b,u,!0,!1,!1),d=new YA(b+"*",u,!1,!1,!1),v=new YA(b+" const*",u,!1,!0,!1);return cA[A]={pointerType:d,constPointerType:v},VA(s,a),[k,d,v]}))},i:function(A,r,f,e,i,n,a){var t=IA(f,e);r=L(r),n=JA(i,n),BA([],[A],(function(A){var e=`${(A=A[0]).name}.${r}`;function i(){yA(`Cannot call ${e} due to unbound types`,t)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var o=A.registeredClass.constructor;return void 0===o[r]?(i.argCount=f-1,o[r]=i):(mA(o,r,e),o[r].overloadTable[f-1]=i),BA([],t,(function(i){var t=[i[0],null].concat(i.slice(1)),c=HA(e,t,null,n,a);if(void 0===o[r].overloadTable?(c.argCount=f-1,o[r]=c):o[r].overloadTable[f-1]=c,A.registeredClass.__derivedClasses)for(const f of A.registeredClass.__derivedClasses)f.constructor.hasOwnProperty(r)||(f.constructor[r]=c);return[]})),[]}))},h:function(A,r,f,e,i,n,a,t){var o=IA(f,e);r=L(r),n=JA(i,n),BA([],[A],(function(A){var e=`${(A=A[0]).name}.${r}`;function i(){yA(`Cannot call ${e} due to unbound types`,o)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]),t&&A.registeredClass.pureVirtualFunctions.push(r);var c=A.registeredClass.instancePrototype,b=c[r];return void 0===b||void 0===b.overloadTable&&b.className!==A.name&&b.argCount===f-2?(i.argCount=f-2,i.className=A.name,c[r]=i):(mA(c,r,e),c[r].overloadTable[f-2]=i),BA([],o,(function(i){var t=HA(e,i,A,n,a);return void 0===c[r].overloadTable?(t.argCount=f-2,c[r]=t):c[r].overloadTable[f-2]=t,[]})),[]}))},t:function(A,r){wA(A,{name:r=L(r),fromWireType:function(A){var r=z(A);return TA(A),r},toWireType:function(A,r){return P(r)},argPackAdvance:8,readValueFromPointer:RA,destructorFunction:null})},o:function(A,r,f){var e=dA(f);wA(A,{name:r=L(r),fromWireType:function(A){return A},toWireType:function(A,r){return r},argPackAdvance:8,readValueFromPointer:jA(r,e),destructorFunction:null})},b:function(A,r,f,e,i,n){var a=IA(r,f);A=L(A),i=JA(e,i),QA(A,(function(){yA(`Cannot call ${A} due to unbound types`,a)}),r-1),BA([],a,(function(f){var e=[f[0],null].concat(f.slice(1));return VA(A,HA(A,e,null,i,n),r-1),[]}))},g:function(A,r,f,e){r=L(r);var i=dA(f),n=A=>A;if(0===e){var a=32-8*f;n=A=>A<>>a}var t=r.includes("unsigned");wA(A,{name:r,fromWireType:n,toWireType:t?function(A,r){return this.name,r>>>0}:function(A,r){return this.name,r},argPackAdvance:8,readValueFromPointer:zA(r,i,0!==e),destructorFunction:null})},c:function(A,r,f){var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function i(A){var r=v,f=r[A>>=2],i=r[A+1];return new e(r.buffer,i,f)}wA(A,{name:f=L(f),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},n:function(A,r){var f="std::string"===(r=L(r));wA(A,{name:r,fromWireType:function(A){var r,e,i=v[A>>2],n=A+4;if(f)for(var a=n,t=0;t<=i;++t){var o=n+t;if(t==i||0==l[o]){var c=(e=a)?LA(l,e,o-a):"";void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),a=o+1}}else{var b=new Array(i);for(t=0;t>2]=e,f&&i)PA(r,l,a,e+1);else if(i)for(var t=0;t255&&(kr(a),j("String has UTF-16 code units that do not fit in 8 bits")),l[a+t]=o}else for(t=0;tk,t=1):4===r&&(e=Ar,i=rr,a=fr,n=()=>v,t=2),wA(A,{name:f,fromWireType:function(A){for(var f,i=v[A>>2],a=n(),o=A+4,c=0;c<=i;++c){var b=A+4+c*r;if(c==i||0==a[b>>t]){var u=e(o,b-o);void 0===f?f=u:(f+=String.fromCharCode(0),f+=u),o=b+r}}return kr(A),f},toWireType:function(A,e){"string"!=typeof e&&j(`Cannot pass non-string to C++ string type ${f}`);var n=a(e),o=sr(4+n+r);return v[o>>2]=n>>t,i(e,o+4,n+r),null!==A&&A.push(kr,o),o},argPackAdvance:8,readValueFromPointer:RA,destructorFunction:function(A){kr(A)}})},v:function(A,r){wA(A,{isVoid:!0,name:r=L(r),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},d:function(A,r,f,e){var i,n;(A=ir[A])(r=z(r),f=void 0===(n=er[i=f])?L(i):n,null,e)},f:TA,e:function(A,r){var f=nr(A,r),e=f[0],i=e.name+"_$"+f.slice(1).map((function(A){return A.name})).join("_")+"$",n=ar[i];if(void 0!==n)return n;var a,t,o=new Array(A-1);return a=(r,i,n,a)=>{for(var t=0,c=0;c4&&(I.get(A).refcount+=1)},k:function(){V("")},s:function(A,r,f){l.copyWithin(A,r,r+f)},r:function(A){var r=l.length,f=2147483648;if((A>>>=0)>f)return!1;for(var e,i=1;i<=4;i*=2){var n=r*(1+.2/i);if(n=Math.min(n,A+100663296),tr(Math.min(f,(e=Math.max(A,n))+(65536-e%65536)%65536)))return!0}return!1},a:c};!function(){var A,r,i,n,a={a:ur};function c(A){var r,f=A.exports;return e.asm=f,G=e.asm.z,r=e.asm.w,E.unshift(r),Y(),f}if(F++,e.monitorRunDependencies&&e.monitorRunDependencies(F),e.instantiateWasm)try{return e.instantiateWasm(a,c)}catch(A){o("Module.instantiateWasm callback failed with error: "+A),f(A)}(A=t,r=g,i=a,n=function(A){c(A.instance)},A||"function"!=typeof b.instantiateStreaming||D(r)||"function"!=typeof fetch?x(r,i,n):fetch(r,{credentials:"same-origin"}).then((A=>b.instantiateStreaming(A,i).then(n,(function(A){return o("wasm streaming compile failed: "+A),o("falling back to ArrayBuffer instantiation"),x(r,i,n)}))))).catch(f)}();var lr,sr=function(){return(sr=e.asm.x).apply(null,arguments)},kr=function(){return(kr=e.asm.y).apply(null,arguments)},dr=function(){return(dr=e.asm.A).apply(null,arguments)};function vr(){function A(){lr||(lr=!0,e.calledRun=!0,w||(y(E),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),p()))}F>0||(N(),F>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),A()}),1)):A()))}if(e.__embind_initialize_bindings=function(){return(e.__embind_initialize_bindings=e.asm.B).apply(null,arguments)},R=function A(){lr||vr(),lr||(R=A)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return vr(),A.ready},e.exports=n;var t=a.exports;A("b",f({__proto__:null,default:r(t)},[t]))}}})); diff --git a/code/cocos-js/bullet.release.wasm-BrNAez8g.js b/code/cocos-js/bullet.release.wasm-BrNAez8g.js new file mode 100644 index 0000000..6226ffd --- /dev/null +++ b/code/cocos-js/bullet.release.wasm-BrNAez8g.js @@ -0,0 +1 @@ +System.register(["./_virtual_cc-BL_aScgX.js"],(function(t){"use strict";var e,r;return{setters:[function(t){e=t.g,r=t._}],execute:function(){function n(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(r){if("default"!==r&&!(r in t)){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}))})),Object.freeze(t)}var i,o,a,s={exports:{}};i=s,o="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,a=function(t){void 0===t&&(t={});var e,n,i=void 0!==t?t:{};i.ready=new Promise((function(t,r){e=t,n=r}));var a=Object.assign({},i),s="";"undefined"!=typeof document&&document.currentScript&&(s=document.currentScript.src),o&&(s=o),s=0!==s.indexOf("blob:")?s.substr(0,s.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i.print||console.log.bind(console);var u,c,l=i.printErr||console.error.bind(console);Object.assign(i,a),a=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(u=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&F("no native wasm support detected");var f,p,d,h,v,y,m,g,b,$=!1;function w(){var t=c.buffer;i.HEAP8=f=new Int8Array(t),i.HEAP16=d=new Int16Array(t),i.HEAP32=v=new Int32Array(t),i.HEAPU8=p=new Uint8Array(t),i.HEAPU16=h=new Uint16Array(t),i.HEAPU32=y=new Uint32Array(t),i.HEAPF32=m=new Float32Array(t),i.HEAPF64=g=new Float64Array(t)}var C=[],P=[],T=[];function A(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)t=i.preRun.shift(),C.unshift(t);var t;U(C)}function O(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)t=i.postRun.shift(),T.unshift(t);var t;U(T)}var _,S,k=0,E=null;function W(){if(k--,i.monitorRunDependencies&&i.monitorRunDependencies(k),0==k&&E){var t=E;E=null,t()}}function F(t){i.onAbort&&i.onAbort(t),l(t="Aborted("+t+")"),$=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}function j(t){return t.startsWith("data:application/octet-stream;base64,")}function R(t){try{if(t==_&&u)return new Uint8Array(u);throw"both async and sync fetching of the wasm failed"}catch(t){F(t)}}function D(t){return u||"function"!=typeof fetch?Promise.resolve().then((function(){return R(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return R(t)}))}function I(t,e,r){return D(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(r,(function(t){l("failed to asynchronously prepare wasm: "+t),F(t)}))}function U(t){for(;t.length>0;)t.shift()(i)}function x(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=48&&e<=57?"_"+t:t}function V(t,e){var r;return(r={},r[t=x(t)]=function(){return e.apply(this,arguments)},r)[t]}j(_="bullet.release.wasm.wasm")||(S=_,_=i.locateFile?i.locateFile(S,s):s+S);var z=new function(){this.allocated=[void 0],this.freelist=[],this.get=function(t){return this.allocated[t]},this.has=function(t){return void 0!==this.allocated[t]},this.allocate=function(t){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},this.free=function(t){this.allocated[t]=void 0,this.freelist.push(t)}};function B(t,e){var r=V(e,(function(t){this.name=e,this.message=t;var r=new Error(t).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var H=void 0;function M(t){throw new H(t)}var q=function(t){return t||M("Cannot use deleted val. handle = "+t),z.get(t).value},G=function(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return z.allocate({refcount:1,value:t})}},L=void 0,N=void 0;function J(t){for(var e="",r=t;p[r];)e+=N[p[r++]];return e}var Z=[];function K(){for(;Z.length;){var t=Z.pop();t.$$.deleteScheduled=!1,t.delete()}}var Q=void 0;var X={};function Y(t,e){for(void 0===e&&M("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}var tt={};function et(t){var e=fe(t),r=J(e);return le(e),r}function rt(t,e){var r=tt[t];return void 0===r&&M(e+" has unknown type "+et(t)),r}function nt(){}var it=!1;function ot(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}function at(t){t.count.value-=1,0===t.count.value&&ot(t)}function st(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=st(t,e,r.baseClass);return null===n?null:r.downcast(n)}var ut={};function ct(t,e){return e=Y(t,e),X[e]}var lt=void 0;function ft(t){throw new lt(t)}function pt(t,e){return e.ptrType&&e.ptr||ft("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&ft("Both smartPtrType and smartPtr must be specified"),e.count={value:1},dt(Object.create(t,{$$:{value:e}}))}function dt(t){return"undefined"==typeof FinalizationRegistry?(dt=function(t){return t},t):(it=new FinalizationRegistry((function(t){at(t.$$)})),dt=function(t){var e=t.$$;if(e.smartPtr){var r={$$:e};it.register(t,r,t)}return t},nt=function(t){return it.unregister(t)},dt(t))}function ht(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}var vt={},yt={};function mt(t,e,r){function n(e){var n=r(e);n.length!==t.length&&ft("Mismatched type converter count");for(var i=0;i>2])}function kt(t,e,r,n,i,o,a,s,u,c,l){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=o,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,i||void 0!==e.baseClass?this.toWireType=Ot:n?(this.toWireType=At,this.destructorFunction=null):(this.toWireType=_t,this.destructorFunction=null)}function Et(t,e,r){i.hasOwnProperty(t)||ft("Replacing nonexistant public symbol"),void 0!==i[t].overloadTable&&void 0!==r?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)}function Wt(t,e,r){var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}var Ft=[];function jt(t){var e=Ft[t];return e||(t>=Ft.length&&(Ft.length=t+1),Ft[t]=e=b.get(t)),e}function Rt(t,e,r){return t.includes("j")?Wt(t,e,r):jt(e).apply(null,r)}function Dt(t,e){var r,n,i,o=(t=J(t)).includes("j")?(r=t,n=e,i=[],function(){return i.length=0,Object.assign(i,arguments),Rt(r,n,i)}):jt(e);return"function"!=typeof o&&M("unknown function pointer with signature "+t+": "+e),o}var It=void 0;function Ut(t,e){var r=[],n={};throw e.forEach((function t(e){n[e]||tt[e]||(yt[e]?yt[e].forEach(t):(r.push(e),n[e]=!0))})),new It(t+": "+r.map(et).join([", "]))}function xt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Vt(t,e,r,n,i){var o=e.length;o<2&&M("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==e[1]&&null!==r,s=!1,u=1;u>2]);return r}function Bt(t){t>=z.reserved&&0==--z.get(t).refcount&&z.free(t)}function Ht(t){if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t}function Mt(t,e){switch(e){case 2:return function(t){return this.fromWireType(m[t>>2])};case 3:return function(t){return this.fromWireType(g[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function qt(t,e,r){switch(e){case 0:return r?function(t){return f[t]}:function(t){return p[t]};case 1:return r?function(t){return d[t>>1]}:function(t){return h[t>>1]};case 2:return r?function(t){return v[t>>2]}:function(t){return y[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function Gt(t,e,r,n){if(!(n>0))return 0;for(var i=r,o=r+n-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=o)break;e[r++]=s}else if(s<=2047){if(r+1>=o)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=o)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-i}function Lt(t){for(var e=0,r=0;r=55296&&n<=57343?(e+=4,++r):e+=3}return e}var Nt="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Jt(t,e,r){for(var n=e+r,i=e;t[i]&&!(i>=n);)++i;if(i-e>16&&t.buffer&&Nt)return Nt.decode(t.subarray(e,i));for(var o="";e>10,56320|1023&c)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}var Zt="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Kt(t,e){for(var r=t,n=r>>1,i=n+e/2;!(n>=i)&&h[n];)++n;if((r=n<<1)-t>32&&Zt)return Zt.decode(p.subarray(t,r));for(var o="",a=0;!(a>=e/2);++a){var s=d[t+2*a>>1];if(0==s)break;o+=String.fromCharCode(s)}return o}function Qt(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,i=(r-=2)<2*t.length?r/2:t.length,o=0;o>1]=a,e+=2}return d[e>>1]=0,e-n}function Xt(t){return 2*t.length}function Yt(t,e){for(var r=0,n="";!(r>=e/4);){var i=v[t+4*r>>2];if(0==i)break;if(++r,i>=65536){var o=i-65536;n+=String.fromCharCode(55296|o>>10,56320|1023&o)}else n+=String.fromCharCode(i)}return n}function te(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,i=n+r-4,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++o)),v[e>>2]=a,(e+=4)+4>i)break}return v[e>>2]=0,e-n}function ee(t){for(var e=0,r=0;r=55296&&n<=57343&&++r,e+=4}return e}var re={},ne=[];function ie(t,e){for(var r=new Array(t),n=0;n>2],"parameter "+n);return r}var oe=[];function ae(t){var e=t-c.buffer.byteLength+65535>>>16;try{return c.grow(e),w(),1}catch(t){}}H=i.BindingError=B(Error,"BindingError"),z.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),z.reserved=z.allocated.length,i.count_emval_handles=function(){for(var t=0,e=z.reserved;e>o])},destructorFunction:null})},i:function(t,e,r,n,i,o,a,s,u,c,l,f,p){l=J(l),o=Dt(i,o),s&&(s=Dt(a,s)),c&&(c=Dt(u,c)),p=Dt(f,p);var d=x(l);Ct(d,(function(){Ut("Cannot construct "+l+" due to unbound types",[n])})),mt([t,e,r],n?[n]:[],(function(e){var r,i;e=e[0],i=n?(r=e.registeredClass).instancePrototype:$t.prototype;var a=V(d,(function(){if(Object.getPrototypeOf(this)!==u)throw new H("Use 'new' to construct "+l);if(void 0===f.constructor_body)throw new H(l+" has no accessible constructor");var t=f.constructor_body[arguments.length];if(void 0===t)throw new H("Tried to invoke ctor of "+l+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return t.apply(this,arguments)})),u=Object.create(i,{constructor:{value:a}});a.prototype=u;var f=new Pt(l,a,u,p,r,o,s,c);f.baseClass&&(void 0===f.baseClass.__derivedClasses&&(f.baseClass.__derivedClasses=[]),f.baseClass.__derivedClasses.push(f));var h=new kt(l,f,!0,!1,!1),v=new kt(l+"*",f,!1,!1,!1),y=new kt(l+" const*",f,!1,!0,!1);return ut[t]={pointerType:v,constPointerType:y},Et(d,a),[h,v,y]}))},h:function(t,e,n,i,o,a,s){var u=zt(n,i);e=J(e),a=Dt(o,a),mt([],[t],(function(t){var i=(t=t[0]).name+"."+e;function o(){Ut("Cannot call "+i+" due to unbound types",u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var c=t.registeredClass.constructor;return void 0===c[e]?(o.argCount=n-1,c[e]=o):(wt(c,e,i),c[e].overloadTable[n-1]=o),mt([],u,(function(o){var u=[o[0],null].concat(o.slice(1)),l=Vt(i,u,null,a,s);if(void 0===c[e].overloadTable?(l.argCount=n-1,c[e]=l):c[e].overloadTable[n-1]=l,t.registeredClass.__derivedClasses)for(var f,p=r(t.registeredClass.__derivedClasses);!(f=p()).done;){var d=f.value;d.constructor.hasOwnProperty(e)||(d.constructor[e]=l)}return[]})),[]}))},g:function(t,e,r,n,i,o,a,s){var u=zt(r,n);e=J(e),o=Dt(i,o),mt([],[t],(function(t){var n=(t=t[0]).name+"."+e;function i(){Ut("Cannot call "+n+" due to unbound types",u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(e);var c=t.registeredClass.instancePrototype,l=c[e];return void 0===l||void 0===l.overloadTable&&l.className!==t.name&&l.argCount===r-2?(i.argCount=r-2,i.className=t.name,c[e]=i):(wt(c,e,n),c[e].overloadTable[r-2]=i),mt([],u,(function(i){var s=Vt(n,i,t,o,a);return void 0===c[e].overloadTable?(s.argCount=r-2,c[e]=s):c[e].overloadTable[r-2]=s,[]})),[]}))},s:function(t,e){gt(t,{name:e=J(e),fromWireType:function(t){var e=q(t);return Bt(t),e},toWireType:function(t,e){return G(e)},argPackAdvance:8,readValueFromPointer:St,destructorFunction:null})},n:function(t,e,r){var n=ht(r);gt(t,{name:e=J(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:Mt(e,n),destructorFunction:null})},a:function(t,e,r,n,i,o){var a=zt(e,r);t=J(t),i=Dt(n,i),Ct(t,(function(){Ut("Cannot call "+t+" due to unbound types",a)}),e-1),mt([],a,(function(r){var n=[r[0],null].concat(r.slice(1));return Et(t,Vt(t,n,null,i,o),e-1),[]}))},f:function(t,e,r,n){e=J(e);var i=ht(r),o=function(t){return t};if(0===n){var a=32-8*r;o=function(t){return t<>>a}}var s=e.includes("unsigned");gt(t,{name:e,fromWireType:o,toWireType:s?function(t,e){return this.name,e>>>0}:function(t,e){return this.name,e},argPackAdvance:8,readValueFromPointer:qt(e,i,0!==n),destructorFunction:null})},b:function(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function i(t){var e=y,r=e[t>>=2],i=e[t+1];return new n(e.buffer,i,r)}gt(t,{name:r=J(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},m:function(t,e){var r="std::string"===(e=J(e));gt(t,{name:e,fromWireType:function(t){var e,n,i=y[t>>2],o=t+4;if(r)for(var a=o,s=0;s<=i;++s){var u=o+s;if(s==i||0==p[u]){var c=(n=a)?Jt(p,n,u-a):"";void 0===e?e=c:(e+=String.fromCharCode(0),e+=c),a=u+1}}else{var l=new Array(i);for(s=0;s>2]=n,r&&i)Gt(e,p,a,n+1);else if(i)for(var s=0;s255&&(le(a),M("String has UTF-16 code units that do not fit in 8 bits")),p[a+s]=u}else for(s=0;s>2],a=o(),u=t+4,c=0;c<=i;++c){var l=t+4+c*e;if(c==i||0==a[l>>s]){var f=n(u,l-u);void 0===r?r=f:(r+=String.fromCharCode(0),r+=f),u=l+e}}return le(t),r},toWireType:function(t,n){"string"!=typeof n&&M("Cannot pass non-string to C++ string type "+r);var o=a(n),u=ce(4+o+e);return y[u>>2]=o>>s,i(n,u+4,o+e),null!==t&&t.push(le,u),u},argPackAdvance:8,readValueFromPointer:St,destructorFunction:function(t){le(t)}})},u:function(t,e){gt(t,{isVoid:!0,name:e=J(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},c:function(t,e,r,n){var i,o;(t=ne[t])(e=q(e),r=void 0===(o=re[i=r])?J(i):o,null,n)},e:Bt,d:function(t,e){var r=ie(t,e),n=r[0],i=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",o=oe[i];if(void 0!==o)return o;var a,s,u=new Array(t-1);return a=function(e,i,o,a){for(var s=0,c=0;c4&&(z.get(t).refcount+=1)},j:function(){F("")},r:function(t,e,r){p.copyWithin(t,e,e+r)},q:function(t){var e=p.length,r=2147483648;if((t>>>=0)>r)return!1;for(var n,i=1;i<=4;i*=2){var o=e*(1+.2/i);if(o=Math.min(o,t+100663296),ae(Math.min(r,(n=Math.max(t,o))+(65536-n%65536)%65536)))return!0}return!1}};!function(){var t,e,r,o,a={a:se};function s(t){var e,r=t.exports;return i.asm=r,c=i.asm.v,w(),b=i.asm.z,e=i.asm.w,P.unshift(e),W(),r}if(k++,i.monitorRunDependencies&&i.monitorRunDependencies(k),i.instantiateWasm)try{return i.instantiateWasm(a,s)}catch(t){l("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=u,e=_,r=a,o=function(t){s(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||j(e)||"function"!=typeof fetch?I(e,r,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(o,(function(t){return l("wasm streaming compile failed: "+t),l("falling back to ArrayBuffer instantiation"),I(e,r,o)}))}))).catch(n)}();var ue,ce=function(){return(ce=i.asm.x).apply(null,arguments)},le=function(){return(le=i.asm.y).apply(null,arguments)},fe=function(){return(fe=i.asm.A).apply(null,arguments)};function pe(){function t(){ue||(ue=!0,i.calledRun=!0,$||(U(P),e(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),O()))}k>0||(A(),k>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t()))}if(i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=i.asm.B).apply(null,arguments)},E=function t(){ue||pe(),ue||(E=t)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return pe(),t.ready},i.exports=a;var u=s.exports,c=e(u);t("b",n({__proto__:null,default:c},[u]))}}})); diff --git a/code/cocos-js/bullet.release.wasm-vGDNSL-o.js b/code/cocos-js/bullet.release.wasm-vGDNSL-o.js new file mode 100644 index 0000000..a0e3e82 --- /dev/null +++ b/code/cocos-js/bullet.release.wasm-vGDNSL-o.js @@ -0,0 +1 @@ +System.register([],(function(e){"use strict";return{execute:function(){e("default","assets/bullet.release.wasm-BWZhVGCB.wasm")}}})); diff --git a/code/cocos-js/cc.js b/code/cocos-js/cc.js new file mode 100644 index 0000000..8b4e2dc --- /dev/null +++ b/code/cocos-js/cc.js @@ -0,0 +1 @@ +System.register(["./_virtual_cc-BL_aScgX.js"],(function(e){"use strict";return{setters:[function(t){e({Acceleration:t.ex,AffineTransform:t.a$,AlphaKey:t.cz,AmbientInfo:t.dA,AnimCurve:t.ax,Animation:t.av,AnimationClip:t.at,AnimationComponent:t.av,AnimationManager:t.aB,AnimationState:t.au,Asset:t.d_,AssetLibrary:t.ei,AssetManager:t.ee,AsyncDelegate:t.c7,Atlas:t.A,AudioClip:t.aF,AudioPCMDataView:t.aG,AudioSource:t.aE,AudioSourceComponent:t.aE,AutoPlacement:t.eK,BASELINE_RATIO:t.E,BITMASK_TAG:t.d0,BaseNode:t.dn,BaseRenderData:t.u,BatchedSkinningModelComponent:t.al,BatchingUtility:t.aa,Billboard:t.eU,BillboardComponent:t.eU,BitMask:t.bC,BitmapFont:t.B,BlockInputEvents:t.h4,BlockInputEventsComponent:t.h4,BoxCharacterController:t.fU,BoxCollider:t.fF,BoxCollider2D:t.fj,BoxColliderComponent:t.fF,BufferAsset:t.d$,BuiltinResMgr:t.ek,Burst:t.e_,Button:t.gR,ButtonComponent:t.gR,CCBoolean:t.bZ,CCClass:t.bU,CCFloat:t.bY,CCInteger:t.bX,CCLoader:t.eg,CCObject:t.bW,CCString:t.b_,CacheMode:t.r,CachedArray:t.bB,CallbacksInvoker:t.d4,Camera:t.dN,CameraComponent:t.dN,Canvas:t.C,CanvasComponent:t.C,CapsuleCharacterController:t.fT,CapsuleCollider:t.fH,CapsuleColliderComponent:t.fH,CharacterController:t.fz,CircleCollider2D:t.fk,CircumSphere:t.eM,Collider:t.fE,Collider2D:t.fi,ColliderComponent:t.fE,Color:t.b4,ColorKey:t.cy,CompactValueTypeArray:t.b$,Component:t.dt,ConeCollider:t.fK,ConfigurableConstraint:t.fQ,ConstantForce:t.fA,Constraint:t.fO,Contact2DType:t.fc,CurveRange:t.eY,CylinderCollider:t.fJ,CylinderColliderComponent:t.fJ,DEFAULT_OCTREE_DEPTH:t.dG,DEFAULT_WORLD_MAX_POS:t.dF,DEFAULT_WORLD_MIN_POS:t.dE,DebugMode:t.cl,DebugView:t.dk,Delaunay:t.eO,Details:t.dY,DirectionalLight:t.ae,DirectionalLightComponent:t.ae,Director:t.dT,DirectorEvent:t.dS,DistanceJoint2D:t.fn,DynamicAtlasManager:t.a5,EAxisDirection:t.fV,ECollider2DType:t.f7,EColliderType:t.fX,EJoint2DType:t.f8,ENUM_TAG:t.c$,EPSILON:t.b9,EPhysics2DDrawFlags:t.fd,EPhysicsDrawFlags:t.fY,ERaycast2DType:t.fb,ERigidBody2DType:t.f6,ERigidBodyType:t.fW,EasingMethod:t.d3,EditBox:t.gS,EditBoxComponent:t.gS,EditorExtendable:t.c4,EffectAsset:t.e7,Enum:t.bD,Event:t.eo,EventAcceleration:t.ep,EventGamepad:t.et,EventHMD:t.ev,EventHandheld:t.ew,EventHandle:t.eu,EventHandler:t.ds,EventInfo:t.ay,EventKeyboard:t.eq,EventMouse:t.er,EventTarget:t.c5,EventTouch:t.es,Eventify:t.c6,ExtrapolationMode:t.ct,FixedConstraint:t.fR,FixedJoint2D:t.fs,FogInfo:t.dC,Font:t.F,GCObject:t.cY,Game:t.dV,Gradient:t.cA,GradientRange:t.eZ,Graphics:t.G,GraphicsComponent:t.G,HALF_PI:t.b7,HeightField:t.g7,HingeConstraint:t.fP,HingeJoint2D:t.fu,HorizontalTextAlignment:t.H,HtmlTextParser:t.D,ImageAsset:t.e4,Input:t.eB,InstanceMaterialType:t.I,InstancedBuffer:t.dg,Intersection2D:t.eI,JavaScript:t.eb,Joint2D:t.fm,JsonAsset:t.e3,KeyCode:t.ey,LOD:t.an,LODGroup:t.ao,LRUCache:t.N,Label:t.t,LabelAtlas:t.L,LabelComponent:t.t,LabelOutline:t.n,LabelOutlineComponent:t.n,LabelShadow:t.p,Layers:t.dq,Layout:t.gT,LayoutComponent:t.gT,Light:t.af,LightComponent:t.af,LightProbeGroup:t.eT,LightProbeInfo:t.dK,LightProbeSampler:t.eP,LightProbes:t.eS,LightProbesData:t.eR,Line:t.eV,LineComponent:t.eV,MATH_FLOAT_ARRAY:t.bx,MIDDLE_RATIO:t.J,Mask:t.i,MaskComponent:t.i,Mat3:t.aY,Mat4:t.aZ,Material:t.e8,MathBase:t.by,Mesh:t.ab,MeshBuffer:t.M,MeshCollider:t.fI,MeshColliderComponent:t.fI,MeshRenderData:t.w,MeshRenderer:t.ad,MissingScript:t.dQ,MobilityMode:t.dy,ModelComponent:t.ad,ModelRenderer:t.dO,MotionStreak:t.f0,MotionStreakAssemblerManager:t.f1,MouseJoint2D:t.fp,Node:t.dn,NodeActivator:t.du,NodeEventType:t.dz,NodePool:t.em,NodeSpace:t.dw,ObjectCurve:t.cx,OctreeInfo:t.dH,Overflow:t.O,PHYSICS_2D_PTM_RATIO:t.fe,PageView:t.h0,PageViewComponent:t.h0,PageViewIndicator:t.h1,PageViewIndicatorComponent:t.h1,ParticleAsset:t.f3,ParticleSystem:t.eW,ParticleSystem2D:t.e$,ParticleSystem2DAssembler:t.f2,ParticleSystemComponent:t.eW,ParticleUtils:t.eX,PhysicMaterial:t.fB,Physics2DManifoldType:t.fg,Physics2DUtils:t.f4,PhysicsGroup:t.fa,PhysicsGroup2D:t.f9,PhysicsLineStripCastResult:t.fD,PhysicsMaterial:t.fB,PhysicsRayResult:t.fC,PhysicsSystem:t.fx,PhysicsSystem2D:t.ff,PipelineEventProcessor:t.di,PipelineEventType:t.dj,PipelineInputAssemblerData:t.dm,PipelineSceneData:t.df,PipelineStateManager:t.dh,PlaceMethod:t.eJ,PlaneCollider:t.fN,PointLight:t.ai,PointToPointConstraint:t.fS,PolygonCollider2D:t.fl,Pool:t.bz,PostSettingsInfo:t.dJ,Prefab:t.dv,PrefabLink:t.dR,Primitive:t.f_,PrivateNode:t.dM,Profiler:t.f$,ProgressBar:t.gU,ProgressBarComponent:t.gU,QuadRenderData:t.Q,Quat:t.aW,QuatCurve:t.cv,QuatInterpolationMode:t.cw,RangedDirectionalLight:t.aj,RatioSampler:t.aw,RealCurve:t.cr,RealInterpolationMode:t.cs,Rect:t.b2,RecyclePool:t.bA,ReflectionProbe:t.ap,ReflectionProbeManager:t.aq,ReflectionProbeType:t.ar,RelativeJoint2D:t.fq,RenderComponent:t.e,RenderData:t.v,RenderRoot2D:t.R,RenderTexture:t.e9,Renderable2D:t.e,RenderableComponent:t.dO,Renderer:t.dP,RenderingSubMesh:t.e0,ResolutionPolicy:t.h8,RichText:t.j,RichTextComponent:t.j,RigidBody:t.fy,RigidBody2D:t.fh,RigidBodyComponent:t.fy,Root:t.aJ,SH:t.eQ,SafeArea:t.h2,SafeAreaComponent:t.h2,Scene:t.dp,SceneAsset:t.e1,SceneGlobals:t.dL,Scheduler:t.cq,Script:t.ea,ScrollBar:t.gV,ScrollBarComponent:t.gV,ScrollView:t.gW,ScrollViewComponent:t.gW,Settings:t.cC,SettingsCategory:t.cB,ShadowsInfo:t.dD,SimplexCollider:t.fM,Size:t.b0,SkelAnimDataHub:t.g1,SkeletalAnimation:t.g4,SkeletalAnimationComponent:t.g4,SkeletalAnimationState:t.g2,Skeleton:t.ac,SkinInfo:t.dI,SkinnedMeshBatchRenderer:t.al,SkinnedMeshRenderer:t.ak,SkinnedMeshUnit:t.am,SkinningModelComponent:t.ak,SkinningModelUnit:t.am,SkyboxInfo:t.dB,Slider:t.gX,SliderComponent:t.gX,SliderJoint2D:t.fr,Socket:t.g3,Sorting:t.a8,SortingLayers:t.a7,SphereCollider:t.fG,SphereColliderComponent:t.fG,SphereLight:t.ag,SphereLightComponent:t.ag,SpotLight:t.ah,SpotLightComponent:t.ah,SpringJoint2D:t.fo,Sprite:t.k,SpriteAtlas:t.b,SpriteComponent:t.k,SpriteFrame:t.d,SpriteFrameEvent:t.c,SpriteRenderer:t.h,StencilManager:t.S,SubContextView:t.h5,System:t.cE,SystemEvent:t.eD,SystemEventType:t.en,TERRAIN_BLOCK_TILE_COMPLEXITY:t.gg,TERRAIN_BLOCK_VERTEX_COMPLEXITY:t.gh,TERRAIN_BLOCK_VERTEX_SIZE:t.gi,TERRAIN_DATA_VERSION:t.gs,TERRAIN_DATA_VERSION2:t.gt,TERRAIN_DATA_VERSION3:t.gu,TERRAIN_DATA_VERSION4:t.gv,TERRAIN_DATA_VERSION5:t.gw,TERRAIN_DATA_VERSION6:t.gx,TERRAIN_DATA_VERSION7:t.gy,TERRAIN_DATA_VERSION8:t.gz,TERRAIN_DATA_VERSION_DEFAULT:t.gA,TERRAIN_EAST_INDEX:t.gr,TERRAIN_HEIGHT_BASE:t.gj,TERRAIN_HEIGHT_FACTORY:t.gk,TERRAIN_HEIGHT_FACTORY_V7:t.gl,TERRAIN_HEIGHT_FMAX:t.gn,TERRAIN_HEIGHT_FMIN:t.gm,TERRAIN_MAX_BLEND_LAYERS:t.ge,TERRAIN_MAX_LAYER_COUNT:t.gf,TERRAIN_MAX_LEVELS:t.gd,TERRAIN_NORTH_INDEX:t.go,TERRAIN_SOUTH_INDEX:t.gp,TERRAIN_WEST_INDEX:t.gq,TTFFont:t.T,TWO_PI:t.b8,TangentWeightMode:t.cu,Terrain:t.gc,TerrainAsset:t.gD,TerrainBlock:t.gb,TerrainBlockLightmapInfo:t.ga,TerrainCollider:t.fL,TerrainInfo:t.g8,TerrainLayer:t.g9,TerrainLayerBinaryInfo:t.gC,TerrainLayerInfo:t.gB,Tetrahedron:t.eN,TextAsset:t.e2,Texture2D:t.e5,TextureCube:t.e6,TiledLayer:t.gH,TiledMap:t.gE,TiledMapAsset:t.gF,TiledObjectGroup:t.gI,TiledTile:t.gJ,TiledUserNodeData:t.gG,Toggle:t.gY,ToggleComponent:t.gY,ToggleContainer:t.gZ,ToggleContainerComponent:t.gZ,Touch:t.ez,TransformBit:t.dx,Tween:t.gO,TweenAction:t.gN,TweenSystem:t.gM,TypeScript:t.ec,UI:t.y,UIComponent:t.U,UICoordinateTracker:t.h3,UICoordinateTrackerComponent:t.h3,UIDrawBatch:t.z,UIMeshRenderer:t.m,UIModelComponent:t.m,UIOpacity:t.q,UIOpacityComponent:t.q,UIRenderable:t.e,UIRenderer:t.e,UIReorderComponent:t.ha,UIStaticBatch:t.o,UIStaticBatchComponent:t.o,UITransform:t.f,UITransformComponent:t.f,UIVertexFormat:t.x,VERSION:t.aN,ValueType:t.bF,Vec2:t.aQ,Vec3:t.aS,Vec4:t.aU,Vertex:t.eL,VerticalTextAlignment:t.V,VideoClip:t.hb,VideoPlayer:t.hc,View:t.h7,ViewGroup:t.g_,WebGL2Device:t.he,WebGLDevice:t.eH,WebView:t.hd,WheelJoint2D:t.ft,Widget:t.g$,WidgetComponent:t.g$,WorldNode3DToLocalNodeUI:t.bQ,WorldNode3DToWorldNodeUI:t.bR,__checkObsoleteInNamespace__:t.bP,__checkObsolete__:t.bO,_decorator:t.bT,_resetDebugSetting:t.d6,absMax:t.bt,absMaxComponent:t.bs,animation:t.as,applyMixins:t.d5,approx:t.bb,assert:t.cc,assertID:t.ch,assertIsNonNullable:t.da,assertIsTrue:t.db,assertsArrayIndex:t.dc,assetManager:t.ed,bezier:t.cH,bezierByTime:t.cI,binarySearch:t.d7,binarySearchBy:t.d9,binarySearchEpsilon:t.d8,bits:t.aP,builtinResMgr:t.el,ccenum:t.bE,cclegacy:t.aO,clamp:t.bc,clamp01:t.bd,color:t.b5,computeRatioByType:t.aA,convertUtils:t.bS,debug:t.c8,debugID:t.cd,deprecateModuleExportedName:t.bN,deserialize:t.dX,deserializeTag:t.c1,director:t.dU,disallowAnimation:t.cS,displayName:t.cN,displayOrder:t.cO,dragonBones:t.eG,dynamicAtlasManager:t.a6,easing:t.cF,editable:t.cK,editorExtrasTag:t.c0,enumerableProps:t.bu,equals:t.ba,error:t.ca,errorID:t.cf,find:t.dr,flattenCodeArray:t.dd,floatToHalf:t.bv,formerlySerializedAs:t.cU,fragmentText:t.a4,game:t.dW,garbageCollectionManager:t.cX,geometry:t.aM,getBaselineOffset:t.K,getEnglishWordPartAtFirst:t.a2,getEnglishWordPartAtLast:t.a3,getError:t.ck,getPathFromRoot:t.aC,getPhaseID:t.dl,getSerializationMetadata:t.c3,getSymbolAt:t.Z,getSymbolCodeAt:t.$,getSymbolLength:t.Y,getWorldTransformUntilRoot:t.aD,gfx:t.aH,graphicsAssembler:t.a,halfToFloat:t.bw,input:t.eA,instantiate:t.dZ,inverseLerp:t.br,isCCClassOrFastDefined:t.bV,isCCObject:t.d1,isDisplayStats:t.ci,isEnglishWordPartAtFirst:t.a0,isEnglishWordPartAtLast:t.a1,isUnicodeCJK:t.P,isUnicodeSpace:t.W,isValid:t.d2,js:t.bG,jsbUtils:t.cJ,labelAssembler:t.l,lerp:t.be,loadWasmModuleBullet:t.fv,loadWasmModuleSpine:t.g6,loader:t.eh,log:t.c9,logID:t.ce,macro:t.co,markAsWarning:t.bM,mat4:t.a_,math:t.aK,memop:t.aL,misc:t.bH,murmurhash2_32_gc:t.cG,native:t.eE,nextPow2:t.bo,override:t.cT,path:t.bI,physics:t.fw,pingPong:t.bq,pipeline:t.de,preTransforms:t.b6,primitives:t.fZ,profiler:t.g0,pseudoRandom:t.bl,pseudoRandomRange:t.bm,pseudoRandomRangeInt:t.bn,quat:t.aX,random:t.bh,randomRange:t.bj,randomRangeInt:t.bk,range:t.cP,rangeStep:t.cQ,rect:t.b3,removeProperty:t.bL,renderer:t.aI,rendering:t.eF,repeat:t.bp,replaceProperty:t.bK,resources:t.ef,safeMeasureText:t.X,sampleAnimationCurve:t.az,screen:t.cm,selector:t.f5,serializable:t.cV,serializeTag:t.c2,setDefaultLogTimes:t.bJ,setDisplayStats:t.cj,setPropertyEnumType:t.cZ,setPropertyEnumTypeOnAttrs:t.c_,setRandGenerator:t.bi,settings:t.cD,shift:t.cW,size:t.b1,slide:t.cR,sp:t.g5,spriteAssembler:t.s,sys:t.cn,systemEvent:t.eC,tiledLayerAssembler:t.gK,toDegree:t.bg,toRadian:t.bf,tooltip:t.cL,tween:t.gP,tweenProgress:t.gL,tweenUtil:t.gQ,url:t.ej,utils:t.a9,v2:t.aR,v3:t.aT,v4:t.aV,view:t.h9,visible:t.cM,visibleRect:t.cp,warn:t.cb,warnID:t.cg,widgetManager:t.h6})}],execute:function(){}}})); diff --git a/code/cocos-js/spine-Ubv7RmXU.js b/code/cocos-js/spine-Ubv7RmXU.js new file mode 100644 index 0000000..1134fe7 --- /dev/null +++ b/code/cocos-js/spine-Ubv7RmXU.js @@ -0,0 +1 @@ +System.register([],(function(e){"use strict";return{execute:function(){e("default","assets/spine-u3j38j0v.wasm")}}})); diff --git a/code/cocos-js/spine.asm-Keb2DSTX.js b/code/cocos-js/spine.asm-Keb2DSTX.js new file mode 100644 index 0000000..2cd96f6 --- /dev/null +++ b/code/cocos-js/spine.asm-Keb2DSTX.js @@ -0,0 +1 @@ +System.register([],(function(r){"use strict";return{execute:function(){var n;r("default",(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(r={}){var e,i,f;e||(e=void 0!==r?r:{}),e.ready=new Promise(((r,n)=>{i=r,f=n}));var t,u=Object.assign({},e),o="";function a(r){return e.locateFile?e.locateFile(r,o):o+r}"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),n&&(o=n),o=0!==o.indexOf("blob:")?o.substr(0,o.replace(/[?#].*/,"").lastIndexOf("/")+1):"",t=(r,n)=>{var e=new XMLHttpRequest;e.open("GET",J,!0),e.responseType="arraybuffer",e.onload=()=>{200==e.status||0==e.status&&e.response?r(e.response):n()},e.onerror=n,e.send(null)};var c,b=e.printErr||console.error.bind(console);function k(r){this.exports=function(r){var n=new ArrayBuffer(16),e=new Int32Array(n),i=new Float32Array(n),f=new Float64Array(n);function t(r){return e[r]}function u(r,n){e[r]=n}function o(){return f[0]}function a(r){f[0]=r}function c(){throw new Error("abort")}function b(r){i[2]=r}function k(){return i[2]}return function(r){var n=r.a,e=n.a,i=e.buffer;e.grow=function(r){r|=0;var n=0|pa(),t=n+r|0;if(n>2]=0,v[r>>2]=404,$(21285,4900,4,11248,11264,405,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=406,$(21285,4902,2,11272,11280,407,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=408,$(21285,2232,3,11284,11296,409,0|r,0,0),C(21291,21292,21293,0,11232,410,11235,0,11235,0,2360,11237,411),P(21291,1,11304,11232,412,413),r=Tt(8),v[r+4>>2]=0,v[r>>2]=414,$(21291,4900,4,11312,11328,415,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=416,$(21291,4902,2,11336,11280,417,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=418,$(21291,2232,3,11344,11356,419,0|r,0,0),r=Tt(4),v[r>>2]=420,$(21291,2225,4,11376,11328,1609,0|r,0,0),C(21296,21297,21298,0,11232,421,11235,0,11235,0,2340,11237,422),P(21296,1,11392,11232,423,424),r=Tt(8),v[r+4>>2]=0,v[r>>2]=425,$(21296,4900,4,11408,11264,426,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=427,$(21296,4902,2,11424,11280,428,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=429,$(21296,2232,3,11432,11296,430,0|r,0,0),r=Tt(4),v[r>>2]=431,$(21296,2225,4,11456,11264,1610,0|r,0,0),C(21299,21300,21301,0,11232,432,11235,0,11235,0,2126,11237,433),P(21299,1,11472,11232,434,435),r=Tt(8),v[r+4>>2]=0,v[r>>2]=436,$(21299,4900,4,11488,11264,437,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=438,$(21299,4902,2,11504,11280,439,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=440,$(21299,2232,3,11512,11296,441,0|r,0,0),r=Tt(4),v[r>>2]=442,$(21299,2225,4,11536,11264,1611,0|r,0,0),C(21302,21303,21304,0,11232,443,11235,0,11235,0,1743,11237,444),P(21302,1,11552,11232,445,446),r=Tt(8),v[r+4>>2]=0,v[r>>2]=447,$(21302,4900,4,11568,11264,448,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=449,$(21302,4902,2,11584,11280,450,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=451,$(21302,2232,3,11592,11296,452,0|r,0,0),r=Tt(4),v[r>>2]=453,$(21302,2225,4,11616,11264,1612,0|r,0,0),C(21306,21307,21308,0,11232,454,11235,0,11235,0,2108,11237,455),P(21306,1,11632,11232,456,457),r=Tt(8),v[r+4>>2]=0,v[r>>2]=458,$(21306,4900,4,11648,11264,459,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=460,$(21306,4902,2,11664,11280,461,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=462,$(21306,2232,3,11672,11296,463,0|r,0,0),r=Tt(4),v[r>>2]=464,$(21306,2225,4,11696,11264,1613,0|r,0,0),C(21309,21310,21311,0,11232,465,11235,0,11235,0,2374,11237,466),P(21309,1,11712,11232,467,468),r=Tt(8),v[r+4>>2]=0,v[r>>2]=469,$(21309,4900,4,11728,11264,470,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=471,$(21309,4902,2,11744,11280,472,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=473,$(21309,2232,3,11752,11296,474,0|r,0,0),r=Tt(4),v[r>>2]=475,$(21309,2225,4,11776,11264,1614,0|r,0,0),C(21312,21313,21314,0,11232,476,11235,0,11235,0,1481,11237,477),P(21312,1,11792,11232,478,479),r=Tt(8),v[r+4>>2]=0,v[r>>2]=480,$(21312,4900,4,11808,11264,481,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=482,$(21312,4902,2,11824,11280,483,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=484,$(21312,2232,3,11832,11296,485,0|r,0,0),r=Tt(4),v[r>>2]=486,$(21312,2225,4,11856,11264,1615,0|r,0,0),C(21316,21317,21318,0,11232,487,11235,0,11235,0,4838,11237,488),P(21316,1,11872,11232,489,490),r=Tt(8),v[r+4>>2]=0,v[r>>2]=491,$(21316,4900,4,11888,11264,492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=493,$(21316,4902,2,11904,11280,494,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=495,$(21316,2232,3,11912,11296,496,0|r,0,0),r=Tt(4),v[r>>2]=497,$(21316,2225,4,11936,11264,1616,0|r,0,0),C(21319,21320,21321,0,11232,498,11235,0,11235,0,3254,11237,499),P(21319,1,11952,11232,500,501),r=Tt(8),v[r+4>>2]=0,v[r>>2]=502,$(21319,4900,4,11968,11264,503,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=504,$(21319,4902,2,11984,11280,505,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=506,$(21319,2232,3,11992,11296,507,0|r,0,0),C(21322,21323,21324,0,11232,508,11235,0,11235,0,3471,11237,509),P(21322,1,12004,11232,510,511),r=Tt(8),v[r+4>>2]=0,v[r>>2]=512,$(21322,4900,4,12016,11264,513,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=514,$(21322,4902,2,12032,11280,515,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=516,$(21322,2232,3,12040,11296,517,0|r,0,0),C(21326,21327,21328,0,11232,518,11235,0,11235,0,3311,11237,519),P(21326,1,12052,11232,520,521),r=Tt(8),v[r+4>>2]=0,v[r>>2]=522,$(21326,4900,4,12064,11264,523,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=524,$(21326,4902,2,12080,11280,525,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=526,$(21326,2232,3,12088,11296,527,0|r,0,0),C(21330,21331,21332,0,11232,528,11235,0,11235,0,3357,11237,529),P(21330,1,12100,11232,530,531),r=Tt(8),v[r+4>>2]=0,v[r>>2]=532,$(21330,4900,4,12112,11264,533,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=534,$(21330,4902,2,12128,11280,535,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=536,$(21330,2232,3,12136,11296,537,0|r,0,0),C(21333,21334,21335,0,11232,538,11235,0,11235,0,3420,11237,539),P(21333,1,12148,11232,540,541),r=Tt(8),v[r+4>>2]=0,v[r>>2]=542,$(21333,4900,4,12160,11264,543,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=544,$(21333,4902,2,12176,11280,545,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=546,$(21333,2232,3,12184,11296,547,0|r,0,0),C(21336,21337,21338,0,11232,548,11235,0,11235,0,3331,11237,549),P(21336,1,12196,11232,550,551),r=Tt(8),v[r+4>>2]=0,v[r>>2]=552,$(21336,4900,4,12208,11264,553,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=554,$(21336,4902,2,12224,11280,555,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=556,$(21336,2232,3,12232,11296,557,0|r,0,0),C(21339,21340,21341,0,11232,558,11235,0,11235,0,3098,11237,559),P(21339,1,12244,11232,560,561),r=Tt(8),v[r+4>>2]=0,v[r>>2]=562,$(21339,4900,4,12256,11264,563,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=564,$(21339,4902,2,12272,11280,565,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=566,$(21339,2232,3,12280,11296,567,0|r,0,0),C(21343,21344,21345,0,11232,568,11235,0,11235,0,3233,11237,569),P(21343,1,12292,11232,570,571),r=Tt(8),v[r+4>>2]=0,v[r>>2]=572,$(21343,4900,4,12304,11264,573,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=574,$(21343,4902,2,12320,11280,575,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=576,$(21343,2232,3,12328,11296,577,0|r,0,0),C(21347,21348,21349,0,11232,578,11235,0,11235,0,3450,11237,579),P(21347,1,12340,11232,580,581),r=Tt(8),v[r+4>>2]=0,v[r>>2]=582,$(21347,4900,4,12352,11264,583,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=584,$(21347,4902,2,12368,11280,585,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=586,$(21347,2232,3,12376,11296,587,0|r,0,0),C(21351,21352,21353,0,11232,588,11235,0,11235,0,3195,11237,589),P(21351,1,12388,11232,590,591),r=Tt(8),v[r+4>>2]=0,v[r>>2]=592,$(21351,4900,4,12400,11264,593,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=594,$(21351,4902,2,12416,11280,595,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=596,$(21351,2232,3,12424,11296,597,0|r,0,0),C(21355,21356,21357,0,11232,598,11235,0,11235,0,3212,11237,599),P(21355,1,12436,11232,600,601),r=Tt(8),v[r+4>>2]=0,v[r>>2]=602,$(21355,4900,4,12448,11264,603,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=604,$(21355,4902,2,12464,11280,605,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=606,$(21355,2232,3,12472,11296,607,0|r,0,0),C(21359,21360,21361,0,11232,608,11235,0,11235,0,3145,11237,609),P(21359,1,12484,11232,610,611),r=Tt(8),v[r+4>>2]=0,v[r>>2]=612,$(21359,4900,4,12496,11264,613,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=614,$(21359,4902,2,12512,11280,615,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=616,$(21359,2232,3,12520,11296,617,0|r,0,0),C(21362,21363,21364,0,11232,618,11235,0,11235,0,3392,11237,619),P(21362,1,12532,11232,620,621),r=Tt(8),v[r+4>>2]=0,v[r>>2]=622,$(21362,4900,4,12544,11264,623,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=624,$(21362,4902,2,12560,11280,625,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=626,$(21362,2232,3,12568,11296,627,0|r,0,0),C(21365,21366,21367,0,11232,628,11235,0,11235,0,3114,11237,629),P(21365,1,12580,11232,630,631),r=Tt(8),v[r+4>>2]=0,v[r>>2]=632,$(21365,4900,4,12592,11264,633,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=634,$(21365,4902,2,12608,11280,635,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=636,$(21365,2232,3,12616,11296,637,0|r,0,0),C(21368,21369,21370,0,11232,638,11235,0,11235,0,3169,11237,639),P(21368,1,12628,11232,640,641),r=Tt(8),v[r+4>>2]=0,v[r>>2]=642,$(21368,4900,4,12640,11264,643,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=644,$(21368,4902,2,12656,11280,645,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=646,$(21368,2232,3,12664,11296,647,0|r,0,0),C(21371,21372,21373,0,11232,648,11235,0,11235,0,3270,11237,649),P(21371,1,12676,11232,650,651),r=Tt(8),v[r+4>>2]=0,v[r>>2]=652,$(21371,4900,4,12688,11264,653,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=654,$(21371,4902,2,12704,11280,655,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=656,$(21371,2232,3,12712,11296,657,0|r,0,0),r=Tt(4),v[r>>2]=658,$(21371,2225,4,12736,11264,1617,0|r,0,0),C(21374,21375,21376,0,11232,659,11235,0,11235,0,3071,11237,660),P(21374,1,12752,11232,661,662),r=Tt(8),v[r+4>>2]=0,v[r>>2]=663,$(21374,4900,4,12768,11264,664,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=665,$(21374,4902,2,12784,11280,666,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=667,$(21374,2232,3,12792,11296,668,0|r,0,0),C(21378,21379,21380,0,11232,669,11235,0,11235,0,3290,11237,670),P(21378,1,12804,11232,671,672),r=Tt(8),v[r+4>>2]=0,v[r>>2]=673,$(21378,4900,4,12816,11264,674,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=675,$(21378,4902,2,12832,11280,676,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=677,$(21378,2232,3,12840,11296,678,0|r,0,0),C(21381,21382,21383,0,11232,679,11235,0,11235,0,3050,11237,680),P(21381,1,12852,11232,681,682),r=Tt(8),v[r+4>>2]=0,v[r>>2]=683,$(21381,4900,4,12880,11264,684,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=685,$(21381,4902,2,12896,11280,686,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=687,$(21381,2232,3,12904,11296,688,0|r,0,0),C(21385,21386,21387,0,11232,689,11235,0,11235,0,3023,11237,690),P(21385,1,12916,11232,691,692),r=Tt(8),v[r+4>>2]=0,v[r>>2]=693,$(21385,4900,4,12944,11264,694,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=695,$(21385,4902,2,12960,11280,696,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=697,$(21385,2232,3,12968,11296,698,0|r,0,0),C(21388,21389,21390,0,11232,699,11235,0,11235,0,6924,11237,700),P(21388,1,12980,11232,701,702),P(21388,3,12984,12996,703,704),r=Tt(4),v[r>>2]=0,n=Tt(4),v[n>>2]=0,I(21388,1374,21294,13001,705,0|r,21294,13005,706,0|n),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(21388,1200,21294,13001,705,0|r,21294,13005,706,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=707,$(21388,2225,4,13024,13040,708,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=709,$(21388,4667,2,13048,13001,710,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=711,$(21388,4907,2,13056,11280,712,0|r,0,0),C(21391,21392,21393,0,11232,713,11235,0,11235,0,3519,11237,714),P(21391,1,13064,11232,715,716),P(21391,5,13072,13092,717,718),r=Tt(8),v[r+4>>2]=0,v[r>>2]=719,$(21391,2225,6,13104,13128,720,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=721,$(21391,6303,6,13104,13128,720,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=722,$(21391,3743,2,13136,11280,723,0|r,0,0),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(21391,3736,21294,13001,724,0|r,21294,13005,725,0|n),r=Tt(4),v[r>>2]=8,n=Tt(4),v[n>>2]=8,I(21391,4898,21294,13001,724,0|r,21294,13005,725,0|n),r=Tt(4),v[r>>2]=12,n=Tt(4),v[n>>2]=12,I(21391,6323,21294,13001,724,0|r,21294,13005,725,0|n),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(21391,6538,21294,13001,724,0|r,21294,13005,725,0|n),C(4276,7452,7446,0,11232,726,11235,0,11235,0,4276,11237,727),r=Tt(8),v[r+4>>2]=1,v[r>>2]=4,$(4276,1181,3,13144,13156,728,0|r,1,0),C(21394,21395,21396,0,11232,729,11235,0,11235,0,2236,11237,730),P(21394,1,13164,11232,731,732),C(6384,7982,7976,0,11232,733,11235,0,11235,0,6384,11237,734),P(6384,2,13168,11280,735,736),r=Tt(8),v[r+4>>2]=0,v[r>>2]=737,I(6384,5744,21272,11280,738,0|r,0,0,0,0),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(6384,3604,21289,11280,739,0|r,21289,13176,740,0|n),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(6384,6257,21397,11280,741,0|r,21397,13176,742,0|n),C(6363,7932,7926,6384,11232,743,11232,744,11232,745,6363,11237,746),P(6363,2,13184,11280,747,748),r=Tt(4),v[r>>2]=749,$(6363,2751,2,13192,11280,1618,0|r,0,0),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(6363,2229,21398,11280,750,0|r,21398,13176,751,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(6363,3969,21295,11280,752,0|r,21295,13176,753,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(6363,2564,21397,11280,754,0|r,21397,13176,755,0|n),r=Tt(4),v[r>>2]=49,n=Tt(4),v[n>>2]=49,I(6363,4804,21397,11280,754,0|r,21397,13176,755,0|n),r=Tt(4),v[r>>2]=50,n=Tt(4),v[n>>2]=50,I(6363,4465,21397,11280,754,0|r,21397,13176,755,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(6363,1214,21294,13001,756,0|r,21294,13005,757,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(6363,2573,21294,13001,756,0|r,21294,13005,757,0|n),C(6380,7956,7950,6384,11232,758,11232,759,11232,760,6380,11237,761),P(6380,2,13200,11280,762,763),r=Tt(4),v[r>>2]=764,$(6380,2751,2,13208,11280,1619,0|r,0,0),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(6380,2229,21399,11280,765,0|r,21399,13176,766,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(6380,5893,21279,11280,767,0|r,21279,13176,768,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(6380,5974,21280,11280,769,0|r,21280,13176,770,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(6380,6005,21281,11280,771,0|r,21281,13176,772,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(6380,4036,21294,13001,773,0|r,21294,13005,774,0|n),r=Tt(4),v[r>>2]=60,n=Tt(4),v[n>>2]=60,I(6380,3919,21294,13001,773,0|r,21294,13005,774,0|n),r=Tt(4),v[r>>2]=64,n=Tt(4),v[n>>2]=64,I(6380,4892,21294,13001,773,0|r,21294,13005,774,0|n),r=Tt(4),v[r>>2]=68,n=Tt(4),v[n>>2]=68,I(6380,1252,21294,13001,773,0|r,21294,13005,774,0|n),r=Tt(4),v[r>>2]=72,n=Tt(4),v[n>>2]=72,I(6380,1262,21294,13001,773,0|r,21294,13005,774,0|n),C(21400,21401,21402,0,11232,775,11235,0,11235,0,2947,11237,776),P(21400,1,13216,11232,777,778),r=Tt(8),v[r+4>>2]=0,v[r>>2]=779,$(21400,5087,4,13232,11264,780,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=781,$(21400,1665,4,13248,13040,782,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=783,$(21400,2054,6,13264,13128,784,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=785,$(21400,3843,3,13288,11296,786,0|r,0,0),r=Tt(4),v[r>>2]=787,$(21400,1651,4,13312,13040,1620,0|r,0,0),r=Tt(4),v[r>>2]=788,$(21400,2036,6,13328,13128,1621,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=789,$(21400,4711,2,13352,13001,790,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=791,$(21400,2173,2,13352,13001,790,0|r,0,0),C(21404,21354,21405,0,11232,792,11235,0,11235,0,1800,11237,793),P(21404,3,13360,13372,794,795),r=Tt(4),v[r>>2]=796,I(21404,6325,21406,11280,797,0|r,0,0,0,0),r=Tt(4),v[r>>2]=12,n=Tt(4),v[n>>2]=12,I(21404,4984,21295,11280,798,0|r,21295,13176,799,0|n),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(21404,4993,21294,13001,800,0|r,21294,13005,801,0|n),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(21404,5004,21272,11280,802,0|r,21272,13176,803,0|n),r=Tt(4),v[r>>2]=8,I(21404,5659,21294,13001,800,0|r,0,0,0,0),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(21404,5652,21294,13001,800,0|r,21294,13005,801,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(21404,6078,21294,13001,800,0|r,21294,13005,801,0|n),C(21406,21350,21407,0,11232,804,11235,0,11235,0,6399,11237,805),P(21406,2,13380,11280,806,807),r=Tt(8),v[r+4>>2]=0,v[r>>2]=808,I(21406,5744,21272,11280,809,0|r,0,0,0,0),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(21406,4984,21295,11280,810,0|r,21295,13176,811,0|n),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(21406,4993,21294,13001,812,0|r,21294,13005,813,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(21406,5004,21272,11280,814,0|r,21272,13176,815,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(21406,4736,21272,11280,814,0|r,21272,13176,815,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(21406,5652,21294,13001,812,0|r,21294,13005,813,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(21406,6078,21294,13001,812,0|r,21294,13005,813,0|n),C(2025,7259,7253,0,11232,816,11235,0,11235,0,2025,11237,817),r=Tt(8),v[r+4>>2]=0,v[r>>2]=818,I(2025,5744,21272,11280,819,0|r,0,0,0,0),C(1860,7118,7112,2025,11232,820,11232,821,11232,822,1860,11237,823),r=Tt(8),v[r+4>>2]=0,v[r>>2]=824,I(1860,6241,21295,11280,825,0|r,0,0,0,0),r=Tt(4),v[r>>2]=826,$(1860,2751,2,13388,11280,1622,0|r,0,0),r=Tt(4),v[r>>2]=827,$(1860,2881,2,13396,11280,1623,0|r,0,0),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(1860,4674,21289,11280,828,0|r,21289,13176,829,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(1860,1944,1860,11280,830,0|r,1860,13176,831,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=832,$(1860,2910,8,13408,13440,833,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=834,$(1860,3793,3,13452,13176,835,0|r,0,0),C(1838,7089,7083,1860,11232,836,11232,837,11232,838,1838,11237,839),P(1838,2,13464,11280,840,841),r=Tt(8),v[r+4>>2]=0,v[r>>2]=818,I(1838,5744,21272,11280,842,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(1838,1151,2,13472,11280,843,0|r,0,0),C(2e3,7233,7227,1860,11232,844,11232,845,11232,846,2e3,11237,847),P(2e3,2,13480,11280,848,849),r=Tt(8),v[r+4>>2]=0,v[r>>2]=850,n=Tt(8),v[n+4>>2]=0,v[n>>2]=851,I(2e3,1597,21399,11280,852,0|r,21399,13176,853,0|n),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(2e3,1151,2,13488,11280,854,0|r,0,0),C(1982,7211,7205,1860,11232,855,11232,856,11232,857,1982,11237,858),P(1982,2,13496,11280,859,860),r=Tt(4),v[r>>2]=168,n=Tt(4),v[n>>2]=168,I(1982,4720,21272,11280,861,0|r,21272,13176,862,0|n),Nf(2989,863),Nf(2982,864),qf(2812,865),r=Tt(4),v[r>>2]=866,I(1982,3491,21391,11280,867,0|r,0,0,0,0),r=Tt(4),v[r>>2]=196,n=Tt(4),v[n>>2]=196,I(1982,4705,21294,13001,868,0|r,21294,13005,869,0|n),r=Tt(4),v[r>>2]=200,n=Tt(4),v[n>>2]=200,I(1982,2166,21294,13001,868,0|r,21294,13005,869,0|n);r=Tt(4),v[r>>2]=224,n=Tt(4),v[n>>2]=224,I(1982,4694,21295,11280,870,0|r,21295,13176,871,0|n),qf(2848,872),r=Tt(8),v[r+4>>2]=0,v[r>>2]=873,$(1982,3002,2,13520,13528,874,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=875,$(1982,4771,2,13532,11280,876,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=877,$(1982,4757,3,13540,13176,878,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(1982,1151,2,13552,11280,879,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=880,$(1982,4785,2,13532,11280,876,0|r,0,0),C(1964,7189,7183,1860,11232,881,11232,882,11232,883,1964,11237,884),P(1964,2,13560,11280,885,886),r=Tt(4),v[r>>2]=887,$(1964,2713,2,13568,11280,1626,0|r,0,0),r=Tt(4),v[r>>2]=80,n=Tt(4),v[n>>2]=80,I(1964,6250,21397,11280,888,0|r,21397,13176,889,0|n),r=Tt(4),v[r>>2]=81,n=Tt(4),v[n>>2]=81,I(1964,6289,21397,11280,888,0|r,21397,13176,889,0|n),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(1964,1151,2,13576,11280,890,0|r,0,0),C(1880,7142,7136,2025,11232,891,11232,892,11232,893,1880,11237,894),P(1880,2,13584,11280,895,896),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(1880,1374,21294,13001,897,0|r,21294,13005,898,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(1880,1200,21294,13001,897,0|r,21294,13005,898,0|n),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(1880,4027,21294,13001,897,0|r,21294,13005,898,0|n),r=Tt(4),v[r>>2]=899,$(1880,3928,5,13600,13620,1627,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=900,$(1880,4093,3,13628,11356,901,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(1880,1151,2,13640,11280,902,0|r,0,0),C(1927,7165,7159,2025,11232,903,11232,904,11232,905,1927,11237,906),P(1927,2,13648,11280,907,908),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(1927,1374,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(1927,1200,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(1927,6697,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(1927,6604,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(1927,4027,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(1927,4705,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(1927,2166,21294,13001,909,0|r,21294,13005,910,0|n),r=Tt(4),v[r>>2]=911,I(1927,3491,21391,11280,912,0|r,0,0,0,0),r=Tt(4),v[r>>2]=116,n=Tt(4),v[n>>2]=116,I(1927,4720,21272,11280,913,0|r,21272,13176,914,0|n),Df(2198,915),r=Tt(8),v[r+4>>2]=0,v[r>>2]=916,$(1927,2975,7,13664,13692,917,0|r,0,0),Df(2982,918),r=Tt(8),v[r+4>>2]=0,v[r>>2]=919,$(1927,2216,2,13704,13528,920,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=921,$(1927,2910,6,13712,13736,922,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(1927,1151,2,13744,11280,923,0|r,0,0),C(3638,7377,7371,0,11232,924,11235,0,11235,0,3638,11237,925),r=Tt(8),v[r+4>>2]=1,v[r>>2]=32,$(3638,1997,4,13760,13776,926,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=28,$(3638,1877,4,13792,13776,927,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=24,$(3638,1961,4,13808,13776,928,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=20,$(3638,1835,4,13824,13776,929,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=16,$(3638,1979,5,13840,13860,930,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(3638,1924,5,13872,13860,931,0|r,1,0),C(3633,7348,7342,3638,11232,932,11232,933,11232,934,3633,11237,935),P(3633,2,13892,11280,936,937),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(3633,1924,5,13904,13860,938,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=16,$(3633,1979,5,13936,13860,939,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=20,$(3633,1835,4,13968,13776,940,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=24,$(3633,1961,4,13984,13776,941,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=28,$(3633,1877,4,14e3,13776,942,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=32,$(3633,1997,4,14016,13776,943,0|r,0,0),C(21411,21412,21413,0,11232,944,11235,0,11235,0,5876,11237,945),P(21411,2,14032,11280,946,947),r=Tt(4),v[r>>2]=948,$(21411,5783,2,14040,11280,1629,0|r,0,0),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(21411,3525,21282,11280,949,0|r,21282,13176,950,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(21411,3535,21282,11280,949,0|r,21282,13176,950,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(21411,3755,21283,11280,951,0|r,21283,13176,952,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(21411,3749,21283,11280,951,0|r,21283,13176,952,0|n),r=Tt(4),v[r>>2]=60,n=Tt(4),v[n>>2]=60,I(21411,4705,21295,11280,953,0|r,21295,13176,954,0|n),r=Tt(4),v[r>>2]=64,n=Tt(4),v[n>>2]=64,I(21411,2166,21295,11280,953,0|r,21295,13176,954,0|n),C(21414,21415,21416,0,11232,955,11235,0,11235,0,4322,11237,956),r=Tt(4),v[r>>2]=957,$(21414,5783,2,14048,11280,1630,0|r,0,0),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(21414,1374,21295,11280,958,0|r,21295,13176,959,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(21414,1200,21295,11280,958,0|r,21295,13176,959,0|n),r=Tt(4),v[r>>2]=68,n=Tt(4),v[n>>2]=68,I(21414,1284,21295,11280,958,0|r,21295,13176,959,0|n),r=Tt(4),v[r>>2]=72,n=Tt(4),v[n>>2]=72,I(21414,5052,21397,11280,960,0|r,21397,13176,961,0|n),r=Tt(4),v[r>>2]=76,n=Tt(4),v[n>>2]=76,I(21414,2864,21295,11280,958,0|r,21295,13176,959,0|n),C(21417,21418,21419,0,11232,962,11235,0,11235,0,3655,11237,963),C(21420,21410,21421,0,11232,964,11235,0,11235,0,2962,11237,965),P(21420,4,14064,13776,966,967),r=Tt(8),v[r+4>>2]=0,v[r>>2]=968,$(21420,4341,3,14080,11296,969,0|r,0,0),C(4253,7401,7395,4276,11232,970,11232,971,11232,972,1376,11237,973),P(4253,2,14092,11280,974,975),C(4270,7425,7419,4276,11232,976,11232,977,11232,978,1385,11237,979),P(4270,2,14100,11280,980,981),C(21399,21329,21422,0,11232,982,11235,0,11235,0,6330,11237,983),P(21399,4,14112,13776,984,985),r=Tt(8),v[r+4>>2]=0,v[r>>2]=986,I(21399,1284,21295,11280,987,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=988,I(21399,5744,21272,11280,989,0|r,0,0,0,0),r=Tt(4),v[r>>2]=990,I(21399,6479,21398,11280,991,0|r,0,0,0,0),r=Tt(4),v[r>>2]=992,I(21399,3491,21391,11280,993,0|r,0,0,0,0),r=Tt(4),v[r>>2]=994,I(21399,3515,21391,11280,993,0|r,0,0,0,0),r=Tt(4),v[r>>2]=80,n=Tt(4),v[n>>2]=80,I(21399,6034,21277,11280,995,0|r,21277,13176,996,0|n),C(5804,7884,7878,0,11232,997,11235,0,11235,0,5804,11237,998),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(5804,5087,2,14128,13528,999,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=16,$(5804,4961,2,14136,11280,1e3,0|r,1,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=16,n=Tt(8),v[n+4>>2]=1,v[n>>2]=20,I(5804,4954,21397,11280,1001,0|r,21397,13176,1002,0|n),C(1711,7047,7041,5804,11232,1003,11232,1004,11232,1005,1711,11237,1006),P(1711,3,14144,11296,1007,1008),r=Tt(4),v[r>>2]=1009,I(1711,6325,6363,11280,1010,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1011,$(1711,2751,2,14156,11280,1631,0|r,0,0),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(1711,2229,5335,11280,1012,0|r,5335,13176,1013,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(1711,3969,21295,11280,1014,0|r,21295,13176,1015,0|n),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(1711,2564,21397,11280,1016,0|r,21397,13176,1017,0|n),r=Tt(4),v[r>>2]=29,n=Tt(4),v[n>>2]=29,I(1711,4804,21397,11280,1016,0|r,21397,13176,1017,0|n),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(1711,1214,21294,13001,1018,0|r,21294,13005,1019,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(1711,2573,21294,13001,1018,0|r,21294,13005,1019,0|n),O(1711,6935,8,14176,14208,1020,1021,0),O(1711,6917,9,14224,14260,1022,1023,0),C(1728,7067,7061,5804,11232,1024,11232,1025,11232,1026,1728,11237,1027),P(1728,3,14272,11296,1028,1029),r=Tt(4),v[r>>2]=1030,I(1728,6325,6380,11280,1031,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1032,$(1728,2751,2,14284,11280,1632,0|r,0,0),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(1728,2229,21408,11280,1033,0|r,21408,13176,1034,0|n),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(1728,3919,21294,13001,1035,0|r,21294,13005,1036,0|n),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(1728,4892,21294,13001,1035,0|r,21294,13005,1036,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(1728,1252,21294,13001,1035,0|r,21294,13005,1036,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(1728,1262,21294,13001,1035,0|r,21294,13005,1036,0|n),C(6339,7901,7895,6384,11232,1037,11232,1038,11232,1039,6339,11237,1040),P(6339,2,14292,11280,1041,1042),r=Tt(4),v[r>>2]=1043,$(6339,2751,2,14300,11280,1633,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1044,I(6339,2229,21398,11280,1045,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1046,I(6339,1252,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1048,I(6339,1262,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1049,I(6339,1275,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1050,I(6339,1243,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1051,I(6339,4036,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1052,I(6339,6646,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1053,I(6339,6540,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1054,I(6339,6704,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1055,I(6339,6611,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1056,I(6339,6572,21294,13001,1047,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1057,I(6339,4970,21397,11280,1058,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1059,I(6339,4559,21397,11280,1058,0|r,0,0,0,0),C(1687,7020,7014,5804,11232,1060,11232,1061,11232,1062,1687,11237,1063),P(1687,3,14308,11296,1064,1065),r=Tt(4),v[r>>2]=1066,I(1687,6325,6339,11280,1067,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1068,$(1687,2751,2,14320,11280,1634,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1069,I(1687,2229,5335,11280,1070,0|r,0,0,0,0),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(1687,1252,21294,13001,1071,0|r,21294,13005,1072,0|n),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(1687,1262,21294,13001,1071,0|r,21294,13005,1072,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(1687,1275,21294,13001,1071,0|r,21294,13005,1072,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(1687,1243,21294,13001,1071,0|r,21294,13005,1072,0|n),C(5335,7473,7467,5804,11232,1073,11232,1074,11232,1075,5335,11237,1076),P(5335,4,14336,13776,1077,1078),r=Tt(4),v[r>>2]=1079,I(5335,6325,21398,11280,1080,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1081,I(5335,3809,21403,11280,1082,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1083,I(5335,1817,5335,11280,1084,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1085,$(5335,4415,2,14352,11280,1635,0|r,0,0),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(5335,1374,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(5335,1200,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(5335,4027,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(5335,6697,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(5335,6604,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(5335,6671,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(5335,6565,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=60,n=Tt(4),v[n>>2]=60,I(5335,1373,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=64,n=Tt(4),v[n>>2]=64,I(5335,1199,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=68,n=Tt(4),v[n>>2]=68,I(5335,4026,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=72,n=Tt(4),v[n>>2]=72,I(5335,6696,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=76,n=Tt(4),v[n>>2]=76,I(5335,6603,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=80,n=Tt(4),v[n>>2]=80,I(5335,6670,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=84,n=Tt(4),v[n>>2]=84,I(5335,6564,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=88,n=Tt(4),v[n>>2]=88,I(5335,6231,21397,11280,1088,0|r,21397,13176,1089,0|n),r=Tt(4),v[r>>2]=92,n=Tt(4),v[n>>2]=92,I(5335,6538,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=96,n=Tt(4),v[n>>2]=96,I(5335,6323,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=104,n=Tt(4),v[n>>2]=104,I(5335,6321,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=108,n=Tt(4),v[n>>2]=108,I(5335,6319,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=100,n=Tt(4),v[n>>2]=100,I(5335,6732,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(4),v[r>>2]=112,n=Tt(4),v[n>>2]=112,I(5335,6639,21294,13001,1086,0|r,21294,13005,1087,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1090,$(5335,4444,2,14360,13528,1091,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1092,$(5335,4642,9,14368,14404,1093,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1094,$(5335,5101,2,14360,13528,1091,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1095,$(5335,6678,2,14416,13001,1096,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1097,$(5335,6585,2,14416,13001,1096,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1098,$(5335,6717,2,14416,13001,1096,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1099,$(5335,6624,2,14416,13001,1096,0|r,0,0),Vf(4565,1100),Vf(6147,1101),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1102,$(5335,4051,3,14436,13156,1103,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1104,$(5335,4072,3,14436,13156,1103,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1105,$(5335,6160,3,14448,13005,1106,0|r,0,0),C(21398,21325,21424,0,11232,1107,11235,0,11235,0,6488,11237,1108),P(21398,4,14464,13776,1109,1110),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1111,I(21398,1284,21295,11280,1112,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1113,I(21398,5744,21272,11280,1114,0|r,0,0,0,0),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(21398,1817,21398,11280,1115,0|r,21398,13176,1116,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(21398,4667,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(21398,1374,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(21398,1200,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(21398,4027,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(21398,6697,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(21398,6604,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(21398,6671,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(21398,6565,21294,13001,1117,0|r,21294,13005,1118,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(21398,5926,21278,11280,1119,0|r,21278,13176,1120,0|n),r=Tt(4),v[r>>2]=60,n=Tt(4),v[n>>2]=60,I(21398,6257,21397,11280,1121,0|r,21397,13176,1122,0|n),C(21408,21342,21425,0,11232,1123,11235,0,11235,0,1600,11237,1124),P(21408,3,14480,11296,1125,1126),r=Tt(4),v[r>>2]=1127,I(21408,6325,21399,11280,1128,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1129,I(21408,5314,5335,11280,1130,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1131,I(21408,3491,21391,11280,1132,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1133,I(21408,3515,21391,11280,1132,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1134,$(21408,4480,2,14492,11280,1637,0|r,0,0),r=Tt(4),v[r>>2]=1135,$(21408,3831,2,14500,11280,1638,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1136,$(21408,1910,2,14508,11280,1137,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1138,$(21408,1896,3,14516,13176,1139,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1140,$(21408,5672,3,14528,13005,1141,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1142,$(21408,5690,2,14540,13001,1143,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1144,$(21408,5101,2,14548,13528,1145,0|r,0,0),C(21409,21346,21426,0,11232,1146,11235,0,11235,0,4398,11237,1147),P(21409,2,14556,11280,1148,1149),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1150,I(21409,5744,21272,11280,1151,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1152,$(21409,2751,2,14564,11280,1639,0|r,0,0),r=Tt(4),v[r>>2]=1153,$(21409,2437,2,14572,11280,1640,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1154,$(21409,1896,5,14592,14612,1155,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1156,$(21409,4395,3,14620,13176,1157,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1158,$(21409,4357,3,14620,13176,1157,0|r,0,0),r=Tt(4),v[r>>2]=1159,$(21409,1555,3,14632,11296,1641,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1160,$(21409,1910,4,14656,13776,1161,0|r,0,0),r=Tt(4),v[r>>2]=1162,$(21409,2541,2,14672,11280,1642,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1163,$(21409,2019,4,14688,11264,1164,0|r,0,0),r=Tt(4),v[r>>2]=1165,$(21409,1533,3,14704,11296,1643,0|r,0,0),C(21427,21384,21428,0,11232,1166,11235,0,11235,0,1069,11237,1167),P(21427,4,14720,13776,1168,1169),r=Tt(4),v[r>>2]=0,n=Tt(4),v[n>>2]=0,I(21427,1290,21289,11280,1170,0|r,21289,13176,1171,0|n),r=Tt(4),v[r>>2]=1172,$(21427,5783,2,14736,11280,1644,0|r,0,0),r=Tt(4),v[r>>2]=1173,$(21427,1910,2,14744,11280,1645,0|r,0,0),C(21430,21431,21432,0,11232,1174,11235,0,11235,0,4875,11237,1175),P(21430,1,14752,11232,1176,1177),r=Tt(4),v[r>>2]=1178,I(21430,2931,21291,11280,1179,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1180,I(21430,2825,21312,11280,1181,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1182,I(21430,3012,21291,11280,1179,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1183,$(21430,1503,4,14768,13776,1184,0|r,0,0);r=Tt(8),v[r+4>>2]=0,v[r>>2]=1185,$(21430,1572,3,14784,13176,1186,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1187,$(21430,6117,2,14796,13528,1188,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1189,$(21430,4864,2,14804,11280,1190,0|r,0,0),C(21433,21434,21435,0,11232,1191,11235,0,11235,0,6447,11237,1192),P(21433,1,14812,11232,1193,1194),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(21433,5744,21272,11280,1195,0|r,21272,13176,1196,0|n),r=Tt(4),v[r>>2]=1197,$(21433,2751,2,14816,11280,1646,0|r,0,0),r=Tt(4),v[r>>2]=1198,$(21433,2428,2,14824,11280,1647,0|r,0,0),r=Tt(4),v[r>>2]=1199,$(21433,2674,2,14832,11280,1648,0|r,0,0),r=Tt(4),v[r>>2]=64,n=Tt(4),v[n>>2]=64,I(21433,4366,21409,11280,1200,0|r,21409,13176,1201,0|n),r=Tt(4),v[r>>2]=1202,$(21433,2519,2,14840,11280,1649,0|r,0,0),r=Tt(4),v[r>>2]=1203,$(21433,2654,2,14848,11280,1650,0|r,0,0),r=Tt(4),v[r>>2]=1204,$(21433,2476,2,14856,11280,1651,0|r,0,0),r=Tt(4),v[r>>2]=1205,$(21433,2452,2,14864,11280,1652,0|r,0,0),r=Tt(4),v[r>>2]=1206,$(21433,2493,2,14872,11280,1653,0|r,0,0),r=Tt(4),v[r>>2]=148,n=Tt(4),v[n>>2]=148,I(21433,1374,21294,13001,1207,0|r,21294,13005,1208,0|n),r=Tt(4),v[r>>2]=152,n=Tt(4),v[n>>2]=152,I(21433,1200,21294,13001,1207,0|r,21294,13005,1208,0|n),r=Tt(4),v[r>>2]=156,n=Tt(4),v[n>>2]=156,I(21433,4705,21294,13001,1207,0|r,21294,13005,1208,0|n),r=Tt(4),v[r>>2]=160,n=Tt(4),v[n>>2]=160,I(21433,2166,21294,13001,1207,0|r,21294,13005,1208,0|n),r=Tt(4),v[r>>2]=164,n=Tt(4),v[n>>2]=164,I(21433,4290,21272,11280,1195,0|r,21272,13176,1196,0|n),r=Tt(4),v[r>>2]=176,n=Tt(4),v[n>>2]=176,I(21433,4799,21272,11280,1195,0|r,21272,13176,1196,0|n),r=Tt(4),v[r>>2]=204,n=Tt(4),v[n>>2]=204,I(21433,2596,21294,13001,1207,0|r,21294,13005,1208,0|n),r=Tt(4),v[r>>2]=208,n=Tt(4),v[n>>2]=208,I(21433,4725,21272,11280,1195,0|r,21272,13176,1196,0|n),r=Tt(4),v[r>>2]=220,n=Tt(4),v[n>>2]=220,I(21433,4736,21272,11280,1195,0|r,21272,13176,1196,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1209,$(21433,5331,3,14880,11296,1210,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1211,$(21433,1359,3,14892,11296,1212,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1213,$(21433,1588,3,14904,11296,1214,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1215,$(21433,1300,3,14892,11296,1212,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1216,$(21433,4386,3,14916,11296,1217,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1218,$(21433,1796,3,14928,11296,1219,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1220,$(21433,4210,3,14940,11296,1221,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1222,$(21433,1707,3,14952,11296,1223,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1224,$(21433,1683,3,14964,11296,1225,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1226,$(21433,1724,3,14976,11296,1227,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1228,$(21433,1314,3,14892,11296,1212,0|r,0,0),C(21436,21358,21437,0,11232,1229,11235,0,11235,0,4227,11237,1230),P(21436,4,14992,15008,1231,1232),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1233,I(21436,5744,21272,11280,1234,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1235,$(21436,2760,2,15020,11280,1654,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1236,$(21436,5454,3,15028,11296,1237,0|r,0,0),r=Tt(4),v[r>>2]=32,n=Tt(4),v[n>>2]=32,I(21436,4114,21294,13001,1238,0|r,21294,13005,1239,0|n),C(5643,7868,7862,0,11232,1240,11235,0,11235,0,5643,11237,1241),r=Tt(8),v[r+4>>2]=1,v[r>>2]=16,$(5643,6307,2,15040,11280,1242,0|r,1,0),C(5591,7779,7773,5643,11232,1243,11232,1244,11232,1245,5591,11237,1246),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1247,$(5591,1631,2,15048,11280,1248,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1249,$(5591,3703,3,15056,13176,1250,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1251,$(5591,6278,3,15056,13176,1250,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1252,$(5591,4923,7,15072,15100,1253,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1254,$(5591,2092,4,15120,15136,1255,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1256,$(5591,5241,3,15144,11356,1257,0|r,0,0),C(5620,7822,7816,5591,11232,1258,11232,1259,11232,1260,5620,11237,1261),P(5620,2,15156,11280,1262,1263),S(5620,6739,21295,10884,11232,1264,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1265,$(5620,5735,6,15168,15192,1266,0|r,0,0),C(5638,7847,7841,5620,11232,1267,11232,1268,11232,1269,5638,11237,1270),P(5638,2,15200,11280,1271,1272),C(5501,7698,7692,5620,11232,1273,11232,1274,11232,1275,5501,11237,1276),P(5501,2,15208,11280,1277,1278),C(5605,7800,7794,5591,11232,1279,11232,1280,11232,1281,5605,11237,1282),P(5605,2,15216,11280,1283,1284),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(5605,1349,21295,11280,1285,0|r,21295,13176,1286,0|n),r=Tt(4),v[r>>2]=1287,$(5605,2773,2,15224,11280,1655,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1288,$(5605,5735,5,15232,13620,1289,0|r,0,0),C(5469,7652,7646,5591,11232,1290,11232,1291,11232,1292,5469,11237,1293),P(5469,2,15252,11280,1294,1295),S(5469,6739,21295,9268,11232,1264,0,0),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(5469,1290,21295,11280,1296,0|r,21295,13176,1297,0|n),r=Tt(4),v[r>>2]=1298,$(5469,2773,2,15260,11280,1656,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1299,$(5469,5735,8,15280,15312,1300,0|r,0,0),C(5466,7628,7622,5591,11232,1301,11232,1302,11232,1303,5466,11237,1304),P(5466,2,15324,11280,1305,1306),S(5466,6739,21295,9268,11232,1264,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1307,n=Tt(8),v[n+4>>2]=0,v[n>>2]=1308,I(5466,1290,21295,11280,1309,0|r,21295,13176,1310,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1311,$(5466,5735,11,15344,15388,1312,0|r,0,0),C(5435,7602,7596,5643,11232,1313,11232,1314,11232,1315,5435,11237,1316),P(5435,2,15404,11280,1317,1318),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(5435,1290,21289,11280,1319,0|r,21289,13176,1320,0|n),r=Tt(4),v[r>>2]=1321,$(5435,2773,2,15412,11280,1657,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1322,$(5435,2783,2,15420,11280,1323,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1324,$(5435,1631,2,15428,11280,1325,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1326,$(5435,5735,5,15440,15460,1327,0|r,0,0),C(5546,7757,7751,5591,11232,1328,11232,1329,11232,1330,5546,11237,1331),P(5546,2,15468,11280,1332,1333),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(5546,1290,21295,11280,1334,0|r,21295,13176,1335,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(5546,1824,1860,11280,1336,0|r,1860,13176,1337,0|n),r=Tt(4),v[r>>2]=1338,$(5546,2773,2,15476,11280,1658,0|r,0,0),r=Tt(4),v[r>>2]=1339,$(5546,2893,2,15484,11280,1659,0|r,0,0),r=Tt(4),v[r>>2]=1340,$(5546,5735,5,15504,15460,1660,0|r,0,0),C(5421,7581,7575,5643,11232,1341,11232,1342,11232,1343,5421,11237,1344),P(5421,2,15524,11280,1345,1346),r=Tt(4),v[r>>2]=1347,$(5421,2773,2,15532,11280,1661,0|r,0,0),r=Tt(4),v[r>>2]=1348,$(5421,2519,2,15540,11280,1662,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1349,$(5421,1631,2,15548,11280,1350,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1351,$(5421,5735,4,15568,11264,1352,0|r,0,0),C(5483,7673,7667,5643,11232,1353,11232,1354,11232,1355,5483,11237,1356),P(5483,2,15584,11280,1357,1358),r=Tt(4),v[r>>2]=1359,$(5483,2773,2,15592,11280,1663,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1360,$(5483,1631,2,15600,11280,1361,0|r,0,0),r=Tt(4),v[r>>2]=1362,$(5483,2582,2,15608,11280,1664,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1363,$(5483,5735,5,15616,15460,1364,0|r,0,0),C(5400,7553,7547,5591,11232,1365,11232,1366,11232,1367,5400,11237,1368),P(5400,2,15636,11280,1369,1370),S(5400,6739,21295,9620,11232,1264,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1371,$(5400,5735,9,15648,15684,1372,0|r,0,0),C(5372,7518,7512,5591,11232,1373,11232,1374,11232,1375,5372,11237,1376),P(5372,2,15696,11280,1377,1378),S(5372,6739,21295,10852,11232,1264,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1379,$(5372,5735,8,15712,15312,1380,0|r,0,0),C(5515,7719,7713,5591,11232,1381,11232,1382,11232,1383,5515,11237,1384),P(5515,2,15744,11280,1385,1386),S(5515,6739,21295,10852,11232,1264,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1387,$(5515,5735,5,15760,13620,1388,0|r,0,0),C(5346,7485,7479,5591,11232,1389,11232,1390,11232,1391,5346,11237,1392),P(5346,2,15780,11280,1393,1394),S(5346,6739,21295,9876,11232,1264,0,0),C(21439,21377,21440,0,11232,1395,11235,0,11235,0,1089,11237,1396),P(21439,1,15788,11232,1397,1398),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1399,I(21439,4135,21436,11280,1400,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1401,I(21439,1380,21439,11280,1402,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1403,I(21439,4490,21439,11280,1402,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1404,I(21439,3800,21439,11280,1402,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1405,I(21439,1338,21295,11280,1406,0|r,0,0,0,0),r=Tt(4),v[r>>2]=36,n=Tt(4),v[n>>2]=36,I(21439,3738,21397,11280,1407,0|r,21397,13176,1408,0|n),r=Tt(4),v[r>>2]=37,n=Tt(4),v[n>>2]=37,I(21439,2402,21397,11280,1407,0|r,21397,13176,1408,0|n),r=Tt(4),v[r>>2]=40,n=Tt(4),v[n>>2]=40,I(21439,6172,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=44,n=Tt(4),v[n>>2]=44,I(21439,6187,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=48,n=Tt(4),v[n>>2]=48,I(21439,6207,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=52,n=Tt(4),v[n>>2]=52,I(21439,1513,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=56,n=Tt(4),v[n>>2]=56,I(21439,6125,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1411,n=Tt(8),v[n+4>>2]=0,v[n>>2]=1412,I(21439,1452,21294,13001,1413,0|r,21294,13005,1414,0|n),r=Tt(4),v[r>>2]=68,n=Tt(4),v[n>>2]=68,I(21439,1196,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=72,n=Tt(4),v[n>>2]=72,I(21439,5725,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=84,n=Tt(4),v[n>>2]=84,I(21439,6138,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=88,n=Tt(4),v[n>>2]=88,I(21439,5846,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=92,n=Tt(4),v[n>>2]=92,I(21439,6497,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=96,n=Tt(4),v[n>>2]=96,I(21439,5664,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=100,n=Tt(4),v[n>>2]=100,I(21439,4123,21294,13001,1409,0|r,21294,13005,1410,0|n),r=Tt(4),v[r>>2]=112,n=Tt(4),v[n>>2]=112,I(21439,6092,21275,11280,1415,0|r,21275,13176,1416,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1417,$(21439,5708,2,15792,13001,1418,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1419,$(21439,5041,2,15800,11280,1420,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1421,$(21439,2600,2,15808,13528,1422,0|r,0,0),C(21441,21442,21443,0,11232,1423,11235,0,11235,0,6460,11237,1424),P(21441,2,15816,11280,1425,1426),r=Tt(4),v[r>>2]=8,n=Tt(4),v[n>>2]=8,I(21441,1218,21294,13001,1427,0|r,21294,13005,1428,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1429,I(21441,6434,21433,11280,1430,0|r,0,0,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1431,$(21441,1229,5,15824,15844,1432,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1433,$(21441,4597,5,15856,15844,1434,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1435,$(21441,1236,4,15888,15904,1436,0|r,0,0),C(21444,21445,21446,0,11232,1437,11235,0,11235,0,5062,11237,1438),P(21444,2,15912,11280,1439,1440),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1441,I(21444,6325,21441,11280,1442,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1443,$(21444,2683,2,15920,11280,1665,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1444,n=Tt(8),v[n+4>>2]=0,v[n>>2]=1445,I(21444,5846,21294,13001,1446,0|r,21294,13005,1447,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1448,$(21444,5087,3,15928,13005,1449,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1450,$(21444,1181,3,15940,11296,1451,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1452,$(21444,2693,2,15952,13528,1453,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1454,$(21444,4586,3,15960,13176,1455,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1456,$(21444,4181,5,15984,13860,1457,0|r,0,0),r=Tt(4),v[r>>2]=1458,$(21444,4608,5,16016,13860,1666,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1459,$(21444,4224,6,16048,16072,1460,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1461,$(21444,4625,6,16080,16072,1462,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1463,$(21444,4145,4,16112,15008,1464,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1465,$(21444,4163,5,16128,16148,1466,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1467,$(21444,2635,3,15928,13005,1449,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1468,$(21444,1806,3,16156,11296,1469,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1470,$(21444,5016,2,15952,13528,1453,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1471,$(21444,5029,2,15952,13528,1453,0|r,0,0),C(21403,21447,21448,0,11232,1472,11235,0,11235,0,3878,11237,1473),P(21403,2,16168,11280,1474,1475),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1476,I(21403,6325,21433,11280,1477,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1478,$(21403,2751,2,16176,11280,1667,0|r,0,0),Kf(2428,1479),Kf(3620,1480),r=Tt(4),v[r>>2]=1481,$(21403,2476,2,16192,11280,1669,0|r,0,0),r=Tt(4),v[r>>2]=1482,$(21403,2452,2,16200,11280,1670,0|r,0,0),r=Tt(4),v[r>>2]=1483,$(21403,2493,2,16208,11280,1671,0|r,0,0),r=Tt(4),v[r>>2]=1484,$(21403,1392,2,16216,11280,1672,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1485,I(21403,4352,21409,11280,1486,0|r,0,0,0,0),r=Tt(4),v[r>>2]=1487,I(21403,3491,21391,11280,1488,0|r,0,0,0,0),r=Tt(4),v[r>>2]=160,n=Tt(4),v[n>>2]=160,I(21403,5659,21294,13001,1489,0|r,21294,13005,1490,0|n),r=Tt(4),v[r>>2]=164,n=Tt(4),v[n>>2]=164,I(21403,6697,21294,13001,1489,0|r,21294,13005,1490,0|n),r=Tt(4),v[r>>2]=168,n=Tt(4),v[n>>2]=168,I(21403,6604,21294,13001,1489,0|r,21294,13005,1490,0|n),r=Tt(4),v[r>>2]=172,n=Tt(4),v[n>>2]=172,I(21403,1374,21294,13001,1489,0|r,21294,13005,1490,0|n),r=Tt(4),v[r>>2]=176,n=Tt(4),v[n>>2]=176,I(21403,1200,21294,13001,1489,0|r,21294,13005,1490,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1491,$(21403,5864,2,16224,13528,1492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1493,$(21403,4444,2,16224,13528,1492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1494,$(21403,5101,2,16224,13528,1492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1495,$(21403,5136,2,16224,13528,1492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1496,$(21403,5116,2,16224,13528,1492,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1497,$(21403,5319,2,16232,11280,1498,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1499,$(21403,5331,3,16240,11296,1500,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1501,$(21403,1359,3,16252,11296,1502,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1503,$(21403,1588,3,16264,11296,1504,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1505,$(21403,1300,3,16252,11296,1502,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1506,$(21403,5769,3,16276,13176,1507,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1508,$(21403,4378,3,16288,13176,1509,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1510,$(21403,5749,4,16304,13776,1511,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1512,$(21403,1910,4,16320,13776,1513,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1514,$(21403,1896,4,16336,11264,1515,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1516,$(21403,1707,3,16352,11296,1517,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1518,$(21403,1683,3,16364,11296,1519,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1520,$(21403,1724,3,16376,11296,1521,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1522,$(21403,5087,3,16388,13005,1523,0|r,0,0),C(2278,7328,7322,0,11232,1524,11235,0,11235,0,2278,11237,1525),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(2278,4403,3,16400,13176,1526,0|r,1,0),r=Tt(4),v[r>>2]=1527,$(2278,4434,4,16416,16432,1673,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=20,$(2278,6113,2,16440,13528,1528,0|r,1,0),C(2254,7277,7271,2278,11232,1529,11232,1530,11232,1531,2294,11237,1532),P(2254,3,16448,12996,1533,1534),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(2254,6654,21294,13001,1535,0|r,21294,13005,1536,0|n),r=Tt(4),v[r>>2]=8,n=Tt(4),v[n>>2]=8,I(2254,6548,21294,13001,1535,0|r,21294,13005,1536,0|n),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(2254,4403,3,16460,13176,1537,0|r,0,0),r=Tt(4),v[r>>2]=1538,$(2254,4434,4,16416,16432,1673,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=20,$(2254,6113,2,16472,13528,1539,0|r,0,0),C(2273,7303,7297,2278,11232,1540,11232,1541,11232,1542,2322,11237,1543),P(2273,3,16480,13372,1544,1545),r=Tt(8),v[r+4>>2]=1,v[r>>2]=12,$(2273,4403,3,16492,13176,1546,0|r,0,0),r=Tt(4),v[r>>2]=1547,$(2273,4434,4,16416,16432,1673,0|r,0,0),r=Tt(8),v[r+4>>2]=1,v[r>>2]=20,$(2273,6113,2,16504,13528,1548,0|r,0,0),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(2273,6662,21294,13001,1549,0|r,21294,13005,1550,0|n),r=Tt(4),v[r>>2]=8,n=Tt(4),v[n>>2]=8,I(2273,6556,21294,13001,1549,0|r,21294,13005,1550,0|n),r=Tt(4),v[r>>2]=12,n=Tt(4),v[n>>2]=12,I(2273,2415,21294,13001,1549,0|r,21294,13005,1550,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1551,n=Tt(8),v[n+4>>2]=0,v[n>>2]=1552,I(2273,5791,21294,13001,1553,0|r,21294,13005,1554,0|n),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(2273,6732,21294,13001,1549,0|r,21294,13005,1550,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(2273,6639,21294,13001,1549,0|r,21294,13005,1550,0|n),C(21449,21450,21451,0,11232,1555,11235,0,11235,0,4525,11237,1556),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(21449,1617,21305,11280,1557,0|r,21305,13176,1558,0|n),r=Tt(4),v[r>>2]=20,n=Tt(4),v[n>>2]=20,I(21449,1624,21305,11280,1557,0|r,21305,13176,1558,0|n),r=Tt(4),v[r>>2]=24,n=Tt(4),v[n>>2]=24,I(21449,3093,21305,11280,1557,0|r,21305,13176,1558,0|n),r=Tt(4),v[r>>2]=28,n=Tt(4),v[n>>2]=28,I(21449,3249,21305,11280,1557,0|r,21305,13176,1558,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1559,$(21449,6409,2,16512,11280,1560,0|r,0,0),C(21290,21452,21453,0,11232,1561,11235,0,11235,0,5293,11237,1562),r=Tt(4),v[r>>2]=0,n=Tt(4),v[n>>2]=0,I(21290,5177,21305,11280,1563,0|r,21305,13176,1564,0|n),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(21290,2190,21305,11280,1563,0|r,21305,13176,1564,0|n),r=Tt(4),v[r>>2]=8,n=Tt(4),v[n>>2]=8,I(21290,1617,21305,11280,1563,0|r,21305,13176,1564,0|n);r=Tt(4),v[r>>2]=12,n=Tt(4),v[n>>2]=12,I(21290,2208,21305,11280,1563,0|r,21305,13176,1564,0|n),r=Tt(4),v[r>>2]=16,n=Tt(4),v[n>>2]=16,I(21290,1624,21305,11280,1563,0|r,21305,13176,1564,0|n),C(21454,21455,21456,0,11232,1565,11235,0,11235,0,6061,11237,1566),P(21454,1,16520,11232,1567,1568),r=Tt(4),v[r>>2]=0,n=Tt(4),v[n>>2]=0,I(21454,5856,21397,11280,1569,0|r,21397,13176,1570,0|n),r=Tt(4),v[r>>2]=4,n=Tt(4),v[n>>2]=4,I(21454,5094,21294,13001,1571,0|r,21294,13005,1572,0|n),r=Tt(4),v[r>>2]=1,n=Tt(4),v[n>>2]=1,I(21454,5814,21397,11280,1569,0|r,21397,13176,1570,0|n),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1573,$(21454,3818,3,16524,11296,1574,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1575,$(21454,4181,5,16544,16564,1576,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1577,$(21454,4378,3,16572,13176,1578,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1579,$(21454,4194,3,16584,13005,1580,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1581,$(21454,6417,2,16596,11280,1582,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1583,$(21454,6518,3,16604,13176,1584,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1585,$(21454,1756,3,16604,13176,1584,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1586,$(21454,3497,6,16624,16648,1587,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1588,$(21454,2291,3,16656,13176,1589,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1590,$(21454,2319,3,16668,13176,1591,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1592,$(21454,2307,2,16680,13528,1593,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1594,$(21454,5059,2,16688,11280,1595,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1596,$(21454,1229,5,16704,15844,1597,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1598,$(21454,3588,3,16724,13176,1599,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1600,$(21454,3566,4,16736,11264,1601,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1602,$(21454,5961,3,16604,13176,1584,0|r,0,0),r=Tt(4),v[r>>2]=1603,$(21454,2730,2,16752,11280,1674,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1604,$(21454,4305,6,16768,13736,1605,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1606,$(21454,1156,2,16680,13528,1593,0|r,0,0),r=Tt(8),v[r+4>>2]=0,v[r>>2]=1607,$(21454,5162,4,16800,11264,1608,0|r,0,0)}function Y(r){var n,e=0,i=0,f=0,t=0,u=0,o=0,a=0,c=0,b=0,k=0,s=0,h=0;D=n=D-16|0;r:{n:{e:{i:{f:{t:{u:{o:{a:{c:{b:{k:{s:{v:{if((r|=0)>>>0<=244){if(3&(e=(o=v[5374])>>>(i=(a=r>>>0<11?16:r+11&-8)>>>3|0)|0)){e=21536+(r=(i=i+(1&~e)|0)<<3)|0,f=v[r+21544>>2],(0|e)!=(0|(r=v[f+8>>2]))?(v[r+12>>2]=e,v[e+8>>2]=r):(s=21496,h=Qf(i)&o,v[s>>2]=h),r=f+8|0,e=i<<3,v[f+4>>2]=3|e,v[4+(e=e+f|0)>>2]=1|v[e+4>>2];break r}if((k=v[5376])>>>0>=a>>>0)break v;if(e){e=21536+(r=(f=qt(0-(r=(0-(r=2<>2],(0|e)!=(0|(r=v[t+8>>2]))?(v[r+12>>2]=e,v[e+8>>2]=r):(o=Qf(f)&o,v[5374]=o),v[t+4>>2]=3|a,f=(r=f<<3)-a|0,v[4+(i=t+a|0)>>2]=1|f,v[r+t>>2]=f,k&&(e=21536+(-8&k)|0,u=v[5379],(r=1<<(k>>>3))&o?r=v[e+8>>2]:(v[5374]=r|o,r=e),v[e+8>>2]=u,v[r+12>>2]=u,v[u+12>>2]=e,v[u+8>>2]=r),r=t+8|0,v[5379]=i,v[5376]=f;break r}if(!(b=v[5375]))break v;for(i=v[21800+(qt(0-b&b)<<2)>>2],u=(-8&v[i+4>>2])-a|0,e=i;(r=v[e+16>>2])||(r=v[e+20>>2]);)u=(f=(e=(-8&v[r+4>>2])-a|0)>>>0>>0)?e:u,i=f?r:i,e=r;if(c=v[i+24>>2],(0|(f=v[i+12>>2]))!=(0|i)){r=v[i+8>>2],v[r+12>>2]=f,v[f+8>>2]=r;break n}if(!(r=v[(e=i+20|0)>>2])){if(!(r=v[i+16>>2]))break s;e=i+16|0}for(;t=e,f=r,(r=v[(e=r+20|0)>>2])||(e=f+16|0,r=v[f+16>>2]););v[t>>2]=0;break n}if(a=-1,!(r>>>0>4294967231)&&(a=-8&(r=r+11|0),b=v[5375])){u=0-a|0,o=0,a>>>0<256||(o=31,a>>>0>16777215||(o=62+((a>>>38-(r=F(r>>>8|0))&1)-(r<<1)|0)|0));l:{h:{if(e=v[21800+(o<<2)>>2])for(r=0,i=a<<(31!=(0|o)?25-(o>>>1|0):0);;){if(!((t=(-8&v[e+4>>2])-a|0)>>>0>=u>>>0||(f=e,u=t,t))){u=0,r=e;break h}if(t=v[e+20>>2],e=v[16+((i>>>29&4)+e|0)>>2],r=t?(0|t)==(0|e)?r:t:r,i<<=1,!e)break}else r=0;if(!(r|f)){if(f=0,!(r=(0-(r=2<>2]}if(!r)break l}for(;u=(i=(e=(-8&v[r+4>>2])-a|0)>>>0>>0)?e:u,f=i?r:f,r=(e=v[r+16>>2])||v[r+20>>2];);}if(!(!f|v[5376]-a>>>0<=u>>>0)){if(o=v[f+24>>2],(0|f)!=(0|(i=v[f+12>>2]))){r=v[f+8>>2],v[r+12>>2]=i,v[i+8>>2]=r;break e}if(!(r=v[(e=f+20|0)>>2])){if(!(r=v[f+16>>2]))break k;e=f+16|0}for(;t=e,i=r,(r=v[(e=r+20|0)>>2])||(e=i+16|0,r=v[i+16>>2]););v[t>>2]=0;break e}}}if((r=v[5376])>>>0>=a>>>0){f=v[5379],(e=r-a|0)>>>0>=16?(v[4+(i=f+a|0)>>2]=1|e,v[r+f>>2]=e,v[f+4>>2]=3|a):(v[f+4>>2]=3|r,v[4+(r=r+f|0)>>2]=1|v[r+4>>2],i=0,e=0),v[5376]=e,v[5379]=i,r=f+8|0;break r}if((c=v[5377])>>>0>a>>>0){e=c-a|0,v[5377]=e,r=(i=v[5380])+a|0,v[5380]=r,v[r+4>>2]=1|e,v[i+4>>2]=3|a,r=i+8|0;break r}if(r=0,b=a+47|0,v[5492]?i=v[5494]:(v[5495]=-1,v[5496]=-1,v[5493]=4096,v[5494]=4096,v[5492]=n+12&-16^1431655768,v[5497]=0,v[5485]=0,i=4096),(e=(t=b+i|0)&(u=0-i|0))>>>0<=a>>>0)break r;if((f=v[5484])&&f>>>0<(o=(i=v[5482])+e|0)>>>0|i>>>0>=o>>>0)break r;v:{if(!(4&l[21940])){l:{h:{d:{p:{if(f=v[5380])for(r=21944;;){if((i=v[r>>2])>>>0<=f>>>0&f>>>0>2]>>>0)break p;if(!(r=v[r+8>>2]))break}if(-1==(0|(i=di(0))))break l;if(o=e,(r=(f=v[5493])-1|0)&i&&(o=(e-i|0)+(r+i&0-f)|0),o>>>0<=a>>>0)break l;if((f=v[5484])&&f>>>0<(u=(r=v[5482])+o|0)>>>0|r>>>0>=u>>>0)break l;if((0|i)!=(0|(r=di(o))))break d;break v}if((0|(i=di(o=u&t-c)))==(v[r>>2]+v[r+4>>2]|0))break h;r=i}if(-1==(0|r))break l;if(a+48>>>0<=o>>>0){i=r;break v}if(-1==(0|di(i=(i=v[5494])+(b-o|0)&0-i)))break l;o=i+o|0,i=r;break v}if(-1!=(0|i))break v}v[5485]=4|v[5485]}if(-1==(0|(i=di(e)))|-1==(0|(r=di(0)))|r>>>0<=i>>>0)break a;if((o=r-i|0)>>>0<=a+40>>>0)break a}r=v[5482]+o|0,v[5482]=r,r>>>0>d[5483]&&(v[5483]=r);v:{if(t=v[5380]){for(r=21944;;){if(((f=v[r>>2])+(e=v[r+4>>2])|0)==(0|i))break v;if(!(r=v[r+8>>2]))break}break b}for((r=v[5378])>>>0<=i>>>0&&r||(v[5378]=i),r=0,v[5487]=o,v[5486]=i,v[5382]=-1,v[5383]=v[5492],v[5489]=0;e=21536+(f=r<<3)|0,v[f+21544>>2]=e,v[f+21548>>2]=e,32!=(0|(r=r+1|0)););e=(f=o-40|0)-(r=i+8&7?-8-i&7:0)|0,v[5377]=e,r=r+i|0,v[5380]=r,v[r+4>>2]=1|e,v[4+(i+f|0)>>2]=40,v[5381]=v[5496];break c}if(8&v[r+12>>2]|i>>>0<=t>>>0|f>>>0>t>>>0)break b;v[r+4>>2]=e+o,i=(r=t+8&7?-8-t&7:0)+t|0,v[5380]=i,r=(e=v[5377]+o|0)-r|0,v[5377]=r,v[i+4>>2]=1|r,v[4+(e+t|0)>>2]=40,v[5381]=v[5496];break c}f=0;break n}i=0;break e}d[5378]>i>>>0&&(v[5378]=i),e=i+o|0,r=21944;b:{k:{s:{for(;;){if((0|e)!=v[r>>2]){if(r=v[r+8>>2])continue;break s}break}if(!(8&l[r+12|0]))break k}for(r=21944;;){if((e=v[r>>2])>>>0<=t>>>0&&(u=e+v[r+4>>2]|0)>>>0>t>>>0)break b;r=v[r+8>>2]}}if(v[r>>2]=i,v[r+4>>2]=v[r+4>>2]+o,v[4+(b=(i+8&7?-8-i&7:0)+i|0)>>2]=3|a,r=(o=e+(e+8&7?-8-e&7:0)|0)-(c=a+b|0)|0,(0|t)==(0|o)){v[5380]=c,r=v[5377]+r|0,v[5377]=r,v[c+4>>2]=1|r;break i}if(v[5379]==(0|o)){v[5379]=c,r=v[5376]+r|0,v[5376]=r,v[c+4>>2]=1|r,v[r+c>>2]=r;break i}if(1!=(3&(u=v[o+4>>2])))break f;if(t=-8&u,u>>>0<=255){if((0|(i=v[o+12>>2]))==(0|(e=v[o+8>>2]))){s=21496,h=v[5374]&Qf(u>>>3|0),v[s>>2]=h;break t}v[e+12>>2]=i,v[i+8>>2]=e;break t}if(a=v[o+24>>2],(0|o)!=(0|(i=v[o+12>>2]))){e=v[o+8>>2],v[e+12>>2]=i,v[i+8>>2]=e;break u}if(!(u=v[(e=o+20|0)>>2])){if(!(u=v[o+16>>2]))break o;e=o+16|0}for(;f=e,(u=v[(e=(i=u)+20|0)>>2])||(e=i+16|0,u=v[i+16>>2]););v[f>>2]=0;break u}for(e=(f=o-40|0)-(r=i+8&7?-8-i&7:0)|0,v[5377]=e,r=r+i|0,v[5380]=r,v[r+4>>2]=1|e,v[4+(i+f|0)>>2]=40,v[5381]=v[5496],v[(f=(r=(u+(u-39&7?39-u&7:0)|0)-47|0)>>>0>>0?t:r)+4>>2]=27,r=v[5489],v[f+16>>2]=v[5488],v[f+20>>2]=r,r=v[5487],v[f+8>>2]=v[5486],v[f+12>>2]=r,v[5488]=f+8,v[5487]=o,v[5486]=i,v[5489]=0,r=f+24|0;v[r+4>>2]=7,e=r+8|0,r=r+4|0,e>>>0>>0;);if((0|f)!=(0|t))if(v[f+4>>2]=-2&v[f+4>>2],u=f-t|0,v[t+4>>2]=1|u,v[f>>2]=u,u>>>0<=255)e=21536+(-8&u)|0,(i=v[5374])&(r=1<<(u>>>3))?r=v[e+8>>2]:(v[5374]=r|i,r=e),v[e+8>>2]=t,v[r+12>>2]=t,v[t+12>>2]=e,v[t+8>>2]=r;else{r=31,u>>>0<=16777215&&(r=62+((u>>>38-(r=F(u>>>8|0))&1)-(r<<1)|0)|0),v[t+28>>2]=r,v[t+16>>2]=0,v[t+20>>2]=0,e=21800+(r<<2)|0;b:{if((f=v[5375])&(i=1<>>1|0):0),f=v[e>>2];;){if((0|u)==(-8&v[(e=f)+4>>2]))break b;if(i=r>>>29|0,r<<=1,!(f=v[16+(i=(4&i)+e|0)>>2]))break}v[i+16>>2]=t}else v[5375]=i|f,v[e>>2]=t;v[t+24>>2]=e,v[t+12>>2]=t,v[t+8>>2]=t;break c}r=v[e+8>>2],v[r+12>>2]=t,v[e+8>>2]=t,v[t+24>>2]=0,v[t+12>>2]=e,v[t+8>>2]=r}}if(!((r=v[5377])>>>0<=a>>>0)){e=r-a|0,v[5377]=e,r=(i=v[5380])+a|0,v[5380]=r,v[r+4>>2]=1|e,v[i+4>>2]=3|a,r=i+8|0;break r}}v[5373]=48,r=0;break r}i=0}if(a){f=v[o+28>>2];u:{if(v[(e=21800+(f<<2)|0)>>2]==(0|o)){if(v[e>>2]=i,i)break u;s=21500,h=v[5375]&Qf(f),v[s>>2]=h;break t}if(v[a+(v[a+16>>2]==(0|o)?16:20)>>2]=i,!i)break t}v[i+24>>2]=a,(e=v[o+16>>2])&&(v[i+16>>2]=e,v[e+24>>2]=i),(e=v[o+20>>2])&&(v[i+20>>2]=e,v[e+24>>2]=i)}}r=r+t|0,u=v[4+(o=t+o|0)>>2]}if(v[o+4>>2]=-2&u,v[c+4>>2]=1|r,v[r+c>>2]=r,r>>>0<=255)e=21536+(-8&r)|0,(i=v[5374])&(r=1<<(r>>>3))?r=v[e+8>>2]:(v[5374]=r|i,r=e),v[e+8>>2]=c,v[r+12>>2]=c,v[c+12>>2]=e,v[c+8>>2]=r;else{u=31,r>>>0<=16777215&&(u=62+((r>>>38-(e=F(r>>>8|0))&1)-(e<<1)|0)|0),v[c+28>>2]=u,v[c+16>>2]=0,v[c+20>>2]=0,e=21800+(u<<2)|0;f:{if((f=v[5375])&(i=1<>>1|0):0),i=v[e>>2];;){if(e=i,(-8&v[i+4>>2])==(0|r))break f;if(i=u>>>29|0,u<<=1,!(i=v[16+(f=(4&i)+e|0)>>2]))break}v[f+16>>2]=c}else v[5375]=i|f,v[e>>2]=c;v[c+24>>2]=e,v[c+12>>2]=c,v[c+8>>2]=c;break i}r=v[e+8>>2],v[r+12>>2]=c,v[e+8>>2]=c,v[c+24>>2]=0,v[c+12>>2]=e,v[c+8>>2]=r}}r=b+8|0;break r}e:if(o){e=v[f+28>>2];i:{if(v[(r=21800+(e<<2)|0)>>2]==(0|f)){if(v[r>>2]=i,i)break i;b=Qf(e)&b,v[5375]=b;break e}if(v[o+(v[o+16>>2]==(0|f)?16:20)>>2]=i,!i)break e}v[i+24>>2]=o,(r=v[f+16>>2])&&(v[i+16>>2]=r,v[r+24>>2]=i),(r=v[f+20>>2])&&(v[i+20>>2]=r,v[r+24>>2]=i)}e:if(u>>>0<=15)r=u+a|0,v[f+4>>2]=3|r,v[4+(r=r+f|0)>>2]=1|v[r+4>>2];else if(v[f+4>>2]=3|a,v[4+(t=f+a|0)>>2]=1|u,v[t+u>>2]=u,u>>>0<=255)e=21536+(-8&u)|0,(i=v[5374])&(r=1<<(u>>>3))?r=v[e+8>>2]:(v[5374]=r|i,r=e),v[e+8>>2]=t,v[r+12>>2]=t,v[t+12>>2]=e,v[t+8>>2]=r;else{r=31,u>>>0<=16777215&&(r=62+((u>>>38-(r=F(u>>>8|0))&1)-(r<<1)|0)|0),v[t+28>>2]=r,v[t+16>>2]=0,v[t+20>>2]=0,e=21800+(r<<2)|0;i:{if((i=1<>>1|0):0),a=v[e>>2];;){if((-8&v[(e=a)+4>>2])==(0|u))break i;if(i=r>>>29|0,r<<=1,!(a=v[16+(i=(4&i)+e|0)>>2]))break}v[i+16>>2]=t}else v[5375]=i|b,v[e>>2]=t;v[t+24>>2]=e,v[t+12>>2]=t,v[t+8>>2]=t;break e}r=v[e+8>>2],v[r+12>>2]=t,v[e+8>>2]=t,v[t+24>>2]=0,v[t+12>>2]=e,v[t+8>>2]=r}r=f+8|0;break r}n:if(c){e=v[i+28>>2];e:{if(v[(r=21800+(e<<2)|0)>>2]==(0|i)){if(v[r>>2]=f,f)break e;s=21500,h=Qf(e)&b,v[s>>2]=h;break n}if(v[c+(v[c+16>>2]==(0|i)?16:20)>>2]=f,!f)break n}v[f+24>>2]=c,(r=v[i+16>>2])&&(v[f+16>>2]=r,v[r+24>>2]=f),(r=v[i+20>>2])&&(v[f+20>>2]=r,v[r+24>>2]=f)}u>>>0<=15?(r=u+a|0,v[i+4>>2]=3|r,v[4+(r=r+i|0)>>2]=1|v[r+4>>2]):(v[i+4>>2]=3|a,v[4+(f=i+a|0)>>2]=1|u,v[f+u>>2]=u,k&&(e=21536+(-8&k)|0,t=v[5379],(r=1<<(k>>>3))&o?r=v[e+8>>2]:(v[5374]=r|o,r=e),v[e+8>>2]=t,v[r+12>>2]=t,v[t+12>>2]=e,v[t+8>>2]=r),v[5379]=f,v[5376]=u),r=i+8|0}return D=n+16|0,0|r}function X(r,n,e,i,t){var o,a=0,c=0,b=0,s=0,h=0,d=w(0),y=0,m=0,g=0,F=0,A=0,T=0,$=0,I=0,C=0,P=0,E=0,O=0,R=0,S=0,W=0,G=0,U=0,j=0,H=0,L=0,M=0,_=0,z=0,x=0,J=0,K=0,B=0,N=0,q=0,V=0,Z=0,Y=0,X=0,Q=0,rr=0,nr=0,er=0;D=o=D-32|0;r:{n:{e:{if(e){if($=Wn(n,1))break e;break r}if(y=ge(a=Xf(68),e=gu(c=o+20|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0)),lf(e),(0|(a=Wn(n,1)))>0)for(c=y+36|0,e=0;s=Wn(n,1),Sn(c,v[i+28>>2]+(s<<2)|0),(0|a)!=(0|(e=e+1|0)););if((0|(a=Wn(n,1)))>0)for(c=y+52|0,e=0;s=Wn(n,1),v[o+20>>2]=v[v[i+112>>2]+(s<<2)>>2],Sn(c,o+20|0),(0|a)!=(0|(e=e+1|0)););if((0|(a=Wn(n,1)))>0)for(c=y+52|0,e=0;s=Wn(n,1),v[o+20>>2]=v[v[i+128>>2]+(s<<2)>>2],Sn(c,o+20|0),(0|a)!=(0|(e=e+1|0)););if((0|(a=Wn(n,1)))>0)for(c=y+52|0,e=0;s=Wn(n,1),v[o+20>>2]=v[v[i+144>>2]+(s<<2)>>2],Sn(c,o+20|0),(0|a)!=(0|(e=e+1|0)););$=Wn(n,1);break n}y=ge(a=Xf(68),e=gu(o+20|0,2138,0)),lf(e)}if(!((0|$)<=0))for(;;){if(P=Wn(n,1),I=0,(0|(E=Wn(n,1)))>0)for(;;){a=C=gu(a=o+20|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0),D=s=D-80|0,m=gu(c=s+68|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0),v[m+4>>2]||ee(m,a),a=v[n+4>>2],v[n+4>>2]=a+1,e=0;n:{e:switch(l[0|a]){case 0:c=gu(a=s+56|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0),v[c+4>>2]||ee(c,m),a=v[n+4>>2],v[n+4>>2]=a+1,h=l[0|a],v[n+4>>2]=a+2,b=l[a+1|0],v[n+4>>2]=a+3,F=l[a+2|0],v[n+4>>2]=a+4,g=l[a+3|0],v[n+4>>2]=a+5,A=l[a+4|0],v[n+4>>2]=a+6,T=l[a+5|0],v[n+4>>2]=a+7,W=l[a+6|0],v[n+4>>2]=a+8,G=l[a+7|0],v[n+4>>2]=a+9,U=l[a+8|0],v[n+4>>2]=a+10,j=l[a+9|0],v[n+4>>2]=a+11,H=l[a+10|0],v[n+4>>2]=a+12,L=l[a+11|0],v[n+4>>2]=a+13,M=l[a+12|0],v[n+4>>2]=a+14,_=l[a+13|0],v[n+4>>2]=a+15,z=l[a+14|0],v[n+4>>2]=a+16,x=l[a+15|0],v[n+4>>2]=a+17,J=l[a+16|0],v[n+4>>2]=a+18,K=l[a+17|0],v[n+4>>2]=a+19,B=l[a+18|0],v[n+4>>2]=a+20,N=l[a+19|0],v[n+4>>2]=a+21,q=l[a+20|0],v[n+4>>2]=a+22,V=l[a+21|0],v[n+4>>2]=a+23,Z=l[a+22|0],v[n+4>>2]=a+24,Y=l[a+23|0],v[n+4>>2]=a+25,X=l[a+24|0],v[n+4>>2]=a+26,Q=l[a+25|0],v[n+4>>2]=a+27,rr=l[a+26|0],e=a+28|0,v[n+4>>2]=e,a=l[a+27|0],l[21076]||(v[5265]=0,v[5266]=0,v[5267]=0,v[5268]=0,v[5264]=9308,f[21076]=1,e=v[n+4>>2]),v[n+4>>2]=e+1,p[5265]=w(l[0|e])/w(255),v[n+4>>2]=e+2,p[5266]=w(l[e+1|0])/w(255),v[n+4>>2]=e+3,p[5267]=w(l[e+2|0])/w(255),v[n+4>>2]=e+4,p[5268]=w(l[e+3|0])/w(255),e=v[r+4>>2],O=Re(s+44|0,m),R=Re(s+32|0,c),e=0|da[v[v[e>>2]+12>>2]](e,y,O,R),lf(R),lf(O),e&&(ee(e+116|0,c),v[e+40>>2]=g|(F|b<<8|h<<16)<<8,d=p[r+36>>2],v[e+48>>2]=(K<<8|J<<16|B)<<8|N,v[e+44>>2]=(_<<8|M<<16|z)<<8|x,p[e+56>>2]=d*(u(2,a|(Q<<8|X<<16|rr)<<8),k()),p[e+52>>2]=d*(u(2,(V<<8|q<<16|Z)<<8|Y),k()),p[e+36>>2]=d*(u(2,(j<<8|U<<16|H)<<8|L),k()),p[e+32>>2]=d*(u(2,(T<<8|A<<16|W)<<8|G),k()),a=v[5266],v[e+148>>2]=v[5265],v[e+152>>2]=a,a=v[5268],v[e+156>>2]=v[5267],v[e+160>>2]=a,zr(e),a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e)),lf(c);break n;case 1:a=Wn(n,1),e=v[r+4>>2],c=Re(s+56|0,m),e=0|da[v[v[e>>2]+20>>2]](e,y,c),lf(c),$r(r,n,e,a),t&&(v[n+4>>2]=v[n+4>>2]+4),a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e);break n;case 2:h=gu(a=s+56|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0),v[h+4>>2]||ee(h,m),e=v[r+4>>2],c=Re(s+44|0,m),b=Re(s+32|0,h),a=0|da[v[v[e>>2]+16>>2]](e,y,c,b),lf(b),lf(c),e=a,a||(e=Mr(Xf(236),m)),ee(e+168|0,h),b=ra(e),c=v[n+4>>2],v[n+4>>2]=c+1,p[b+4>>2]=w(l[0|c])/w(255),v[n+4>>2]=c+2,p[b+8>>2]=w(l[c+1|0])/w(255),v[n+4>>2]=c+3,p[b+12>>2]=w(l[c+2|0])/w(255),v[n+4>>2]=c+4,p[b+16>>2]=w(l[c+3|0])/w(255),Nr(n,(c=Wn(n,1))<<1,w(1),e+120|0),re(n,e+136|0),$r(r,n,e,c),sr(e),nr=e,er=Wn(n,1)<<1,v[nr+224>>2]=er,t?(re(n,e+152|0),c=v[n+4>>2],v[n+4>>2]=c+1,b=l[0|c],v[n+4>>2]=c+2,F=l[c+1|0],v[n+4>>2]=c+3,g=l[c+2|0],v[n+4>>2]=c+4,d=p[r+36>>2],p[e+196>>2]=d*(u(2,l[c+3|0]|(g|F<<8|b<<16)<<8),k()),v[n+4>>2]=c+5,b=l[c+4|0],v[n+4>>2]=c+6,F=l[c+5|0],v[n+4>>2]=c+7,g=l[c+6|0],v[n+4>>2]=c+8,d=w(d*(u(2,l[c+7|0]|(g|F<<8|b<<16)<<8),k()))):(v[e+196>>2]=0,d=w(0)),p[e+200>>2]=d,a?(a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e)):(da[v[v[e>>2]+4>>2]](e),e=0),lf(h);break n;case 3:h=gu(a=s+56|0,e=(e=Wn(n,1))?v[(v[i+200>>2]+(e<<2)|0)-4>>2]:0,0),v[h+4>>2]||ee(h,m),e=v[r+4>>2],c=Re(a=s+44|0,m),b=Re(s+32|0,h),e=0|da[v[v[e>>2]+16>>2]](e,y,c,b),lf(b),lf(c),ee(e+168|0,h),b=ra(e),c=v[n+4>>2],v[n+4>>2]=c+1,p[b+4>>2]=w(l[0|c])/w(255),v[n+4>>2]=c+2,p[b+8>>2]=w(l[c+1|0])/w(255),v[n+4>>2]=c+3,p[b+12>>2]=w(l[c+2|0])/w(255),v[n+4>>2]=c+4,p[b+16>>2]=w(l[c+3|0])/w(255),c=gu(a,c=(c=Wn(n,1))?v[(v[i+200>>2]+(c<<2)|0)-4>>2]:0,0),b=gu(b=s+32|0,a=(a=Wn(n,1))?v[(v[i+200>>2]+(a<<2)|0)-4>>2]:0,0),a=v[n+4>>2],v[n+4>>2]=a+1,F=l[0|a],t&&(v[n+4>>2]=a+2,g=l[a+1|0],v[n+4>>2]=a+3,A=l[a+2|0],v[n+4>>2]=a+4,T=l[a+3|0],v[n+4>>2]=a+5,d=p[r+36>>2],p[e+196>>2]=d*(u(2,l[a+4|0]|(T|A<<8|g<<16)<<8),k()),v[n+4>>2]=a+6,g=l[a+5|0],v[n+4>>2]=a+7,A=l[a+6|0],v[n+4>>2]=a+8,T=l[a+7|0],v[n+4>>2]=a+9,p[e+200>>2]=d*(u(2,l[a+8|0]|(T|A<<8|g<<16)<<8),k())),F=Cf(T=Xf(40),e,a=Re(s+20|0,c),P,A=Re(g=s+8|0,b),!!(0|F)),lf(A),lf(a),v[s+8>>2]=F,Sn(r+8|0,g),lf(b),lf(c),lf(h);break n;case 4:if(e=v[r+4>>2],a=Re(c=s+56|0,m),e=0|da[v[v[e>>2]+24>>2]](e,y,a),lf(a),a=v[n+4>>2],v[n+4>>2]=a+1,h=0,f[e+80|0]=0!=l[0|a],v[n+4>>2]=a+2,f[e+81|0]=0!=l[a+1|0],$r(r,n,e,a=Wn(n,1)),v[s+56>>2]=0,yn(e- -64|0,b=(0|a)/3|0,c),(0|a)>=3)for(F=v[e+76>>2],a=v[n+4>>2];v[n+4>>2]=a+1,g=l[0|a],v[n+4>>2]=a+2,A=l[a+1|0],v[n+4>>2]=a+3,T=l[a+2|0],c=a+4|0,v[n+4>>2]=c,p[F+(h<<2)>>2]=p[r+36>>2]*(u(2,l[a+3|0]|(T|A<<8|g<<16)<<8),k()),a=c,(0|b)!=(0|(h=h+1|0)););t&&(v[n+4>>2]=v[n+4>>2]+4),a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e);break n;case 5:e=v[r+4>>2],a=Re(s+56|0,m),e=0|da[v[v[e>>2]+28>>2]](e,y,a),lf(a),a=v[n+4>>2],v[n+4>>2]=a+1,c=l[0|a],v[n+4>>2]=a+2,h=l[a+1|0],v[n+4>>2]=a+3,b=l[a+2|0],v[n+4>>2]=a+4,v[e+28>>2]=l[a+3|0]|(b|h<<8|c<<16)<<8,v[n+4>>2]=a+5,c=l[a+4|0],v[n+4>>2]=a+6,h=l[a+5|0],v[n+4>>2]=a+7,b=l[a+6|0],v[n+4>>2]=a+8,d=p[r+36>>2],p[e+20>>2]=d*(u(2,l[a+7|0]|(b|h<<8|c<<16)<<8),k()),v[n+4>>2]=a+9,c=l[a+8|0],v[n+4>>2]=a+10,h=l[a+9|0],v[n+4>>2]=a+11,b=l[a+10|0],v[n+4>>2]=a+12,p[e+24>>2]=d*(u(2,l[a+11|0]|(b|h<<8|c<<16)<<8),k()),t&&(v[n+4>>2]=a+16),a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e);break n;case 6:break e;default:break n}a=Wn(n,1),c=Wn(n,1),e=v[r+4>>2],$r(r,n,e=0|da[v[v[e>>2]+32>>2]](e,y,m),c),v[e+64>>2]=v[v[i+44>>2]+(a<<2)>>2],t&&(v[n+4>>2]=v[n+4>>2]+4),a=v[r+4>>2],da[v[v[a>>2]+36>>2]](a,e)}if(lf(m),D=s+80|0,e&&(yt(y,P,a=Re(o+8|0,C),e),lf(a)),lf(C),(0|E)==(0|(I=I+1|0)))break}if((0|(S=S+1|0))==(0|$))break}}return D=o+32|0,y}function Q(r,n,e){r|=0,n|=0,e|=0;var i,t=0,u=0,o=0,a=0,c=0,b=0,k=0,s=0,h=0,d=w(0),y=w(0),m=0,g=0,F=w(0),A=w(0),T=w(0),$=0,I=0,C=w(0),P=w(0),E=0,O=0,R=w(0),S=w(0),W=w(0),G=w(0),U=w(0),j=w(0),H=0,L=0,M=0;if(D=i=D-16|0,!v[r+224>>2]){v[r+224>>2]=e,u=v[e+52>>2],v[i+12>>2]=0,yn(b=r+128|0,u,i+12|0),Gf(e,n,0,u,b,0,2),Qr(b),e=0,D=c=D-16|0,n=v[b+4>>2],v[40+(a=r+4|0)>>2]=0,ca(g=a+36|0,k=n>>>1|0),v[c+12>>2]=0,mn(g,k,c+12|0);r:if(n>>>0>=2){for(u=k>>>0<=1?1:k,s=v[a+48>>2];v[s+(e<<2)>>2]=e,(0|u)!=(0|(e=e+1|0)););if(Ji(u=a+52|0,k),e=0,f[c+11|0]=0,Cn(u,k,c+11|0),n>>>0<2)break r;for(u=k>>>0<=1?1:k,s=v[a- -64>>2];L=e+s|0,M=Yn(e,k,b,g),f[0|L]=M,(0|u)!=(0|(e=e+1|0)););}else Ji(e=a+52|0,k),f[c+11|0]=0,Cn(e,k,c+11|0);if(v[a+72>>2]=0,ca($=a+68|0,(((0|k)<=2?2:k)<<2)-8|0),n>>>0>=8)for(t=v[a- -64>>2];;){I=v[b+12>>2],h=v[a+48>>2],n=0,e=1,s=k=(o=k)-1|0;r:{for(;;){n:{u=n,n=e;e:if(!l[t+u|0]){if((0|s)==(0|(e=(0|(e=n+1|0))!=(0|o)?e:0)))break n;for(m=I+(v[h+(n<<2)>>2]<<3)|0,C=p[m>>2],E=I+(v[h+(u<<2)>>2]<<3)|0,T=p[E>>2],O=I+(v[h+(s<<2)>>2]<<3)|0,R=p[O>>2],y=p[m+4>>2],d=p[E+4>>2],G=w(y-d),A=p[O+4>>2],U=w(d-A),j=w(A-y);;){if(l[e+t|0]&&(m=I+(v[h+(e<<2)>>2]<<3)|0,P=p[m>>2],F=p[m+4>>2],!(!(w(w(P*j)+w(w(C*w(F-A))+w(R*w(y-F))))>=w(0))|!(w(w(P*U)+w(w(R*w(F-d))+w(T*w(A-F))))>=w(0)))&&w(w(P*G)+w(w(T*w(F-y))+w(C*w(d-F))))>=w(0)))break e;if((0|s)==(0|(e=(e+1>>>0)%(o>>>0)|0)))break}break n}if(n){e=(0|(e=n+1|0))!=(0|o)?e:0,s=u;continue}for(;;){if(!l[t+u|0])break n;if(n=0,!(u=u-1|0))break r}}break}n=u}if(Sn($,h+(((I=n+k|0)>>>0)%(o>>>0)<<2)|0),Sn($,(e=n<<2)+v[a+48>>2]|0),Sn($,v[a+48>>2]+((n+1>>>0)%(o>>>0)<<2)|0),u=v[a+40>>2]-1|0,v[a+40>>2]=u,n>>>0>>0)for(s=v[a+48>>2],o=v[s+e>>2],e=n;m=s+(e<<2)|0,t=s+((e=e+1|0)<<2)|0,v[m>>2]=v[t>>2],v[t>>2]=o,(0|e)!=(0|u););if(s=v[a+56>>2]-1|0,v[a+56>>2]=s,t=v[a+64>>2],n>>>0>>0)for(o=l[n+t|0],e=n;m=l[0|(h=(u=e+1|0)+t|0)],f[0|h]=o,f[e+t|0]=m,(0|s)!=(0|(e=u)););if(L=(e=(I-1>>>0)%(k>>>0)|0)+t|0,M=Yn(e,k,b,g),f[0|L]=M,L=(n=(0|n)!=(0|k)?n:0)+t|0,M=Yn(n,k,b,g),f[0|L]=M,!(k>>>0>3))break}if(3==(0|k)&&(Sn($,v[a+48>>2]+8|0),Sn($,v[a+48>>2]),Sn($,v[a+48>>2]+4|0)),e=$,n=0,D=t=(D=c+16|0)-48|0,u=v[a+8>>2])for(s=a+84|0;he(s,v[v[a+16>>2]+(n<<2)>>2]),(0|u)!=(0|(n=n+1|0)););if(n=0,v[a+8>>2]=0,u=v[a+24>>2])for(s=a+104|0;he(s,v[v[a+32>>2]+(n<<2)>>2]),(0|u)!=(0|(n=n+1|0)););if(s=a+4|0,v[a+24>>2]=0,n=Vo(k=a+104|0),v[t+44>>2]=n,v[n+4>>2]=0,n=Zo($=a+84|0),v[t+40>>2]=n,v[n+4>>2]=0,E=v[e+4>>2]){for(g=a+20|0,I=-1,u=0,n=0;o=v[e+12>>2]+(n<<2)|0,h=(c=v[o>>2])<<1,v[t+36>>2]=h,m=v[o+4>>2],v[t+32>>2]=m<<1,O=v[o+8>>2],v[t+28>>2]=O<<1,c=(o=v[b+12>>2])+(c<<3)|0,p[t+24>>2]=p[c>>2],p[t+20>>2]=p[c+4>>2],c=o+(m<<3)|0,p[t+16>>2]=p[c>>2],p[t+12>>2]=p[c+4>>2],F=p[(o=o+(O<<3)|0)>>2],p[t+8>>2]=F,y=p[o+4>>2],p[t+4>>2]=y,c=v[t+40>>2],m=v[c+4>>2],(0|h)!=(0|I)||(o=v[c+12>>2],d=p[(h=o+(m<<2)|0)-16>>2],C=p[h-12>>2],A=w(p[h-4>>2]-C),T=w(p[h-8>>2]-d),(0|(w(w(w(T*C)+w(w(F*A)-w(y*T)))-w(d*A))>=w(0)?1:-1))!=(0|u)||(d=w(p[o>>2]-F),A=w(d*y),y=w(p[o+4>>2]-y),(0|(w(w(A+w(w(p[o+8>>2]*y)-w(p[o+12>>2]*d)))-w(F*y))>=w(0)?1:-1))!=(0|u)))?(m?(Sn(s,t+40|0),Sn(g,t+44|0)):(he($,c),he(k,v[t+44>>2])),u=Zo($),v[t+40>>2]=u,v[u+4>>2]=0,Rn(u,t+24|0),Rn(v[t+40>>2],t+20|0),Rn(v[t+40>>2],t+16|0),Rn(v[t+40>>2],t+12|0),Rn(v[t+40>>2],t+8|0),Rn(v[t+40>>2],t+4|0),u=Vo(k),v[t+44>>2]=u,v[u+4>>2]=0,Sn(u,t+36|0),Sn(v[t+44>>2],t+32|0),Sn(v[t+44>>2],t+28|0),y=p[t+20>>2],F=w(p[t+12>>2]-y),d=p[t+24>>2],A=w(p[t+16>>2]-d),u=w(w(w(A*y)+w(w(p[t+8>>2]*F)-w(p[t+4>>2]*A)))-w(d*F))>=w(0)?1:-1,I=v[t+36>>2]):(Rn(c,t+8|0),Rn(v[t+40>>2],t+4|0),Sn(v[t+44>>2],t+28|0)),E>>>0>(n=n+3|0)>>>0;);v[v[t+40>>2]+4>>2]&&(Sn(s,t+40|0),Sn(g,t+44|0))}if(o=v[a+8>>2]){for(e=0;;){if(n=v[(u=e<<2)+v[a+32>>2]>>2],v[t+44>>2]=n,b=v[n+4>>2])for(n=v[n+12>>2],c=v[(n+(b<<2)|0)-4>>2],h=v[n>>2],n=v[u+v[a+16>>2]>>2],v[t+40>>2]=n,u=v[n+4>>2]<<2,n=v[n+12>>2],F=p[(u=u+n|0)-8>>2],d=p[u-4>>2],A=p[u-12>>2],y=w(d-A),C=p[u-16>>2],T=w(F-C),R=p[n>>2],P=p[n+4>>2],G=w(w(w(T*A)+w(w(R*y)-w(P*T)))-w(C*y)),U=p[n+12>>2],j=p[n+8>>2],n=0;y=d,(0|n)!=(0|e)?(u=v[(g=n<<2)+v[a+32>>2]>>2],3!=v[u+4>>2]||(b=v[u+12>>2],I=v[b+4>>2],m=v[b>>2],v[t+36>>2]=v[b+8>>2],b=v[g+v[a+16>>2]>>2],g=(v[b+4>>2]<<2)+v[b+12>>2]|0,d=p[g-8>>2],p[t+32>>2]=d,T=p[g-4>>2],p[t+28>>2]=T,(0|h)!=(0|m)|(0|c)!=(0|I)||(g=G>=w(0),S=w(F-C),W=w(y-A),(0|g)==(0|!(w(w(w(S*A)+w(w(d*W)-w(T*S)))-w(C*W))>=w(0)))||(S=w(R-d),W=w(S*T),T=w(P-T),g^w(w(W+w(w(j*T)-w(U*S)))-w(d*T))>=w(0))))?d=y:(n=0,v[b+4>>2]=0,v[u+4>>2]=0,Rn(v[t+40>>2],t+32|0),Rn(v[t+40>>2],t+28|0),Sn(v[t+44>>2],t+36|0),d=p[t+28>>2],A=y,C=F,F=p[t+32>>2])):n=e,o>>>0>(n=n+1|0)>>>0;);if((0|o)==(0|(e=e+1|0)))break}if(!((0|(u=v[a+8>>2]))<=0))for(;;){if(o=v[(c=(e=u-1|0)<<2)+v[a+16>>2]>>2],v[t+40>>2]=o,!v[o+4>>2]){if(b=v[a+8>>2]-1|0,v[a+8>>2]=b,b>>>0>(n=e)>>>0){for(;o=v[a+16>>2],g=v[(h=o+(n<<2)|0)>>2],m=o,o=(n=n+1|0)<<2,v[h>>2]=v[m+o>>2],v[o+v[a+16>>2]>>2]=g,(0|n)!=(0|b););o=v[t+40>>2]}if(he($,o),o=v[c+v[a+32>>2]>>2],v[t+44>>2]=o,b=v[a+24>>2]-1|0,v[a+24>>2]=b,b>>>0>(n=e)>>>0){for(;o=v[a+32>>2],h=v[(c=o+(n<<2)|0)>>2],m=o,o=(n=n+1|0)<<2,v[c>>2]=v[m+o>>2],v[o+v[a+32>>2]>>2]=h,(0|n)!=(0|b););o=v[t+44>>2]}he(k,o)}if(n=(0|u)>1,u=e,!n)break}}if(D=t+48|0,e=s,v[r+228>>2]=e,v[e+4>>2])for(;Qr(n=v[v[e+12>>2]+(H<<2)>>2]),Rn(n,v[n+12>>2]),Rn(n,v[n+12>>2]+4|0),e=v[r+228>>2],(u=v[e+4>>2])>>>0>(H=H+1|0)>>>0;);else u=0}return D=i+16|0,0|u}function rr(r){var n,e,i,t=0,u=0,o=0,a=0,c=0,b=0,k=0,h=0,d=0,p=0,y=0,m=0;if(v[124+(r|=0)>>2]=0,v[r+108>>2]=0,u=v[r+12>>2])for(;a=v[v[r+20>>2]+(t<<2)>>2],h=l[v[a+4>>2]+60|0],f[a+116|0]=h,f[a+117|0]=1^h,(0|u)!=(0|(t=t+1|0)););if((h=v[r+136>>2])&&(u=v[h+40>>2]))for(t=0;;){for(a=v[v[r+20>>2]+(v[v[v[h+48>>2]+(t<<2)>>2]+4>>2]<<2)>>2];s[a+116>>1]=256,a=v[a+12>>2];);if((0|u)==(0|(t=t+1|0)))break}r:if(h=(i=v[r+92>>2])+((n=v[r+76>>2])+(e=v[r+60>>2])|0)|0)for(a=0;;){n:{e:{i:if(e){if(t=0,d=1,u=v[v[r+68>>2]>>2],v[v[u+4>>2]+16>>2]!=(0|a)){for(;;){if((0|e)==(0|(t=t+1|0)))break i;if(u=v[v[r+68>>2]+(t<<2)>>2],v[v[u+4>>2]+16>>2]==(0|a))break}d=t>>>0>>0}D=c=D-16|0;f:{t:if(l[v[u+40>>2]+117|0]){u:{if(l[v[u+4>>2]+20|0]){if(!(t=v[r+136>>2]))break t;if(!(o=v[t+56>>2])){f[u+44|0]=0;break f}if(k=v[u+4>>2],b=v[t- -64>>2],(0|k)!=v[b>>2]){for(t=0;(0|o)!=(0|(t=t+1|0))&(0|k)!=v[b+(t<<2)>>2];);if(t=t>>>0>>0,f[u+44|0]=t,t)break u;break f}}f[u+44|0]=1}Ki(r,v[u+40>>2]),Ki(r,k=v[v[u+20>>2]>>2]);u:if(!((t=v[u+12>>2])>>>0<2)){if(o=v[(v[u+20>>2]+(t<<2)|0)-4>>2],v[c+12>>2]=o,b=v[r+108>>2]){if(p=v[r+116>>2],(0|o)==v[p>>2])break u;for(t=0;(0|b)!=(0|(t=t+1|0))&(0|o)!=v[p+(t<<2)>>2];);if(t>>>0>>0)break u}Sn(r+120|0,c+12|0)}v[c+8>>2]=u,Sn(r+104|0,c+8|0),ui(k+16|0),f[v[(v[u+20>>2]+(v[u+12>>2]<<2)|0)-4>>2]+116|0]=1;break f}f[u+44|0]=0}if(D=c+16|0,a=a+1|0,d)break e}i:if(n){if(t=0,d=1,u=v[v[r+84>>2]>>2],v[v[u+4>>2]+16>>2]!=(0|a)){for(;;){if((0|n)==(0|(t=t+1|0)))break i;if(u=v[v[r+84>>2]+(t<<2)>>2],v[v[u+4>>2]+16>>2]==(0|a))break}d=t>>>0>>0}D=c=D-16|0;f:{t:{u:if(l[v[u+24>>2]+117|0]){o:{if(l[v[u+4>>2]+20|0]){if(!(t=v[r+136>>2]))break u;if(!(o=v[t+56>>2])){f[u+44|0]=0;break f}if(k=v[u+4>>2],b=v[t- -64>>2],(0|k)!=v[b>>2]){for(t=0;(0|o)!=(0|(t=t+1|0))&(0|k)!=v[b+(t<<2)>>2];);if(t=t>>>0>>0,f[u+44|0]=t,t)break o;break f}}f[u+44|0]=1}if(Ki(r,v[u+24>>2]),o=v[u+12>>2],l[v[u+4>>2]+85|0]){if(!o)break t;for(p=r+120|0,b=0;;){t=v[v[u+20>>2]+(b<<2)>>2],v[c+12>>2]=t,Ki(r,v[t+12>>2]);o:{if(k=v[r+108>>2]){if(t=0,y=v[c+12>>2],m=v[r+116>>2],(0|y)==v[m>>2])break o;for(;(0|k)!=(0|(t=t+1|0))&v[(t<<2)+m>>2]!=(0|y););if(t>>>0>>0)break o}Sn(p,c+12|0)}if((0|o)==(0|(b=b+1|0)))break}}else{if(!o)break t;for(t=0;Ki(r,v[v[u+20>>2]+(t<<2)>>2]),(0|o)!=(0|(t=t+1|0)););}if(v[c+8>>2]=u,Sn(r+104|0,c+8|0),!o)break f;for(t=0;ui(v[v[u+20>>2]+(t<<2)>>2]+16|0),(0|o)!=(0|(t=t+1|0)););if(!o)break f;for(u=v[u+20>>2],t=0;f[v[u+(t<<2)>>2]+116|0]=1,(0|o)!=(0|(t=t+1|0)););break f}f[u+44|0]=0;break f}v[c+8>>2]=u,Sn(r+104|0,c+8|0)}if(D=c+16|0,a=a+1|0,d)break e}if(t=0,!i)break n;for(;;){if(u=v[v[r+100>>2]+(t<<2)>>2],v[v[u+4>>2]+16>>2]!=(0|a)){if((0|i)!=(0|(t=t+1|0)))continue;break n}break}D=c=D-16|0;i:{f:{t:if(l[v[v[u+24>>2]+8>>2]+117|0]){u:{if(l[v[u+4>>2]+20|0]){if(!(t=v[r+136>>2]))break t;if(!(o=v[t+56>>2])){f[u+140|0]=0;break i}if(b=v[u+4>>2],d=v[t- -64>>2],(0|b)!=v[d>>2]){for(t=0;(0|o)!=(0|(t=t+1|0))&(0|b)!=v[d+(t<<2)>>2];);if(t=t>>>0>>0,f[u+140|0]=t,t)break u;break i}}f[u+140|0]=1}if(b=v[u+24>>2],d=v[v[b+4>>2]+4>>2],o=v[b+8>>2],(t=v[r+136>>2])?(Vr(r,t,d,o),k=v[r+136>>2]):k=0,t=v[r+4>>2],!(p=v[t+64>>2])|(0|k)==(0|p)||(Vr(r,p,d,o),t=v[r+4>>2]),k=v[t+52>>2])for(t=0;Vr(r,v[v[v[r+4>>2]+60>>2]+(t<<2)>>2],d,o),(0|k)!=(0|(t=t+1|0)););if((t=v[b+60>>2])&&Tf(0|da[v[v[t>>2]+8>>2]](t),20924)&&jn(r,t,o),!(o=v[u+12>>2])){v[c+12>>2]=u,Sn(r+104|0,c+12|0);break i}for(t=0;Ki(r,v[v[u+20>>2]+(t<<2)>>2]),(0|o)!=(0|(t=t+1|0)););break f}f[u+140|0]=0;break i}if(v[c+12>>2]=u,Sn(r+104|0,c+12|0),o){for(t=0;ui(v[v[u+20>>2]+(t<<2)>>2]+16|0),(0|o)!=(0|(t=t+1|0)););if(o)for(u=v[u+20>>2],t=0;f[v[u+(t<<2)>>2]+116|0]=1,(0|o)!=(0|(t=t+1|0)););}}D=c+16|0,a=a+1|0}if(h>>>0>a>>>0)continue;break r}if(!(h>>>0>(a=a+1|0)>>>0))break}if(h=v[r+12>>2])for(a=0;Ki(r,v[v[r+20>>2]+(a<<2)>>2]),(0|h)!=(0|(a=a+1|0)););}function nr(r,n,e,i,f,t){var u,o,a,c=0,b=0,k=0,l=0,d=w(0),y=0,F=w(0),A=w(0),T=0,$=0,I=0,C=w(0),P=0,E=w(0),O=0,R=0,S=w(0),W=0,G=0,U=w(0),j=0,H=w(0),L=w(0),M=w(0),_=w(0),z=w(0),x=w(0),J=0,K=w(0),B=w(0),N=w(0),q=0,V=0,Z=0,Y=w(0),X=w(0),Q=w(0),rr=w(0),nr=w(0),er=w(0),ir=w(0),fr=w(0),tr=w(0),ur=w(0),or=0,ar=w(0),cr=w(0),br=w(0),kr=0;D=u=D-16|0,o=v[r+228>>2],a=v[o+4>>2],v[r+196>>2]=0,v[r+164>>2]=0,v[r+180>>2]=0;r:if(i)for(q=r+192|0,V=r+176|0,Z=r+160|0,O=r+144|0;;){n:{if(a)for(k=m(h[(c=(G<<1)+e|0)>>1],t)<<2,Y=p[k+f>>2],l=m(h[c+4>>1],t)<<2,X=p[l+f>>2],c=m(h[c+2>>1],t)<<2,Q=p[c+f>>2],rr=p[(y=k+4|0)+f>>2],nr=p[(T=l+4|0)+f>>2],er=p[(b=c+4|0)+f>>2],K=p[n+b>>2],U=p[n+T>>2],ir=w(K-U),B=p[n+k>>2],H=p[n+l>>2],fr=w(B-H),N=p[n+c>>2],tr=w(H-N),x=p[n+y>>2],ur=w(w(1)/w(w(ir*fr)+w(tr*w(x-U)))),br=w(U-x),J=0;;){$=v[r+164>>2],j=v[v[o+12>>2]+(J<<2)>>2],I=0,D=b=D-48|0,p[b+40>>2]=x,p[b+44>>2]=B,p[b+36>>2]=N,p[b+32>>2]=K,p[b+28>>2]=H,p[b+24>>2]=U,c=r+208|0,l=2&v[j+4>>2],v[(k=l?O:c)+4>>2]=0,Rn(k,y=b+44|0),Rn(k,T=b+40|0),Rn(k,b+36|0),Rn(k,b+32|0),Rn(k,b+28|0),Rn(k,b+24|0),Rn(k,y),Rn(k,T),v[(c=l?c:O)+4>>2]=0,kr=v[j+4>>2]-4|0,y=0;e:{i:{for(;;){if(P=v[j+12>>2],F=p[(R=P+(l=y<<2)|0)>>2],p[b+20>>2]=F,d=p[P+(4|l)>>2],p[b+16>>2]=d,or=v[k+4>>2]-2|0){for(l=k,L=p[P+((T=y+2|0)<<2)>>2],ar=w(F-L),F=p[R+12>>2],cr=w(-w(d-F)),k=0;;){P=v[l+12>>2],d=p[P+(4|(R=k<<2))>>2],A=p[(R=P+R|0)>>2],E=p[P+((k=k+2|0)<<2)>>2],p[b+12>>2]=E,C=p[R+12>>2],p[b+8>>2]=C,S=w(w(ar*w(C-F))+w(w(E-L)*cr));f:if(w(w(ar*w(d-F))+w(w(A-L)*cr))>w(0)){if(S>w(0)){Rn(c,b+12|0),Rn(c,b+8|0);break f}if(S=w(C-d),C=p[b+20>>2],M=w(L-C),_=p[b+16>>2],E=w(E-A),z=w(w(S*M)-w(w(F-_)*E)),w(g(z))>w(9.999999974752427e-7)){d=w(w(w(E*w(_-d))-w(w(C-A)*S))/z),p[b+4>>2]=w(M*d)+C,Rn(c,I=b+4|0),A=p[b+16>>2],p[b+4>>2]=w(w(F-A)*d)+A,Rn(c,I),I=1;break f}Rn(c,b+20|0),Rn(c,b+16|0),I=1}else I=1,S>w(0)&&(S=w(C-d),C=p[b+20>>2],M=w(L-C),_=p[b+16>>2],E=w(E-A),z=w(w(S*M)-w(w(F-_)*E)),w(g(z))>w(9.999999974752427e-7)?(d=w(w(w(E*w(_-d))-w(w(C-A)*S))/z),p[b+4>>2]=w(M*d)+C,Rn(c,P=b+4|0),A=p[b+16>>2],p[b+4>>2]=w(w(F-A)*d)+A,Rn(c,P)):(Rn(c,b+20|0),Rn(c,b+16|0)),Rn(c,b+12|0),Rn(c,b+8|0));if(!(k>>>0>>0))break}if(v[c+4>>2]){if(Rn(c,v[c+12>>2]),Rn(c,v[c+12>>2]+4|0),(0|y)==(0|kr))break i;v[l+4>>2]=0,y=T,k=c,c=l;continue}}break}v[O+4>>2]=0,I=1;break e}if((0|c)==(0|O))c=v[O+4>>2],v[b+20>>2]=0,yn(O,c-2|0,b+20|0);else{if(k=0,v[O+4>>2]=0,!(l=v[c+4>>2]-2|0))break e;for(;Rn(O,v[c+12>>2]+(k<<2)|0),(0|l)!=(0|(k=k+1|0)););}}if(D=b+48|0,!I)break n;if(k=v[r+148>>2]){for(c=0,v[u+12>>2]=0,yn(Z,l=(-2&k)+$|0,y=u+12|0),v[u+12>>2]=0,yn(q,l,y),l=v[r+204>>2],y=v[r+172>>2],T=v[r+156>>2];F=p[(I=c<<2)+T>>2],j=4+(b=$<<2)|0,d=p[T+(4|I)>>2],p[j+y>>2]=d,p[b+y>>2]=F,A=w(F-H),d=w(d-U),F=w(ur*w(w(ir*A)+w(tr*d))),d=w(ur*w(w(br*A)+w(fr*d))),A=w(w(w(1)-F)-d),p[l+j>>2]=w(nr*A)+w(w(rr*F)+w(er*d)),p[b+l>>2]=w(X*A)+w(w(Y*F)+w(Q*d)),$=$+2|0,k>>>0>(c=c+2|0)>>>0;);if($=v[r+180>>2],s[u+12>>1]=0,pn(V,(m(k=k>>>1|0,3)+$|0)-6|0,u+12|0),(y=k-1|0)>>>0>=2)for(T=v[r+188>>2],c=1;s[(l=T+($<<1)|0)>>1]=W,b=c+W|0,s[l+2>>1]=b,s[l+4>>1]=b+1,$=$+3|0,(0|y)!=(0|(c=c+1|0)););W=k+W|0}if((0|a)==(0|(J=J+1|0)))break}if((G=G+3|0)>>>0>>0)continue;break r}if(v[u+12>>2]=0,yn(Z,c=$+6|0,l=u+12|0),v[u+12>>2]=0,yn(q,c,l),k=v[r+172>>2],p[k+(y=20+(c=$<<2)|0)>>2]=U,p[(T=c+16|0)+k>>2]=H,p[(b=c+12|0)+k>>2]=K,p[($=c+8|0)+k>>2]=N,p[(I=c+4|0)+k>>2]=x,p[c+k>>2]=B,k=v[r+204>>2],p[k+y>>2]=nr,p[k+T>>2]=X,p[b+k>>2]=er,p[k+$>>2]=Q,p[k+I>>2]=rr,p[c+k>>2]=Y,c=v[r+180>>2],s[u+12>>1]=0,pn(V,c+3|0,l),c=v[r+188>>2]+(c<<1)|0,s[c>>1]=W,s[c+4>>1]=W+2,s[c+2>>1]=W+1,W=W+3|0,!((G=G+3|0)>>>0>>0))break}D=u+16|0}function er(r,n){var e,i=0,f=0,o=0,a=0,c=0,s=0,l=0,h=0,d=0,p=0,F=0,T=0,$=0,I=0,C=0,P=0,E=0,O=0,R=0,S=0,W=0,G=0;D=e=D-16|0,b(r);r:if((o=2147483647&(P=t(2)))>>>0<=1305022426){if(C=(h=+r)+-1.5707963109016418*(i=.6366197723675814*h+6755399441055744-6755399441055744)+-1.5893254773528196e-8*i,y[n>>3]=C,a=C<-.7853981852531433,o=g(i)<2147483648?~~i:-2147483648,a){i+=-1,y[n>>3]=h+-1.5707963109016418*i+-1.5893254773528196e-8*i,o=o-1|0;break r}if(!(C>.7853981852531433))break r;i+=1,y[n>>3]=h+-1.5707963109016418*i+-1.5893254773528196e-8*i,o=o+1|0}else if(o>>>0>=2139095040)y[n>>3]=w(r-r),o=0;else{if(f=o,o=(o>>>23|0)-150|0,y[e+8>>3]=(u(2,f-(o<<23)|0),k()),E=e+8|0,D=c=D-560|0,l=o+m($=(0|(f=(o-3|0)/24|0))>0?f:0,-24)|0,(0|(p=v[4356]))>=0)for(o=p+1|0,f=$;y[(c+320|0)+(a<<3)>>3]=(0|f)<0?0:+v[17440+(f<<2)>>2],f=f+1|0,(0|o)!=(0|(a=a+1|0)););for(F=l-24|0,o=0,a=(0|p)>0?p:0;;){for(f=0,i=0;i=y[(f<<3)+E>>3]*y[(c+320|0)+(o-f<<3)>>3]+i,1!=(0|(f=f+1|0)););if(y[(o<<3)+c>>3]=i,f=(0|o)==(0|a),o=o+1|0,f)break}W=47-l|0,O=48-l|0,R=(0|l)<25,G=l-25|0,o=p;n:{for(;;){if(i=y[(o<<3)+c>>3],f=0,a=o,!(d=(0|o)<=0))for(;T=(c+480|0)+(f<<2)|0,s=g(h=5.960464477539063e-8*i)<2147483648?~~h:-2147483648,s=g(i=-16777216*(h=+(0|s))+i)<2147483648?~~i:-2147483648,v[T>>2]=s,i=y[((a=a-1|0)<<3)+c>>3]+h,(0|(f=f+1|0))!=(0|o););i=Gn(i,F),i+=-8*A(.125*i),i-=+(0|(T=g(i)<2147483648?~~i:-2147483648));e:{i:{f:{if(R){if(F)break f;s=v[476+((o<<2)+c|0)>>2]>>23}else I=f=(o<<2)+c|0,f=(s=v[f+476>>2])-((a=s>>O)<>2]=f,T=a+T|0,s=f>>W;if((0|s)<=0)break e;break i}if(s=2,!(i>=.5)){s=0;break e}}if(f=0,a=0,!d)for(;S=v[(I=(c+480|0)+(f<<2)|0)>>2],d=16777215,a||(d=16777216,S)?(v[I>>2]=d-S,a=1):a=0,(0|(f=f+1|0))!=(0|o););i:if(!R){f=8388607;f:switch(0|G){case 1:f=4194303;break;case 0:break f;default:break i}v[476+(d=(o<<2)+c|0)>>2]=v[d+476>>2]&f}T=T+1|0,2==(0|s)&&(i=1-i,s=2,a&&(i-=Gn(1,F)))}if(0!=i)break;if(f=1,d=0,a=o,!((0|o)<=(0|p))){for(;d=v[(c+480|0)+((a=a-1|0)<<2)>>2]|d,(0|a)>(0|p););if(d){for(l=F;l=l-24|0,!v[(c+480|0)+((o=o-1|0)<<2)>>2];);break n}}for(;a=f,f=f+1|0,!v[(c+480|0)+(p-a<<2)>>2];);for(a=o+a|0;;){for(y[(c+320|0)+((o=o+1|0)<<3)>>3]=v[17440+(o+$<<2)>>2],f=0,i=0;i=y[(f<<3)+E>>3]*y[(c+320|0)+(o-f<<3)>>3]+i,1!=(0|(f=f+1|0)););if(y[(o<<3)+c>>3]=i,!((0|o)<(0|a)))break}o=a}(i=Gn(i,24-l|0))>=16777216?(F=(c+480|0)+(o<<2)|0,f=g(h=5.960464477539063e-8*i)<2147483648?~~h:-2147483648,a=g(i=-16777216*+(0|f)+i)<2147483648?~~i:-2147483648,v[F>>2]=a,o=o+1|0):(f=g(i)<2147483648?~~i:-2147483648,l=F),v[(c+480|0)+(o<<2)>>2]=f}if(i=Gn(1,l),(0|o)>=0){for(a=o;y[((f=a)<<3)+c>>3]=i*+v[(c+480|0)+(f<<2)>>2],a=f-1|0,i*=5.960464477539063e-8,f;);for(a=o;;){if(i=0,f=0,(0|(F=(0|(l=o-a|0))>(0|p)?p:l))>=0)for(;i=y[20208+(f<<3)>>3]*y[(f+a<<3)+c>>3]+i,$=(0|f)!=(0|F),f=f+1|0,$;);if(y[(c+160|0)+(l<<3)>>3]=i,f=(0|a)>0,a=a-1|0,!f)break}}if(i=0,(0|o)>=0)for(;a=o,o=o-1|0,i+=y[(c+160|0)+(a<<3)>>3],a;);y[e>>3]=s?-i:i,D=c+560|0,o=7&T,i=y[e>>3],(0|P)<0?(y[n>>3]=-i,o=0-o|0):y[n>>3]=i}return D=e+16|0,o}function ir(r,n){r|=0,n|=0;var e,i=0,t=0,u=0,o=0,a=0,c=0,b=0,k=0,s=w(0),h=0,d=0,y=0,m=w(0),g=0,F=0,A=w(0),T=0,$=0,I=w(0);if(D=e=D-16|0,l[r+88|0]){if(f[r+88|0]=0,t=v[r+80>>2])for(;i=v[t+12>>2],da[v[v[t>>2]+4>>2]](t),t=i,i;);if(v[r+80>>2]=0,v[r+84>>2]=0,g=v[r+44>>2]){for(;;){if(i=v[v[r+52>>2]+(d<<2)>>2]){for(;t=i,i=v[i+24>>2];);for(;;){if(i=v[t+28>>2],3!=v[t+112>>2]||!i){b=0,D=a=D-16|0,y=v[t+16>>2],c=v[y+8>>2],i=v[t+28>>2],v[a+12>>2]=0,mn(t+116|0,c,o=a+12|0),v[a+12>>2]=0,Fn(t+132|0,c,o);r:if(!i|!l[i+37|0]){if(c)for(T=r+76|0;;){o=v[(k=b<<2)+v[y+16>>2]>>2],$=0|da[v[v[o>>2]+16>>2]](o),v[a+12>>2]=$;n:{if(u=v[r+80>>2])for(;;){if(v[u+4>>2]==(0|$)){u=0;break n}if(!(u=v[u+12>>2]))break}if(u=1,f[a+11|0]=1,Ln(T,a+12|0,a+11|0),i&&!lu(0|da[v[v[o>>2]+8>>2]](o),20700)&&!lu(0|da[v[v[o>>2]+8>>2]](o),20808)&&!lu(0|da[v[v[o>>2]+8>>2]](o),20820)&&(o=i,wi(v[i+16>>2],v[a+12>>2]))){for(;;){if(u=2,!(o=v[o+28>>2]))break n;if(!wi(v[o+16>>2],v[a+12>>2]))break}if(p[t+100>>2]>w(0)){if(v[k+v[t+128>>2]>>2]=3,v[k+v[t+144>>2]>>2]=t,c>>>0>(b=b+1|0)>>>0)continue;break r}}}if(v[k+v[t+128>>2]>>2]=u,!(c>>>0>(b=b+1|0)>>>0))break}}else{if(!c)break r;for(o=r+76|0,i=0;;){u=v[(b=i<<2)+v[y+16>>2]>>2],k=0|da[v[v[u>>2]+16>>2]](u),v[a+12>>2]=k;n:{if(u=v[r+80>>2])for(;;){if((0|k)==v[u+4>>2])break n;if(!(u=v[u+12>>2]))break}f[a+11|0]=1,Ln(o,a+12|0,a+11|0)}if(v[b+v[t+128>>2]>>2]=2,(0|c)==(0|(i=i+1|0)))break}}D=a+16|0,i=v[t+28>>2]}if(!(t=i))break}}if((0|g)==(0|(d=d+1|0)))break}if(t=v[r+80>>2])for(;i=v[t+12>>2],da[v[v[t>>2]+4>>2]](t),t=i,i;);if(v[r+80>>2]=0,v[r+84>>2]=0,!((0|(i=v[r+44>>2]))<=0))for(;;){if(o=i,i=i-1|0,t=v[v[r+52>>2]+(i<<2)>>2])for(;;){if(u=0,D=a=D-16|0,b=v[t+16>>2],d=v[b+8>>2])for(y=r+76|0;;){c=v[(k=u<<2)+v[b+16>>2]>>2];r:if(lu(0|da[v[v[c>>2]+8>>2]](c),20700)){g=v[k+v[b+16>>2]>>2],T=v[g+4>>2];n:{if(c=v[r+80>>2])for(;;){if((0|T)==v[c+4>>2])break n;if(!(c=v[c+12>>2]))break}v[a+12>>2]=v[g+4>>2],f[a+11|0]=1,Ln(y,a+12|0,a+11|0);break r}c=k+v[t+128>>2]|0,v[c>>2]=4|v[c>>2]}if((0|d)==(0|(u=u+1|0)))break}if(D=a+16|0,!(t=v[t+24>>2]))break}if(!((0|o)>1))break}}}if(d=v[r+44>>2])for(a=r+56|0;;){if(!(!(i=v[v[r+52>>2]+(F<<2)>>2])|p[i+68>>2]>w(0))){t=F?v[i+112>>2]:1,m=p[i+92>>2],v[i+24>>2]?m=w(m*lr(r,i,n,t)):p[i+72>>2]>=p[i+84>>2]&&(m=v[i+20>>2]?m:w(0)),s=p[i+52>>2],I=p[i+60>>2];r:if(l[i+36|0]){if((A=w(p[i+56>>2]-s))==w(0))break r;s=w(s+Cr(p[i+72>>2],A))}else s=(s=w(s+p[i+72>>2]))<(A=p[i+56>>2])?s:A;c=v[i+16>>2],o=v[c+8>>2];r:if(!(!F&m==w(1))&3!=(0|t)){if(b=i+148|0,(y=v[i+152>>2])||(v[e+12>>2]=0,yn(b,o<<1,e+12|0)),o)for(h=0;k=3&v[(u=h<<2)+v[i+128>>2]>>2]?0:t,u=v[u+v[c+16>>2]>>2],lu(0|da[v[v[u>>2]+8>>2]](u),21020)?hr(u,n,s,m,k,b,h<<1,!y):da[v[v[u>>2]+12>>2]](u,n,I,s,a,m,k,0),(0|o)!=(0|(h=h+1|0)););}else{if(!o)break r;for(h=0;u=v[v[c+16>>2]+(h<<2)>>2],da[v[v[u>>2]+12>>2]](u,n,I,s,a,m,t,0),(0|o)!=(0|(h=h+1|0)););}Jr(r,i,s),v[r+60>>2]=0,p[i+64>>2]=s,p[i+80>>2]=p[i+72>>2],h=1}if((0|d)==(0|(F=F+1|0)))break}return pr(v[r+72>>2]),D=e+16|0,1&h}function fr(r,n,e,i,t){var u,o,a=0,c=0,b=0,k=0,s=0,h=0,d=0,y=0,m=0,g=0,F=0,A=w(0),T=w(0),$=0,I=0,C=0,P=0,E=0;if(D=u=D+-64|0,v[u+60>>2]=n,(0|(o=Qn(i)))>0&&(d=47!=(0|(c=l[(i+o|0)-1|0]))&92!=(0|c)),v[u+56>>2]=0,ie(u+60|0,c=n+e|0,u+48|0))for($=r+4|0,I=r+20|0,C=1+(o+d|0)|0,m=u+44|0,g=u+36|0,s=12|(n=u+16|0),h=4|n,F=u+52|0;;){if((0|(a=v[u+52>>2]))!=(0|(e=v[u+48>>2])))if(v[u+56>>2])Bf((n=Xf(112))+4|0,0,108),v[n>>2]=8952,ht(n+8|0),v[n+108>>2]=0,v[n+100>>2]=0,v[n+104>>2]=0,v[n+96>>2]=8680,v[n+92>>2]=0,v[n+84>>2]=0,v[n+88>>2]=0,v[n+80>>2]=8680,v[u>>2]=n,v[n+4>>2]=v[u+56>>2],b=v[5208],n=a-e|0,e=Ff(0|da[v[v[b>>2]+12>>2]](b,n+1|0,8524,308),e,n),f[n+e|0]=0,n=gu(u+4|0,e,1),ee(v[u>>2]+8|0,n),lf(n),Ui(u+60|0,c,u+48|0),n=90,Te(4979,e=v[u+48>>2],a=v[u+52>>2]-e|0)&&(n=0,Te(5156,e,a)&&(n=du(e,F))),e=v[u>>2],v[e+76>>2]=n,f[e+72|0]=90==(0|n),cn(u+60|0,c,u+16|0),n=du(v[u+16>>2],h),v[v[u>>2]+20>>2]=n,n=du(v[u+24>>2],s),v[v[u>>2]+24>>2]=n,cn(u+60|0,c,u+16|0),n=du(v[u+16>>2],h),v[v[u>>2]+28>>2]=n,e=du(v[u+24>>2],s),n=v[u>>2],v[n+32>>2]=e,a=v[n+20>>2],k=v[u+56>>2],A=w(v[k+60>>2]),p[n+36>>2]=w(0|a)/A,b=v[n+24>>2],T=w(v[k+64>>2]),p[n+40>>2]=w(0|b)/T,l[n+72|0]?(b=b+v[n+28>>2]|0,e=e+a|0):(b=e+b|0,e=a+v[n+28>>2]|0),p[n+48>>2]=w(0|b)/T,p[n+44>>2]=w(0|e)/A,4==(0|cn(u+60|0,c,u+16|0))&&(v[u+4>>2]=0,mn(n+80|0,4,u+4|0),n=du(v[u+16>>2],h),v[v[v[u>>2]+92>>2]>>2]=n,n=du(v[u+24>>2],s),v[v[v[u>>2]+92>>2]+4>>2]=n,n=du(v[u+32>>2],g),v[v[v[u>>2]+92>>2]+8>>2]=n,n=du(v[u+40>>2],m),e=v[u>>2],v[v[e+92>>2]+12>>2]=n,4==(0|cn(u+60|0,c,u+16|0))&&(v[u+4>>2]=0,mn(e+96|0,4,u+4|0),n=du(v[u+16>>2],h),v[v[v[u>>2]+108>>2]>>2]=n,n=du(v[u+24>>2],s),v[v[v[u>>2]+108>>2]+4>>2]=n,n=du(v[u+32>>2],g),v[v[v[u>>2]+108>>2]+8>>2]=n,n=du(v[u+40>>2],m),v[v[v[u>>2]+108>>2]+12>>2]=n,cn(u+60|0,c,u+16|0))),n=du(v[u+16>>2],h),v[v[u>>2]+60>>2]=n,n=du(v[u+24>>2],s),v[v[u>>2]+64>>2]=n,cn(n=u+60|0,c,u+16|0),e=du(v[u+16>>2],h),p[v[u>>2]+52>>2]=0|e,e=du(v[u+24>>2],s),p[v[u>>2]+56>>2]=0|e,Ui(n,c,u+48|0),n=du(v[u+48>>2],F),v[v[u>>2]+68>>2]=n,Sn(I,u);else{for(n=v[5208],a=a-e|0,n=Ff(0|da[v[v[n>>2]+12>>2]](n,a+1|0,8524,308),e,a),f[n+a|0]=0,e=Qn(n),a=v[5208],b=Ff(0|da[v[v[a>>2]+12>>2]](a,e+C|0,8524,116),i,o),d&&(f[b+o|0]=47),hn((b+o|0)+d|0,n),P=u,E=Be(e=Xf(68),n=gu(u+4|0,n,1)),v[P+56>>2]=E,lf(n),cn(u+60|0,c,u+16|0),n=du(v[u+16>>2],h),v[v[u+56>>2]+60>>2]=n,n=du(v[u+24>>2],s),a=v[u+56>>2],v[a+64>>2]=n,cn(u+60|0,c,u+16|0),e=v[u+16>>2],k=v[u+20>>2]-e|0,n=8;;){if(n){if(Te(v[8848+((n=n-1|0)<<2)>>2],e,k))continue}else n=0;break}for(v[a+40>>2]=n,cn(u+60|0,c,u+16|0),e=v[u+16>>2],k=v[u+20>>2]-e|0,n=8;;){if(n){if(Te(v[8880+((n=n-1|0)<<2)>>2],e,k))continue}else n=0;break}for(v[a+44>>2]=n,e=v[u+24>>2],k=v[u+28>>2]-e|0,n=8;;){if(n){if(Te(v[8880+((n=n-1|0)<<2)>>2],e,k))continue}else n=0;break}v[a+48>>2]=n,Ui(u+60|0,c,u+48|0),v[a+52>>2]=1,v[a+56>>2]=1;r:if(Te(5309,k=v[u+48>>2],y=v[u+52>>2]-k|0)){e=a+56|0,n=a+52|0;n:{e:{if(1==(0|y))switch(l[0|k]-120|0){case 0:break n;case 1:break e;default:break r}if(Te(1056,k,y))break r;v[a+52>>2]=2}n=e}v[n>>2]=2}t?((n=v[r+36>>2])&&(e=gu(u+4|0,b,0),da[v[v[n>>2]+8>>2]](n,a,e),lf(e)),n=v[5208],da[v[v[n>>2]+20>>2]](n,b,8524,156)):(n=gu(u+4|0,b,1),ee(v[u+56>>2]+28|0,n),lf(n)),Sn($,u+56|0)}else v[u+56>>2]=0;if(!ie(u+60|0,c,u+48|0))break}D=u- -64|0}function tr(r,n){var e=0,i=0,t=0,u=0,o=0,a=0,c=0,b=0;r:{n:{e:{i:{f:{if((0|(e=f[0|n]))<=90)switch(e-34|0){case 11:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:break n;case 0:break f;default:break r}if((0|e)<=109){if(91==(0|e))break i;if(102!=(0|e))break r;if(Te(n+1|0,5157,4))break r;return v[r+8>>2]=0,n+5|0}if(123==(0|e))break e;if(116!=(0|e)){if(110!=(0|e))break r;if(Te(n+1|0,4507,3))break r;return v[r+8>>2]=2,n+4|0}if(Te(n+1|0,4980,3))break r;return v[r+20>>2]=1,v[r+8>>2]=1,n+4|0}return yr(r,n)}for(t=r,v[r+8>>2]=5,n=n+1|0;n=(r=n)+1|0,((e=l[0|r])-1&255)>>>0<32;);i:{f:{if(93!=(0|e)){for(He(e=Tt(32),0),v[t+4>>2]=e;n=r,r=r+1|0,(l[0|n]-1&255)>>>0<32;);if(!(n=tr(e,n)))break f;for(;n=(r=n)+1|0,(l[0|r]-1&255)>>>0<32;);for(n=1;;){t:{if(v[t+12>>2]=n,44!=(0|(n=l[0|r]))){if(93!=(0|n))break t;n=r+1|0;break i}for(He(i=Tt(32),0),v[e>>2]=i;n=l[r+1|0],r=r+1|0,(n-1&255)>>>0<32;);if(!(n=tr(i,r)))break f;for(;n=(r=n)+1|0,(l[0|r]-1&255)>>>0<32;);n=v[t+12>>2]+1|0,e=i;continue}break}v[5218]=r,n=0}break i}n=0}return n}for(o=r,v[r+8>>2]=6,e=n+1|0;e=(r=e)+1|0,((n=l[0|r])-1&255)>>>0<32;);e:{i:{f:if(125!=(0|n)){for(He(i=Tt(32),0),v[o+4>>2]=i;n=r,r=r+1|0,(l[0|n]-1&255)>>>0<32;);if(r=0,!(e=yr(i,n)))break e;for(;e=(r=e)+1|0,(l[0|r]-1&255)>>>0<32;);if(v[i+28>>2]=v[i+16>>2],e=0,v[i+16>>2]=0,58!=l[0|r])break i;for(;n=l[r+1|0],r=r+1|0,(n-1&255)>>>0<32;);if(n=tr(i,r)){for(;n=(r=n)+1|0,(l[0|r]-1&255)>>>0<32;);for(e=1;;){t:{if(v[o+12>>2]=e,44!=(0|(n=l[0|r]))){if(125!=(0|n))break t;r=r+1|0;break e}for(He(t=Tt(32),0),v[i>>2]=t;n=l[r+1|0],r=r+1|0,(n-1&255)>>>0<32;);if(e=0,!(n=yr(t,r)))break f;for(;n=(r=n)+1|0,(l[0|r]-1&255)>>>0<32;);if(v[t+28>>2]=v[t+16>>2],v[t+16>>2]=0,58!=l[0|r]){v[5218]=r,r=0;break e}for(;n=l[r+1|0],r=r+1|0,(n-1&255)>>>0<32;);if(!(n=tr(t,r)))break f;for(;n=(r=n)+1|0,(l[0|r]-1&255)>>>0<32;);e=v[o+12>>2]+1|0,i=t;continue}break}e=0,v[5218]=r}}r=e;break e}v[5218]=r,r=0}return r}if(i=r,t=n,a=l[0|n],((n=l[0|(e=(45==(0|a))+n|0)])-48&255)>>>0>9)r=e;else for(;u=10*u+ +((255&n)-48|0),n=l[e+1|0],e=r=e+1|0,(n-48&255)>>>0<10;);if(46==(255&n)){if(n=r+1|0,((e=l[r+1|0])-48&255)>>>0>9)r=n;else for(;c=10*c+ +((255&e)-48|0),o=o+1|0,e=l[n+1|0],n=r=n+1|0,(e-48&255)>>>0<10;);u+=c/(+(yi(o)>>>0)+4294967296*+(V>>>0)),n=l[0|r]}if(b=c=45==(0|a)?-u:u,101==(255&n|32)){if(n=(e=45==(0|(a=l[r+1|0]))|43==(0|a))?r+2|0:r+1|0,o=0,((e=l[(e?2:1)+r|0])-48&255)>>>0>9)r=n;else for(;o=(m(o,10)+(255&e)|0)-48|0,e=l[n+1|0],n=r=n+1|0,(e-48&255)>>>0<10;);b=c/(u=+(yi(o)>>>0)+4294967296*+(V>>>0)),45!=(0|a)&&(b=c*u)}return u=b,(0|r)==(0|t)?(v[5218]=t,r=0):(v[i+8>>2]=3,n=g(u)<2147483648?~~u:-2147483648,v[i+20>>2]=n,p[i+24>>2]=u),r}return v[5218]=n,0}function ur(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t|=0,u=w(u),o=w(o);var a,c,b,k,s=w(0),h=w(0),d=w(0),y=w(0),m=w(0),F=w(0),A=0,$=w(0),I=w(0),C=w(0),P=w(0),E=w(0),O=w(0),R=0,S=w(0),W=w(0),G=w(0),U=w(0),j=w(0),H=w(0);if(A=v[r+12>>2],o!=w(0)){if(l[r+88|0]||Fr(r),l[n+88|0]||Fr(n),P=p[n+60>>2],G=p[r+64>>2],U=p[r+60>>2],h=p[n+72>>2],$=p[A+96>>2],y=p[A+104>>2],I=p[A+92>>2],C=p[v[n+4>>2]+24>>2],d=p[A+108>>2],R=(O=p[r+72>>2])>2])>2],s=w(p[r+112>>2]+w(w(p[r+104>>2]*P)+w(W*p[r+108>>2]))),m=w(p[r+100>>2]+w(w(p[r+92>>2]*P)+w(W*p[r+96>>2])))):(s=w(w(p[r+104>>2]*P)+p[r+112>>2]),m=w(w(p[r+92>>2]*P)+p[r+100>>2])),E=w(m-p[A+100>>2]),s=w(s-p[A+112>>2]),m=w(w(1)/w(w(I*d)-w(y*$))),H=w(w(w(w(d*E)-w($*s))*m)-U),s=w(w(w(w(s*I)-w(y*E))*m)-G),+(s=w(T(w(w(H*H)+w(s*s)))))<1e-4)return gr(r,e,i,0,t,0,o),void cr(n,P,W,w(0),p[n+72>>2],p[n+76>>2],p[n+80>>2],p[n+84>>2]);k=0-(c=R?-1:1)|0,E=(b=h>2]),i=w(i-p[A+112>>2]),e=w(w(w(w(h*d)-w($*i))*m)-U),h=w(w(w(w(i*I)-w(y*h))*m)-G),d=w(w(e*e)+w(h*h)),u!=w(0)&&(i=w(w(w(F*w(E+w(1)))*w(.5))*u),$=w(T(d)),(u=w(i+w(w($-s)-w(C*F))))>w(0)&&(d=i,i=(i=w(u/w(i+i)))>w(1)?w(0):w(i+w(-1)),i=w(w(-w(u-w(d*w(w(1)-w(i*i)))))/$),e=w(w(i*e)+e),h=w(w(i*h)+h),d=w(w(e*e)+w(h*h)))),A=a?k:c,E=w(R?180:0),i=w(F*C),S<=w(9999999747378752e-20)?(u=w(-1),(F=w(w(w(d-w(s*s))-w(i*i))/w(i*w(s+s))))w(1))?w(1):F,!R|!t||(u=w(1),O=w(O*w(w(w(w(w(T(d))/w(i+s))+w(-1))*o)+w(1))))),s=w(w(i*u)+s),d=w(Yr(u)*w(0|f)),i=w(i*Wr(d)),u=Pr(w(w(h*s)-w(i*e)),w(w(e*s)+w(h*i)))):($=w(0),S=Pr(h,e),C=w(j*C),e=w(C*C),u=w(w(e*w(-2))*s),h=w(i*i),y=w(e-h),I=w(w(w(e*w(s*s))+w(h*d))-w(h*e)),(m=w(w(u*u)+w(w(y*w(-4))*I)))>=w(0)&&(m=w(T(m)),u=w(w(u+(u=w(-1))|!(e<=w(1)))&&(h=Wr(e=Yr(e)),s=w(w(i*Rr(e))+s),h=w(C*h),F>(i=w(w(s*s)+w(h*h)))&&(m=e,F=i,$=h,u=s),i>I)||(e=w(0),s=y,i=I,h=w(0)),t=w(w(F+i)*w(.5))>=d,i=w(0|f),u=w(S-Pr(w((t?$:h)*i),t?u:s)),d=w((t?m:e)*i))),e=w(b?180:0),s=u,i=w(0|A),u=w(Pr(W,P)*i),(s=w(w(w(w(s-u)*w(57.2957763671875))+E)-p[r+68>>2]))>w(180)?s=w(s+w(-360)):s>2]),O,p[r+76>>2],w(0),w(0)),s=w(w(d+u)*w(57.2957763671875)),u=p[n+80>>2],i=w(w(w(s-u)*i)+e),e=p[n+68>>2],(s=w(i-e))>w(180)?s=w(s+w(-360)):s>2],p[n+76>>2],u,p[n+84>>2])}else Of(n)}function or(r){var n=0,e=0,i=0,f=0,t=0,u=0,o=0,a=0,c=0;r:if(r|=0){t=(i=r-8|0)+(r=-8&(n=v[r-4>>2]))|0;n:if(!(1&n)){if(!(3&n))break r;if((i=i-(n=v[i>>2])|0)>>>0>>0<=255){if(f=n>>>3|0,(0|(n=v[i+12>>2]))==(0|(e=v[i+8>>2]))){a=21496,c=v[5374]&Qf(f),v[a>>2]=c;break n}v[e+12>>2]=n,v[n+8>>2]=e;break n}if(u=v[i+24>>2],(0|i)!=(0|(n=v[i+12>>2]))){e=v[i+8>>2],v[e+12>>2]=n,v[n+8>>2]=e;break e}if(!(e=v[(f=i+20|0)>>2])){if(!(e=v[i+16>>2]))break i;f=i+16|0}for(;o=f,(e=v[(f=(n=e)+20|0)>>2])||(f=n+16|0,e=v[n+16>>2]););v[o>>2]=0;break e}if(3&~(n=v[t+4>>2]))break n;return v[5376]=r,v[t+4>>2]=-2&n,v[i+4>>2]=1|r,void(v[t>>2]=r)}n=0}if(u){e=v[i+28>>2];e:{if(v[(f=21800+(e<<2)|0)>>2]==(0|i)){if(v[f>>2]=n,n)break e;a=21500,c=v[5375]&Qf(e),v[a>>2]=c;break n}if(v[u+(v[u+16>>2]==(0|i)?16:20)>>2]=n,!n)break n}v[n+24>>2]=u,(e=v[i+16>>2])&&(v[n+16>>2]=e,v[e+24>>2]=n),(e=v[i+20>>2])&&(v[n+20>>2]=e,v[e+24>>2]=n)}}if(!(i>>>0>=t>>>0)&&1&(n=v[t+4>>2])){n:{e:{i:{f:{if(!(2&n)){if(v[5380]==(0|t)){if(v[5380]=i,r=v[5377]+r|0,v[5377]=r,v[i+4>>2]=1|r,v[5379]!=(0|i))break r;return v[5376]=0,void(v[5379]=0)}if(v[5379]==(0|t))return v[5379]=i,r=v[5376]+r|0,v[5376]=r,v[i+4>>2]=1|r,void(v[r+i>>2]=r);if(r=(-8&n)+r|0,n>>>0<=255){if(f=n>>>3|0,(0|(n=v[t+12>>2]))==(0|(e=v[t+8>>2]))){a=21496,c=v[5374]&Qf(f),v[a>>2]=c;break e}v[e+12>>2]=n,v[n+8>>2]=e;break e}if(u=v[t+24>>2],(0|t)!=(0|(n=v[t+12>>2]))){e=v[t+8>>2],v[e+12>>2]=n,v[n+8>>2]=e;break i}if(!(e=v[(f=t+20|0)>>2])){if(!(e=v[t+16>>2]))break f;f=t+16|0}for(;o=f,(e=v[(f=(n=e)+20|0)>>2])||(f=n+16|0,e=v[n+16>>2]););v[o>>2]=0;break i}v[t+4>>2]=-2&n,v[i+4>>2]=1|r,v[r+i>>2]=r;break n}n=0}if(u){e=v[t+28>>2];i:{if(v[(f=21800+(e<<2)|0)>>2]==(0|t)){if(v[f>>2]=n,n)break i;a=21500,c=v[5375]&Qf(e),v[a>>2]=c;break e}if(v[u+(v[u+16>>2]==(0|t)?16:20)>>2]=n,!n)break e}v[n+24>>2]=u,(e=v[t+16>>2])&&(v[n+16>>2]=e,v[e+24>>2]=n),(e=v[t+20>>2])&&(v[n+20>>2]=e,v[e+24>>2]=n)}}if(v[i+4>>2]=1|r,v[r+i>>2]=r,v[5379]==(0|i))return void(v[5376]=r)}if(r>>>0<=255)return n=21536+(-8&r)|0,(e=v[5374])&(r=1<<(r>>>3))?r=v[n+8>>2]:(v[5374]=r|e,r=n),v[n+8>>2]=i,v[r+12>>2]=i,v[i+12>>2]=n,void(v[i+8>>2]=r);e=31,r>>>0<=16777215&&(e=62+((r>>>38-(n=F(r>>>8|0))&1)-(n<<1)|0)|0),v[i+28>>2]=e,v[i+16>>2]=0,v[i+20>>2]=0,n=21800+(e<<2)|0;n:{e:{if((f=v[5375])&(o=1<>>1|0):0),n=v[n>>2];;){if(f=n,(-8&v[n+4>>2])==(0|r))break e;if(n=e>>>29|0,e<<=1,!(n=v[16+(o=f+(4&n)|0)>>2]))break}v[o+16>>2]=i,v[i+24>>2]=f}else v[5375]=f|o,v[n>>2]=i,v[i+24>>2]=n;v[i+12>>2]=i,v[i+8>>2]=i;break n}r=v[f+8>>2],v[r+12>>2]=i,v[f+8>>2]=i,v[i+24>>2]=0,v[i+12>>2]=f,v[i+8>>2]=r}r=v[5382]-1|0,v[5382]=r||-1}}}function ar(r,n){var e,i=0,f=0,t=0,u=0,o=0,a=0,c=0;e=r+n|0;r:{n:if(!(1&(i=v[r+4>>2]))){if(!(3&i))break r;n=(i=v[r>>2])+n|0;e:{i:{f:{if((0|(r=r-i|0))!=v[5379]){if(i>>>0<=255){if((0|(f=v[r+8>>2]))!=(0|(t=v[r+12>>2])))break f;a=21496,c=v[5374]&Qf(i>>>3|0),v[a>>2]=c;break n}if(u=v[r+24>>2],(0|(i=v[r+12>>2]))!=(0|r)){f=v[r+8>>2],v[f+12>>2]=i,v[i+8>>2]=f;break e}if(!(f=v[(t=r+20|0)>>2])){if(!(f=v[r+16>>2]))break i;t=r+16|0}for(;o=t,(f=v[(t=(i=f)+20|0)>>2])||(t=i+16|0,f=v[i+16>>2]););v[o>>2]=0;break e}if(3&~(i=v[e+4>>2]))break n;return v[5376]=n,v[e+4>>2]=-2&i,v[r+4>>2]=1|n,void(v[e>>2]=n)}v[f+12>>2]=t,v[t+8>>2]=f;break n}i=0}if(u){f=v[r+28>>2];e:{if(v[(t=21800+(f<<2)|0)>>2]==(0|r)){if(v[t>>2]=i,i)break e;a=21500,c=v[5375]&Qf(f),v[a>>2]=c;break n}if(v[u+(v[u+16>>2]==(0|r)?16:20)>>2]=i,!i)break n}v[i+24>>2]=u,(f=v[r+16>>2])&&(v[i+16>>2]=f,v[f+24>>2]=i),(f=v[r+20>>2])&&(v[i+20>>2]=f,v[f+24>>2]=i)}}n:{e:{i:{f:{if(!(2&(i=v[e+4>>2]))){if(v[5380]==(0|e)){if(v[5380]=r,n=v[5377]+n|0,v[5377]=n,v[r+4>>2]=1|n,v[5379]!=(0|r))break r;return v[5376]=0,void(v[5379]=0)}if(v[5379]==(0|e))return v[5379]=r,n=v[5376]+n|0,v[5376]=n,v[r+4>>2]=1|n,void(v[r+n>>2]=n);if(n=(-8&i)+n|0,i>>>0<=255){if(t=i>>>3|0,(0|(i=v[e+12>>2]))==(0|(f=v[e+8>>2]))){a=21496,c=v[5374]&Qf(t),v[a>>2]=c;break e}v[f+12>>2]=i,v[i+8>>2]=f;break e}if(u=v[e+24>>2],(0|e)!=(0|(i=v[e+12>>2]))){f=v[e+8>>2],v[f+12>>2]=i,v[i+8>>2]=f;break i}if(!(f=v[(t=e+20|0)>>2])){if(!(f=v[e+16>>2]))break f;t=e+16|0}for(;o=t,(f=v[(t=(i=f)+20|0)>>2])||(t=i+16|0,f=v[i+16>>2]););v[o>>2]=0;break i}v[e+4>>2]=-2&i,v[r+4>>2]=1|n,v[r+n>>2]=n;break n}i=0}if(u){f=v[e+28>>2];i:{if(v[(t=21800+(f<<2)|0)>>2]==(0|e)){if(v[t>>2]=i,i)break i;a=21500,c=v[5375]&Qf(f),v[a>>2]=c;break e}if(v[u+(v[u+16>>2]==(0|e)?16:20)>>2]=i,!i)break e}v[i+24>>2]=u,(f=v[e+16>>2])&&(v[i+16>>2]=f,v[f+24>>2]=i),(f=v[e+20>>2])&&(v[i+20>>2]=f,v[f+24>>2]=i)}}if(v[r+4>>2]=1|n,v[r+n>>2]=n,v[5379]==(0|r))return void(v[5376]=n)}if(n>>>0<=255)return i=21536+(-8&n)|0,(f=v[5374])&(n=1<<(n>>>3))?n=v[i+8>>2]:(v[5374]=n|f,n=i),v[i+8>>2]=r,v[n+12>>2]=r,v[r+12>>2]=i,void(v[r+8>>2]=n);f=31,n>>>0<=16777215&&(f=62+((n>>>38-(i=F(n>>>8|0))&1)-(i<<1)|0)|0),v[r+28>>2]=f,v[r+16>>2]=0,v[r+20>>2]=0,i=21800+(f<<2)|0;n:{if((t=v[5375])&(o=1<>>1|0):0),i=v[i>>2];;){if(t=i,(-8&v[i+4>>2])==(0|n))break n;if(i=f>>>29|0,f<<=1,!(i=v[16+(o=t+(4&i)|0)>>2]))break}v[o+16>>2]=r,v[r+24>>2]=t}else v[5375]=t|o,v[i>>2]=r,v[r+24>>2]=i;return v[r+12>>2]=r,void(v[r+8>>2]=r)}n=v[t+8>>2],v[n+12>>2]=r,v[t+8>>2]=r,v[r+24>>2]=0,v[r+12>>2]=t,v[r+8>>2]=n}}function cr(r,n,e,i,t,u,o,a){r|=0,n=w(n),e=w(e),i=w(i),t=w(t),u=w(u),o=w(o),a=w(a);var c,b=w(0),k=w(0),s=w(0),l=w(0),h=0,d=w(0),y=w(0),m=w(0),F=0,A=w(0);if(f[r+88|0]=1,p[r+84>>2]=a,p[r+80>>2]=o,p[r+76>>2]=u,p[r+72>>2]=t,p[r+68>>2]=i,p[r+64>>2]=e,p[r+60>>2]=n,c=v[r+8>>2],d=p[c+168>>2],y=p[c+164>>2],!(h=v[r+12>>2]))return o=w(w(i+o)*w(.01745329238474369)),F=r,A=w(w(Wr(o)*t)*d),p[F+104>>2]=A,F=r,A=w(w(Rr(o)*t)*y),p[F+92>>2]=A,i=w(w(w(i+w(90))+a)*w(.01745329238474369)),F=r,A=w(w(Wr(i)*u)*d),p[F+108>>2]=A,F=r,A=w(w(Rr(i)*u)*y),p[F+96>>2]=A,p[r+100>>2]=w(n*y)+p[c+172>>2],void(p[r+112>>2]=w(e*d)+p[c+176>>2]);b=p[h+104>>2],s=p[h+108>>2],k=p[h+92>>2],l=p[h+96>>2],p[r+100>>2]=w(w(k*n)+w(l*e))+p[h+100>>2],p[r+112>>2]=w(w(b*n)+w(s*e))+p[h+112>>2];r:{n:{e:{i:{f:{switch(0|(h=v[v[r+4>>2]+56>>2])){case 3:case 4:break n;case 2:break e;case 1:break i;case 0:break f}i=p[r+108>>2],n=p[r+104>>2],u=p[r+96>>2],t=p[r+92>>2];break r}return e=Wr(n=w(w(i+o)*w(.01745329238474369))),n=w(Rr(n)*t),e=w(e*t),p[r+104>>2]=w(b*n)+w(e*s),p[r+92>>2]=w(k*n)+w(e*l),e=Wr(n=w(w(w(i+w(90))+a)*w(.01745329238474369))),n=w(Rr(n)*u),e=w(e*u),p[r+108>>2]=w(b*n)+w(e*s),void(p[r+96>>2]=w(k*n)+w(e*l))}e=w(w(i+o)*w(.01745329238474369)),n=w(Wr(e)*t),t=w(Rr(e)*t),e=w(w(w(i+w(90))+a)*w(.01745329238474369)),i=w(Wr(e)*u),u=w(Rr(e)*u);break r}n=w(i+o),(e=w(w(k*k)+w(b*b)))>w(9999999747378752e-20)?(e=w(w(g(w(w(k*s)-w(b*l))))/e),s=w(k*e),l=w(b*e),e=w(Pr(b,k)*w(57.2957763671875))):(b=w(0),k=w(0),e=w(w(Pr(s,l)*w(-57.2957763671875))+w(90))),o=Wr(n=w(w(n-e)*w(.01745329238474369))),m=w(Rr(n)*t),t=w(o*t),n=w(w(b*m)+w(s*t)),t=w(w(k*m)-w(t*l)),i=Wr(e=w(w(w(w(i+a)-e)+w(90))*w(.01745329238474369))),e=w(Rr(e)*u),u=w(i*u),i=w(w(b*e)+w(s*u)),u=w(w(k*e)-w(u*l));break r}n=Wr(e=w(i*w(.01745329238474369))),i=Rr(e),m=e=w(w(w(k*i)+w(n*l))/y),n=w(w(w(b*i)+w(n*s))/d),i=(e=w(T(w(w(e*e)+w(n*n)))))>w(9999999747378752e-21)?w(w(1)/e):e,e=w(m*i),n=w(n*i),i=w(T(w(w(e*e)+w(n*n)))),b=3==(0|h)&&y>2]=d*i,p[r+104>>2]=d*n,p[r+96>>2]=y*u,p[r+92>>2]=y*t}function br(r,n){var e,i=0,f=0,t=0,u=0,o=0,a=0,c=0;if(D=e=D-16|0,v[r+4>>2]=n,v[r+120>>2]=9196,v[r+116>>2]=0,v[r+108>>2]=0,v[r+112>>2]=0,v[r+104>>2]=10232,v[r+100>>2]=0,v[r+92>>2]=0,v[r+96>>2]=0,v[r+88>>2]=10216,v[r+84>>2]=0,v[r+76>>2]=0,v[r+80>>2]=0,v[r+72>>2]=10200,v[r+68>>2]=0,v[r+60>>2]=0,v[r+64>>2]=0,v[r+56>>2]=10184,v[r+52>>2]=0,v[r+44>>2]=0,v[r+48>>2]=0,v[r+40>>2]=10168,v[r+36>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+24>>2]=10168,v[r+20>>2]=0,v[r+12>>2]=0,v[r+16>>2]=0,v[r+8>>2]=9196,v[r>>2]=10152,v[r+132>>2]=0,v[r+136>>2]=0,v[r+124>>2]=0,v[r+128>>2]=0,v[r+140>>2]=9308,v[r+144>>2]=1065353216,v[r+148>>2]=1065353216,v[r+152>>2]=1065353216,v[r+156>>2]=1065353216,ci(r+140|0),v[r+176>>2]=0,v[r+168>>2]=1065353216,v[r+172>>2]=0,v[r+160>>2]=0,v[r+164>>2]=1065353216,u=r+8|0,i=v[r+4>>2],ca(u,v[(n=i)+20>>2]),v[n+20>>2])for(n=0;f=v[v[i+28>>2]+(n<<2)>>2],(t=v[f+20>>2])?(t=v[v[r+20>>2]+(v[t+4>>2]<<2)>>2],a=e,c=ye(Xf(120),f,r,t),v[a+12>>2]=c,Sn(t+16|0,e+12|0)):(a=e,c=ye(Xf(120),f,r,0),v[a+12>>2]=c),Sn(u,e+12|0),(n=n+1|0)>>>0>2];);if(f=r+24|0,i=v[r+4>>2],ca(f,v[(n=i)+36>>2]),ca(t=r+40|0,v[n+36>>2]),v[n+36>>2])for(n=0;u=v[v[i+44>>2]+(n<<2)>>2],o=v[v[r+20>>2]+(v[v[u+20>>2]+4>>2]<<2)>>2],a=e,c=Tn(Xf(84),u,o),v[a+12>>2]=c,Sn(f,u=e+12|0),Sn(t,u),(n=n+1|0)>>>0>2];);if(f=r+56|0,i=v[r+4>>2],ca(f,v[(n=i)+104>>2]),v[n+104>>2])for(n=0;t=v[v[i+112>>2]+(n<<2)>>2],a=e,c=en(Xf(48),t,r),v[a+12>>2]=c,Sn(f,e+12|0),(n=n+1|0)>>>0>2];);if(f=r+72|0,i=v[r+4>>2],ca(f,v[(n=i)+120>>2]),v[n+120>>2])for(n=0;t=v[v[i+128>>2]+(n<<2)>>2],a=e,c=fn(Xf(48),t,r),v[a+12>>2]=c,Sn(f,e+12|0),(n=n+1|0)>>>0>2];);if(f=r+88|0,i=v[r+4>>2],ca(f,v[(n=i)+136>>2]),v[n+136>>2])for(n=0;t=v[v[i+144>>2]+(n<<2)>>2],a=e,c=Ar(Xf(144),t,r),v[a+12>>2]=c,Sn(f,e+12|0),(n=n+1|0)>>>0>2];);return rr(r),D=e+16|0,r}function kr(r,n,e,i,f,t,u){var o,a=0,c=w(0),b=w(0),k=0,s=0,l=w(0),h=w(0),d=w(0),y=0,g=0,F=w(0),A=w(0),T=0,$=w(0),I=0,C=0;o=m(i>>>1|0,u)+t|0,k=v[n+8>>2];r:{n:{e:{if(v[r+24>>2]){if(e)break e;i=0;break n}if(t>>>0>=o>>>0)break r;for(c=p[k+108>>2],b=p[k+104>>2],l=p[k+96>>2],h=p[k+92>>2],d=p[k+112>>2],$=p[k+100>>2],r=v[12+(v[n+72>>2]?n+68|0:r+36|0)>>2];n=(t<<2)+f|0,F=p[(i=r+(e<<2)|0)>>2],A=p[i+4>>2],p[n+4>>2]=d+w(w(F*b)+w(c*A)),p[n>>2]=$+w(w(F*h)+w(l*A)),e=e+2|0,o>>>0>(t=t+u|0)>>>0;);break r}for(y=v[r+32>>2],i=0;i=(g=v[y+(a<<2)>>2])+i|0,a=1+(a+g|0)|0,(s=s+2|0)>>>0>>0;);}if(k=v[k+8>>2],v[n+72>>2]){if(!(t>>>0>=o>>>0))for(s=m(i,3),e=i<<1,g=v[n+80>>2],I=v[r+48>>2],n=v[r+32>>2];;){if(i=a+1|0,(0|(r=v[n+(a<<2)>>2]))<=0)c=w(0),a=i,b=w(0);else for(a=(0|(r=r+i|0))>(0|(a=a+2|0))?r:a,C=v[k+20>>2],b=w(0),c=w(0);r=v[(v[n+(i<<2)>>2]<<2)+C>>2],T=g+(e<<2)|0,l=w(p[(y=(s<<2)+I|0)>>2]+p[T>>2]),h=w(p[y+4>>2]+p[T+4>>2]),d=p[y+8>>2],b=w(w(w(p[r+112>>2]+w(w(l*p[r+104>>2])+w(h*p[r+108>>2])))*d)+b),c=w(w(w(p[r+100>>2]+w(w(l*p[r+92>>2])+w(h*p[r+96>>2])))*d)+c),e=e+2|0,s=s+3|0,(0|a)!=(0|(i=i+1|0)););if(p[(r=(t<<2)+f|0)>>2]=c,p[r+4>>2]=b,!(o>>>0>(t=t+u|0)>>>0))break}}else{if(t>>>0>=o>>>0)break r;for(s=m(i,3),y=v[r+48>>2],n=v[r+32>>2];;){if(i=a+1|0,(0|(r=v[n+(a<<2)>>2]))<=0)c=w(0),b=w(0),a=i;else for(a=(0|(r=r+i|0))>(0|(e=a+2|0))?r:e,g=v[k+20>>2],b=w(0),c=w(0);r=v[g+(v[n+(i<<2)>>2]<<2)>>2],l=p[(e=y+(s<<2)|0)>>2],h=p[e+4>>2],d=p[e+8>>2],b=w(w(w(p[r+112>>2]+w(w(l*p[r+104>>2])+w(h*p[r+108>>2])))*d)+b),c=w(w(w(p[r+100>>2]+w(w(l*p[r+92>>2])+w(h*p[r+96>>2])))*d)+c),s=s+3|0,(0|a)!=(0|(i=i+1|0)););if(p[(r=(t<<2)+f|0)>>2]=c,p[r+4>>2]=b,!(o>>>0>(t=t+u|0)>>>0))break}}}}function sr(r){r|=0;var n,e=w(0),i=0,f=w(0),t=0,u=w(0),o=w(0),a=0,c=0,b=w(0),k=w(0),s=w(0),l=0;D=n=D-16|0,(0|(c=v[r+108>>2]))!=(0|(t=v[r+124>>2]))&&(v[n+12>>2]=0,yn(r+104|0,t,n+12|0),c=v[r+124>>2]),e=p[r+184>>2],f=p[r+180>>2];r:{n:{if(270!=(0|(t=v[r+232>>2]))){if(180!=(0|t)){if(90!=(0|t))break n;if((0|c)<=0)break r;for(u=p[r+84>>2],o=w(u/w(p[r+192>>2]-e)),b=p[r+92>>2],u=w(e-w(w(w(b-p[r+76>>2])-u)/o)),k=p[r+88>>2],e=w(k/w(p[r+188>>2]-f)),s=f,f=p[r+96>>2],k=w(s-w(w(w(f-p[r+80>>2])-k)/e)),o=w(b/o),e=w(f/e),t=v[r+116>>2],a=v[r+132>>2],r=0;l=4|(i=r<<2),p[t+i>>2]=w(p[a+l>>2]*e)+k,p[t+l>>2]=w(w(w(1)-p[i+a>>2])*o)+u,(0|c)>(0|(r=r+2|0)););break r}if((0|c)<=0)break r;for(u=p[r+84>>2],o=w(u/w(p[r+188>>2]-f)),s=f,f=p[r+92>>2],u=w(s-w(w(w(f-p[r+76>>2])-u)/o)),b=w(p[r+88>>2]/w(p[r+192>>2]-e)),k=w(p[r+96>>2]/b),f=w(f/o),e=w(e-w(p[r+80>>2]/b)),t=v[r+116>>2],a=v[r+132>>2],r=0;p[(i=r<<2)+t>>2]=w(w(w(1)-p[i+a>>2])*f)+u,p[(i|=4)+t>>2]=w(w(w(1)-p[i+a>>2])*k)+e,(0|c)>(0|(r=r+2|0)););break r}if((0|c)<=0)break r;for(o=w(p[r+88>>2]/w(p[r+192>>2]-e)),u=w(p[r+92>>2]/o),b=w(p[r+84>>2]/w(p[r+188>>2]-f)),k=w(p[r+96>>2]/b),e=w(e-w(p[r+76>>2]/o)),f=w(f-w(p[r+80>>2]/b)),t=v[r+116>>2],a=v[r+132>>2],r=0;l=4|(i=r<<2),p[t+i>>2]=w(w(w(1)-p[a+l>>2])*k)+f,p[t+l>>2]=w(p[i+a>>2]*u)+e,(0|c)>(0|(r=r+2|0)););break r}if(!((0|c)<=0))for(u=p[r+88>>2],o=w(u/w(p[r+192>>2]-e)),s=e,e=p[r+96>>2],u=w(s-w(w(w(e-p[r+80>>2])-u)/o)),e=w(e/o),o=w(p[r+84>>2]/w(p[r+188>>2]-f)),b=w(p[r+92>>2]/o),f=w(f-w(p[r+76>>2]/o)),t=v[r+116>>2],a=v[r+132>>2],r=0;p[(i=r<<2)+t>>2]=w(p[i+a>>2]*b)+f,p[(i|=4)+t>>2]=w(p[i+a>>2]*e)+u,(0|c)>(0|(r=r+2|0)););}D=n+16|0}function vr(r,n,e,i){var f,t=0,u=0,o=0,a=0,c=0,b=0,k=w(0),s=0,l=0;if(D=f=D-32|0,d[r+8>>2]<=n>>>0){if(v[f+24>>2]=0,v[f+16>>2]=0,v[f+20>>2]=0,v[f+12>>2]=10696,o=f+12|0,b=v[r+8>>2],t=n+1|0,v[r+8>>2]=t,t>>>0>d[r+12>>2]&&(k=w(w(t>>>0)*w(1.75)),t=(t=w(g(k))>>0<=8?8:t,v[r+12>>2]=t,u=v[5208],s=r,l=0|da[v[v[u>>2]+16>>2]](u,v[r+16>>2],t<<4,8524,85),v[s+16>>2]=l,t=v[r+8>>2]),t>>>0>b>>>0)for(;;){if(t=v[r+16>>2]+(b<<4)|0,v[t>>2]=10696,v[t+4>>2]=v[o+4>>2],u=v[o+8>>2],v[t+12>>2]=0,v[t+8>>2]=u,u&&(a=v[5208],s=t,l=0|da[v[v[a>>2]+12>>2]](a,m(u,20),8524,206),v[s+12>>2]=l,v[t+4>>2]))for(u=0;a=(c=m(u,20))+v[t+12>>2]|0,c=c+v[o+12>>2]|0,v[a>>2]=v[c>>2],Re(a+4|0,c+4|0),v[a+16>>2]=v[c+16>>2],(u=u+1|0)>>>0>2];);if(!((b=b+1|0)>>>0>2]))break}se(o)}r:{n:{e:{if(t=v[r+16>>2]+(n<<4)|0,v[t+4>>2])for(r=0;;){if(qi(4+(v[t+12>>2]+m(r,20)|0)|0,e))break e;if(!((r=r+1|0)>>>0>2]))break}Fo(i);break n}if(Fo(i),!((0|r)<0)){r=m(r,20),Sf(v[16+(r+v[t+12>>2]|0)>>2]),v[16+(r+v[t+12>>2]|0)>>2]=i;break r}}v[f+12>>2]=n,o=Re(f+16|0,e),v[f+28>>2]=i,r=f+12|0,D=n=D-32|0,(0|(e=v[t+4>>2]))!=v[t+8>>2]?(v[t+4>>2]=e+1,e=v[t+12>>2]+m(e,20)|0,v[e>>2]=v[r>>2],Re(e+4|0,r+4|0),v[e+16>>2]=v[r+16>>2]):(v[n+12>>2]=v[r>>2],e=Re(n+16|0,r+4|0),v[n+28>>2]=v[r+16>>2],k=w(w(d[t+4>>2])*w(1.75)),r=(r=w(g(k))>>0<=8?8:r,v[t+8>>2]=r,i=v[5208],r=0|da[v[v[i>>2]+16>>2]](i,v[t+12>>2],m(r,20),8524,109),v[t+12>>2]=r,i=v[t+4>>2],v[t+4>>2]=i+1,r=r+m(i,20)|0,v[r>>2]=v[n+12>>2],Re(r+4|0,e),v[r+16>>2]=v[n+28>>2],lf(e)),D=n+32|0,lf(o)}D=f+32|0}function lr(r,n,e,i){var f,t,u,o,a,c=w(0),b=0,k=w(0),s=w(0),h=0,d=w(0),y=0,m=0,g=0,F=w(0),A=w(0),T=w(0),$=w(0),I=0,C=0;D=u=D-16|0,f=v[n+24>>2],v[f+24>>2]&&lr(r,f,e,i),(c=p[n+100>>2])!=w(0)?(s=(c=w(p[n+96>>2]/c))>w(1)?w(1):c,h=1,1!=(0|i)&&(h=v[f+112>>2])):(s=w(1),h=1!=(0|i)?i:0),i=r+56|0,b=p[f+40>>2]>s,k=p[f+52>>2],F=p[f+60>>2],A=p[f+48>>2],T=p[f+44>>2];r:if(l[f+36|0]){if((c=w(p[f+56>>2]-k))==w(0))break r;k=w(k+Cr(p[f+72>>2],c))}else k=(c=w(k+p[f+72>>2]))<(d=p[f+56>>2])?c:d;a=b?i:0,d=w(p[f+92>>2]*p[n+104>>2]),$=w(w(w(1)-s)*d),o=v[f+16>>2],t=v[o+8>>2];r:if(3!=(0|h)){if(I=f+148|0,(C=v[f+152>>2])||(v[u+12>>2]=0,yn(I,t<<1,u+12|0)),v[f+108>>2]=0,t)for(;;){b=v[(m=g<<2)+v[o+16>>2]>>2],i=0,c=$;n:{e:{switch(3&v[v[f+128>>2]+m>>2]){case 0:if(i=h,!(s>2]+8>>2]](b),20700)&&(i=0,4&l[v[f+128>>2]+m|0]))break n;if(s>2]+8>>2]](b),20808))break e;break n;case 2:c=d;break e;case 1:break e}y=v[v[f+144>>2]+m>>2],c=w(w(1)-w(p[y+96>>2]/p[y+100>>2])),c=w(d*(c>2]=c+p[f+108>>2],lu(0|da[v[v[b>>2]+8>>2]](b),21020))hr(b,e,k,c,i,I,g<<1,!C);else{y=1;e:if(!i)if(lu(0|da[v[v[b>>2]+8>>2]](b),20700)){if(!(s>2]+m|0]))break e;y=0}else y=!(s>2]+8>>2]](b),20808);da[v[v[b>>2]+12>>2]](b,e,F,k,a,c,i,y)}}if((0|(g=g+1|0))==(0|t))break}}else{if(!t)break r;for(i=0;h=v[v[o+16>>2]+(i<<2)>>2],da[v[v[h>>2]+12>>2]](h,e,F,k,a,$,3,1),(0|t)!=(0|(i=i+1|0)););}return p[n+100>>2]>w(0)&&Jr(r,f,k),v[r+60>>2]=0,p[f+64>>2]=k,p[f+80>>2]=p[f+72>>2],D=u+16|0,s}function hr(r,n,e,i,f,t,u,o){var a,c=w(0),b=0,k=w(0),s=0,l=w(0);if(o&&(v[v[t+12>>2]+(u<<2)>>2]=0),i!=w(1)){a=v[v[n+20>>2]+(v[r+20>>2]<<2)>>2];r:if(0|da[v[v[a>>2]+16>>2]](a)){if(s=v[r+36>>2],p[s>>2]>e){n:switch(0|f){case 0:return void(p[a+40>>2]=p[v[a+4>>2]+36>>2]);case 1:break n;default:break r}l=p[a+40>>2],e=p[v[a+4>>2]+36>>2]}else n=f?a+40|0:v[a+4>>2]+36|0,l=p[n>>2],n=s+(v[r+28>>2]<<2)|0,p[n-8>>2]<=e?e=w(p[v[a+4>>2]+36>>2]+p[n-4>>2]):(n=(s=(f=Pe(r+24|0,e,2))<<2)+v[r+36>>2]|0,k=p[n-4>>2],c=e,e=p[n>>2],e=bn(r,(f>>1)-1|0,w(w(1)-w(w(c-e)/w(p[n-8>>2]-e)))),c=w(p[4+(v[r+36>>2]+s|0)>>2]-k),b=16384.499999999996-+w(c/w(360)),r=g(b)<2147483648?~~b:-2147483648,e=w(p[v[a+4>>2]+36>>2]+w(w(w(c-w(0|m(16384-r|0,360)))*e)+k)),b=16384.499999999996-+w(e/w(360)),r=g(b)<2147483648?~~b:-2147483648,e=w(e-w(0|m(16384-r|0,360))));e=w(e-l),b=+w(e/w(-360))+16384.499999999996,r=g(b)<2147483648?~~b:-2147483648,c=w(0),(k=w(e-w(0|m(16384-r|0,360))))!=w(0)?(e=k,o||(r=v[t+12>>2]+(u<<2)|0,c=p[r>>2],e=p[r+4>>2]),r=c>=w(0),n=k>w(0),!(w(g(e))<=w(90))|Bt(e)==Bt(k)||(w(g(c))>w(180)&&(c=w(w(Bt(c)*w(360))+c)),r=n),e=w(w(k+c)-Cr(c,w(360))),(0|r)!=(0|n)&&(e=w(w(Bt(c)*w(360))+e)),r=v[t+12>>2],p[r+(u<<2)>>2]=e):(r=v[t+12>>2],e=p[r+(u<<2)>>2]),p[4+((u<<2)+r|0)>>2]=k,e=w(w(e*i)+l),b=+w(e/w(-360))+16384.499999999996,r=g(b)<2147483648?~~b:-2147483648,p[a+40>>2]=e-w(0|m(16384-r|0,360))}}else da[v[v[r>>2]+12>>2]](r,n,w(0),e,0,w(1),f,0)}function dr(r,n,e,i){var f,t=0,u=0,o=0,a=0,c=w(0),b=0,k=0,s=0;if(D=f=D+-64|0,v[f+60>>2]=0,v[f+52>>2]=0,v[f+56>>2]=0,v[f+48>>2]=8712,v[e+52>>2]=i,n=In(n,2872),(u=v[n+12>>2])&&(v[f+56>>2]=u,t=v[5208],k=f,s=0|da[v[v[t>>2]+16>>2]](t,0,u<<2,8524,97),v[k+60>>2]=s),v[f+12>>2]=0,yn(f+48|0,u,f+12|0),n=v[n+4>>2])for(t=0,o=v[f+60>>2];p[o+(t<<2)>>2]=p[n+24>>2],t=t+1|0,n=v[n>>2];);if((0|i)!=(0|u)){if(v[f+44>>2]=0,v[f+36>>2]=0,v[f+40>>2]=0,v[f+28>>2]=0,v[f+20>>2]=0,v[f+24>>2]=0,v[f+32>>2]=8712,v[f+16>>2]=10632,v[f+12>>2]=10616,i&&(v[f+24>>2]=m(i,3),n=v[5208],n=0|da[v[v[n>>2]+16>>2]](n,0,m(i,12),8524,97),v[f+40>>2]=m(i,9),v[f+28>>2]=n,n=v[5208],k=f,s=0|da[v[v[n>>2]+16>>2]](n,0,m(i,36),8524,97),v[k+44>>2]=s),n=f+32|0,i=f+16|0,u)for(t=0;;){if(c=p[v[f+60>>2]+(t<<2)>>2],o=w(g(c))>2]=o,On(i,f+8|0),(t=t+1|0)>>>0<(b=t+(o<<2)|0)>>>0)for(;c=p[(o=t<<2)+v[f+60>>2]>>2],a=w(g(c))>2]=a,On(i,a=f+8|0),p[f+8>>2]=p[4+(o+v[f+60>>2]|0)>>2]*p[r+24>>2],Rn(n,a),p[f+8>>2]=p[8+(o+v[f+60>>2]|0)>>2]*p[r+24>>2],Rn(n,a),Rn(n,12+(o+v[f+60>>2]|0)|0),b>>>0>(t=t+4|0)>>>0;);if(!(t>>>0>>0))break}v[e+40>>2]=0,_i(e+36|0,n),v[e+24>>2]=0,zi(e+20|0,i),v[f+12>>2]=10616,vo(n),Fu(i)}else{if(!(!i|p[r+24>>2]==w(1)))for(n=0,t=v[f+60>>2];p[(u=t+(n<<2)|0)>>2]=p[r+24>>2]*p[u>>2],(0|i)!=(0|(n=n+1|0)););v[e+40>>2]=0,_i(e+36|0,f+48|0)}vo(f+48|0),D=f- -64|0}function pr(r){var n=0,e=0,i=0,t=0,u=0,o=0;if(!l[r+28|0]){if(f[r+28|0]=1,v[r+8>>2]){for(e=v[r+20>>2];;){t=v[r+16>>2]+(u<<4)|0,n=v[t+8>>2];r:{n:{e:{i:{f:switch(0|(i=v[t+4>>2])){case 5:break n;case 3:break e;case 2:break i;case 0:case 1:case 4:break f;default:break r}if((o=v[n+168>>2])?da[v[v[o>>2]+8>>2]](o,e,i,n,0):da[v[n+164>>2]](e,i,n,0),!(i=v[e+96>>2])){da[v[e+92>>2]](e,v[t+4>>2],n,0);break r}da[v[v[i>>2]+8>>2]](i,e,v[t+4>>2],n,0);break r}(i=v[n+168>>2])?da[v[v[i>>2]+8>>2]](i,e,2,n,0):da[v[n+164>>2]](e,2,n,0),(i=v[e+96>>2])?da[v[v[i>>2]+8>>2]](i,e,v[t+4>>2],n,0):da[v[e+92>>2]](e,v[t+4>>2],n,0)}(t=v[n+168>>2])?da[v[v[t>>2]+8>>2]](t,e,3,n,0):da[v[n+164>>2]](e,3,n,0),(t=v[e+96>>2])?da[v[v[t>>2]+8>>2]](t,e,3,n,0):da[v[e+92>>2]](e,3,n,0),v[n+16>>2]=0,v[n+20>>2]=0,v[n+24>>2]=0,v[n+28>>2]=0,(t=v[n+12>>2])&&(i=v[n+8>>2])&&da[0|t](i),v[n+168>>2]=0,v[n+164>>2]=9,v[n+8>>2]=0,v[n+12>>2]=0,v[n+152>>2]=0,v[n+136>>2]=0,v[n+120>>2]=0,he(v[r+24>>2],n);break r}(i=v[n+168>>2])?da[v[v[i>>2]+8>>2]](i,e,5,n,v[t+12>>2]):da[v[n+164>>2]](e,5,n,v[t+12>>2]),(i=v[e+96>>2])?da[v[v[i>>2]+8>>2]](i,e,v[t+4>>2],n,v[t+12>>2]):da[v[e+92>>2]](e,v[t+4>>2],n,v[t+12>>2])}if(!((n=v[r+8>>2])>>>0>(u=u+1|0)>>>0))break}if(n)for(e=0;n=v[r+16>>2]+(~e+n<<4)|0,da[v[v[n>>2]>>2]](n),(n=v[r+8>>2])>>>0>(e=e+1|0)>>>0;);}f[r+28|0]=0,v[r+8>>2]=0}}function yr(r,n){var e,i=0,t=0,u=0,o=0,a=0;D=e=D-16|0;r:if(34!=l[0|n])v[5218]=n,u=0;else{for(i=n=n+1|0;!(!(o=l[0|i])|34==(0|o));)t=t+1|0,i=(92==(0|o)?2:1)+i|0;if(o=v[5208],u=0,!(o=0|da[v[v[o>>2]+8>>2]](o,t+1|0,8524,265)))break r;for(i=o;;){n:{e:if(92==(0|(u=l[0|n]))){u=n+1|0;i:{f:{t:{u:{o:{a:{switch((a=f[n+1|0])-110|0){case 1:case 2:case 3:case 5:break f;case 7:break t;case 6:break u;case 4:break o;case 0:break a}c:switch(a-98|0){case 0:f[0|i]=8;break i;case 4:break c;default:break f}f[0|i]=12;break i}f[0|i]=10;break i}f[0|i]=13;break i}f[0|i]=9;break i}if(_n(n+2|0,e+12|0),u=n+5|0,!(t=v[e+12>>2]))break e;if(56320==(0|(a=-1024&t)))break e;t:{u:{o:{if(55296!=(0|a)){if(n=1,t>>>0<128)break t;if(n=2,t>>>0<2048)break u;if(n=3,t>>>0<65536)break o}else{if(92!=l[n+6|0]|117!=l[n+7|0])break e;if(_n(n+8|0,e+8|0),u=n+11|0,(n=v[e+8>>2])-57344>>>0<4294966272)break e;t=65536+(1023&n|t<<10&1047552)|0,v[e+12>>2]=t}f[i+3|0]=63&t|128,t=v[e+12>>2]>>>6|0,v[e+12>>2]=t,n=4}f[i+2|0]=63&t|128,t=v[e+12>>2]>>>6|0,v[e+12>>2]=t}f[i+1|0]=63&t|128,t=v[e+12>>2]>>>6|0,v[e+12>>2]=t}f[0|i]=l[n+9660|0]|t,i=n+i|0;break e}f[0|i]=a}i=i+1|0}else{if(!u|34==(0|u))break n;f[0|i]=u,i=i+1|0,u=n}n=u+1|0;continue}break}f[0|i]=0,u=l[0|n],v[r+8>>2]=4,v[r+16>>2]=o,u=(34==(0|u))+n|0}return D=e+16|0,u}function mr(r,n,e,i){var t,u=0,o=0,a=0,c=0,b=0,k=0,s=0,h=0,d=0,p=0,y=0,m=0,w=0,g=0,F=0;D=t=D-16|0;r:{n:{e:{if((0|e)<=36){if(u=l[0|r])break e;o=r;break n}v[5373]=28,i=0;break r}o=r;e:{for(;;){if(!eo(u<<24>>24))break e;if(u=l[o+1|0],o=o+1|0,!u)break}break n}e:switch((u&=255)-43|0){case 0:case 2:break e;default:break n}s=45==(0|u)?-1:0,o=o+1|0}n:if(16!=(16|e)|48!=l[0|o])d=e||10;else{if(w=1,88==(223&l[o+1|0])){o=o+2|0,d=16;break n}o=o+1|0,d=e||8}for(e=0;u=-48,(((a=f[0|o])-48&255)>>>0<10||(u=-87,(a-97&255)>>>0<26||(u=-55,!((a-65&255)>>>0>25))))&&!((0|(a=u+a|0))>=(0|d));)c=Se(h,0,0,0),b=V,F=Se(k,0,d,0),u=V,p=Se(0,0,k,0),y=V,c=c+(y=(u=u+p|0)>>>0

>>0?y+1|0:y)|0,p=Se(h,0,d,0)+u|0,m=V,m=(u=u>>>0>p>>>0?m+1|0:m)+c|0,v[t+8>>2]=m,b=c>>>0>>0?b+1|0:b,v[t+12>>2]=u>>>0>m>>>0?b+1|0:b,v[t>>2]=F,v[t+4>>2]=p,u=1,v[t+8>>2]|v[t+12>>2]||(b=Se(k,h,d,0),-1==(0|(c=V))&~a>>>0>>0||(h=(k=a+b|0)>>>0>>0?c+1|0:c,w=1,u=e)),o=o+1|0,e=u;n&&(v[n>>2]=w?o:r);n:{if(e)v[5373]=68,s=(r=1&i)?0:s,k=i,h=0;else{if(!h&i>>>0>k>>>0)break n;r=1&i}if(!(r|s)){v[5373]=68,i=(r=i)-1|0,g=0-!r|0;break r}if(!(!h&i>>>0>=k>>>0)){v[5373]=68;break r}}i=(r=s^k)-s|0,g=((n=s>>31)^h)-((r>>>0>>0)+n|0)|0}return D=t+16|0,V=g,i}function wr(r,n){var e=0,i=0,f=0,c=0,s=0,l=w(0),h=0,d=0;b(n),c=au(f=t(2));r:{n:{e:{b(r);i:{if((e=t(2))-2139095040>>>0>=2164260864){if(c)break i;break n}if(!c)break e}if(l=w(1),1065353216==(0|e))break r;if(!(s=f<<1))break r;if(!(s>>>0<4278190081&(e<<=1)>>>0<=4278190080))return w(r+n);if(2130706432==(0|e))break r;return w(e>>>0>2130706431^(0|f)>=0?0:n*n)}if(au(e)){if(l=w(r*r),(0|e)<0&&(l=1==(0|Li(f))?w(-l):l),(0|f)>=0)break r;return st(w(w(1)/l))}if((0|e)<0){if(!(f=Li(f)))return r=w(r-r),w(r/r);s=(1==(0|f))<<16,e&=2147483647}e>>>0>8388607||(e=(2147483647&(b(w(r*w(8388608))),t(2)))-192937984|0)}if(c=(f=e-1060306944|0)>>>15&240,u(2,e-(-8388608&f)|0),a(+(i=((h=(i=+k()*y[c+20272>>3]-1)*i)*h*(.288457581109214*i-.36092606229713164)+((.480898481472577*i-.7213474675006291)*h+(1.4426950408774342*i+(y[c+20280>>3]+ +(f>>23)))))*+n)),e=0|t(1),t(0),!(1079967744==(0|(e&=2147450880))|e>>>0<1079967744)){if(i>127.99999995700433)return wu(s,w(15845632502852868e13));if(i<=-150)return wu(s,w(2524354896707238e-44))}i-=(d=(h=y[2152])+i)-h,i=(y[2153]*i+y[2154])*i*i+y[2155]*i+1,a(+d),t(1),e=s+(c=0|t(0))|0,f=c=v[(s=16960+((31&c)<<3)|0)>>2],e=v[s+4>>2]+(e<<15)|0,u(0,0|f),u(1,0|(f>>>0>>0?e+1:e)),l=w(i*+o())}return l}function gr(r,n,e,i,f,t,u){r|=0,n=w(n),e=w(e),i|=0,f|=0,t|=0,u=w(u);var o=w(0),a=w(0),c=0,b=w(0),k=w(0),s=w(0),h=w(0),d=w(0),y=w(0);h=p[r+68>>2],s=w(-p[r+80>>2]),c=v[r+12>>2],k=p[c+108>>2],o=p[c+104>>2],b=p[c+96>>2],a=p[c+92>>2],l[r+88|0]||Fr(r),h=w(s-h);r:{switch(v[v[r+4>>2]+56>>2]-1|0){case 0:c=r+112|0,o=e,a=w(n-p[r+100>>2]);break r;case 1:b=w(w(g(w(w(a*k)-w(o*b))))/w(w(a*a)+w(o*o))),k=w(a*b),b=w(b*w(-o)),h=w(w(Pr(o,a)*w(57.2957763671875))+h)}s=w(e-p[c+112>>2]),d=w(n-p[c+100>>2]),y=w(w(s*a)-w(o*d)),a=w(w(a*k)-w(o*b)),o=w(y/a),c=r- -64|0,a=w(w(w(w(d*k)-w(b*s))/a)-p[r+60>>2])}s=w(o-p[c>>2]),o=w(w(Pr(s,a)*w(57.2957763671875))+h),(o=(k=p[r+72>>2])w(180)?o=w(o+w(-360)):o>2];r:if(i|f){c=i,n=(i=v[v[r+4>>2]+56>>2]-3>>>0<2)?w(n-p[r+100>>2]):a,a=w(n*n),n=i?w(e-p[r+112>>2]):s;n:{if(!((e=w(T(w(a+w(n*n)))))<(n=w(k*p[v[r+4>>2]+24>>2]))&&c)){if(!f|!(n>w(9999999747378752e-20)))break r;if(nw(9999999747378752e-20)))break r}n=w(w(w(w(e/n)+w(-1))*u)+w(1)),k=w(k*n),b=w(b*(t?n:w(1)))}cr(r,p[r+60>>2],p[r+64>>2],w(w(o*u)+p[r+68>>2]),k,b,p[r+80>>2],p[r+84>>2])}function Fr(r){var n,e=w(0),i=w(0),t=w(0),u=w(0),o=w(0),a=w(0),c=w(0),b=w(0),k=w(0),s=0,l=w(0);return f[r+88|0]=1,(n=v[r+12>>2])?(e=p[n+112>>2],o=p[n+100>>2],i=p[n+108>>2],u=p[n+92>>2],c=p[n+104>>2],t=p[n+96>>2],v[r+80>>2]=0,a=w(p[r+112>>2]-e),e=w(w(1)/w(w(u*i)-w(c*t))),o=w(p[r+100>>2]-o),p[r+64>>2]=w(w(u*a)*e)-w(e*w(c*o)),p[r+60>>2]=w(w(i*o)*e)-w(e*w(t*a)),i=w(i*e),o=p[r+92>>2],a=w(-e),k=w(t*a),b=p[r+104>>2],t=w(w(i*o)+w(k*b)),e=w(u*e),a=w(c*a),u=w(w(e*b)+w(a*o)),c=w(T(w(w(t*t)+w(u*u)))),p[r+72>>2]=c,o=p[r+108>>2],b=a,a=p[r+96>>2],e=w(w(e*o)+w(b*a)),i=w(w(i*a)+w(k*o)),c>w(9999999747378752e-20)?(o=w(w(t*e)-w(u*i)),p[r+76>>2]=o/c,s=r,l=w(Pr(w(w(t*i)+w(u*e)),o)*w(57.2957763671875)),p[s+84>>2]=l,s=r,l=w(Pr(u,t)*w(57.2957763671875)),void(p[s+68>>2]=l)):(v[r+84>>2]=0,v[r+72>>2]=0,p[r+76>>2]=T(w(w(i*i)+w(e*e))),s=r,l=w(w(Pr(e,i)*w(-57.2957763671875))+w(90)),void(p[s+68>>2]=l))):(p[r+60>>2]=p[r+100>>2],p[r+64>>2]=p[r+112>>2],e=p[r+104>>2],i=p[r+92>>2],v[r+80>>2]=0,p[r+72>>2]=T(w(w(i*i)+w(e*e))),s=r,l=w(Pr(e,i)*w(57.2957763671875)),p[s+68>>2]=l,t=p[r+96>>2],u=p[r+108>>2],p[r+76>>2]=T(w(w(t*t)+w(u*u))),s=r,l=w(Pr(w(w(i*t)+w(e*u)),w(w(i*u)-w(e*t)))*w(57.2957763671875)),void(p[s+84>>2]=l))}function Ar(r,n,e){var i,t,u,o=w(0),a=0,c=0;if(D=t=D-16|0,i=Oo(r),v[i+8>>2]=9196,v[i+4>>2]=n,v[i>>2]=9828,r=0,v[i+20>>2]=0,v[i+12>>2]=0,v[i+16>>2]=0,a=i,c=tu(e,Bo(v[n+40>>2])),v[a+24>>2]=c,p[i+28>>2]=p[n+60>>2],p[i+32>>2]=p[n+64>>2],p[i+36>>2]=p[n+68>>2],o=p[n+72>>2],v[i+124>>2]=8712,v[i+120>>2]=0,v[i+112>>2]=0,v[i+116>>2]=0,v[i+108>>2]=8712,v[i+104>>2]=0,v[i+96>>2]=0,v[i+100>>2]=0,v[i+92>>2]=8712,v[i+88>>2]=0,v[i+80>>2]=0,v[i+84>>2]=0,v[i+76>>2]=8712,v[i+72>>2]=0,v[(n=i- -64|0)>>2]=0,v[n+4>>2]=0,v[i+60>>2]=8712,v[i+56>>2]=0,v[i+48>>2]=0,v[i+52>>2]=0,v[i+44>>2]=8712,p[i+40>>2]=o,f[i+133|0]=0,f[i+134|0]=0,f[i+135|0]=0,f[i+136|0]=0,f[i+137|0]=0,f[i+138|0]=0,f[i+139|0]=0,f[i+140|0]=0,v[i+128>>2]=0,v[i+132>>2]=0,ca(u=i+8|0,v[v[i+4>>2]+28>>2]),n=v[i+4>>2],v[n+28>>2])for(;a=t,c=ku(e,Bo(v[v[n+36>>2]+(r<<2)>>2])),v[a+12>>2]=c,Sn(u,t+12|0),r=r+1|0,n=v[i+4>>2],r>>>0>2];);return v[t+8>>2]=0,yn(i+124|0,10,t+8|0),D=t+16|0,i}function Tr(r,n){r|=0,n=w(n);var e,i=0,f=0,t=w(0),u=w(0),o=0,a=w(0),c=0,b=w(0);if(e=v[r+44>>2])for(n=w(p[r+100>>2]*n);;){c=v[r+52>>2]+(o<<2)|0;r:if(i=v[c>>2]){if(p[i+60>>2]=p[i+64>>2],u=p[i+80>>2],p[i+76>>2]=u,a=p[i+88>>2],t=w(n*a),(b=p[i+68>>2])>w(0)){if(t=w(b-t),p[i+68>>2]=t,t>w(0))break r;v[i+68>>2]=0,t=w(-t)}n:{if(f=v[i+20>>2]){if(!((u=w(u-p[f+68>>2]))>=w(0)))break n;if(v[f+68>>2]=0,p[f+72>>2]=(a!=w(0)?w(w(n+w(u/a))*p[f+88>>2]):w(0))+p[f+72>>2],p[i+72>>2]=t+p[i+72>>2],gn(r,o,f,1),!(i=v[f+24>>2]))break r;for(;p[f+96>>2]=n+p[f+96>>2],f=i,i=v[i+24>>2];);break r}if(!(v[i+24>>2]|!(u>=p[i+84>>2]))){v[c>>2]=0,jf(v[r+72>>2],i),pi(r,i);break r}}if(v[i+24>>2]&&dn(r,i,n)&&(f=v[i+24>>2],v[i+24>>2]=0,f))for(v[f+28>>2]=0;jf(v[r+72>>2],f),f=v[f+24>>2];);p[i+72>>2]=t+p[i+72>>2]}if((0|e)==(0|(o=o+1|0)))break}pr(v[r+72>>2])}function $r(r,n,e,i){var f,t,o=0,a=0,c=0,b=0,s=w(0),h=0,d=0,y=0,g=0,F=0;if(D=f=D-16|0,s=p[r+36>>2],r=i<<1,v[e+52>>2]=r,o=v[n+4>>2],v[n+4>>2]=o+1,t=e+36|0,l[0|o]){if(ca(t,m(i,18)),ca(o=e+20|0,m(i,6)),!((0|i)<=0))for(;;){if(h=Wn(n,1),v[f+12>>2]=h,On(o,f+12|0),d=0,(0|h)>0)for(;g=f,F=Wn(n,1),v[g+12>>2]=F,On(o,e=f+12|0),r=v[n+4>>2],v[n+4>>2]=r+1,a=l[0|r],v[n+4>>2]=r+2,c=l[r+1|0],v[n+4>>2]=r+3,b=l[r+2|0],v[n+4>>2]=r+4,p[f+12>>2]=s*(u(2,l[r+3|0]|(b|c<<8|a<<16)<<8),k()),Rn(t,e),r=v[n+4>>2],v[n+4>>2]=r+1,a=l[0|r],v[n+4>>2]=r+2,c=l[r+1|0],v[n+4>>2]=r+3,b=l[r+2|0],v[n+4>>2]=r+4,p[f+12>>2]=s*(u(2,l[r+3|0]|(b|c<<8|a<<16)<<8),k()),Rn(t,e),r=v[n+4>>2],v[n+4>>2]=r+1,a=l[0|r],v[n+4>>2]=r+2,c=l[r+1|0],v[n+4>>2]=r+3,b=l[r+2|0],v[n+4>>2]=r+4,v[f+12>>2]=l[r+3|0]|(b|c<<8|a<<16)<<8,Rn(t,e),(0|(d=d+1|0))!=(0|h););if((0|(y=y+1|0))==(0|i))break}}else Nr(n,r,s,t);D=f+16|0}function Ir(r){return v[r+208>>2]=8712,v[r+204>>2]=0,v[r+196>>2]=0,v[r+200>>2]=0,v[r+192>>2]=8712,v[r+188>>2]=0,v[r+180>>2]=0,v[r+184>>2]=0,v[r+176>>2]=9788,v[r+172>>2]=0,v[r+164>>2]=0,v[r+168>>2]=0,v[r+160>>2]=8712,v[r+156>>2]=0,v[r+148>>2]=0,v[r+152>>2]=0,v[r+144>>2]=8712,v[r+140>>2]=0,v[r+132>>2]=0,v[r+136>>2]=0,v[r+128>>2]=8712,v[r+124>>2]=0,v[r+116>>2]=0,v[r+120>>2]=0,v[r+112>>2]=10392,v[r+108>>2]=10440,v[r+104>>2]=0,v[r+96>>2]=0,v[r+100>>2]=0,v[r+92>>2]=10376,v[r+88>>2]=10424,v[r+84>>2]=0,v[r+76>>2]=0,v[r+80>>2]=0,v[r+72>>2]=8680,v[r+68>>2]=0,v[r+60>>2]=0,v[r+64>>2]=0,v[r+56>>2]=10408,v[r+52>>2]=0,v[r+44>>2]=0,v[r+48>>2]=0,v[r+40>>2]=8680,v[r+36>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+24>>2]=10392,v[r+20>>2]=0,v[r+12>>2]=0,v[r+16>>2]=0,v[r+8>>2]=10376,v[r+4>>2]=10944,v[r>>2]=10360,v[r+220>>2]=0,v[r+224>>2]=0,v[r+212>>2]=0,v[r+216>>2]=0,ca(r+144|0,128),ca(r+160|0,128),ba(r+176|0,128),ca(r+192|0,128),r}function Cr(r,n){var e=0,i=0,f=0,o=0,a=0,c=0;if(b(n),!((e=(o=t(2))<<1)&&(b(r),255!=(0|(f=(c=t(2))>>>23&255))&&(2147483647&(b(n),t(2)))>>>0<2139095041)))return r=w(r*n),w(r/r);if((i=c<<1)>>>0<=e>>>0)return(0|i)==(0|e)?w(r*w(0)):r;if(a=o>>>23&255,f)i=8388607&c|8388608;else{if(f=0,(0|(i=c<<9))>=0)for(;f=f-1|0,(0|(i<<=1))>=0;);i=c<<1-f}if(a)e=8388607&o|8388608;else{if(a=0,(0|(e=o<<9))>=0)for(;a=a-1|0,(0|(e<<=1))>=0;);e=o<<1-a}if(o=e,(0|f)>(0|a)){for(;;){if(!((0|(e=i-o|0))<0||(i=e)))return w(r*w(0));if(i<<=1,!((0|a)<(0|(f=f-1|0))))break}f=a}if(!((0|(e=i-o|0))<0||(i=e)))return w(r*w(0));if(i>>>0>8388607)e=i;else for(;f=f-1|0,o=i>>>0<4194304,i=e=i<<1,o;);return u(2,-2147483648&c|((0|f)>0?e-8388608|f<<23:e>>>1-f)),k()}function Pr(r,n){var e,i,f=0,o=0,a=w(0);if(!((2147483647&(b(r),t(2)))>>>0<2139095041&(2147483647&(b(n),t(2)))>>>0<=2139095040))return w(r+n);if(b(n),1065353216==(0|(f=t(2))))return Er(r);i=f>>>30&2,b(r),e=i|(o=t(2))>>>31;r:{n:{e:{if(!(o&=2147483647)){i:switch(e-2|0){case 0:return w(3.1415927410125732);case 1:break i;default:break e}return w(-3.1415927410125732)}if(2139095040!=(0|(f&=2147483647))){if(!f|!(2139095040!=(0|o)&o>>>0<=f+218103808>>>0))break r;switch(i&&(a=w(0),f>>>0>o+218103808>>>0)||(a=Er(w(g(w(r/n))))),r=a,0|e){case 1:return w(-r);case 2:return w(w(3.1415927410125732)-w(r+w(8.742277657347586e-8)));case 0:break e}return w(w(r+w(8.742277657347586e-8))+w(-3.1415927410125732))}if(2139095040==(0|o))break n;r=p[17364+(e<<2)>>2]}return r}return p[17348+(e<<2)>>2]}return u(2,-2147483648&(b(r),t(2))|1070141403),k()}function Er(r){var n,e,i=0,f=w(0),o=w(0),a=w(0);if(b(r),(n=2147483647&(e=t(2)))>>>0>=1283457024)return(2147483647&(b(r),t(2)))>>>0>2139095040?r:(u(2,-2147483648&(b(r),t(2))|1070141402),k());r:{n:{if(n>>>0<=1054867455){if(i=-1,n>>>0>=964689920)break n;break r}if(r=w(g(r)),n>>>0<=1066926079){if(n>>>0<=1060110335){r=w(w(w(r+r)+w(-1))/w(r+w(2))),i=0;break n}r=w(w(r+w(-1))/w(r+w(1))),i=1}else n>>>0<=1075576831?(r=w(w(r+w(-1.5))/w(w(r*w(1.5))+w(1))),i=2):(r=w(w(-1)/r),i=3)}if(o=w(r*r),f=w(o*o),a=w(f*w(w(f*w(-.106480173766613))+w(-.19999158382415771))),f=w(o*w(w(f*w(w(f*w(.06168760731816292))+w(.14253635704517365)))+w(.333333283662796))),n>>>0<=1054867455)return w(r-w(r*w(a+f)));r=w(p[17392+(i<<=2)>>2]-w(w(w(r*w(a+f))-p[i+17408>>2])-r)),r=(0|e)<0?w(-r):r}return r}function Or(r,n){var e,i,f=0,t=0,u=0,o=0,a=w(0);if(D=i=D-16|0,e=si(r,n),v[e+40>>2]=9400,v[e+24>>2]=8712,v[e+20>>2]=0,v[e>>2]=9372,v[e+44>>2]=0,v[e+48>>2]=0,v[e+36>>2]=0,v[e+28>>2]=0,v[e+32>>2]=0,v[e+52>>2]=0,v[e+56>>2]=0,ca(r=e+24|0,n),aa(e+40|0,n),v[i>>2]=0,yn(r,n,i),(0|n)>0)for(r=0;v[i+12>>2]=0,v[i+4>>2]=0,v[i+8>>2]=0,v[i>>2]=8712,D=u=D-16|0,(0|(f=v[e+44>>2]))!=v[e+48>>2]?(v[e+44>>2]=f+1,xn(v[e+52>>2]+(f<<4)|0,i)):(o=xn(u,i),a=w(w(d[e+44>>2])*w(1.75)),t=(f=w(g(a))>>0<=8?8:f,v[e+48>>2]=t,f=v[5208],t=0|da[v[v[f>>2]+16>>2]](f,v[e+52>>2],t<<4,8524,109),v[e+52>>2]=t,f=v[e+44>>2],v[e+44>>2]=f+1,xn(t+(f<<4)|0,o),vo(o)),D=u+16|0,vo(i),(0|n)!=(0|(r=r+1|0)););return D=i+16|0,e}function Rr(r){var n,e,i=w(0),f=0,u=0;D=n=D-16|0,b(r);r:if((e=2147483647&(f=t(2)))>>>0<=1061752794){if(i=w(1),e>>>0<964689920)break r;i=Bi(+r)}else if(e>>>0<=1081824209){if(e>>>0>=1075235812){i=w(-Bi(+r+((0|f)<0?3.141592653589793:-3.141592653589793)));break r}if(u=+r,(0|f)<0){i=Gi(u+1.5707963267948966);break r}i=Gi(1.5707963267948966-u)}else if(e>>>0<=1088565717){if(e>>>0>=1085271520){i=Bi(+r+((0|f)<0?6.283185307179586:-6.283185307179586));break r}if((0|f)<0){i=Gi(-4.71238898038469-+r);break r}i=Gi(+r-4.71238898038469)}else if(i=w(r-r),!(e>>>0>=2139095040)){switch(3&er(r,n+8|0)){case 0:i=Bi(y[n+8>>3]);break r;case 1:i=Gi(-y[n+8>>3]);break r;case 2:i=w(-Bi(y[n+8>>3]));break r}i=Gi(y[n+8>>3])}return D=n+16|0,i}function Sr(r){var n=0,e=0,i=0,t=0,u=0;if(n=v[12+(r|=0)>>2])for(;Ke(v[v[r+20>>2]+(e<<2)>>2]),(0|n)!=(0|(e=e+1|0)););if(t=v[r+60>>2])for(u=v[r+68>>2],e=0;n=v[u+(e<<2)>>2],i=v[n+4>>2],v[n+24>>2]=v[i+44>>2],f[n+28|0]=l[i+48|0],f[n+29|0]=l[i+49|0],p[n+32>>2]=p[i+52>>2],p[n+36>>2]=p[i+56>>2],(0|t)!=(0|(e=e+1|0)););if(t=v[r+76>>2])for(u=v[r+84>>2],e=0;n=v[u+(e<<2)>>2],i=v[n+4>>2],p[n+28>>2]=p[i+44>>2],p[n+32>>2]=p[i+48>>2],p[n+36>>2]=p[i+52>>2],p[n+40>>2]=p[i+56>>2],(0|t)!=(0|(e=e+1|0)););if(i=v[r+92>>2])for(t=v[r+100>>2],e=0;r=v[t+(e<<2)>>2],n=v[r+4>>2],p[r+28>>2]=p[n+60>>2],p[r+32>>2]=p[n+64>>2],p[r+36>>2]=p[n+68>>2],p[r+40>>2]=p[n+72>>2],(0|i)!=(0|(e=e+1|0)););}function Wr(r){var n,e,i=0,f=0;D=n=D-16|0,b(r);r:if((e=2147483647&(f=t(2)))>>>0<=1061752794){if(e>>>0<964689920)break r;r=Gi(+r)}else if(e>>>0<=1081824209){if(i=+r,e>>>0<=1075235811){if((0|f)<0){r=w(-Bi(i+1.5707963267948966));break r}r=Bi(i+-1.5707963267948966);break r}r=Gi(-(((0|f)>=0?-3.141592653589793:3.141592653589793)+i))}else if(e>>>0<=1088565717){if(e>>>0<=1085271519){if(i=+r,(0|f)<0){r=Bi(i+4.71238898038469);break r}r=w(-Bi(i+-4.71238898038469));break r}r=Gi(+r+((0|f)<0?6.283185307179586:-6.283185307179586))}else if(e>>>0>=2139095040)r=w(r-r);else{switch(3&er(r,n+8|0)){case 0:r=Gi(y[n+8>>3]);break r;case 1:r=Bi(y[n+8>>3]);break r;case 2:r=Gi(-y[n+8>>3]);break r}r=w(-Bi(y[n+8>>3]))}return D=n+16|0,r}function Gr(r,n){n|=0;var e=0,i=0,f=0,t=0,u=0,o=0,a=0;if((0|(t=v[136+(r|=0)>>2]))!=(0|n)){r:if(n)if(t){if(!(e=v[t+24>>2]))break r;for(a=n+16|0;;){if(u=v[t+32>>2],d[4+(u+(i<<4)|0)>>2]<=o>>>0){n:{e:{for(;;){if((0|(i=i+1|0))==(0|e))break e;if(v[4+(u+(i<<4)|0)>>2])break}f=i;break n}f=e}if(e=e>>>0<=i>>>0,o=0,i=f,e)break r}if(f=v[12+(u+(i<<4)|0)>>2]+m(o,20)|0,e=v[f>>2],u=v[v[r+36>>2]+(e<<2)>>2],v[u+60>>2]==v[f+16>>2]&&(f=Dn(a,e,f+4|0))&&af(u,f),o=o+1|0,!(i>>>0<(e=v[t+24>>2])>>>0))break}}else if(f=v[r+28>>2])for(;i=v[v[r+36>>2]+(e<<2)>>2],t=Lo(v[i+4>>2]),v[t+4>>2]&&(t=gt(n,e,t))&&af(i,t),(0|f)!=(0|(e=e+1|0)););v[r+136>>2]=n,rr(r)}}function Ur(r,n){var e,i,f=0,t=0,u=0,o=0,a=w(0);if(D=i=D-16|0,e=Eo(r),v[e+20>>2]=9444,v[e+4>>2]=8712,v[e>>2]=9416,v[e+32>>2]=0,v[e+24>>2]=0,v[e+28>>2]=0,v[e+16>>2]=0,v[e+8>>2]=0,v[e+12>>2]=0,ca(r=e+4|0,n),aa(e+20|0,n),v[i>>2]=0,yn(r,n,i),(0|n)>0)for(r=0;v[i+12>>2]=0,v[i+4>>2]=0,v[i+8>>2]=0,v[i>>2]=8680,D=u=D-16|0,(0|(f=v[e+24>>2]))!=v[e+28>>2]?(v[e+24>>2]=f+1,Jn(v[e+32>>2]+(f<<4)|0,i)):(o=Jn(u,i),a=w(w(d[e+24>>2])*w(1.75)),t=(f=w(g(a))>>0<=8?8:f,v[e+28>>2]=t,f=v[5208],t=0|da[v[v[f>>2]+16>>2]](f,v[e+32>>2],t<<4,8524,109),v[e+32>>2]=t,f=v[e+24>>2],v[e+24>>2]=f+1,Jn(t+(f<<4)|0,o),Qu(o)),D=u+16|0,Qu(i),(0|n)!=(0|(r=r+1|0)););return D=i+16|0,e}function jr(r,n,e){var i,f=0,t=0,o=0,a=0,c=0,b=0,s=0,h=0,d=0,p=0,y=0,m=0,w=0,g=0,F=0;switch(i=v[r+4>>2],v[r+4>>2]=i+1,l[0|i]-1|0){case 0:return void ct(e,n);case 1:v[r+4>>2]=i+2,f=l[i+1|0],v[r+4>>2]=i+3,t=l[i+2|0],v[r+4>>2]=i+4,o=l[i+3|0],v[r+4>>2]=i+5,a=l[i+4|0],v[r+4>>2]=i+6,c=l[i+5|0],v[r+4>>2]=i+7,b=l[i+6|0],v[r+4>>2]=i+8,s=l[i+7|0],v[r+4>>2]=i+9,h=l[i+8|0],v[r+4>>2]=i+10,d=l[i+9|0],v[r+4>>2]=i+11,p=l[i+10|0],v[r+4>>2]=i+12,y=l[i+11|0],v[r+4>>2]=i+13,m=l[i+12|0],v[r+4>>2]=i+14,w=l[i+13|0],v[r+4>>2]=i+15,g=l[i+14|0],v[r+4>>2]=i+16,F=l[i+15|0],v[r+4>>2]=i+17,_r(e,n,(u(2,(t<<8|f<<16|o)<<8|a),k()),(u(2,(b<<8|c<<16|s)<<8|h),k()),(u(2,(p<<8|d<<16|y)<<8|m),k()),(u(2,l[i+16|0]|(g<<8|w<<16|F)<<8),k()))}}function Hr(r){return v[r>>2]=10456,ht(r+4|0),v[r+52>>2]=0,v[r+56>>2]=0,v[r+48>>2]=10488,v[r+44>>2]=0,v[r+36>>2]=0,v[r+40>>2]=0,v[r+32>>2]=10472,v[r+28>>2]=0,v[r+20>>2]=0,v[r+24>>2]=0,v[r+16>>2]=9612,v[r+60>>2]=0,v[r+64>>2]=0,v[r+132>>2]=10568,v[r+128>>2]=0,v[r+120>>2]=0,v[r+124>>2]=0,v[r+116>>2]=10552,v[r+112>>2]=0,v[r+104>>2]=0,v[r+108>>2]=0,v[r+100>>2]=10536,v[r+96>>2]=0,v[r+88>>2]=0,v[r+92>>2]=0,v[r+84>>2]=10520,v[r+80>>2]=0,v[r+72>>2]=0,v[r+76>>2]=0,v[r+68>>2]=10504,v[r+160>>2]=0,v[r+152>>2]=0,v[r+156>>2]=0,v[r+144>>2]=0,v[r+148>>2]=0,v[r+136>>2]=0,v[r+140>>2]=0,ht(r+164|0),ht(r+176|0),v[r+192>>2]=0,v[r+196>>2]=0,v[r+188>>2]=10584,v[r+200>>2]=0,v[r+204>>2]=0,ht(r+208|0),ht(r+220|0),r}function Lr(r,n){var e;return D=e=D-16|0,r=kt(r,n),v[r+52>>2]=0,v[r+56>>2]=0,v[r+48>>2]=1065353216,v[r+40>>2]=0,v[r+44>>2]=1065353216,v[r+32>>2]=0,v[r+36>>2]=0,v[r+20>>2]=10052,v[r>>2]=10028,v[r+24>>2]=0,v[r+28>>2]=0,v[r+100>>2]=8712,v[r+84>>2]=8712,v[r+60>>2]=0,v[r+64>>2]=0,v[r+68>>2]=0,v[r+72>>2]=0,v[r+76>>2]=0,v[r+80>>2]=0,v[r+112>>2]=0,v[r+104>>2]=0,v[r+108>>2]=0,v[r+96>>2]=0,v[r+88>>2]=0,v[r+92>>2]=0,ht(r+116|0),v[r+136>>2]=0,v[r+140>>2]=0,v[r+128>>2]=0,v[r+132>>2]=0,v[r+156>>2]=1065353216,v[r+160>>2]=1065353216,v[r+148>>2]=1065353216,v[r+152>>2]=1065353216,v[r+144>>2]=9308,ci(r+144|0),v[e+12>>2]=0,yn(r+84|0,8,e+12|0),v[e+8>>2]=0,yn(r+100|0,8,e+8|0),D=e+16|0,r}function Mr(r,n){return r=Fe(r,n),v[r+76>>2]=0,v[r+80>>2]=0,v[r+64>>2]=9772,v[r>>2]=9748,v[r+68>>2]=0,v[r+72>>2]=0,v[r+152>>2]=9788,v[r+136>>2]=9788,v[r+120>>2]=8712,v[r+104>>2]=8712,v[r+84>>2]=0,v[r+88>>2]=0,v[r+92>>2]=0,v[r+96>>2]=0,v[r+100>>2]=0,v[r+164>>2]=0,v[r+156>>2]=0,v[r+160>>2]=0,v[r+148>>2]=0,v[r+140>>2]=0,v[r+144>>2]=0,v[r+132>>2]=0,v[r+124>>2]=0,v[r+128>>2]=0,v[r+116>>2]=0,v[r+108>>2]=0,v[r+112>>2]=0,ht(r+168|0),v[r+196>>2]=0,v[r+200>>2]=0,v[r+188>>2]=0,v[r+192>>2]=0,v[r+180>>2]=0,v[r+184>>2]=0,v[r+216>>2]=1065353216,v[r+220>>2]=1065353216,v[r+208>>2]=1065353216,v[r+212>>2]=1065353216,v[r+204>>2]=9308,ci(r+204|0),v[r+232>>2]=0,f[r+228|0]=0,v[r+224>>2]=0,r}function _r(r,n,e,i,f,t){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t);var u,o=w(0),a=w(0),c=w(0),b=w(0),k=0;if(u=v[r+16>>2],r=m(n,19),v[u+(r<<2)>>2]=1073741824,(n=r+1|0)>>>0<(r=r+19|0)>>>0)for(o=w(w(f-w(e+e))*w(.029999999329447746)),c=w(w(w(w(e-f)*w(3))+w(1))*w(.006000000052154064)),f=w(w(o+o)+c),a=w(w(t-w(i+i))*w(.029999999329447746)),b=w(w(w(w(i-t)*w(3))+w(1))*w(.006000000052154064)),t=w(w(a+a)+b),a=i=w(w(b*w(.1666666716337204))+w(w(i*w(.30000001192092896))+a)),o=e=w(w(c*w(.1666666716337204))+w(w(e*w(.30000001192092896))+o));p[(k=(n<<2)+u|0)>>2]=e,p[k+4>>2]=i,a=w(t+a),i=w(a+i),o=w(o+f),e=w(e+o),f=w(c+f),t=w(b+t),r>>>0>(n=n+2|0)>>>0;);}function zr(r){r|=0;var n,e=w(0),i=w(0),f=w(0),t=w(0),u=w(0),o=w(0),a=w(0),c=w(0),b=w(0),k=w(0),s=w(0),l=w(0),h=w(0);f=p[r+52>>2],e=p[r+44>>2],u=p[r+76>>2],c=p[r+60>>2],b=p[r+68>>2],i=Wr(o=w(p[r+40>>2]*w(.01745329238474369))),t=p[r+56>>2],a=p[r+48>>2],k=p[r+80>>2],s=p[r+64>>2],o=Rr(o),l=p[r+32>>2],h=p[r+72>>2],u=w(e*w(f/u)),f=w(w(e*w(f*w(-.5)))+w(u*c)),n=v[r+96>>2],e=w(a*w(t*w(-.5))),t=w(a*w(t/k)),e=w(e+w(s*t)),a=p[r+36>>2],c=w(w(o*e)+a),u=w(w(b*u)+f),b=w(i*u),p[n+28>>2]=c+b,k=w(l+w(f*o)),t=w(w(h*t)+e),s=w(i*t),p[n+8>>2]=k-s,f=w(f*i),p[n+4>>2]=c+f,i=w(e*i),p[n>>2]=k-i,e=w(l+w(u*o)),p[n+24>>2]=e-i,i=w(a+w(t*o)),p[n+20>>2]=i+b,p[n+16>>2]=e-s,p[n+12>>2]=i+f}function xr(r){r|=0;var n,e,i=0,t=0;return Mr(n=Xf(236),No(r)),i=v[r+68>>2],(e=v[n+72>>2])&&(!(t=v[n+68>>2])|(0|i)==(0|t)||da[0|e](t)),v[n+72>>2]=0,v[n+68>>2]=i,p[n+180>>2]=p[r+180>>2],p[n+184>>2]=p[r+184>>2],p[n+188>>2]=p[r+188>>2],p[n+192>>2]=p[r+192>>2],f[n+228|0]=l[r+228|0],v[n+232>>2]=v[r+232>>2],p[n+76>>2]=p[r+76>>2],p[n+80>>2]=p[r+80>>2],p[n+84>>2]=p[r+84>>2],p[n+88>>2]=p[r+88>>2],p[n+92>>2]=p[r+92>>2],p[n+96>>2]=p[r+96>>2],ee(n+168|0,r+168|0),p[n+208>>2]=p[r+208>>2],p[n+212>>2]=p[r+212>>2],p[n+216>>2]=p[r+216>>2],p[n+220>>2]=p[r+220>>2],ci(n+204|0),v[n+56>>2]=v[r+56>>2],zn(n,(i=v[r+100>>2])||r),sr(n),0|n}function Jr(r,n,e){var i,f,t=0,u=0,o=w(0),a=w(0),c=0,b=w(0),k=w(0),s=w(0);D=i=D-16|0,f=v[r+60>>2],o=p[n+56>>2],b=p[n+52>>2],a=w(o-b),k=Cr(p[n+76>>2],a);r:if(f){for(;;){if(u=v[v[r+68>>2]+(t<<2)>>2],(s=p[u+8>>2])>2],ut(i,5,n,u),qr(c+4|0,i)),(0|f)==(0|(t=t+1|0)))break}t=f}r:{n:{if(l[n+36|0]){if(a==w(0))break n;if(Cr(p[n+72>>2],a)=o)|!(p[n+60>>2]>2],ut(i,4,n,0),qr(u+4|0,i)}if(t>>>0>>0)for(;u=v[v[r+68>>2]+(t<<2)>>2],p[u+8>>2]>2],ut(i,5,n,u),qr(c+4|0,i)),(0|f)!=(0|(t=t+1|0)););D=i+16|0}function Kr(r,n,e,i){var t,u=0,o=0,a=0,c=0,b=0;if(D=t=D-16|0,v[r>>2]=1032,v[r+4>>2]=1048,v[r+8>>2]=v[e+4>>2],u=v[e+8>>2],v[r+16>>2]=0,v[r+12>>2]=u,u&&(o=v[5208],c=r,b=0|da[v[v[o>>2]+12>>2]](o,u<<2,8524,206),v[c+16>>2]=b,o=v[r+8>>2]))for(u=0;v[(a=u<<2)+v[r+16>>2]>>2]=v[v[e+12>>2]+a>>2],(0|o)!=(0|(u=u+1|0)););if(p[r+32>>2]=i,v[r+24>>2]=0,v[r+28>>2]=0,v[r+20>>2]=8536,Re(r+36|0,n),v[e+4>>2]>0)for(u=r+20|0,n=0;o=v[v[e+12>>2]+(n<<2)>>2],c=t,b=0|da[v[v[o>>2]+16>>2]](o),v[c+12>>2]=b,f[t+11|0]=1,Ln(u,t+12|0,t+11|0),(0|(n=n+1|0))>2];);return D=t+16|0,r}function Br(r,n,e,i,f,u,o,a,c,k,s,l){var h=w(0),d=w(0),y=w(0),m=w(0),g=0,F=w(0),A=w(0),T=w(0),$=w(0);r:{if(!(r>2])+(s<<2)|0,d=w(r*r),F=w(d*r),$=w(c*F),c=w(w(1)-r),y=w(c*r),h=w(y*w(3)),A=w(h*r),m=w(c*c),T=w(c*m),c=w(c*h),h=w($+w(w(o*A)+w(w(e*T)+w(c*f)))),p[g+4>>2]=h,a=w(w(a*F)+w(w(u*A)+w(w(n*T)+w(c*i)))),p[g>>2]=a,!l)break r;+r<.001?r=Pr(w(f-e),w(i-n)):(r=w(y*f),e=w(h-w(w(o*d)+w(w(e*m)+w(r+r)))),r=w(y*i),r=Pr(e,w(a-w(w(u*d)+w(w(n*m)+w(r+r))))))}else k=v[k+12>>2],p[(l=k+(s<<2)|0)>>2]=n,p[l+4>>2]=e,r=Pr(w(f-e),w(i-n));p[8+((s<<2)+k|0)>>2]=r}}function Nr(r,n,e,i){var f,t=0,o=0,a=0,c=0,b=0,s=0;D=f=D-16|0,v[f+12>>2]=0,yn(i,n,f+12|0);r:if(e==w(1)){if(!((0|n)<=0))for(t=v[r+4>>2],a=v[i+12>>2],i=0;v[r+4>>2]=t+1,c=l[0|t],v[r+4>>2]=t+2,b=l[t+1|0],v[r+4>>2]=t+3,s=l[t+2|0],o=t+4|0,v[r+4>>2]=o,v[a+(i<<2)>>2]=l[t+3|0]|(s|b<<8|c<<16)<<8,t=o,(0|(i=i+1|0))!=(0|n););}else{if((0|n)<=0)break r;for(t=v[r+4>>2],a=v[i+12>>2],i=0;v[r+4>>2]=t+1,c=l[0|t],v[r+4>>2]=t+2,b=l[t+1|0],v[r+4>>2]=t+3,s=l[t+2|0],o=t+4|0,v[r+4>>2]=o,p[a+(i<<2)>>2]=(u(2,l[t+3|0]|(s|b<<8|c<<16)<<8),k()*e),t=o,(0|(i=i+1|0))!=(0|n););}D=f+16|0}function qr(r,n){var e,i=0,f=w(0),t=0;D=e=D-16|0,(0|(i=v[r+4>>2]))!=v[r+8>>2]?(v[r+4>>2]=i+1,r=v[r+12>>2]+(i<<4)|0,v[r>>2]=8600,i=v[n+8>>2],v[r+4>>2]=v[n+4>>2],v[r+8>>2]=i,v[r+12>>2]=v[n+12>>2]):(v[e>>2]=8600,v[e+12>>2]=v[n+12>>2],t=v[n+8>>2],v[e+4>>2]=v[n+4>>2],v[e+8>>2]=t,f=w(w(i>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,i=v[5208],n=0|da[v[v[i>>2]+16>>2]](i,v[r+12>>2],n<<4,8524,109),v[r+12>>2]=n,i=r,r=v[r+4>>2],v[i+4>>2]=r+1,v[(r=n+(r<<4)|0)>>2]=8600,n=v[e+8>>2],v[r+4>>2]=v[e+4>>2],v[r+8>>2]=n,v[r+12>>2]=v[e+12>>2]),D=e+16|0}function Dr(){C(21457,21458,21459,0,11232,1675,11235,0,11235,0,4511,11237,1676),O(21457,2146,1,16816,11237,1677,1678,0),O(21457,1164,1,16816,11237,1677,1679,0),O(21457,1100,2,16820,11280,1680,1681,0),O(21457,6768,2,16828,11280,1682,1683,0),O(21457,3887,3,16836,11296,1684,1685,0),O(21457,1117,3,16848,11296,1686,1687,0),O(21457,6830,3,16860,13176,1688,1689,0),O(21457,6797,2,16872,13528,1690,1691,0),O(21457,3866,2,16224,13528,1692,1693,0),O(21457,6747,1,15016,11232,1694,1695,0),O(21457,5182,1,16880,11232,1696,1697,0),O(21457,1079,1,15788,11232,1397,1698,0),O(21457,1780,1,16884,11232,1699,1700,0)}function Vr(r,n,e,i){var f,t=0,u=0,o=0,a=0,c=0;D=f=D-32|0,xt(f+20|0,n),n=v[f+24>>2],t=v[f+20>>2];r:if(!(n>>>0>=(u=v[t+4>>2])>>>0))for(c=f+4|0;;){if(o=v[f+28>>2],a=v[t+12>>2],o>>>0>=d[4+(a+(n<<4)|0)>>2]){n:{e:{for(;;){if((0|u)==(0|(n=n+1|0)))break e;if(v[4+((n<<4)+a|0)>>2])break}t=n;break n}t=u}if(v[f+24>>2]=t,u=n>>>0>=u>>>0,o=0,n=t,u)break r}if(n=v[12+((n<<4)+a|0)>>2],v[f+28>>2]=o+1,n=n+m(o,20)|0,v[f>>2]=v[n>>2],t=Re(c,n+4|0),n=v[n+16>>2],v[f+16>>2]=n,v[f>>2]==(0|e)&&jn(r,n,i),lf(t),n=v[f+24>>2],t=v[f+20>>2],!(n>>>0<(u=v[t+4>>2])>>>0))break}D=f+32|0}function Zr(r,n,e,i,f){var t,u=w(0),o=w(0),a=w(0),c=w(0),b=w(0),k=w(0),s=w(0),l=w(0);b=p[n+100>>2],k=p[n+92>>2],s=p[n+96>>2],t=(i<<2)+e|0,a=p[n+112>>2],r=v[r+96>>2],u=p[r+24>>2],c=p[n+104>>2],l=p[n+108>>2],o=p[r+28>>2],p[t+4>>2]=a+w(w(u*c)+w(l*o)),p[t>>2]=b+w(w(u*k)+w(s*o)),i=((n=i+f|0)<<2)+e|0,u=p[r>>2],o=p[r+4>>2],p[i+4>>2]=a+w(w(c*u)+w(l*o)),p[i>>2]=b+w(w(u*k)+w(s*o)),i=((n=n+f|0)<<2)+e|0,u=p[r+8>>2],o=p[r+12>>2],p[i+4>>2]=a+w(w(c*u)+w(l*o)),p[i>>2]=b+w(w(u*k)+w(s*o)),n=(n+f<<2)+e|0,u=a,a=p[r+16>>2],o=w(c*a),c=p[r+20>>2],p[n+4>>2]=u+w(o+w(l*c)),p[n>>2]=b+w(w(a*k)+w(s*c))}function Yr(r){var n,e,i=w(0),f=w(0);if(b(r),(n=2147483647&(e=t(2)))>>>0>=1065353216)return w(1065353216==(0|n)?(0|e)>=0?0:3.141592502593994:w(0)/w(r-r));r:{if(n>>>0<=1056964607){if(i=w(1.570796251296997),n>>>0<847249409)break r;return w(w(w(w(7.549789415861596e-8)-w(r*Hi(w(r*r))))-r)+w(1.570796251296997))}if((0|e)<0)return r=w(w(r+w(1))*w(.5)),i=w(T(r)),r=w(w(1.570796251296997)-w(i+w(w(i*Hi(r))+w(-7.549789415861596e-8)))),w(r+r);i=w(w(w(1)-r)*w(.5)),u(2,-4096&(b(f=w(T(i))),t(2))),r=k(),r=w(w(w(f*Hi(i))+w(w(i-w(r*r))/w(f+r)))+r),i=w(r+r)}return i}function Xr(r){var n=0,e=0,i=0,f=0;if(v[4+(r|=0)>>2]=8648,v[r>>2]=8632,n=v[r+44>>2])for(;;){if(i=v[v[r+52>>2]+(f<<2)>>2]){if(n=v[i+24>>2])for(;e=v[n+24>>2],da[v[v[n>>2]+4>>2]](n),n=e;);if(n=v[i+20>>2])for(;e=v[n+20>>2],da[v[v[n>>2]+4>>2]](n),n=e;);da[v[v[i>>2]+4>>2]](i),n=v[r+44>>2]}if(!((f=f+1|0)>>>0>>0))break}return(n=v[r+72>>2])&&da[v[v[n>>2]+4>>2]](n),no(r+76|0),ho(r+56|0),oo(r+40|0),it(r+20|0),v[r+4>>2]=8664,(n=v[r+12>>2])&&(e=v[r+8>>2])&&da[0|n](e),0|r}function Qr(r){var n,e,i=0,f=0,t=0,u=w(0),o=w(0),a=w(0),c=0;n=v[r+12>>2],u=p[n>>2],f=v[r+4>>2],o=w(w(p[((e=f-2|0)<<2)+n>>2]*p[n+4>>2])-w(p[((f<<2)+n|0)-4>>2]*u));r:{if(i=f-3|0){for(r=0;a=w(u*p[12+((t=r<<2)+n|0)>>2]),u=p[((r=r+2|0)<<2)+n>>2],o=w(o+w(a-w(p[(4|t)+n>>2]*u))),r>>>0>>0;);if(f>>>0<2|o>>1|0}else if(f=1,o>2],u=p[(t=(4|t)+n|0)>>2],c=i,i=(e-r<<2)+n|0,p[c>>2]=p[i>>2],p[t>>2]=p[i+4>>2],p[i+4>>2]=u,p[i>>2]=o,f>>>0>(r=r+2|0)>>>0;);}}function rn(r){var n,e=0,i=0,f=0,t=0,u=0,o=0;D=n=D-32|0,v[(r|=0)>>2]=10664;r:if(e=v[r+24>>2])for(o=n+16|0;;){if(u=v[r+32>>2],d[4+(u+(i<<4)|0)>>2]<=t>>>0){n:{e:{for(;;){if((0|(i=i+1|0))==(0|e))break e;if(v[4+((i<<4)+u|0)>>2])break}f=i;break n}f=e}if(e=e>>>0<=i>>>0,t=0,i=f,e)break r}if(f=v[12+((i<<4)+u|0)>>2]+m(t,20)|0,v[n+12>>2]=v[f>>2],e=Re(o,f+4|0),f=v[f+16>>2],v[n+28>>2]=f,Sf(f),lf(e),t=t+1|0,!(i>>>0<(e=v[r+24>>2])>>>0))break}return Vu(r+52|0),bo(r+36|0),v[r+16>>2]=10648,qu(r+20|0),lf(r+4|0),D=n+32|0,0|r}function nn(r,n,e,i,t){var u=0,o=w(0),a=0;return(u=v[r+28>>2])?(a=u-1|0,u=v[v[r+36>>2]+(a<<2)>>2],v[r+28>>2]=a):on(u=Xf(172)),v[u+40>>2]=0,v[u+44>>2]=0,f[u+37|0]=0,f[u+36|0]=i,v[u+16>>2]=e,v[u+32>>2]=n,v[u+48>>2]=0,v[u+52>>2]=0,o=p[e+32>>2],v[u+104>>2]=1065353216,v[u+84>>2]=2139095039,v[u+88>>2]=1065353216,v[u+76>>2]=-1082130432,v[u+80>>2]=-1082130432,v[u+68>>2]=0,v[u+72>>2]=0,v[u+60>>2]=-1082130432,v[u+64>>2]=-1082130432,p[u+56>>2]=o,v[u+92>>2]=1065353216,v[u+96>>2]=0,o=t?Un(v[r+16>>2],v[t+16>>2],e):w(0),p[u+100>>2]=o,u}function en(r,n,e){var i,t,u,o=0,a=0;if(D=t=D-16|0,i=Oo(r),v[i+8>>2]=9196,v[i+4>>2]=n,v[i>>2]=9556,r=0,v[i+20>>2]=0,v[i+12>>2]=0,v[i+16>>2]=0,v[i+24>>2]=v[n+44>>2],f[i+28|0]=l[n+48|0],f[i+29|0]=l[n+49|0],p[i+32>>2]=p[n+52>>2],p[i+36>>2]=p[n+56>>2],n=ku(e,Bo(v[n+40>>2])),f[i+44|0]=0,v[i+40>>2]=n,ca(u=i+8|0,v[v[i+4>>2]+28>>2]),n=v[i+4>>2],v[n+28>>2])for(;o=t,a=ku(e,Bo(v[v[n+36>>2]+(r<<2)>>2])),v[o+12>>2]=a,Sn(u,t+12|0),r=r+1|0,n=v[i+4>>2],r>>>0>2];);return D=t+16|0,i}function fn(r,n,e){var i,t,u,o=w(0),a=0,c=0;if(D=t=D-16|0,i=Oo(r),v[i+8>>2]=9196,v[i+4>>2]=n,v[i>>2]=10804,r=0,v[i+20>>2]=0,v[i+12>>2]=0,v[i+16>>2]=0,a=i,c=ku(e,Bo(v[n+40>>2])),v[a+24>>2]=c,p[i+28>>2]=p[n+44>>2],p[i+32>>2]=p[n+48>>2],p[i+36>>2]=p[n+52>>2],o=p[n+56>>2],f[i+44|0]=0,p[i+40>>2]=o,ca(u=i+8|0,v[v[i+4>>2]+28>>2]),n=v[i+4>>2],v[n+28>>2])for(;a=t,c=ku(e,Bo(v[v[n+36>>2]+(r<<2)>>2])),v[a+12>>2]=c,Sn(u,t+12|0),r=r+1|0,n=v[i+4>>2],r>>>0>2];);return D=t+16|0,i}function tn(r,n,e,i,f){r|=0,n|=0,e|=0,i|=0,f=w(f);var t=0,u=0,o=w(0),a=w(0);r:if(t=Me(r,n)){for(;t=v[(u=t)+20>>2];);if(t=nn(r,n,e,i,u),v[u+20>>2]=t,!(f<=w(0)))break r;if((a=w(p[u+56>>2]-p[u+52>>2]))!=w(0)){o=p[u+72>>2],l[u+36|0]?(o=w(o/a),n=w(g(o))>2],v[u+16>>2],e));break r}f=p[u+72>>2]}else gn(r,n,t=nn(r,n,e,i,0),1),pr(v[r+72>>2]);return p[t+68>>2]=f,0|t}function un(r,n,e){r|=0,n|=0,e|=0;var i=0,f=0,t=w(0),u=0,o=0;if(f=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(t=w(w(n>>>0)*w(1.75)),n=(n=w(g(t))>>0<=8?8:n,v[r+8>>2]=n,i=v[5208],u=r,o=0|da[v[v[i>>2]+16>>2]](i,v[r+12>>2],m(n,20),8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>f>>>0)for(;i=v[e+4>>2],n=v[r+12>>2]+m(f,20)|0,v[n>>2]=v[e>>2],v[n+4>>2]=i,v[n+16>>2]=v[e+16>>2],i=v[e+12>>2],v[n+8>>2]=v[e+8>>2],v[n+12>>2]=i,(f=f+1|0)>>>0>2];);}function on(r){return v[r+16>>2]=0,v[r+20>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,v[r+4>>2]=8584,v[r>>2]=8568,v[r+24>>2]=0,v[r+28>>2]=0,s[r+30>>1]=0,s[r+32>>1]=0,s[r+34>>1]=0,s[r+36>>1]=0,Bf(r+40|0,0,48),v[r+92>>2]=0,v[r+96>>2]=0,v[r+88>>2]=1065353216,v[r+100>>2]=0,v[r+104>>2]=0,v[r+168>>2]=0,v[r+164>>2]=9,v[r+160>>2]=0,v[r+152>>2]=0,v[r+156>>2]=0,v[r+148>>2]=8712,v[r+144>>2]=0,v[r+136>>2]=0,v[r+140>>2]=0,v[r+132>>2]=8696,v[r+128>>2]=0,v[r+120>>2]=0,v[r+124>>2]=0,v[r+116>>2]=8680,v[r+108>>2]=0,v[r+112>>2]=2,r}function an(r,n){return v[r+16>>2]=n,v[r+8>>2]=0,v[r+12>>2]=0,v[r+68>>2]=0,v[r+60>>2]=0,v[r+64>>2]=0,v[r+56>>2]=8760,v[r+52>>2]=0,v[r+44>>2]=0,v[r+48>>2]=0,v[r+40>>2]=8696,v[r+36>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+24>>2]=8696,v[r+20>>2]=8744,v[r+4>>2]=8648,v[r>>2]=8632,n=Xf(32),f[n+28|0]=0,v[n+24>>2]=r+20,v[n+20>>2]=r,v[n+16>>2]=0,v[n+8>>2]=0,v[n+12>>2]=0,v[n+4>>2]=8728,v[n>>2]=8616,v[r+80>>2]=0,v[r+84>>2]=0,v[r+76>>2]=8536,v[r+72>>2]=n,f[r+88|0]=0,v[r+96>>2]=0,v[r+100>>2]=1065353216,v[r+92>>2]=9,r}function cn(r,n,e){var i,f,t=0,u=0,o=0,a=0;D=i=D-16|0,v[i+8>>2]=0,v[i+12>>2]=0,ie(r,n,i+8|0),f=v[i+12>>2],n=v[i+8>>2];r:{for(;;){if(r=0,(0|n)==(0|f))break r;if(r=l[0|n],n=n+1|0,58==(0|r))break}for(v[i+8>>2]=n,r=n;;){v[(a=(t<<3)+e|0)>>2]=n;n:{for(;;){if(u=r,(0|r)==(0|f)){r=n,o=t;break n}if(r=u+1|0,44==l[0|u])break}if(o=3,v[4+((t<<3)+e|0)>>2]=u-1,Kn(a),n=r,3!=(0|(t=t+1|0)))continue}break}v[4+(n=(o<<3)+e|0)>>2]=f,v[n>>2]=r,Kn(n),r=o+1|0}return D=i+16|0,r}function bn(r,n,e){r|=0,n|=0,e=w(e);var i,f=w(0),t=w(0),u=0,o=0,a=w(0);if(e=hu(e),i=v[r+16>>2],r=m(n,19),(f=p[i+(r<<2)>>2])==w(0))return w(e);if(f!=w(1)){if((u=r+1|0)>>>0<(o=r+19|0)>>>0){for(r=u;;){if(n=r,e<=(t=p[(r<<2)+i>>2]))return f=w(0),(0|n)!=(0|u)&&(a=p[(r=(n<<2)+i|0)-4>>2],f=p[r-8>>2]),w(w(a+w(w(w(e-f)*w(p[4+((n<<2)+i|0)>>2]-a))/w(t-f))));if(!(o>>>0>(r=n+2|0)>>>0))break}r=n+1|0}f=p[(r<<2)+i>>2],e=w(f+w(w(w(e-t)*w(w(1)-f))/w(w(1)-t)))}else e=w(0);return w(e)}function kn(r){var n,e,i,f,t,u,o,a,c=0,b=0;if(v[(r|=0)>>2]=10456,Pn(n=r+16|0),Pn(e=r+32|0),Pn(i=r+48|0),v[r+64>>2]=0,Pn(f=r+68|0),Pn(t=r+84|0),Pn(u=r+100|0),Pn(o=r+116|0),Pn(a=r+132|0),v[r+192>>2])for(;b=v[5208],da[v[v[b>>2]+20>>2]](b,v[v[r+200>>2]+(c<<2)>>2],8524,74),(c=c+1|0)>>>0>2];);return lf(r+220|0),lf(r+208|0),Hu(r+188|0),lf(r+176|0),lf(r+164|0),Lu(a),Mu(o),_u(u),xu(t),Ju(f),Bu(i),Nu(e),bo(n),lf(r+4|0),0|r}function sn(r,n){var e,i,f,t=0,u=0,o=0,a=0;if(D=i=D-16|0,e=Eo(r),v[e+24>>2]=9148,v[e+8>>2]=8712,r=0,v[e+4>>2]=0,v[e>>2]=9120,v[e+36>>2]=0,v[e+28>>2]=0,v[e+32>>2]=0,v[e+20>>2]=0,v[e+12>>2]=0,v[e+16>>2]=0,ca(t=e+8|0,n),d[8+(f=e+24|0)>>2]>>0&&(v[f+8>>2]=n,u=v[5208],o=f,a=0|da[v[v[u>>2]+16>>2]](u,v[f+12>>2],m(n,12),8524,97),v[o+12>>2]=a),v[i+4>>2]=0,yn(t,n,i+4|0),(0|n)>0)for(;wn(f,t=ht(i+4|0)),lf(t),(0|n)!=(0|(r=r+1|0)););return D=i+16|0,e}function vn(r,n){var e=0,i=0,f=0,t=0,u=w(0);if(ba(r,v[n+4>>2]+v[r+4>>2]|0),v[n+4>>2])for(;f=v[n+12>>2]+(t<<1)|0,(0|(e=v[r+4>>2]))!=v[r+8>>2]?s[v[r+12>>2]+(e<<1)>>1]=h[f>>1]:(f=h[f>>1],u=w(w(e>>>0)*w(1.75)),e=(e=w(g(u))>>0<=8?8:e,v[r+8>>2]=e,i=v[5208],i=0|da[v[v[i>>2]+16>>2]](i,v[r+12>>2],e<<1,8524,109),v[r+12>>2]=i,e=v[r+4>>2],s[i+(e<<1)>>1]=f),v[r+4>>2]=e+1,(t=t+1|0)>>>0>2];);}function ln(r){var n=0,e=0,i=0,t=0,u=0;if(i=v[124+(r|=0)>>2])for(u=v[r+132>>2];n=v[(e<<2)+u>>2],f[n+88|0]=1,p[n+60>>2]=p[n+32>>2],t=v[n+40>>2],v[n+64>>2]=v[n+36>>2],v[n+68>>2]=t,t=v[n+48>>2],v[n+72>>2]=v[n+44>>2],v[n+76>>2]=t,t=v[n+56>>2],v[n+80>>2]=v[n+52>>2],v[n+84>>2]=t,(0|i)!=(0|(e=e+1|0)););if(e=v[r+108>>2])for(n=0;i=v[v[r+116>>2]+(n<<2)>>2],da[v[v[i>>2]+12>>2]](i),(0|e)!=(0|(n=n+1|0)););}function hn(r,n){var e=0,i=0;r:{if(3&((i=r)^n))e=l[0|n];else{if(3&n)for(;;){if(e=l[0|n],f[0|i]=e,!e)break r;if(i=i+1|0,!(3&(n=n+1|0)))break}if(!(~(e=v[n>>2])&e-16843009&-2139062144))for(;v[i>>2]=e,e=v[n+4>>2],i=i+4|0,n=n+4|0,!(e-16843009&~e&-2139062144););}if(f[0|i]=e,255&e)for(;e=l[n+1|0],f[i+1|0]=e,i=i+1|0,n=n+1|0,e;);}return r}function dn(r,n,e){var i,f=0,t=w(0),u=w(0),o=0;if(!(i=v[n+24>>2]))return 1;f=dn(r,i,e),p[i+60>>2]=p[i+64>>2],p[i+76>>2]=p[i+80>>2];r:{if((t=p[n+96>>2])>w(0)&&(u=p[n+100>>2])<=t){if(u!=w(0)&p[i+108>>2]!=w(0))break r;return v[n+24>>2]=v[i+24>>2],(o=v[i+24>>2])&&(v[o+28>>2]=n),p[n+104>>2]=p[i+104>>2],jf(v[r+72>>2],i),f}p[i+72>>2]=w(e*p[i+88>>2])+p[i+72>>2],p[n+96>>2]=t+e,f=0}return f}function pn(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<1,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(r=v[r+12>>2];s[r+(i<<1)>>1]=h[e>>1],(0|(i=i+1|0))!=(0|n););}function yn(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<2,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(r=v[r+12>>2];p[r+(i<<2)>>2]=p[e>>2],(0|(i=i+1|0))!=(0|n););}function mn(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<2,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(r=v[r+12>>2];v[r+(i<<2)>>2]=v[e>>2],(0|(i=i+1|0))!=(0|n););}function wn(r,n){var e,i=0,f=0,t=w(0);D=e=D-16|0,(0|(i=v[r+4>>2]))!=v[r+8>>2]?(v[r+4>>2]=i+1,Re(v[r+12>>2]+m(i,12)|0,n)):(i=Re(e+4|0,n),t=w(w(d[r+4>>2])*w(1.75)),n=(n=w(g(t))>>0<=8?8:n,v[r+8>>2]=n,f=v[5208],n=0|da[v[v[f>>2]+16>>2]](f,v[r+12>>2],m(n,12),8524,109),v[r+12>>2]=n,f=r,r=v[r+4>>2],v[f+4>>2]=r+1,Re(n+m(r,12)|0,i),lf(i)),D=e+16|0}function gn(r,n,e,i){var t,u,o=w(0);D=u=D-16|0,t=Me(r,n),v[v[r+52>>2]+(n<<2)>>2]=e,t&&(i&&(n=v[r+72>>2],ut(u,1,t,0),qr(n+4|0,u)),v[e+24>>2]=t,v[t+28>>2]=e,v[e+96>>2]=0,v[t+24>>2]&&(o=p[t+100>>2])>w(0)&&(o=w(p[t+96>>2]/o),p[e+104>>2]=p[e+104>>2]*(o>w(1)?w(1):o)),v[t+152>>2]=0),n=v[r+72>>2],D=r=D-16|0,ut(r,0,e,0),qr(n+4|0,r),f[v[n+20>>2]+88|0]=1,D=r+16|0,D=u+16|0}function Fn(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<2,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(;v[v[r+12>>2]+(i<<2)>>2]=v[e>>2],(0|(i=i+1|0))!=(0|n););}function An(){B(21288,6226),K(21397,4501,1,1,0),E(22004,3678,1,-128,127),E(22005,3671,1,-128,127),E(22006,3669,1,0,255),E(22007,1475,2,-32768,32767),E(21315,1466,2,0,65535),E(21295,1776,4,-2147483648,2147483647),E(21305,1767,4,0,-1),E(22008,4821,4,-2147483648,2147483647),E(21289,4812,4,0,-1),vu(22009,2390,-2147483648,2147483647),vu(22010,2389,0,-1),H(21294,2334,4),H(22011,5797,8),J(21438,4536)}function Tn(r,n,e){return v[r+8>>2]=e,v[r+4>>2]=n,v[r>>2]=10728,e=v[e+8>>2],v[r+28>>2]=1065353216,v[r+32>>2]=1065353216,v[r+20>>2]=1065353216,v[r+24>>2]=1065353216,v[r+16>>2]=9308,v[r+12>>2]=e,ci(r+16|0),v[r+40>>2]=0,v[r+44>>2]=0,v[r+36>>2]=9308,v[r+48>>2]=0,v[r+52>>2]=0,ci(r+36|0),n=l[n+64|0],v[r+80>>2]=0,v[r+72>>2]=0,v[r+76>>2]=0,v[r+68>>2]=8712,v[r+60>>2]=0,v[r+64>>2]=0,f[r+56|0]=n,En(r),r}function $n(r,n,e){var i=0,f=0;r:{if(i=v[r+4>>2])for(;;){if($f(i+4|0,n))break r;if(!(i=v[i+20>>2]))break}return i=Xf(28),v[i>>2]=8824,Ot(i+4|0,0,0),v[i+20>>2]=0,v[i+24>>2]=0,f=v[n+8>>2],v[i+8>>2]=v[n+4>>2],v[i+12>>2]=f,p[i+16>>2]=p[e>>2],(n=v[r+4>>2])&&(v[n+24>>2]=i,v[i+20>>2]=n),v[r+4>>2]=i,void(v[r+8>>2]=v[r+8>>2]+1)}r=v[n+8>>2],v[i+8>>2]=v[n+4>>2],v[i+12>>2]=r,p[i+16>>2]=p[e>>2]}function In(r,n){var e=0,i=0,f=0,t=0,u=0;for(r=r+4|0;;){if(r=v[r>>2]){if(!n|!(i=v[r+28>>2]))e=-1,n>>>0>i>>>0||(e=(0|n)!=(0|i));else{f=n,u=0;r:if(e=l[0|i]){for(;;){if((t=l[0|f])&&((0|e)==(0|t)||(0|po(e))==(0|po(t)))){if(f=f+1|0,e=l[i+1|0],i=i+1|0,e)continue;break r}break}u=e}e=po(255&u)-po(l[0|f])|0}if(e)continue}break}return r}function Cn(r,n,e){var i=0,t=w(0),u=0,o=0,a=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(t=w(w(n>>>0)*w(1.75)),n=(n=w(g(t))>>0<=8?8:n,v[r+8>>2]=n,u=v[5208],o=r,a=0|da[v[v[u>>2]+16>>2]](u,v[r+12>>2],n,8524,85),v[o+12>>2]=a,n=v[r+4>>2]),n>>>0>i>>>0)for(r=v[r+12>>2];f[r+i|0]=l[0|e],(0|(i=i+1|0))!=(0|n););}function Pn(r){var n=0,e=0,i=0,f=0,t=0,u=0,o=0,a=0;if((0|(e=v[r+4>>2]))>0)for(f=e;;){if(t=f-1|0,(n=v[v[r+12>>2]+(t<<2)>>2])&&(da[v[v[n>>2]+4>>2]](n),e=v[r+4>>2]),e=e-1|0,v[r+4>>2]=e,e>>>0>(n=t)>>>0)for(;i=v[r+12>>2],o=v[(u=i+(n<<2)|0)>>2],a=i,i=(n=n+1|0)<<2,v[u>>2]=v[a+i>>2],v[i+v[r+12>>2]>>2]=o,(0|n)!=(0|e););if(n=(0|f)>1,f=t,!n)break}}function En(r){r|=0;var n=0,e=w(0);n=Ko(v[r+4>>2]),p[r+20>>2]=p[n+4>>2],p[r+24>>2]=p[n+8>>2],p[r+28>>2]=p[n+12>>2],p[r+32>>2]=p[n+16>>2],ci(r+16|0),n=Lo(v[r+4>>2]);r:{if(v[n+4>>2]){if(v[r+60>>2]=0,(0|(n=Fi(v[r+12>>2],v[v[r+4>>2]+4>>2],n)))==v[r+60>>2])break r;v[r+60>>2]=n}else{if(!v[r+60>>2])break r;v[r+60>>2]=0}e=p[v[r+12>>2]+160>>2],v[r+72>>2]=0,p[r+64>>2]=e}}function On(r,n){var e=0,i=w(0),f=0;if((0|(e=v[r+4>>2]))==v[r+8>>2])return f=v[n>>2],i=w(w(e>>>0)*w(1.75)),n=(n=w(g(i))>>0<=8?8:n,v[r+8>>2]=n,e=v[5208],n=0|da[v[v[e>>2]+16>>2]](e,v[r+12>>2],n<<2,8524,109),v[r+12>>2]=n,e=r,r=v[r+4>>2],v[e+4>>2]=r+1,void(v[n+(r<<2)>>2]=f);v[r+4>>2]=e+1,v[v[r+12>>2]+(e<<2)>>2]=v[n>>2]}function Rn(r,n){var e=0,i=w(0),f=w(0);(0|(e=v[r+4>>2]))!=v[r+8>>2]?p[v[r+12>>2]+(e<<2)>>2]=p[n>>2]:(f=p[n>>2],i=w(w(e>>>0)*w(1.75)),n=(n=w(g(i))>>0<=8?8:n,v[r+8>>2]=n,e=v[5208],n=0|da[v[v[e>>2]+16>>2]](e,v[r+12>>2],n<<2,8524,109),v[r+12>>2]=n,e=v[r+4>>2],p[n+(e<<2)>>2]=f),v[r+4>>2]=e+1}function Sn(r,n){var e=0,i=w(0),f=0;(0|(e=v[r+4>>2]))!=v[r+8>>2]?v[v[r+12>>2]+(e<<2)>>2]=v[n>>2]:(f=v[n>>2],i=w(w(e>>>0)*w(1.75)),n=(n=w(g(i))>>0<=8?8:n,v[r+8>>2]=n,e=v[5208],n=0|da[v[v[e>>2]+16>>2]](e,v[r+12>>2],n<<2,8524,109),v[r+12>>2]=n,e=v[r+4>>2],v[n+(e<<2)>>2]=f),v[r+4>>2]=e+1}function Wn(r,n){var e,i=0,t=0;return e=v[r+4>>2],v[r+4>>2]=e+1,t=127&(i=f[0|e]),(0|i)>=0||(v[r+4>>2]=e+2,t|=(i=f[e+1|0])<<7&16256,(0|i)>=0||(v[r+4>>2]=e+3,t|=(i=f[e+2|0])<<14&2080768,(0|i)>=0||(v[r+4>>2]=e+4,t|=(i=f[e+3|0])<<21&266338304,(0|i)>=0||(v[r+4>>2]=e+5,t=l[e+4|0]<<28|t)))),n?t:0-(1&t)^t>>>1}function Gn(r,n){r:if((0|n)>=1024){if(r*=898846567431158e293,n>>>0<2047){n=n-1023|0;break r}r*=898846567431158e293,n=((0|n)>=3069?3069:n)-2046|0}else(0|n)>-1023||(r*=2004168360008973e-307,n>>>0>4294965304?n=n+969|0:(r*=2004168360008973e-307,n=((0|n)<=-2960?-2960:n)+1938|0));return u(0,0),u(1,n+1023<<20),r*+o()}function Un(r,n,e){r|=0,n|=0,e|=0;var i,f=w(0);D=i=D-16|0,Ot(i+4|0,n,e);r:{n:{e:{if(e=v[r+16>>2])for(;;){if($f(e+4|0,i+4|0))break e;if(!(e=v[e+20>>2]))break}r=r+8|0;break n}if(!(e=v[r+16>>2]))break r;for(;;){if(!$f(e+4|0,i+4|0)){if(e=v[e+20>>2])continue;break r}break}r=e+16|0}f=p[r>>2]}return D=i+16|0,w(f)}function jn(r,n,e){var i=0,f=0;if(n&&Tf(0|da[v[v[n>>2]+8>>2]](n),20924))if(f=v[n+24>>2])for(e=0;;){if(i=e<<2,(e=e+1|0)>>>0<(i=e+v[i+v[n+32>>2]>>2]|0)>>>0){for(;Ki(r,v[v[r+20>>2]+(v[v[n+32>>2]+(e<<2)>>2]<<2)>>2]),(0|i)!=(0|(e=e+1|0)););e=i}if(!(e>>>0>>0))break}else Ki(r,e)}function Hn(r,n){var e=0,i=0,f=0,t=0;if(v[r>>2]=9148,v[r+4>>2]=v[n+4>>2],e=v[n+8>>2],v[r+12>>2]=0,v[r+8>>2]=e,e&&(i=v[5208],f=r,t=0|da[v[v[i>>2]+12>>2]](i,m(e,12),8524,206),v[f+12>>2]=t,v[r+4>>2]))for(e=0;Re((i=m(e,12))+v[r+12>>2]|0,i+v[n+12>>2]|0),(e=e+1|0)>>>0>2];);return r}function Ln(r,n,e){var i=0,t=0;r:{if(i=v[r+4>>2])for(t=v[n>>2];;){if(v[i+4>>2]==(0|t))break r;if(!(i=v[i+12>>2]))break}return i=Xf(20),v[i+12>>2]=0,v[i+16>>2]=0,v[i>>2]=8552,v[i+4>>2]=v[n>>2],f[i+8|0]=l[0|e],(n=v[r+4>>2])&&(v[n+16>>2]=i,v[i+12>>2]=n),v[r+4>>2]=i,void(v[r+8>>2]=v[r+8>>2]+1)}v[i+4>>2]=t,f[i+8|0]=l[0|e]}function Mn(r,n,e){var i=0,f=0,t=0,u=0;if(v[r>>2]=e,v[r+4>>2]=v[n+4>>2],e=v[n+8>>2],v[r+12>>2]=0,v[r+8>>2]=e,e&&(i=v[5208],t=r,u=0|da[v[v[i>>2]+12>>2]](i,e<<2,8524,206),v[t+12>>2]=u,i=v[r+4>>2]))for(e=0;v[(f=e<<2)+v[r+12>>2]>>2]=v[v[n+12>>2]+f>>2],(0|i)!=(0|(e=e+1|0)););return r}function _n(r,n){var e=0,i=0,f=0,t=0;for(v[n>>2]=0;;){r:{n:{e:{if(((i=l[r+f|0])-58&255)>>>0<=245){if(i-65>>>0<6|i-97>>>0<6)break e;return void(v[n>>2]=0)}e<<=4,t=-48;break n}if(e<<=4,v[n>>2]=e,t=-55,!((i-65&255)>>>0<6)&&(t=-87,(i-97&255)>>>0>5))break r}e|=(i<<24>>24)+t,v[n>>2]=e}if(4==(0|(f=f+1|0)))break}}function zn(r,n){n|=0;var e=0;v[100+(r|=0)>>2]=n,n&&(v[r+24>>2]=0,zi(r+20|0,n+20|0),v[r+40>>2]=0,_i(r+36|0,n+36|0),e=v[n+52>>2],v[r+124>>2]=0,v[r+52>>2]=e,_i(r+120|0,n+120|0),v[r+140>>2]=0,vn(r+136|0,n+136|0),e=v[n+224>>2],v[r+156>>2]=0,v[r+224>>2]=e,vn(r+152|0,n+152|0),p[r+196>>2]=p[n+196>>2],p[r+200>>2]=p[n+200>>2])}function xn(r,n){var e=0,i=0,f=0,t=0;if(v[r>>2]=8712,v[r+4>>2]=v[n+4>>2],e=v[n+8>>2],v[r+12>>2]=0,v[r+8>>2]=e,e&&(i=v[5208],e=0|da[v[v[i>>2]+12>>2]](i,e<<2,8524,206),v[r+12>>2]=e,i=v[r+4>>2]))for(t=v[n+12>>2],n=0;p[e+(f=n<<2)>>2]=p[t+f>>2],(0|i)!=(0|(n=n+1|0)););return r}function Jn(r,n){var e=0,i=0,f=0,t=0;if(v[r>>2]=8680,v[r+4>>2]=v[n+4>>2],e=v[n+8>>2],v[r+12>>2]=0,v[r+8>>2]=e,e&&(i=v[5208],e=0|da[v[v[i>>2]+12>>2]](i,e<<2,8524,206),v[r+12>>2]=e,i=v[r+4>>2]))for(t=v[n+12>>2],n=0;v[e+(f=n<<2)>>2]=v[t+f>>2],(0|i)!=(0|(n=n+1|0)););return r}function Kn(r){var n=0,e=0,i=0,f=0;e=v[r+4>>2];r:{n:if(n=v[r>>2],eo(l[0|n])){for(;;){if(n>>>0>=e>>>0)break n;if(i=n+1|0,v[r>>2]=i,f=l[n+1|0],n=i,!eo(f))break}break r}i=n}if((0|e)!=(0|i)){for(;e=(n=e)-1|0,v[r+4>>2]=e,!(e>>>0>>0||13!=l[0|e]););v[r+4>>2]=n}}function Bn(r,n,e,i){return v[r+4>>2]=n,v[r>>2]=10744,Re(r+8|0,e),v[r+36>>2]=1065353216,v[r+40>>2]=1065353216,v[r+28>>2]=1065353216,v[r+32>>2]=1065353216,v[r+24>>2]=9308,v[r+20>>2]=i,ci(r+24|0),v[r+48>>2]=0,v[r+52>>2]=0,v[r+44>>2]=9308,v[r+56>>2]=0,v[r+60>>2]=0,ci(r+44|0),f[r+64|0]=0,ht(r+68|0),v[r+80>>2]=0,r}function Nn(r,n,e,i){var f,t=0,u=0,o=0;return D=f=D-16|0,o=1,(t=Me(r,n))?p[t+80>>2]!=w(-1)?pi(r,t):(v[v[r+52>>2]+(n<<2)>>2]=v[t+24>>2],u=v[r+72>>2],o=0,ut(f,1,t,0),qr(u+4|0,f),jf(v[r+72>>2],t),pi(r,t),t=v[t+24>>2]):t=0,gn(r,u=n,n=nn(r,n,e,i,t),o),pr(v[r+72>>2]),D=f+16|0,n}function qn(r,n){n|=0;var e=0,i=0;if(!(d[44+(r|=0)>>2]<=n>>>0)&&(e=v[v[r+52>>2]+(n<<2)>>2])){if(jf(v[r+72>>2],e),pi(r,e),n=v[e+24>>2])for(i=e;jf(v[r+72>>2],n),v[i+24>>2]=0,v[i+28>>2]=0,i=n,n=v[n+24>>2];);v[v[r+52>>2]+(v[e+32>>2]<<2)>>2]=0,pr(v[r+72>>2])}}function Dn(r,n,e){var i=0,f=0,t=0;if(!(d[r+8>>2]<=n>>>0)&&(f=v[r+16>>2]+(n<<4)|0,v[f+4>>2])){r:{for(;;){if(qi(4+(v[f+12>>2]+m(i,20)|0)|0,e))break r;if(!((i=i+1|0)>>>0>2]))break}return 0}(0|i)<0||(t=v[16+(v[12+(v[r+16>>2]+(n<<4)|0)>>2]+m(i,20)|0)>>2])}return t}function Vn(r,n,e,i){var f,t,u,o,a,c,b=0;D=f=D-16|0,e=Re(f+4|0,e),t=v[e+4>>2],b=(u=v[i+4>>2])+t|0,v[e+4>>2]=b,c=v[i+8>>2],o=v[5208],a=v[e+8>>2],b=0|da[v[v[o>>2]+16>>2]](o,a,b+1|0,8524,150),v[e+8>>2]=b,Ff(b+t|0,(0|c)==(0|a)?b:v[i+8>>2],u+1|0),ee(r+32|0,e),lf(e),n&&or(we(n)),D=f+16|0}function Zn(r,n,e,i,f,t){r|=0,n=w(n),e=w(e),i=w(i),f=w(f),t|=0;var u=0;r=v[r+112>>2],t?(p[r+28>>2]=e,p[r+24>>2]=n,p[r+20>>2]=f,p[r+16>>2]=n,p[r+4>>2]=e,p[r>>2]=i,u=r+8|0,t=3):(p[r+28>>2]=e,p[r+24>>2]=i,p[r+20>>2]=e,p[r+16>>2]=n,p[r+12>>2]=f,p[r+8>>2]=n,u=r,t=1),p[u>>2]=i,p[r+(t<<2)>>2]=f}function Yn(r,n,e,i){var f,t,u=w(0),o=w(0),a=w(0);return e=v[e+12>>2],i=v[i+12>>2],f=e+(v[i+((r+1|0)%(0|n)<<2)>>2]<<3)|0,t=e+(v[i+(r<<2)>>2]<<3)|0,u=p[t+4>>2],r=e+(v[i+(((r+n|0)-1|0)%(0|n)<<2)>>2]<<3)|0,o=p[r+4>>2],a=p[f+4>>2],!(w(w(p[f>>2]*w(u-o))+w(w(p[r>>2]*w(a-u))+w(p[t>>2]*w(o-a))))>=w(0))}function Xn(r,n,e,i){return v[r+4>>2]=n,v[r>>2]=9212,Re(r+8|0,e),v[r+24>>2]=0,v[r+28>>2]=0,v[r+20>>2]=i,v[r+32>>2]=0,v[r+36>>2]=0,v[r+48>>2]=0,v[r+52>>2]=0,v[r+40>>2]=1065353216,v[r+44>>2]=1065353216,f[r+53|0]=0,f[r+54|0]=0,f[r+55|0]=0,f[r+56|0]=0,f[r+57|0]=0,f[r+58|0]=0,f[r+59|0]=0,f[r+60|0]=0,r}function Qn(r){var n=0,e=0,i=0;r:{n:if(3&(n=r)){if(!l[0|r])return 0;for(;;){if(!(3&(n=n+1|0)))break n;if(!l[0|n])break}break r}for(;e=n,n=n+4|0,!(~(i=v[e>>2])&i-16843009&-2139062144););for(;e=(n=e)+1|0,l[0|n];);}return n-r|0}function re(r,n){var e,i,f=0,t=0,u=0,o=0,a=0;if(D=e=D-16|0,i=Wn(r,1),s[e+14>>1]=0,pn(n,i,e+14|0),(0|i)>0)for(f=v[r+4>>2],a=v[n+12>>2];v[r+4>>2]=f+1,u=(t<<1)+a|0,o=l[0|f]<<8,s[u>>1]=o,n=f+2|0,v[r+4>>2]=n,s[u>>1]=l[f+1|0]|o,f=n,(0|(t=t+1|0))!=(0|i););D=e+16|0}function ne(r,n,e){var i=0,f=0,t=w(0),u=w(0),o=w(0);return f=Se(v[5504],v[5505],1284865837,1481765933),i=V,i=(f=f+1|0)?i:i+1|0,v[5504]=f,v[5505]=i,t=w(w(i>>>1|0)*w(4.656612873077393e-10)),o=w(e-r),u=w(n-r),t<=w(o/u)?w(w(T(w(o*w(u*t))))+r):w(n-w(T(w(w(n-e)*w(u*w(w(1)-t))))))}function ee(r,n){var e=0,i=0;if((0|r)!=(0|n)){if((e=v[r+8>>2])&&(i=v[5208],da[v[v[i>>2]+20>>2]](i,e,8524,106)),!v[n+8>>2])return v[r+4>>2]=0,void(v[r+8>>2]=0);v[r+4>>2]=v[n+4>>2],e=r,r=v[5208],r=0|da[v[v[r>>2]+12>>2]](r,v[n+4>>2]+1|0,8524,113),v[e+8>>2]=r,Ff(r,v[n+8>>2],v[n+4>>2]+1|0)}}function ie(r,n,e){var i=0,f=0;if((0|(i=v[r>>2]))==(0|n))return 0;v[e>>2]=i,f=n;r:if((0|(i=v[r>>2]))!=(0|n)){for(;;){if(f=i,10==l[0|i])break r;if(i=i+1|0,v[r>>2]=i,(0|n)==(0|i))break}f=n}return v[e+4>>2]=f,Kn(e),(0|(e=n))!=(0|(n=v[r>>2]))&&(v[r>>2]=n+1),1}function fe(r,n,e){var i,t,u=0,o=0;if(D=i=D-272|0,t=hn(i+16|0,n),e){u=Qn(n),n=Qn(n=u+t|0)+n|0;r:if(u=255-u|0)for(;;){if(!(o=l[0|e]))break r;if(f[0|n]=o,n=n+1|0,e=e+1|0,!(u=u-1|0))break}f[0|n]=0}ee(n=r+24|0,r=gu(i+4|0,t,0)),lf(r),D=i+272|0}function te(r,n,e,i,f){var t,u,o,a=0,c=0;if(v[r>>2]=11112,t=Tt(16),v[r+4>>2]=t,u=Tt((o=Se(n,0,24,0),V?-1:o)),n)for(c=m(n,24)+u|0,a=u;v[a+20>>2]=0,(0|c)!=(0|(a=a+24|0)););v[t+8>>2]=n,v[t>>2]=u,v[t+12>>2]=i,v[t+4>>2]=e,v[r+8>>2]=f}function ue(r){var n=0,e=0,i=0;if(v[44+(r|=0)>>2]=0,e=v[r+28>>2]){for(i=r+40|0;Sn(i,v[r+36>>2]+(n<<2)|0),(0|e)!=(0|(n=n+1|0)););if(e=v[r+28>>2])for(n=0;En(v[v[r+36>>2]+(n<<2)>>2]),(0|e)!=(0|(n=n+1|0)););}}function oe(r){var n=0,e=0,i=0;if(v[(r|=0)>>2]=8840,v[r+36>>2]&&(e=v[r+8>>2]))for(;i=v[r+36>>2],da[v[v[i>>2]+12>>2]](i,v[v[v[r+16>>2]+(n<<2)>>2]+8>>2]),(0|e)!=(0|(n=n+1|0)););return Pn(n=r+4|0),Pn(e=r+20|0),io(e),to(n),0|r}function ae(r){var n=0,e=0;if(v[(r|=0)>>2]=9148,n=v[r+4>>2])for(;n=v[r+12>>2]+m(~e+n|0,12)|0,da[v[v[n>>2]>>2]](n),(n=v[r+4>>2])>>>0>(e=e+1|0)>>>0;);return v[r+4>>2]=0,(n=v[r+12>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,215)),0|r}function ce(r){var n=0;return v[r+12>>2]=0,(n=v[r+24>>2])&&da[v[v[n>>2]+4>>2]](n),(n=v[r+20>>2])&&da[v[v[n>>2]+4>>2]](n),(n=v[r+16>>2])&&da[v[v[n>>2]+4>>2]](n),(n=v[r+8>>2])&&da[v[v[n>>2]+4>>2]](n),(n=v[r+32>>2])&&or(Iu(n)),Tu(r+80|0),$u(r- -64|0),r}function be(r,n,e,i,f){n|=0,e|=0,i|=0,f|=0;var t,u,o=0;return D=t=D-32|0,n=((o=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&o?v[v[n>>2]+r>>2]:r,o=n,u=e,n=Ae(t+20|0,i+4|0,v[i>>2],0),e=Ae(t+8|0,f+4|0,v[f>>2],0),r=0|da[0|r](o,u,n,e),lf(e),lf(n),D=t+32|0,0|r}function ke(r,n){var e=0,i=0;if((0|(e=v[r+8>>2]))!=(0|n)){if(e&&(i=v[5208],da[v[v[i>>2]+20>>2]](i,e,8524,122)),!n)return v[r+4>>2]=0,void(v[r+8>>2]=0);e=Qn(n),v[r+4>>2]=e,i=v[5208],e=0|da[v[v[i>>2]+12>>2]](i,e+1|0,8524,129),v[r+8>>2]=e,Ff(e,n,v[r+4>>2]+1|0)}}function se(r){var n=0,e=0;if(v[(r|=0)>>2]=10696,n=v[r+4>>2])for(;lf(4+(v[r+12>>2]+m(~e+n|0,20)|0)|0),(e=e+1|0)>>>0<(n=v[r+4>>2])>>>0;);return v[r+4>>2]=0,(n=v[r+12>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,215)),0|r}function ve(r,n){var e=0;if(v[r>>2]=n,n=v[r+4>>2])for(;n=v[r+12>>2]+(~e+n<<4)|0,da[v[v[n>>2]>>2]](n),(n=v[r+4>>2])>>>0>(e=e+1|0)>>>0;);return v[r+4>>2]=0,(n=v[r+12>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,215)),r}function le(r,n){var e;return D=e=D-16|0,r=Eo(r),v[r+20>>2]=8760,v[r+4>>2]=8712,v[r>>2]=9492,v[r+32>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+16>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,v[e+12>>2]=0,yn(r+4|0,n,e+12|0),v[e+8>>2]=0,Fn(r+20|0,n,e+8|0),D=e+16|0,r}function he(r,n){var e,i,f=0,t=0;D=e=D-16|0,v[e+12>>2]=n;r:{if(i=v[r+8>>2]){if(t=v[r+16>>2],v[t>>2]==(0|n))break r;for(;(0|i)!=(0|(f=f+1|0))&v[(f<<2)+t>>2]!=(0|n););if(f>>>0>>0)break r}Sn(r+4|0,e+12|0)}D=e+16|0}function de(r,n){var e,i=w(0);return D=e=D-16|0,i=w(-1),Qn(r)>>>1>>>0<=n>>>0||(r=(n<<1)+r|0,f[e+13|0]=l[0|r],r=l[r+1|0],f[e+15|0]=0,f[e+14|0]=r,r=mr(e+13|0,e+8|0,16,-1),l[v[e+8>>2]]||(i=w(w(0|r)/w(255)))),D=e+16|0,i}function pe(r,n,e,i,f){r|=0,n|=0,e|=0,i|=0,f=w(f);var t,u=0;D=t=D-32|0,n=((u=v[r+4>>2])>>1)+n|0,r=v[r>>2],r=1&u?v[v[n>>2]+r>>2]:r,u=n,n=Ae(t+20|0,e+4|0,v[e>>2],0),e=Ae(t+8|0,i+4|0,v[i>>2],0),da[0|r](u,n,e,f),lf(e),lf(n),D=t+32|0}function ye(r,n,e,i){return r=Oo(r),v[r+16>>2]=9196,v[r+12>>2]=i,v[r+8>>2]=e,v[r+4>>2]=n,v[r>>2]=9164,Bf(r+20|0,0,69),s[r+116>>1]=0,v[r+108>>2]=1065353216,v[r+112>>2]=0,v[r+100>>2]=0,v[r+104>>2]=0,v[r+92>>2]=1065353216,v[r+96>>2]=0,Ke(r),r}function me(r,n,e,i,f){var t=w(0),u=w(0),o=w(0),a=0,c=w(0);i=v[i+12>>2]+(f<<2)|0,n=v[n+12>>2]+(e<<2)|0,u=p[n+12>>2],o=p[n+8>>2],t=Pr(w(u-p[n+4>>2]),w(o-p[n>>2])),p[i+8>>2]=t,a=i,c=w(u+w(r*Wr(t))),p[a+4>>2]=c,a=i,c=w(o+w(r*Rr(t))),p[a>>2]=c}function we(r){var n=0,e=0;for(n=v[r+4>>2];n&&(e=v[n>>2],we(n),or(n),n=e););return(n=v[r+16>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,164)),(n=v[r+28>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,168)),r}function ge(r,n){return v[r>>2]=10664,Re(r+4|0,n),v[r+32>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+20>>2]=10680,v[r+16>>2]=10648,v[r- -64>>2]=0,v[r+56>>2]=0,v[r+60>>2]=0,v[r+52>>2]=10712,v[r+48>>2]=0,v[r+40>>2]=0,v[r+44>>2]=0,v[r+36>>2]=9612,r}function Fe(r,n){return r=kt(r,n),v[r+36>>2]=8712,v[r+20>>2]=10632,v[r>>2]=11024,v[r+40>>2]=0,v[r+44>>2]=0,v[r+32>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+48>>2]=0,v[r+52>>2]=0,v[r+56>>2]=r,n=v[5294],v[5294]=n+1,v[r+60>>2]=n<<11&134215680,r}function Ae(r,n,e,i){return v[r>>2]=10760,n?(v[r+4>>2]=e,i?(v[r+8>>2]=n,r):(i=v[5208],e=0|da[v[v[i>>2]+12>>2]](i,e+1|0,8524,49),v[r+8>>2]=e,f[e+v[r+4>>2]|0]=0,Ff(v[r+8>>2],n,v[r+4>>2]),r)):(v[r+4>>2]=0,v[r+8>>2]=0,r)}function Te(r,n,e){var i=0,f=0,t=0;if(!e)return 0;r:if(i=l[0|r]){for(;;){if(!((0|(f=l[0|n]))!=(0|i)|!f)&&(e=e-1|0)){if(n=n+1|0,i=l[r+1|0],r=r+1|0,i)continue;break r}break}t=i}return(255&t)-l[0|n]|0}function $e(r,n,e,i){if(r|=0,n|=0,e=w(e),i|=0,p[v[r+16>>2]+(n<<2)>>2]=e,r=v[r+32>>2]+(n<<4)|0,v[r+4>>2]=0,n=0,ca(r,v[i+4>>2]+v[r+4>>2]|0),v[i+4>>2])for(;Sn(r,v[i+12>>2]+(n<<2)|0),(n=n+1|0)>>>0>2];);}function Ie(r,n,e,i){var f=w(0),t=w(0),u=w(0),o=0,a=w(0);n=v[n+12>>2],t=p[n+4>>2],e=v[e+12>>2]+(i<<2)|0,u=p[n>>2],f=Pr(w(p[n+12>>2]-t),w(p[n+8>>2]-u)),p[e+8>>2]=f,o=e,a=w(t+w(r*Wr(f))),p[o+4>>2]=a,o=e,a=w(u+w(r*Rr(f))),p[o>>2]=a}function Ce(r){var n=0;r:{n:if(n=In(r,4352)){if(r=v[n+16>>2])return!ri(r,4979);r=1;e:switch(v[n+8>>2]){case 0:case 2:return 0;case 1:break r;case 3:break e;default:break n}return p[n+24>>2]!=w(0)}r=0}return r}function Pe(r,n,e){var i=0,f=0,t=0,u=0,o=0;if(i=(v[r+4>>2]/(0|e)|0)-2|0){for(o=v[r+12>>2],r=0,f=i;f=(r=(u=p[(m(f=1+(t=f>>>1|0)|0,e)<<2)+o>>2]<=n)?f:r)+(i=u?i:t)|0,(0|r)!=(0|i););e=m(r+1|0,e)}return e}function Ee(r){var n,e=0;return v[64+(r|=0)>>2]=9772,v[r>>2]=9748,lf(r+168|0),lo(r+152|0),lo(r+136|0),vo(r+120|0),vo(r+104|0),v[r+64>>2]=8664,(n=v[r+72>>2])&&(e=v[r+68>>2])&&da[0|n](e),0|tt(r)}function Oe(r,n,e,i,f,t,u,o,a,c){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),u=w(u),o=w(o),a=w(a),c=w(c),r=v[r+32>>2]+(n<<5)|0,p[r>>2]=e,p[r+4>>2]=i,p[r+8>>2]=f,p[r+12>>2]=t,p[r+16>>2]=u,p[r+20>>2]=o,p[r+24>>2]=a,p[r+28>>2]=c}function Re(r,n){var e=0;return v[r>>2]=10760,v[n+8>>2]?(v[r+4>>2]=v[n+4>>2],e=v[5208],e=0|da[v[v[e>>2]+12>>2]](e,v[n+4>>2]+1|0,8524,67),v[r+8>>2]=e,Ff(e,v[n+8>>2],v[n+4>>2]+1|0),r):(v[r+4>>2]=0,v[r+8>>2]=0,r)}function Se(r,n,e,i){var f,t,u,o,a=0,c=0;return o=m(a=e>>>16|0,c=r>>>16|0),a=(65535&(c=((u=m(f=65535&e,t=65535&r))>>>16|0)+m(c,f)|0))+m(a,t)|0,V=(m(n,e)+o|0)+m(r,i)+(c>>>16)+(a>>>16)|0,65535&u|a<<16}function We(r,n){var e,i=0,f=0,t=0,u=0;if(!(i=v[r+4>>2]-2|0))return 1;for(e=v[r+12>>2],r=0,f=i;f=(r=(u=p[((f=1+(t=f>>>1|0)|0)<<2)+e>>2]<=n)?f:r)+(i=u?i:t)|0,(0|r)!=(0|i););return r+1|0}function Ge(r){var n,e,i,f,t;return v[(r|=0)>>2]=10152,Pn(n=r+8|0),Pn(e=r+24|0),Pn(i=r+56|0),Pn(f=r+72|0),Pn(t=r+88|0),so(r+120|0),Cu(r+104|0),Pu(t),Eu(f),Ou(i),Du(r+40|0),Du(e),so(n),0|r}function Ue(r,n){var e,i;return D=e=D-16|0,r=si(r,n),v[r+20>>2]=8712,v[r>>2]=10916,v[r+24>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+36>>2]=0,ca(i=r+20|0,n=m(n,3)),v[e+12>>2]=0,yn(i,n,e+12|0),D=e+16|0,r}function je(r,n,e,i){n|=0,e|=0,i|=0;var f,t=0;return D=f=D-16|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,t=n,n=Ae(f+4|0,i+4|0,v[i>>2],0),r=0|da[0|r](t,e,n),lf(n),D=f+16|0,0|r}function He(r,n){var e=0;if(v[r>>2]=0,v[r+4>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+16>>2]=0,v[r+20>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,n){for(;n=(e=n)+1|0,(l[0|e]-1&255)>>>0<32;);tr(r,e)}return r}function Le(r,n){var e,i;return D=e=D-16|0,r=si(r,n),v[r+20>>2]=8712,v[r>>2]=10964,v[r+24>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+36>>2]=0,ca(i=r+20|0,n<<=3),v[e+12>>2]=0,yn(i,n,e+12|0),D=e+16|0,r}function Me(r,n){var e,i=0,f=0;if(D=e=D-16|0,d[r+44>>2]<=n>>>0)for(i=r+40|0;v[e+12>>2]=0,Sn(i,e+12|0),d[r+44>>2]<=n>>>0;);else f=v[v[r+52>>2]+(n<<2)>>2];return D=e+16|0,f}function _e(r,n,e){var i;if(i=In(r,4917)){if(v[i+8>>2]==v[2414]&&!ri(v[i+16>>2],6270))return void ct(n,e);_r(n,e,Pt(r,4917,w(0)),Pt(r,6932,w(0)),Pt(r,6914,w(1)),Pt(r,6902,w(1)))}}function ze(r,n,e){n|=0,e|=0;var i,f=0;return D=i=D-16|0,n=((f=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&f?v[v[n>>2]+r>>2]:r,f=n,n=Ae(i+4|0,e+4|0,v[e>>2],0),r=0|da[0|r](f,n),lf(n),D=i+16|0,0|r}function xe(r,n){n|=0;var e=0,i=0;r:{n:if(v[88+(r|=0)>>2]){for(;;){if(!qi(Jo(i=v[v[r+96>>2]+(e<<2)>>2]),n)){if((e=e+1|0)>>>0>2])continue;break n}break}break r}i=0}return 0|i}function Je(r){var n,e,i=0;if(i=v[72+(r|=0)>>2],e=l[i+28|0],f[i+28|0]=1,n=v[r+44>>2]){for(i=0;qn(r,i),(0|n)!=(0|(i=i+1|0)););i=v[r+72>>2]}v[r+44>>2]=0,f[i+28|0]=e,pr(i)}function Ke(r){var n;n=v[4+(r|=0)>>2],p[r+32>>2]=p[n+28>>2],p[r+36>>2]=p[n+32>>2],p[r+40>>2]=p[n+36>>2],p[r+44>>2]=p[n+40>>2],p[r+48>>2]=p[n+44>>2],p[r+52>>2]=p[n+48>>2],p[r+56>>2]=p[n+52>>2]}function Be(r,n){return v[r+8>>2]=0,v[r+12>>2]=0,v[r+4>>2]=8936,v[r>>2]=8920,Re(r+16|0,n),ht(r+28|0),v[r+64>>2]=0,v[r+56>>2]=1,v[r+60>>2]=0,v[r+48>>2]=1,v[r+52>>2]=1,v[r+40>>2]=6,v[r+44>>2]=1,r}function Ne(r,n,e,i){n|=0,e|=0,i|=0;var f,t=0;D=f=D-16|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,t=n,n=Ae(f+4|0,i+4|0,v[i>>2],0),da[0|r](t,e,n),lf(n),D=f+16|0}function qe(){var r,n=0;D=r=D-16|0,l[20608]||(v[5149]=0,v[5150]=0,v[5148]=1048,v[5151]=0,f[20608]=1),l[20660]||(Kr(20612,n=gu(r+4|0,6864,0),20592,w(0)),lf(n),f[20660]=1),D=r+16|0}function De(r){var n,e=0;return v[4+(r|=0)>>2]=8584,v[r>>2]=8568,vo(r+148|0),oo(r+132|0),Qu(r+116|0),v[r+4>>2]=8664,(n=v[r+12>>2])&&(e=v[r+8>>2])&&da[0|n](e),0|r}function Ve(r,n){return r=rt(r,n),v[r+24>>2]=9612,v[r>>2]=9592,v[r+52>>2]=1065353216,v[r+56>>2]=0,f[r+50|0]=0,s[r+48>>1]=0,v[r+44>>2]=1,v[r+28>>2]=0,v[r+32>>2]=0,v[r+36>>2]=0,v[r+40>>2]=0,r}function Ze(r,n,e,i){var f;return D=f=D-16|0,r=si(r,n),v[r+20>>2]=8712,v[r>>2]=i,v[r+24>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+36>>2]=0,v[f+12>>2]=0,yn(r+20|0,m(n,e),f+12|0),D=f+16|0,r}function Ye(r,n){n|=0;var e,i=0;if(e=v[24+(r|=0)>>2])for(;;){if(qi(v[v[r+32>>2]+(i<<2)>>2]+8|0,n))return v[v[r+32>>2]+(i<<2)>>2];if((0|e)==(0|(i=i+1|0)))break}return 0}function Xe(r,n){var e;return D=e=D-16|0,r=si(r,n),v[r+24>>2]=8712,v[r+20>>2]=0,v[r>>2]=9280,v[r+36>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[e+12>>2]=0,yn(r+24|0,m(n,5),e+12|0),D=e+16|0,r}function Qe(r,n){var e;return D=e=D-16|0,r=si(r,n),v[r+24>>2]=8712,v[r+20>>2]=0,v[r>>2]=10068,v[r+36>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[e+12>>2]=0,yn(r+24|0,n<<1,e+12|0),D=e+16|0,r}function ri(r,n){var e=0,i=0;r:if(!(!(e=l[0|r])|(0|(i=l[0|n]))!=(0|e)))for(;;){if(i=l[n+1|0],!(e=l[r+1|0]))break r;if(n=n+1|0,r=r+1|0,(0|e)!=(0|i))break}return e-i|0}function ni(r,n){var e;return D=e=D-16|0,r=si(r,n),v[r+20>>2]=8712,v[r>>2]=9932,v[r+24>>2]=0,v[r+28>>2]=0,v[r+32>>2]=0,v[r+36>>2]=0,v[e+12>>2]=0,yn(r+20|0,n<<1,e+12|0),D=e+16|0,r}function ei(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t|=0,u|=0,o|=0,r=v[r+32>>2]+m(n,24)|0,p[r>>2]=e,p[r+4>>2]=i,p[r+8>>2]=f,p[r+12>>2]=0|t,p[r+16>>2]=u>>>0,p[r+20>>2]=o>>>0}function ii(r,n,e){n|=0,e|=0;var i,f=0;D=i=D-16|0,n=((f=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&f?v[v[n>>2]+r>>2]:r,f=n,n=Ae(i+4|0,e+4|0,v[e>>2],0),da[0|r](f,n),lf(n),D=i+16|0}function fi(r,n){var e=0,i=0;r:if(v[r+4>>2]){for(;;){if(i=v[v[r+12>>2]+(e<<2)>>2],!qi(Bo(v[i+4>>2]),n)){if((e=e+1|0)>>>0>2])continue;break r}break}return i}return 0}function ti(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),e=0|da[0|e](n),n=Y((r=v[e+4>>2])+4|0),v[n>>2]=r,Ff(n+4|0,v[e+8>>2],r),0|n}function ui(r){var n,e=0,i=0;if(n=v[r+4>>2])for(;e=v[v[r+12>>2]+(i<<2)>>2],l[e+117|0]&&(l[e+116|0]&&ui(e+16|0),f[e+116|0]=0),(0|n)!=(0|(i=i+1|0)););}function oi(r,n,e){return v[r+36>>2]=0,v[r+32>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+20>>2]=8984,v[r+16>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,v[r+4>>2]=8968,v[r>>2]=8840,fr(r,n,e,8524,0),r}function ai(r,n,e,i){var f;return r|=0,n|=0,e|=0,i|=0,D=f=D-32|0,v[f+28>>2]=n,n=Ae(f+16|0,e+4|0,v[e>>2],0),v[f+12>>2]=i,r=0|da[0|r](f+28|0,n,f+12|0),lf(n),D=f+32|0,0|r}function ci(r){r|=0;var n=0,e=w(0);return n=r,e=hu(p[r+4>>2]),p[n+4>>2]=e,n=r,e=hu(p[r+8>>2]),p[n+8>>2]=e,n=r,e=hu(p[r+12>>2]),p[n+12>>2]=e,n=r,e=hu(p[r+16>>2]),p[n+16>>2]=e,0|r}function bi(r){var n,e=0;return v[(r|=0)>>2]=10248,Pn(n=r+8|0),v[r+12>>2]=0,l[r+40|0]&&(e=v[r+4>>2])&&da[v[v[e>>2]+4>>2]](e),lf(r+24|0),Zu(n),0|r}function ki(r,n){var e=0,i=0;r:if(v[r+4>>2]){for(;;){if(!qi(Bo(i=v[v[r+12>>2]+(e<<2)>>2]),n)){if((e=e+1|0)>>>0>2])continue;break r}break}return i}return 0}function si(r,n){var e;return D=e=D-16|0,r=Eo(r),v[r+4>>2]=8712,v[r>>2]=9344,v[r+16>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,v[e+12>>2]=0,yn(r+4|0,m(n,19)-19|0,e+12|0),D=e+16|0,r}function vi(r,n){var e=0,i=0;r:if(v[r+4>>2]){for(;;){if(!qi(No(i=v[v[r+12>>2]+(e<<2)>>2]),n)){if((e=e+1|0)>>>0>2])continue;break r}break}return i}return 0}function li(r,n,e,i,f,t,u,o){r|=0,n|=0,e|=0,i=w(i),f=w(f),t=w(t),u=w(u),o=w(o);var a=0;a=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(a=v[a+v[n>>2]>>2]),da[0|a](n,e,i,f,t,u,o)}function hi(r,n,e,i){var f,t;n|=0,e|=0,i|=0,D=f=D-16|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,v[f+12>>2]=i,da[0|r](n,e,f+12|0),D=f+16|0}function di(r){var n,e;return(r=(n=v[5146])+(e=r+7&-8)|0)>>>0<=n>>>0&&e||r>>>0>pa()<<16>>>0&&!(0|z(0|r))?(v[5373]=48,-1):(v[5146]=r,n)}function pi(r,n){var e,i=0,f=0;if(D=e=D-16|0,i=v[n+20>>2])for(;f=v[r+72>>2],ut(e,3,i,0),qr(f+4|0,e),i=v[i+20>>2];);v[n+20>>2]=0,D=e+16|0}function yi(r){var n=0,e=0,i=0,f=0,t=0;if(n=10,i=1,r)for(;i=Se((e=1&r)?n:1,e?f:0,i,t),t=V,e=r>>>0>1,n=Se(n,f,n,f),f=V,r=r>>>1|0,e;);return V=t,i}function mi(r){var n=0,e=0;return(n=Wn(r,1))?(e=v[5208],e=0|da[v[v[e>>2]+8>>2]](e,n,8524,373),n=n-1|0,e=Ff(e,v[r+4>>2],n),v[r+4>>2]=n+v[r+4>>2],f[n+e|0]=0,e):0}function wi(r,n){n|=0;var e=0;e=0;r:if(r=v[24+(r|=0)>>2]){for(;;){if(e=r,v[r+4>>2]==(0|n))break r;if(!(r=v[r+12>>2]))break}e=0}return 0|!!(0|e)}function gi(r,n){var e;n|=0,!(e=v[224+(r|=0)>>2])|v[e+64>>2]!=v[n+4>>2]||(v[r+224>>2]=0,v[r+228>>2]=0,v[r+196>>2]=0,v[r+164>>2]=0,v[r+180>>2]=0,v[r+132>>2]=0)}function Fi(r,n,e){n|=0,e|=0;var i=0;if(!(i=v[136+(r|=0)>>2])||!(i=gt(i,n,e))){if(!v[v[r+4>>2]+64>>2])return 0;i=gt(v[v[r+4>>2]+64>>2],n,e)}return 0|i}function Ai(r,n){var e=0,i=0;(0|(e=v[r+8>>2]))!=(0|n)&&(e&&(i=v[5208],da[v[v[i>>2]+20>>2]](i,e,8524,86)),n?e=Qn(n):(n=0,e=0),v[r+8>>2]=n,v[r+4>>2]=e)}function Ti(r,n){var e,i;return n|=0,D=e=D-16|0,i=e+4|0,da[v[(r|=0)>>2]](i,n),n=Y((r=v[e+8>>2])+4|0),v[n>>2]=r,Ff(n+4|0,v[e+12>>2],r),lf(i),D=e+16|0,0|n}function $i(r){var n,e=0;return v[(r|=0)>>2]=10600,Pn(n=r+8|0),l[r+28|0]&&(e=v[r+4>>2])&&da[v[v[e>>2]+4>>2]](e),lf(r+32|0),Zu(n),0|r}function Ii(r,n){var e=0;return(e=v[r+8>>2])?(n=e-1|0,e=v[v[r+16>>2]+(n<<2)>>2],v[r+8>>2]=n,e):(r=Xf(16),v[r+12>>2]=0,v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=n,r)}function Ci(r,n){var e,i=0;if(e=v[r+4>>2])for(;;){if(qi(Bo(v[v[v[r+12>>2]+(i<<2)>>2]+4>>2]),n))return i;if((0|e)==(0|(i=i+1|0)))break}return-1}function Pi(r,n,e,i){var f;r|=0,n|=0,e|=0,i=w(i),D=f=D-16|0,n=xe(v[r+4>>2],n),e=xe(v[r+4>>2],e),p[f+12>>2]=i,Ot(f,n,e),$n(r+12|0,f,f+12|0),D=f+16|0}function Ei(r,n){var e=0;if(v[r>>2]=n,n=v[r+4>>2])for(;e=v[n+20>>2],da[v[v[n>>2]+4>>2]](n),n=e;);return v[r+4>>2]=0,v[r+8>>2]=0,r}function Oi(r,n){var e=0;if(v[r>>2]=n,n=v[r+4>>2])for(;e=v[n+12>>2],da[v[v[n>>2]+4>>2]](n),n=e;);return v[r+4>>2]=0,v[r+8>>2]=0,r}function Ri(r,n,e,i,f,t,u){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),u=w(u),r=v[r+36>>2]+m(n,20)|0,p[r>>2]=e,p[r+16>>2]=u,p[r+12>>2]=t,p[r+8>>2]=f,p[r+4>>2]=i}function Si(r,n,e,i,f,t,u){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),u=w(u),r=v[r+32>>2]+m(n,20)|0,p[r>>2]=e,p[r+16>>2]=u,p[r+12>>2]=t,p[r+8>>2]=f,p[r+4>>2]=i}function Wi(r){var n,e;return v[(r|=0)>>2]=10944,Pn(n=r+4|0),Pn(e=r+20|0),nt(r+104|0),et(r+84|0),Qu(r+68|0),ju(r+52|0),Qu(r+36|0),Xu(e),Yu(n),0|r}function Gi(r){var n,e;return w((e=(n=r*r)*r)*n*n*(2718311493989822e-21*n-.00019839334836096632)+(e*(.008333329385889463*n-.16666666641626524)+r))}function Ui(r,n,e){var i=0;for(ie(r,n,e),r=v[e+4>>2],n=v[e>>2];;){if((0|r)==(0|n))return;if(i=l[0|n],n=n+1|0,58==(0|i))break}v[e>>2]=n,Kn(e)}function ji(r,n){var e,i=0;if(e=v[r+4>>2])for(;;){if(qi(Bo(v[v[r+12>>2]+(i<<2)>>2]),n))return i;if((0|e)==(0|(i=i+1|0)))break}return-1}function Hi(r){return w(w(w(w(r*w(w(r*w(-.008656363002955914))+w(-.04274342209100723)))+w(.16666586697101593))*r)/w(w(r*w(-.7066296339035034))+w(1)))}function Li(r){var n=0,e=0;return n=0,(e=r>>>23&255)>>>0<127||(n=2,e>>>0>150||(n=0,(e=1<<150-e)-1&r||(n=r&e?1:2))),n}function Mi(r,n,e){var i=0,f=0,t=0;d[r+8>>2]>>0&&(v[r+8>>2]=n,i=v[5208],f=r,t=0|da[v[v[i>>2]+16>>2]](i,v[r+12>>2],n<>2]=t)}function _i(r,n){var e=0;if(ca(r,v[n+4>>2]+v[r+4>>2]|0),v[n+4>>2])for(;Rn(r,v[n+12>>2]+(e<<2)|0),(e=e+1|0)>>>0>2];);}function zi(r,n){var e=0;if(ca(r,v[n+4>>2]+v[r+4>>2]|0),v[n+4>>2])for(;On(r,v[n+12>>2]+(e<<2)|0),(e=e+1|0)>>>0>2];);}function xi(r,n){return r=Fe(r,n),v[r+64>>2]=8712,v[r>>2]=9804,v[r+68>>2]=0,v[r+72>>2]=0,s[r+74>>1]=0,s[r+76>>1]=0,s[r+78>>1]=0,s[r+80>>1]=0,r}function Ji(r,n){var e=0,i=0,f=0;d[r+8>>2]>>0&&(v[r+8>>2]=n,e=v[5208],i=r,f=0|da[v[v[e>>2]+16>>2]](e,v[r+12>>2],n,8524,97),v[i+12>>2]=f)}function Ki(r,n){var e,i=0;D=e=D-16|0,l[n+116|0]||((i=v[n+12>>2])&&Ki(r,i),f[n+116|0]=1,v[e+12>>2]=n,Sn(r+104|0,e+12|0)),D=e+16|0}function Bi(r){var n;return w((r*=r)*(n=r*r)*(2439044879627741e-20*r-.001388676377460993)+.04166662332373906*n+-.499999997251031*r+1)}function Ni(r,n,e,i,f){r|=0,n|=0,e|=0,i=w(i),f=w(f);var t=0;t=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(t=v[t+v[n>>2]>>2]),da[0|t](n,e,i,f)}function qi(r,n){var e,i;return(0|(e=v[r+8>>2]))==(0|(i=v[n+8>>2]))?1:!(r=!i|!e|v[r+4>>2]!=v[n+4>>2]?1:ri(e,i))}function Di(r,n){var e,i=0;for(i=Qn(r)+1|0,e=255&n;n=0,i&&(0|e)!=l[0|(n=(i=i-1|0)+r|0)];);return n}function Vi(r,n,e){return v[r+12>>2]=0,v[r+16>>2]=0,p[r+8>>2]=n,v[r+4>>2]=e,v[r>>2]=9460,ht(r+20|0),v[r+32>>2]=1065353216,v[r+36>>2]=0,r}function Zi(r,n,e,i,f){p[i>>2]=p[r+100>>2]+w(w(n*p[r+92>>2])+w(p[r+96>>2]*e)),p[f>>2]=p[r+112>>2]+w(w(n*p[r+104>>2])+w(p[r+108>>2]*e))}function Yi(r,n){r|=0,v[24+(n|=0)>>2]=0,zi(n+20|0,r+20|0),v[n+40>>2]=0,_i(n+36|0,r+36|0),v[n+52>>2]=v[r+52>>2],v[n+56>>2]=v[r+56>>2]}function Xi(r,n,e){var i;r|=0,n=w(n),e=w(e),D=i=D-16|0,p[i+12>>2]=n,p[i+8>>2]=e,da[v[v[r>>2]+16>>2]](r,i+12|0,i+8|0),D=i+16|0}function Qi(r,n,e){var i;return r|=0,n=w(n),e=w(e),D=i=D-16|0,p[i+12>>2]=n,p[i+8>>2]=e,r=0|da[0|r](i+12|0,i+8|0),D=i+16|0,0|r}function rf(r,n){return v[r>>2]=9476,Re(r+4|0,n),v[r+16>>2]=0,v[r+20>>2]=0,ht(r+24|0),ht(r+36|0),v[r+48>>2]=1065353216,v[r+52>>2]=0,r}function nf(r,n,e){r|=0,n|=0,e=w(e);var i=0;return i=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),w(w(da[0|i](n,e)))}function ef(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),v[da[0|i](n,e)>>2]}function ff(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),w(w(da[0|i](n,e)))}function tf(r,n,e,i){n|=0,e|=0,i|=0;var f=0;f=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),da[0|f](n,e,i)}function uf(r){var n,e=0;return v[(r|=0)>>2]=11112,e=v[r+4>>2],(!(n=v[e>>2])||(or(n),e=v[r+4>>2]))&&or(e),0|r}function of(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),0|da[0|i](n,e)}function af(r,n){r|=0,n|=0;var e=w(0);v[r+60>>2]!=(0|n)&&(v[r+60>>2]=n,e=p[v[r+12>>2]+160>>2],v[r+72>>2]=0,p[r+64>>2]=e)}function cf(r,n,e){n|=0,e|=0,r=v[12+(r|=0)>>2]+(n<<4)|0,n=v[e+8>>2],v[r+4>>2]=v[e+4>>2],v[r+8>>2]=n,v[r+12>>2]=v[e+12>>2]}function bf(r){v[224+(r|=0)>>2]&&(v[r+224>>2]=0,v[r+228>>2]=0,v[r+196>>2]=0,v[r+164>>2]=0,v[r+180>>2]=0,v[r+132>>2]=0)}function kf(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),w(w(da[0|e](n)))}function sf(r,n,e){var i;r|=0,n|=0,D=i=D-16|0,e=Ae(i+4|0,4+(e|=0)|0,v[e>>2],0),ee(v[r>>2]+n|0,e),lf(e),D=i+16|0}function vf(r,n){var e;return r|=0,D=e=D-16|0,n=Ae(e+4|0,4+(n|=0)|0,v[n>>2],0),r=0|da[0|r](n),lf(n),D=e+16|0,0|r}function lf(r){var n,e=0;return v[(r|=0)>>2]=10760,(n=v[r+8>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,187)),0|r}function hf(r,n,e,i){var f;n|=0,e|=0,i|=0,D=f=D-16|0,r=v[(r|=0)>>2],v[f+12>>2]=i,da[0|r](n,e,f+12|0),D=f+16|0}function df(r,n,e){r|=0,n|=0,e=w(e);var i=0;i=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),da[0|i](n,e)}function pf(r,n){var e=0;return v[r+4>>2]=0,v[r>>2]=n,(n=v[r+12>>2])&&(e=v[5208],da[v[v[e>>2]+20>>2]](e,n,8524,215)),r}function yf(r,n,e){n|=0,e|=0;var i=0;i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),da[0|i](n,e)}function mf(r,n){var e;return n|=0,e=v[(r|=0)>>2]+n|0,n=Y((r=v[e+4>>2])+4|0),v[n>>2]=r,Ff(n+4|0,v[e+8>>2],r),0|n}function wf(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),0|da[0|e](n)}function gf(r,n,e){var i;return r|=0,n=w(n),e|=0,D=i=D-16|0,p[i+12>>2]=n,r=0|da[0|r](i+12|0,e),D=i+16|0,0|r}function Ff(r,n,e){var i=0;if(e)for(i=r;f[0|i]=l[0|n],i=i+1|0,n=n+1|0,e=e-1|0;);return r}function Af(r,n,e,i,f){r|=0,n|=0,e=w(e),i=w(i),f=w(f),r=v[r+32>>2]+m(n,12)|0,p[r>>2]=e,p[r+8>>2]=f,p[r+4>>2]=i}function Tf(r,n){var e=0;for(n=v[n+4>>2];(e=ri(v[r+4>>2],n))&&(r=v[r+8>>2]););return!e}function $f(r,n){return qi(v[r+4>>2]+36|0,v[n+4>>2]+36|0)?qi(v[r+8>>2]+36|0,v[n+8>>2]+36|0):0}function If(r,n){n|=0;var e=0;e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),da[0|e](n)}function Cf(r,n,e,i,t,u){return v[r+4>>2]=n,v[r>>2]=9676,Re(r+8|0,e),v[r+20>>2]=i,Re(r+24|0,t),f[r+36|0]=u,r}function Pf(r,n){var e;return r|=0,n|=0,D=e=D-16|0,v[e+12>>2]=n,r=0|da[0|r](e+12|0),D=e+16|0,0|r}function Ef(r,n){return v[r+8>>2]=0,v[r+4>>2]=n,v[r+16>>2]=0,v[r+20>>2]=0,v[r+12>>2]=8808,v[r>>2]=8776,r}function Of(r){cr(r|=0,p[r+32>>2],p[r+36>>2],p[r+40>>2],p[r+44>>2],p[r+48>>2],p[r+52>>2],p[r+56>>2])}function Rf(r){var n,e;return e=Tt(12),n=v[r+4>>2],te(e,v[n+8>>2],v[n+4>>2],v[n+12>>2],v[r+8>>2]),e}function Sf(r){r&&(v[r+16>>2]=v[r+16>>2]-1,v[r+16>>2]||da[v[v[r>>2]+4>>2]](r))}function Wf(r,n,e,i){r|=0,n|=0,e=w(e),i|=0,p[v[r+20>>2]+(n<<2)>>2]=e,ee(v[r+36>>2]+m(n,12)|0,i)}function Gf(r,n,e,i,f,t,u){t|=0,u|=0,kr(r|=0,n|=0,e|=0,i|=0,v[12+(f|=0)>>2],t,u)}function Uf(r){var n;return v[(r|=0)>>2]=1032,Pn(n=r+4|0),lf(r+36|0),no(r+20|0),fo(n),0|r}function jf(r,n){var e;D=e=D-16|0,ut(e,2,n,0),qr(r+4|0,e),f[v[r+20>>2]+88|0]=1,D=e+16|0}function Hf(r,n,e){n|=0,e|=0,p[(n<<=2)+v[16+(r|=0)>>2]>>2]=p[e+8>>2],v[n+v[r+32>>2]>>2]=e}function Lf(r,n,e,i){r|=0,n|=0,e=w(e),i=w(i),r=v[r+32>>2]+(n<<3)|0,p[r>>2]=e,p[r+4>>2]=i}function Mf(r,n,e,i){r|=0,n|=0,e=w(e),i=w(i),r=v[r+36>>2]+(n<<3)|0,p[r>>2]=e,p[r+4>>2]=i}function _f(r,n,e,i){p[v[r+36>>2]+(n<<2)>>2]=e,r=v[r+52>>2]+(n<<4)|0,v[r+4>>2]=0,_i(r,i)}function zf(r,n){return r=kt(r,n),v[r+28>>2]=0,v[r+20>>2]=0,v[r+24>>2]=0,v[r>>2]=9988,r}function xf(r){var n;return n=Xf(16),v[n+12>>2]=0,v[n+4>>2]=0,v[n+8>>2]=0,v[n>>2]=r,n}function Jf(r){var n;return v[(r|=0)>>2]=9492,Pn(n=r+20|0),ho(n),vo(r+4|0),0|r}function Kf(r,n){var e;e=Tt(4),v[e>>2]=n,$(21403,0|r,2,16184,11280,1668,0|e,0,0)}function Bf(r,n,e){if(e)for(;f[0|r]=n,r=r+1|0,e=e-1|0;);}function Nf(r,n){var e;e=Tt(4),v[e>>2]=n,$(1982,0|r,2,13504,11280,1624,0|e,0,0)}function qf(r,n){var e;e=Tt(4),v[e>>2]=n,$(1982,0|r,2,13512,11280,1625,0|e,0,0)}function Df(r,n){var e;e=Tt(4),v[e>>2]=n,$(1927,0|r,2,13656,11280,1628,0|e,0,0)}function Vf(r,n){var e;e=Tt(4),v[e>>2]=n,$(5335,0|r,3,14424,13176,1636,0|e,0,0)}function Zf(r,n){return r=rt(r,n),v[r+24>>2]=9612,v[r>>2]=10840,Bf(r+28|0,0,58),r}function Yf(r,n){return r=rt(r,n),v[r+24>>2]=9612,v[r>>2]=9864,Bf(r+28|0,0,48),r}function Xf(r){var n;return n=v[5208],0|da[v[v[n>>2]+12>>2]](n,r,8524,40)}function Qf(r){var n;return(-1>>>(n=31&r)&-2)<>>r}function rt(r,n){return v[r>>2]=9324,Re(r+4|0,n),f[r+20|0]=0,v[r+16>>2]=0,r}function nt(r){var n;return v[(r|=0)>>2]=10440,Pn(n=r+4|0),Xu(n),0|r}function et(r){var n;return v[(r|=0)>>2]=10424,Pn(n=r+4|0),Yu(n),0|r}function it(r){var n;return v[(r|=0)>>2]=8744,Pn(n=r+4|0),oo(n),0|r}function ft(r,n,e){return r|=0,n=w(n),e=w(e),p[r+4>>2]=e,p[r>>2]=n,0|r}function tt(r){return v[(r|=0)>>2]=11024,vo(r+36|0),Fu(r+20|0),0|jt(r)}function ut(r,n,e,i){v[r+12>>2]=i,v[r+8>>2]=e,v[r+4>>2]=n,v[r>>2]=8600}function ot(r,n,e){n|=0,e|=0,v[v[12+(r|=0)>>2]+(n<<2)>>2]=v[e>>2]}function at(r){var n;n=v[5208],da[v[v[n>>2]+20>>2]](n,r,8524,62)}function ct(r,n){n|=0,v[v[16+(r|=0)>>2]+m(n,76)>>2]=1065353216}function bt(r,n,e,i){n|=0,e|=0,i|=0,da[v[(r|=0)>>2]](n,e,i)}function kt(r,n){return v[r>>2]=9048,Re(r+4|0,n),v[r+16>>2]=0,r}function st(r){var n;return p[12+(n=D-16|0)>>2]=r,p[n+12>>2]}function vt(r,n){return v[r>>2]=9072,v[r+4>>2]=n,v[r>>2]=9e3,r}function lt(r){return v[4+(0|da[v[v[(r|=0)>>2]+8>>2]](r))>>2]}function ht(r){return v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=10760,r}function dt(r,n){return r=Fe(r,n),v[r+64>>2]=0,v[r>>2]=9252,r}function pt(r,n){return r=vt(r,n),v[r+8>>2]=n,v[r>>2]=11128,r}function yt(r,n,e,i){vr(16+(r|=0)|0,n|=0,e|=0,i|=0)}function mt(r){return v[(r|=0)>>2]=10916,vo(r+20|0),0|Ut(r)}function wt(r){return v[4+(0|da[v[v[(r|=0)>>2]>>2]](r))>>2]}function gt(r,n,e){return 0|Dn(16+(r|=0)|0,n|=0,e|=0)}function Ft(r){return v[(r|=0)>>2]=9932,vo(r+20|0),0|Ut(r)}function At(r,n,e){return n|=0,e|=0,0|da[0|(r|=0)](n,e)}function Tt(r){return(r=Y(r>>>0<=1?1:r))||(j(),c()),r}function $t(r,n,e){return(r=In(r,n))&&(e=v[r+20>>2]),e}function It(r,n,e){v[r+8>>2]=e,v[r+4>>2]=n,v[r>>2]=10012}function Ct(r,n,e){return(r=In(r,n))&&(e=v[r+16>>2]),e}function Pt(r,n,e){return(r=In(r,n))&&(e=p[r+24>>2]),e}function Et(r,n){return n|=0,v[12+(r|=0)>>2]+(n<<4)|0}function Ot(r,n,e){v[r+8>>2]=e,v[r+4>>2]=n,v[r>>2]=8792}function Rt(r,n,e){r|=0,n|=0,e=w(e),p[v[r>>2]+n>>2]=e}function St(r,n){return n|=0,v[12+(r|=0)>>2]+(n<<2)|0}function Wt(r,n){var e;e=ni(r,n),v[e>>2]=9960}function Gt(r,n){r|=0,n=w(n),p[r+160>>2]=p[r+160>>2]+n}function Ut(r){return v[(r|=0)>>2]=9344,vo(r+4|0),0|r}function jt(r){return v[(r|=0)>>2]=9048,lf(r+4|0),0|r}function Ht(r,n){v[r+8>>2]=0,v[r+4>>2]=n,v[r>>2]=10012}function Lt(r,n){return n|=0,w(p[v[(r|=0)>>2]+n>>2])}function Mt(r){return v[(r|=0)>>2]=9324,lf(r+4|0),0|r}function _t(r,n,e){n|=0,e|=0,v[v[(r|=0)>>2]+n>>2]=e}function zt(r){return v[(r|=0)>>2]=8616,ro(r+4|0),0|r}function xt(r,n){v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=n+20}function Jt(r,n,e){n|=0,e|=0,f[v[(r|=0)>>2]+n|0]=e}function Kt(r,n){return n|=0,0|da[v[(r|=0)>>2]](n)}function Bt(r){return rw(0)?w(1):w(0)}function Nt(r){(r|=0)&&da[v[v[r>>2]+16>>2]](r)}function qt(r){return r?31-F(r-1^r)|0:32}function Dt(r,n){return n|=0,v[v[(r|=0)>>2]+n>>2]}function Vt(r,n){return 0|vi(100+(r|=0)|0,n|=0)}function Zt(r,n){return 0|vi(116+(r|=0)|0,n|=0)}function Yt(r,n){return 0|vi(132+(r|=0)|0,n|=0)}function Xt(r,n){return 0|ji(16+(r|=0)|0,n|=0)}function Qt(r,n){return 0|vi(68+(r|=0)|0,n|=0)}function ru(r,n){return 0|ki(16+(r|=0)|0,n|=0)}function nu(r,n){return n|=0,l[v[(r|=0)>>2]+n|0]}function eu(r,n){return 0|ji(32+(r|=0)|0,n|=0)}function iu(r,n){return 0|vi(48+(r|=0)|0,n|=0)}function fu(r,n){n|=0,Gr(r|=0,iu(v[r+4>>2],n))}function tu(r,n){return 0|fi(24+(r|=0)|0,n|=0)}function uu(r){(r|=0)&&da[v[v[r>>2]+4>>2]](r)}function ou(r,n){return 0|ki(32+(r|=0)|0,n|=0)}function au(r){return 16777216+(r<<1)>>>0<16777217}function cu(r,n){return r=Ue(r,n),v[r>>2]=10096,r}function bu(r,n){return r=Ue(r,n),v[r>>2]=10124,r}function ku(r,n){return 0|fi(8+(r|=0)|0,n|=0)}function su(r,n){return r=Fe(r,n),v[r>>2]=9228,r}function vu(r,n,e,i){_(0|r,0|n,8,0,0|e,-1,0|i)}function lu(r,n){return!ri(v[r+4>>2],v[n+4>>2])}function hu(r){return rw(1)?w(1):r}function du(r,n){return mr(r,n,10,-2147483648)}function pu(r){return v[v[4+(r|=0)>>2]+16>>2]}function yu(r){return 0!=v[224+(r|=0)>>2]|0}function mu(r){v[r+4>>2]=v[5498],v[5498]=r}function wu(r,n){return w(st(r?w(-n):n)*n)}function gu(r,n,e){return Ae(r,n,Qn(n),e)}function Fu(r){return 0|pf(r|=0,10632)}function Au(r){return 0|ve(r|=0,12928)}function Tu(r){return 0|Oi(r|=0,11208)}function $u(r){return 0|pf(r|=0,11192)}function Iu(r){return 0|pf(r|=0,11176)}function Cu(r){return 0|pf(r|=0,10232)}function Pu(r){return 0|pf(r|=0,10216)}function Eu(r){return 0|pf(r|=0,10200)}function Ou(r){return 0|pf(r|=0,10184)}function Ru(r){return 0|pf(r|=0,12864)}function Su(r){return 0|Ei(r|=0,16896)}function Wu(r){return 0|pf(r|=0,10328)}function Gu(r){return w(p[60+(r|=0)>>2])}function Uu(r,n){n|=0,v[36+(r|=0)>>2]=n}function ju(r){return 0|pf(r|=0,10408)}function Hu(r){return 0|pf(r|=0,10584)}function Lu(r){return 0|pf(r|=0,10568)}function Mu(r){return 0|pf(r|=0,10552)}function _u(r){return 0|pf(r|=0,10536)}function zu(r,n){n|=0,v[28+(r|=0)>>2]=n}function xu(r){return 0|pf(r|=0,10520)}function Ju(r){return 0|pf(r|=0,10504)}function Ku(r){return 0|pf(r|=0,10344)}function Bu(r){return 0|pf(r|=0,10488)}function Nu(r){return 0|pf(r|=0,10472)}function qu(r){return 0|ve(r|=0,10680)}function Du(r){return 0|pf(r|=0,10168)}function Vu(r){return 0|pf(r|=0,10712)}function Zu(r){return 0|pf(r|=0,10280)}function Yu(r){return 0|pf(r|=0,10376)}function Xu(r){return 0|pf(r|=0,10392)}function Qu(r){return 0|pf(r|=0,8680)}function ro(r){return 0|ve(r|=0,8728)}function no(r){return 0|Oi(r|=0,8536)}function eo(r){return 32==(0|r)|r-9>>>0<5}function io(r){return 0|pf(r|=0,8984)}function fo(r){return 0|pf(r|=0,1048)}function to(r){return 0|pf(r|=0,8968)}function uo(r){return 0|Ei(r|=0,8808)}function oo(r){return 0|pf(r|=0,8696)}function ao(r){return 0|ve(r|=0,9400)}function co(r){return 0|ve(r|=0,9444)}function bo(r){return 0|pf(r|=0,9612)}function ko(r,n){n|=0,f[44+(r|=0)|0]=n}function so(r){return 0|pf(r|=0,9196)}function vo(r){return 0|pf(r|=0,8712)}function lo(r){return 0|pf(r|=0,9788)}function ho(r){return 0|pf(r|=0,8760)}function po(r){return r-65>>>0<26?32|r:r}function yo(r){return 0|da[0|(r|=0)]()}function mo(r,n){return Ze(r,n,5,10864)}function wo(r,n){return Ze(r,n,3,9888)}function go(r){return v[60+(r|=0)>>2]}function Fo(r){v[r+16>>2]=v[r+16>>2]+1}function Ao(r){return v[12+(r|=0)>>2]}function To(r){return v[24+(r|=0)>>2]}function $o(r){return v[20+(r|=0)>>2]}function Io(r){return v[16+(r|=0)>>2]}function Co(r,n){return Ze(r,n,6,9632)}function Po(r,n){return Mn(r,n,10328)}function Eo(r){return v[r>>2]=10776,r}function Oo(r){return v[r>>2]=10992,r}function Ro(r,n){return Mn(r,n,12864)}function So(r){return l[44+(r|=0)|0]}function Wo(r){return v[8+(r|=0)>>2]}function Go(r){return v[4+(r|=0)>>2]}function Uo(r){return(r|=0)- -64|0}function jo(r){return 104+(r|=0)|0}function Ho(r){return 100+(r|=0)|0}function Lo(r){return 68+(r|=0)|0}function Mo(r){return 20+(r|=0)|0}function _o(r){return 16+(r|=0)|0}function zo(r){return 40+(r|=0)|0}function xo(r){return 84+(r|=0)|0}function Jo(r){return 36+(r|=0)|0}function Ko(r){return 24+(r|=0)|0}function Bo(r){return 8+(r|=0)|0}function No(r){return 4+(r|=0)|0}function qo(r){(r|=0)&&or(r)}function Do(r){Sr(r|=0),ue(r)}function Vo(r){return Ii(r,8680)}function Zo(r){return Ii(r,8712)}function Yo(r){return 0|r}function Xo(r){at(tt(r|=0))}function Qo(r){at(mt(r|=0))}function ra(r){return r+204|0}function na(r){return r+140|0}function ea(r,n){v[r+16>>2]=n}function ia(r){return r+144|0}function fa(r){return r+44|0}function ta(){}function ua(r,n){f[r+20|0]=n}function oa(r){f[r+64|0]=1}function aa(r,n){Mi(r,n,4)}function ca(r,n){Mi(r,n,2)}function ba(r,n){Mi(r,n,1)}function ka(r){at(r|=0)}function sa(r){or(r|=0)}function va(){c()}function la(){}var ha,da=(ha=[null,Uf,function(r){Uf(r|=0),at(r)},fo,function(r){at(fo(r|=0))},no,function(r){at(no(r|=0))},Yo,ka,function(){},function(){fo(20592)},function(){Uf(20612)},De,function(r){De(r|=0),at(r)},function(r){return 0|De((r|=0)-4|0)},function(r){De(r=(r|=0)-4|0),at(r)},ka,zt,function(r){zt(r|=0),at(r)},Xr,function(r){Xr(r|=0),at(r)},function(r){return 0|Xr((r|=0)-4|0)},function(r){Xr(r=(r|=0)-4|0),at(r)},function(r){var n,e=0;return v[(r|=0)>>2]=8664,(n=v[r+8>>2])&&(e=v[r+4>>2])&&da[0|n](e),0|r},function(r){var n,e=0;v[(r|=0)>>2]=8664,(n=v[r+8>>2])&&(e=v[r+4>>2])&&da[0|n](e),or(r)},Qu,function(r){at(Qu(r|=0))},oo,function(r){at(oo(r|=0))},vo,function(r){at(vo(r|=0))},ro,function(r){at(ro(r|=0))},it,function(r){at(it(r|=0))},ho,function(r){at(ho(r|=0))},function(r){return v[(r|=0)>>2]=8776,uo(r+12|0),0|r},function(r){v[(r|=0)>>2]=8776,uo(r+12|0),at(r)},ka,uo,function(r){at(uo(r|=0))},function(r){return v[(r|=0)>>2]=8824,0|r},function(r){v[(r|=0)>>2]=8824,at(r)},oe,function(r){oe(r|=0),at(r)},function(r){var n,e=0;return v[4+(r|=0)>>2]=8936,v[r>>2]=8920,lf(r+28|0),lf(r+16|0),v[r+4>>2]=8664,(n=v[r+12>>2])&&(e=v[r+8>>2])&&da[0|n](e),0|r},function(r){var n,e=0;v[4+(r|=0)>>2]=8936,v[r>>2]=8920,lf(r+28|0),lf(r+16|0),v[r+4>>2]=8664,(n=v[r+12>>2])&&(e=v[r+8>>2])&&da[0|n](e),at(r)},function(r){var n,e;return v[(r|=0)>>2]=8936,v[(n=r-4|0)>>2]=8920,lf(r+24|0),lf(r+12|0),v[r>>2]=8664,(e=v[r+8>>2])&&(r=v[r+4>>2])&&da[0|e](r),0|n},function(r){var n,e;v[(r|=0)>>2]=8936,v[(n=r-4|0)>>2]=8920,lf(r+24|0),lf(r+12|0),v[r>>2]=8664,(e=v[r+8>>2])&&(r=v[r+4>>2])&&da[0|e](r),at(n)},function(r){return v[(r|=0)>>2]=8952,Qu(r+96|0),Qu(r+80|0),lf(r+8|0),0|r},function(r){v[(r|=0)>>2]=8952,Qu(r+96|0),Qu(r+80|0),lf(r+8|0),at(r)},to,function(r){at(to(r|=0))},io,function(r){at(io(r|=0))},la,Yo,ka,function(){return 20664},function(r,n,e,i){return n|=0,e|=0,i|=0,(r=Ye(v[4+(r|=0)>>2],i))?(n=Lr(Xf(164),e),(i=v[n+28>>2])&&(!(e=v[n+24>>2])|(0|r)==(0|e)||da[0|i](e)),v[n+28>>2]=0,v[n+24>>2]=r,Zn(n,p[r+36>>2],p[r+40>>2],p[r+44>>2],p[r+48>>2],l[r+72|0]),p[n+60>>2]=p[r+52>>2],p[n+64>>2]=p[r+56>>2],p[n+68>>2]=v[r+28>>2],p[n+72>>2]=v[r+32>>2],p[n+76>>2]=v[r+60>>2],p[n+80>>2]=v[r+64>>2],0|n):0},function(r,n,e,i){return n|=0,e|=0,i|=0,(n=Ye(v[4+(r|=0)>>2],i))?(r=Mr(Xf(236),e),(i=v[r+72>>2])&&(!(e=v[r+68>>2])|(0|n)==(0|e)||da[0|i](e)),v[r+72>>2]=0,v[r+68>>2]=n,p[r+180>>2]=p[n+36>>2],p[r+184>>2]=p[n+40>>2],p[r+188>>2]=p[n+44>>2],p[r+192>>2]=p[n+48>>2],f[r+228|0]=l[n+72|0],v[r+232>>2]=v[n+76>>2],p[r+76>>2]=p[n+52>>2],p[r+80>>2]=p[n+56>>2],p[r+84>>2]=v[n+28>>2],p[r+88>>2]=v[n+32>>2],p[r+92>>2]=v[n+60>>2],p[r+96>>2]=v[n+64>>2],0|r):0},function(r,n,e){return e|=0,0|su(Xf(64),e)},function(r,n,e){return e|=0,0|xi(Xf(84),e)},function(r,n,e){return e|=0,0|zf(Xf(32),e)},function(r,n,e){return e|=0,0|dt(Xf(68),e)},ta,la,jt,va,function(){return 20676},function(){j(),c()},la,va,function(){return 20688},la,function(r){return v[(r|=0)>>2]=9120,ae(r+24|0),vo(r+8|0),0|r},function(r){v[(r|=0)>>2]=9120,ae(r+24|0),vo(r+8|0),at(r)},function(){return 20700},function(r,n,e,i,f,t,u,o){r|=0,n|=0,i=w(i),f|=0,u|=0,o|=0;var a=0;r:if(a=v[v[n+36>>2]+(v[r+4>>2]<<2)>>2],f=v[a+8>>2],0|da[v[v[f>>2]+16>>2]](f)){n:{e:{if(1!=(0|o)|u)if(o=v[r+20>>2],p[o>>2]>i){if(u>>>0>1)break r;if(f=v[a+4>>2],!v[f+72>>2])break e;f=f+68|0}else{if(f=v[r+12>>2]-1|0,p[o+(f<<2)>>2]<=i||(f=Pe(r+8|0,i,1)-1|0),u=v[r+36>>2],!v[4+(u+m(f,12)|0)>>2])break e;f=u+m(f,12)|0}else{if(f=v[a+4>>2],!v[f+72>>2])break e;f=f+68|0}r=Fi(n,v[r+4>>2],f);break n}r=0}af(a,r)}},function(r){return v[4+(r|=0)>>2]+67108864|0},ae,function(r){at(ae(r|=0))},la,function(r){return v[(r|=0)>>2]=9164,so(r+16|0),0|r},function(r){v[(r|=0)>>2]=9164,so(r+16|0),at(r)},function(){return 20712},Of,function(r){return l[117+(r|=0)|0]},function(r,n){n|=0,f[117+(r|=0)|0]=n},so,function(r){at(so(r|=0))},function(r){return v[(r|=0)>>2]=9212,lf(r+8|0),0|r},function(r){v[(r|=0)>>2]=9212,lf(r+8|0),at(r)},la,tt,Xo,function(){return 20724},function(r){var n;return r|=0,su(n=Xf(64),No(r)),Yi(r,n),0|n},la,Xo,function(){return 20736},function(r){var n;return r|=0,dt(n=Xf(68),No(r)),Yi(r,n),v[n+64>>2]=v[r+64>>2],0|n},la,function(r){return v[(r|=0)>>2]=9280,vo(r+24|0),0|Ut(r)},function(r){v[(r|=0)>>2]=9280,vo(r+24|0),at(Ut(r))},function(){return 20748},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=w(0),b=w(0),k=0,s=0,l=w(0);D=f=D-32|0,n=v[v[n+36>>2]+(v[r+20>>2]<<2)>>2],o=v[n+8>>2];r:if(0|da[v[v[o>>2]+16>>2]](o))if(o=v[r+36>>2],p[o>>2]>i){n:switch(0|u){case 0:r=v[n+4>>2],p[n+20>>2]=p[r+28>>2],p[n+24>>2]=p[r+32>>2],p[n+28>>2]=p[r+36>>2],p[n+32>>2]=p[r+40>>2],ci(n+16|0);break r;case 1:break n;default:break r}r=v[n+4>>2],v[f+12>>2]=9308,u=v[r+40>>2],v[f+24>>2]=v[r+36>>2],v[f+28>>2]=u,u=v[r+32>>2],v[f+16>>2]=v[r+28>>2],v[f+20>>2]=u,e=p[f+24>>2],i=p[f+16>>2],a=p[f+28>>2],c=p[n+24>>2],p[n+24>>2]=w(w(p[f+20>>2]-c)*t)+c,c=e,e=p[n+28>>2],p[n+28>>2]=w(w(c-e)*t)+e,e=p[n+32>>2],p[n+32>>2]=w(w(a-e)*t)+e,e=p[n+20>>2],p[n+20>>2]=w(w(i-e)*t)+e,ci(n+16|0)}else o=o+(v[r+28>>2]<<2)|0,p[o-20>>2]<=i?(i=p[o-4>>2],e=p[o-8>>2],c=p[o-12>>2],a=p[o-16>>2]):(o=(s=(k=Pe(r+24|0,i,5))<<2)+v[r+36>>2]|0,b=p[o-16>>2],c=p[o-12>>2],e=p[o-8>>2],l=p[o-4>>2],a=i,i=p[o>>2],a=bn(r,((k>>>0)/5|0)-1|0,w(w(1)-w(w(a-i)/w(p[o-20>>2]-i)))),r=v[r+36>>2]+s|0,i=w(l+w(a*w(p[r+16>>2]-l))),e=w(e+w(a*w(p[r+12>>2]-e))),c=w(c+w(a*w(p[r+8>>2]-c))),a=w(b+w(a*w(p[r+4>>2]-b)))),r=n+16|0,t!=w(1)?(u||(u=Ko(v[n+4>>2]),p[n+20>>2]=p[u+4>>2],p[n+24>>2]=p[u+8>>2],p[n+28>>2]=p[u+12>>2],p[n+32>>2]=p[u+16>>2],ci(r)),b=p[n+32>>2],p[n+32>>2]=b+w(w(i-b)*t),i=p[n+28>>2],p[n+28>>2]=i+w(w(e-i)*t),e=p[n+24>>2],p[n+24>>2]=e+w(w(c-e)*t),e=p[n+20>>2],p[n+20>>2]=e+w(w(a-e)*t),ci(r)):(p[n+32>>2]=i,p[n+28>>2]=e,p[n+24>>2]=c,p[n+20>>2]=a,ci(r));D=f+32|0},function(r){return v[20+(r|=0)>>2]+83886080|0},ka,la,la,Mt,function(r){Mt(r|=0),at(r)},function(){return 20772},la,Ut,va,function(){return 20784},la,function(r){return v[(r|=0)>>2]=9372,ao(r+40|0),vo(r+24|0),0|Ut(r)},function(r){v[(r|=0)>>2]=9372,ao(r+40|0),vo(r+24|0),at(Ut(r))},function(){return 20796},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a,c=0,b=0,k=0,s=w(0),l=0;D=a=D-16|0,n=v[v[n+36>>2]+(v[r+20>>2]<<2)>>2],f=v[n+8>>2];r:if(0|da[v[v[f>>2]+16>>2]](f)&&(o=v[n+60>>2])&&!(!Tf(0|da[v[v[o>>2]+8>>2]](o),21164)|v[o+56>>2]!=v[r+56>>2])){k=v[n+72>>2]?u:0,u=n+68|0,f=v[v[r+52>>2]+4>>2];n:if(p[v[r+36>>2]>>2]>i){e:switch(0|k){case 0:v[n+72>>2]=0;break r;case 2:case 3:break r;case 1:break e;default:break n}if(t==w(1)){v[n+72>>2]=0;break r}if(v[a+12>>2]=0,yn(u,f,a+12|0),!v[o+24>>2]){if(!f)break r;for(n=v[n+80>>2],u=v[o+48>>2],r=0;e=p[(c=(o=r<<2)+n|0)>>2],p[c>>2]=w(w(p[u+o>>2]-e)*t)+e,(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(e=w(w(1)-t),n=v[n+80>>2],r=0;p[(u=n+(r<<2)|0)>>2]=e*p[u>>2],(0|f)!=(0|(r=r+1|0)););break r}if(v[a+8>>2]=0,yn(u,f,a+8|0),u=v[r+28>>2]-1|0,p[v[r+36>>2]+(u<<2)>>2]<=i){if(r=v[r+52>>2],t==w(1)){if(3==(0|k)){if(v[o+24>>2]){if(!f)break r;for(n=v[n+80>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;p[(c=(o=r<<2)+n|0)>>2]=p[u+o>>2]+p[c>>2],(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(c=v[n+80>>2],o=v[o+48>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;p[(b=(n=r<<2)+c|0)>>2]=w(p[n+u>>2]-p[n+o>>2])+p[b>>2],(0|f)!=(0|(r=r+1|0)););break r}Ff(v[n+80>>2],v[12+(r+(u<<4)|0)>>2],f<<2);break r}n:switch(0|k){case 0:if(v[o+24>>2]){if(!f)break r;for(n=v[n+80>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;p[(o=r<<2)+n>>2]=p[u+o>>2]*t,(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(c=v[n+80>>2],o=v[o+48>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;e=p[(n=r<<2)+o>>2],p[n+c>>2]=w(w(p[n+u>>2]-e)*t)+e,(0|f)!=(0|(r=r+1|0)););break r;case 1:case 2:if(!f)break r;for(n=v[n+80>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;e=p[(c=(o=r<<2)+n|0)>>2],p[c>>2]=w(w(p[u+o>>2]-e)*t)+e,(0|f)!=(0|(r=r+1|0)););break r;case 3:break n;default:break r}if(v[o+24>>2]){if(!f)break r;for(n=v[n+80>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;p[(c=(o=r<<2)+n|0)>>2]=w(p[u+o>>2]*t)+p[c>>2],(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(c=v[n+80>>2],o=v[o+48>>2],u=v[12+(r+(u<<4)|0)>>2],r=0;p[(b=(n=r<<2)+c|0)>>2]=w(w(p[n+u>>2]-p[n+o>>2])*t)+p[b>>2],(0|f)!=(0|(r=r+1|0)););}else if(c=We(r+24|0,i),u=v[r+52>>2],l=r,b=c-1|0,r=v[r+36>>2],e=p[r+(c<<2)>>2],e=bn(l,b,w(w(1)-w(w(i-e)/w(p[r+(b<<2)>>2]-e)))),t!=w(1)){n:switch(0|k){case 0:if(v[o+24>>2]){if(!f)break r;for(o=v[n+80>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],r=0;i=p[(n=r<<2)+u>>2],p[n+o>>2]=w(w(w(p[n+c>>2]-i)*e)+i)*t,(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(k=v[n+80>>2],o=v[o+48>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],n=0;i=p[(r=n<<2)+u>>2],s=w(w(w(p[r+c>>2]-i)*e)+i),i=p[r+o>>2],p[r+k>>2]=w(w(s-i)*t)+i,(0|f)!=(0|(n=n+1|0)););break r;case 1:case 2:if(!f)break r;for(o=v[n+80>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],r=0;b=(n=r<<2)+o|0,i=p[n+u>>2],s=w(w(w(p[n+c>>2]-i)*e)+i),i=p[b>>2],p[b>>2]=w(w(s-i)*t)+i,(0|f)!=(0|(r=r+1|0)););break r;case 3:break n;default:break r}if(v[o+24>>2]){if(!f)break r;for(o=v[n+80>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],r=0;b=(n=r<<2)+o|0,i=p[n+u>>2],p[b>>2]=w(w(w(w(p[n+c>>2]-i)*e)+i)*t)+p[b>>2],(0|f)!=(0|(r=r+1|0)););}else if(f)for(k=v[n+80>>2],o=v[o+48>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],n=0;b=(r=n<<2)+k|0,i=p[r+u>>2],p[b>>2]=w(w(w(w(w(p[r+c>>2]-i)*e)+i)-p[r+o>>2])*t)+p[b>>2],(0|f)!=(0|(n=n+1|0)););}else{if(3!=(0|k)){if(!f)break r;for(o=v[n+80>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],r=0;i=p[(n=r<<2)+u>>2],p[n+o>>2]=w(w(p[n+c>>2]-i)*e)+i,(0|f)!=(0|(r=r+1|0)););break r}if(v[o+24>>2]){if(!f)break r;for(o=v[n+80>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],r=0;b=(n=r<<2)+o|0,i=p[n+u>>2],p[b>>2]=p[b>>2]+w(w(w(p[n+c>>2]-i)*e)+i),(0|f)!=(0|(r=r+1|0)););break r}if(!f)break r;for(k=v[n+80>>2],o=v[o+48>>2],c=v[12+(u+(c<<4)|0)>>2],u=v[12+(u+(b<<4)|0)>>2],n=0;b=(r=n<<2)+k|0,i=p[r+u>>2],p[b>>2]=w(w(w(w(p[r+c>>2]-i)*e)+i)-p[r+o>>2])+p[b>>2],(0|f)!=(0|(n=n+1|0)););}}D=a+16|0},function(r){return 100663296+(v[v[56+(r|=0)>>2]+60>>2]+v[r+20>>2]|0)|0},ao,function(r){at(ao(r|=0))},la,function(r){return v[(r|=0)>>2]=9416,co(r+20|0),vo(r+4|0),0|r},function(r){v[(r|=0)>>2]=9416,co(r+20|0),vo(r+4|0),at(r)},function(){return 20808},function(r,n,e,i,f,t,u,o){r|=0,n|=0,i=w(i),f|=0,f=n+40|0;r:if(1!=(0|(o|=0))|(u|=0)){if(o=v[r+16>>2],p[o>>2]>i){if(u>>>0>1)break r;if(u=0,v[n+44>>2]=0,ca(f,v[n+28>>2]),!(r=v[n+28>>2]))break r;for(;Sn(f,v[n+36>>2]+(u<<2)|0),(0|r)!=(0|(u=u+1|0)););}else if(u=v[r+8>>2]-1|0,p[o+(u<<2)>>2]<=i||(u=We(r+4|0,i)-1|0),r=v[r+32>>2]+(u<<4)|0,o=v[r+4>>2])for(u=0;v[(f=u<<2)+v[n+52>>2]>>2]=v[v[n+36>>2]+(v[f+v[r+12>>2]>>2]<<2)>>2],(0|o)!=(0|(u=u+1|0)););else if(u=0,v[n+44>>2]=0,r=v[n+28>>2])for(;Sn(f,v[n+36>>2]+(u<<2)|0),(0|r)!=(0|(u=u+1|0)););}else{if(u=0,v[n+44>>2]=0,ca(f,v[n+28>>2]),!(r=v[n+28>>2]))break r;for(;Sn(f,v[n+36>>2]+(u<<2)|0),(0|r)!=(0|(u=u+1|0)););}},function(){return 134217728},co,function(r){at(co(r|=0))},function(r){return v[(r|=0)>>2]=9460,lf(r+20|0),0|r},function(r){v[(r|=0)>>2]=9460,lf(r+20|0),at(r)},function(r){return v[(r|=0)>>2]=9476,lf(r+36|0),lf(r+24|0),lf(r+4|0),0|r},function(r){v[(r|=0)>>2]=9476,lf(r+36|0),lf(r+24|0),lf(r+4|0),at(r)},la,Jf,function(r){Jf(r|=0),at(r)},function(){return 20820},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=0,c=0;r:if(f){if(a=v[r+8>>2],e>i)da[v[v[r>>2]+12>>2]](r,n,e,w(34028234663852886e22),f,t,u,o),o=v[r+16>>2],e=w(-1);else if(o=v[r+16>>2],p[(o+(a<<2)|0)-4>>2]<=e)break r;if(!((t=p[o>>2])>i)){o=0;n:if(!(e>31,c=v[r+16>>2],e=p[c+(u<<2)>>2];;){if((0|(o=u))<=0){o=n;break n}if(e!=p[((u=o-1|0)<<2)+c>>2])break}if(!(o>>>0>=a>>>0))for(;;){if(!(p[(n=o<<2)+v[r+16>>2]>>2]<=i))break r;if(Sn(f,n+v[r+32>>2]|0),(0|a)==(0|(o=o+1|0)))break}}}},function(){return 117440512},Yo,va,la,function(r){return v[(r|=0)>>2]=9556,so(r+8|0),0|r},function(r){v[(r|=0)>>2]=9556,so(r+8|0),at(r)},function(){return 20836},function(r){var n=0,e=0,i=0;switch(v[12+(r|=0)>>2]-1|0){case 0:return n=v[r+40>>2],void gr(v[v[r+20>>2]>>2],p[n+100>>2],p[n+112>>2],l[r+28|0],l[r+29|0],l[v[r+4>>2]+50|0],p[r+32>>2]);case 1:n=v[r+20>>2],e=v[n>>2],i=v[n+4>>2],n=v[r+40>>2],ur(e,i,p[n+100>>2],p[n+112>>2],v[r+24>>2],l[r+29|0],p[r+36>>2],p[r+32>>2])}},So,ko,pu,la,function(r){return v[(r|=0)>>2]=9592,bo(r+24|0),0|Mt(r)},function(r){v[(r|=0)>>2]=9592,bo(r+24|0),at(Mt(r))},function(){return 20848},bo,function(r){at(bo(r|=0))},la,function(r){return v[(r|=0)>>2]=9632,vo(r+20|0),0|Ut(r)},function(r){v[(r|=0)>>2]=9632,vo(r+20|0),at(Ut(r))},function(){return 20860},function(r,n,e,i,t,u,o,a){r|=0,n|=0,e=w(e),i=w(i),t|=0,u=w(u),o|=0,a|=0;var c=0,b=w(0),k=w(0);r:{n:{e:{n=v[v[n+68>>2]+(v[r+36>>2]<<2)>>2];i:if(0|da[v[v[n>>2]+16>>2]](n)){if(t=v[r+32>>2],p[t>>2]>i){f:switch(0|o){case 0:r=v[n+4>>2],p[n+32>>2]=p[r+52>>2],p[n+36>>2]=p[r+56>>2];break e;case 1:break f;default:break i}r=v[n+4>>2],e=p[n+32>>2],p[n+32>>2]=w(w(p[r+52>>2]-e)*u)+e,e=p[n+36>>2],p[n+36>>2]=w(w(p[r+56>>2]-e)*u)+e;break e}if(c=v[r+24>>2],p[(t+(c<<2)|0)-24>>2]<=i){if(!o){if(r=t+(c<<2)|0,t=v[n+4>>2],e=p[t+52>>2],p[n+32>>2]=w(w(p[r-20>>2]-e)*u)+e,e=p[t+56>>2],p[n+36>>2]=w(w(p[r-16>>2]-e)*u)+e,1==(0|a))break n;break r}if(r=t+(c<<2)|0,e=p[n+32>>2],p[n+32>>2]=w(w(p[r-20>>2]-e)*u)+e,e=p[n+36>>2],p[n+36>>2]=w(w(p[r-16>>2]-e)*u)+e,a)break i;break r}if(t=Pe(r+20|0,i,6),c=v[r+32>>2]+(t<<2)|0,e=p[c-16>>2],b=p[c-20>>2],k=i,i=p[c>>2],i=bn(r,((0|t)/6|0)-1|0,w(w(1)-w(w(k-i)/w(p[c-24>>2]-i)))),!o){if(c=v[r+32>>2],k=w(w(w(p[4+(o=c+(t<<2)|0)>>2]-b)*i)+b),t=v[n+4>>2],b=p[t+52>>2],p[n+32>>2]=w(w(k-b)*u)+b,i=w(w(w(p[o+8>>2]-e)*i)+e),e=p[t+56>>2],p[n+36>>2]=w(w(i-e)*u)+e,1==(0|a))break n;return e=p[(c+(v[r+24>>2]<<2)|0)-12>>2],r=w(g(e))>2]=r,f[n+28|0]=p[o-8>>2]!=w(0),void(f[n+29|0]=p[o-4>>2]!=w(0))}r=v[r+32>>2]+(t<<2)|0,k=w(w(w(p[r+4>>2]-b)*i)+b),b=p[n+32>>2],p[n+32>>2]=w(w(k-b)*u)+b,i=w(w(w(p[r+8>>2]-e)*i)+e),e=p[n+36>>2],p[n+36>>2]=w(w(i-e)*u)+e,a||(e=p[r-12>>2],t=w(g(e))>2]=t,f[n+28|0]=p[r-8>>2]!=w(0),f[n+29|0]=p[r-4>>2]!=w(0))}return}return v[n+24>>2]=v[r+44>>2],f[n+28|0]=l[r+48|0],void(f[n+29|0]=l[r+49|0])}return v[n+24>>2]=v[t+44>>2],f[n+28|0]=l[t+48|0],void(f[n+29|0]=l[t+49|0])}e=p[r-12>>2],t=w(g(e))>2]=t,f[n+28|0]=p[r-8>>2]!=w(0),f[n+29|0]=p[r-4>>2]!=w(0)},function(r){return v[36+(r|=0)>>2]+150994944|0},function(r){return v[(r|=0)>>2]=9676,lf(r+24|0),lf(r+8|0),0|r},function(r){v[(r|=0)>>2]=9676,lf(r+24|0),lf(r+8|0),at(r)},la,la,la,function(){return 20888},function(r,n){return r|=0,(n=w(n))<=w(.5)?w(w(wr(w(n+n),w(v[r+4>>2]))*w(.5))):(n=w(n+w(-1)),r=v[r+4>>2],w(w(w(wr(w(n+n),w(0|r))/w(1&r?2:-2))+w(1))))},function(r,n,e,i){return r|=0,n=w(n),e=w(e),i=w(i),w(w(w(w(e-n)*w(da[v[v[r>>2]+4>>2]](r,i)))+n))},Yo,sa,function(){return 20900},function(r,n){return r|=0,n=w(n),r=v[r+4>>2],w(w(w(wr(w(n+w(-1)),w(0|r))*w(1&r?1:-1))+w(1)))},sa,la,Ee,function(r){Ee(r|=0),at(r)},function(){return 20912},function(r){var n,e,i=0,t=0;return v[100+(r|=0)>>2]?0|xr(r):(Mr(n=Xf(236),No(r)),i=v[r+68>>2],(e=v[n+72>>2])&&(!(t=v[n+68>>2])|(0|i)==(0|t)||da[0|e](t)),v[n+72>>2]=0,v[n+68>>2]=i,p[n+180>>2]=p[r+180>>2],p[n+184>>2]=p[r+184>>2],p[n+188>>2]=p[r+188>>2],p[n+192>>2]=p[r+192>>2],f[n+228|0]=l[r+228|0],v[n+232>>2]=v[r+232>>2],p[n+76>>2]=p[r+76>>2],p[n+80>>2]=p[r+80>>2],p[n+84>>2]=p[r+84>>2],p[n+88>>2]=p[r+88>>2],p[n+92>>2]=p[r+92>>2],p[n+96>>2]=p[r+96>>2],ee(n+168|0,r+168|0),p[n+208>>2]=p[r+208>>2],p[n+212>>2]=p[r+212>>2],p[n+216>>2]=p[r+216>>2],p[n+220>>2]=p[r+220>>2],ci(n+204|0),Yi(r,n),v[n+124>>2]=0,_i(n+120|0,r+120|0),v[n+108>>2]=0,_i(n+104|0,r+104|0),v[n+140>>2]=0,vn(n+136|0,r+136|0),i=v[r+224>>2],v[n+156>>2]=0,v[n+224>>2]=i,vn(i=n+152|0,i),p[n+196>>2]=p[r+196>>2],p[n+200>>2]=p[r+200>>2],0|n)},function(r){return 0|Ee((r|=0)-64|0)},function(r){Ee(r=(r|=0)-64|0),at(r)},lo,function(r){at(lo(r|=0))},la,function(r){return v[(r|=0)>>2]=9804,vo(r- -64|0),0|tt(r)},function(r){v[(r|=0)>>2]=9804,vo(r- -64|0),at(tt(r))},function(){return 20924},function(r){var n;return r|=0,xi(n=Xf(84),No(r)),Yi(r,n),v[n+68>>2]=0,_i(n- -64|0,r- -64|0),f[n+80|0]=l[r+80|0],f[n+81|0]=l[r+81|0],0|n},la,function(r){return v[(r|=0)>>2]=9828,vo(r+124|0),vo(r+108|0),vo(r+92|0),vo(r+76|0),vo(r+60|0),vo(r+44|0),so(r+8|0),0|r},function(r){v[(r|=0)>>2]=9828,vo(r+124|0),vo(r+108|0),vo(r+92|0),vo(r+76|0),vo(r+60|0),vo(r+44|0),so(r+8|0),at(r)},function(){return 20936},function(r){r|=0;var n,e=w(0),i=0,t=w(0),u=w(0),o=0,a=w(0),c=w(0),b=0,k=0,s=0,h=0,d=0,y=w(0),g=w(0),F=0,A=w(0),$=w(0),I=w(0),C=0,P=w(0),E=w(0),O=0,R=0,S=0,W=w(0),G=0,U=0,j=w(0),H=w(0),L=w(0),M=w(0),_=w(0),z=w(0),x=0,J=0,K=0,B=0,N=0,q=w(0),V=0,Z=0,Y=w(0);if(D=n=D-16|0,(k=v[v[r+24>>2]+60>>2])&&Tf(0|da[v[v[k>>2]+8>>2]](k),20924)&&(q=p[r+40>>2],M=p[r+36>>2],q>w(0)|M>w(0))){K=v[r+12>>2],x=v[r+4>>2],s=v[x+48>>2],G=v[x+52>>2],v[n+12>>2]=0,yn(r+44|0,C=!!(0|G)+K|0,n+12|0),a=p[r+32>>2];r:if(2==(0|G)|2!=(0|s)){if(2==(0|G)&&(v[n+8>>2]=0,yn(r+108|0,K,n+8|0)),O=C-1|0)for(b=v[x+48>>2];;){o=v[(h=i<<2)+v[r+20>>2]>>2];n:if((c=p[v[o+4>>2]+24>>2])>2]>>2]=0}else if(2!=(0|s))e=w(c*p[o+92>>2]),t=w(e*e),e=w(c*p[o+104>>2]),e=w(T(w(t+w(e*e)))),2==(0|G)&&(p[h+v[r+120>>2]>>2]=e),e=w(w(w(a+(b?w(-0):c))*e)/c);else{if(e=a,2!=(0|G))break n;e=w(c*p[o+92>>2]),t=w(e*e),e=w(c*p[o+104>>2]),p[h+v[r+120>>2]>>2]=T(w(t+w(e*e))),e=a}if(i=i+1|0,p[v[r+56>>2]+(i<<2)>>2]=e,!(i>>>0>>0))break}}else{if(C>>>0<2)break r;for(o=v[r+56>>2],i=1;p[o+(i<<2)>>2]=a,(0|C)!=(0|(i=i+1|0)););}V=!G,U=1==v[x+44>>2],B=2==(0|s),D=R=D-16|0,h=r,u=p[r+28>>2],d=v[r+24>>2],v[R+12>>2]=0,yn(O=r+60|0,m(C,3)+2|0,R+12|0),F=r+76|0,b=(0|(i=v[k+52>>2]))/6|0,J=l[k+80|0];r:if(l[k+81|0]){if(J?(v[R+12>>2]=0,yn(F,S=i+2|0,R+12|0),Gf(k,d,2,r=i-2|0,F,0,2),Gf(k,d,0,2,F,r,2),r=v[h+88>>2],p[(i=r+(i<<2)|0)>>2]=p[r>>2],p[i+4>>2]=p[r+4>>2]):(v[R+12>>2]=0,yn(F,S=i-4|0,R+12|0),Gf(k,d,2,S,F,0,2),b=b-1|0),i=0,v[R+12>>2]=0,yn(h+92|0,b,R+12|0),s=v[h+88>>2],a=p[s+4>>2],c=p[s>>2],(0|b)>0)for(d=v[h+104>>2],o=2,e=a,t=c;P=p[(r=(N=o<<2)+s|0)>>2],_=p[r+8>>2],c=p[r+16>>2],a=w(w(w(w(w(P-_)*w(3))-t)+c)*w(.09375)),A=w(w(P-t)*w(.75)),t=w(w(w(t-w(P+P))+_)*w(.1875)),y=w(w(a*w(.1666666716337204))+w(A+t)),t=w(w(t+t)+a),W=w(y+t),t=w(a+t),j=w(W+t),A=w(j+w(a+t)),E=p[s+(4|N)>>2],z=p[r+12>>2],a=p[r+20>>2],t=w(w(w(w(w(E-z)*w(3))-e)+a)*w(.09375)),$=w(w(E-e)*w(.75)),e=w(w(w(e-w(E+E))+z)*w(.1875)),g=w(w(t*w(.1666666716337204))+w($+e)),$=w(w(e+e)+t),e=w(g+$),L=w(t+$),$=w(e+L),t=w($+w(t+L)),I=w(w(w(w(I+w(T(w(w(y*y)+w(g*g)))))+w(T(w(w(W*W)+w(e*e)))))+w(T(w(w(j*j)+w($*$)))))+w(T(w(w(A*A)+w(t*t))))),p[d+(i<<2)>>2]=I,o=o+6|0,j=a,e=a,W=c,t=c,(0|b)!=(0|(i=i+1|0)););if(e=I,e=U?e:w(e/p[(v[k+76>>2]+(b<<2)|0)-4>>2]),!(!B|(0|C)<2))for(i=v[h+56>>2],r=1;p[(o=i+(r<<2)|0)>>2]=I*p[o>>2],(0|C)!=(0|(r=r+1|0)););if(!((0|C)<=0))for(y=w(u*e),S=S-4|0,s=-1,i=0,r=0,k=0,b=0,u=w(0);;){Y=p[v[h+56>>2]+(b<<2)>>2],y=w(y+Y);n:{e:{if(J)o=0,e=Cr(y,I),e=w(e+(eI)break e;o=r,e=y}for(d=v[h+104>>2];o=(r=o)+1|0,(t=p[(U=d+(r<<2)|0)>>2])>2],e=w(w(A-e)/w(t-e))):e=w(e/t),A=e,(0|r)!=(0|s)){for(d=v[h+136>>2],i=v[h+88>>2]+m(r,24)|0,P=p[i+8>>2],_=p[i+16>>2],c=p[i>>2],W=p[i+24>>2],$=w(w(w(w(w(P-_)*w(3))-c)+W)*w(.006000000052154064)),g=w(w(w(c-w(P+P))+_)*w(.029999999329447746)),e=w(w($*w(.1666666716337204))+w(w(w(P-c)*w(.30000001192092896))+g)),E=p[i+12>>2],z=p[i+20>>2],a=p[i+4>>2],j=p[i+28>>2],L=w(w(w(w(w(E-z)*w(3))-a)+j)*w(.006000000052154064)),u=w(w(w(a-w(E+E))+z)*w(.029999999329447746)),t=w(w(L*w(.1666666716337204))+w(w(w(E-a)*w(.30000001192092896))+u)),H=w(T(w(w(e*e)+w(t*t)))),p[d>>2]=H,u=w(w(u+u)+L),g=w(w(g+g)+$),i=1;e=w(g+e),t=w(u+t),H=w(H+w(T(w(w(e*e)+w(t*t))))),p[(i<<2)+d>>2]=H,u=w(L+u),g=w($+g),8!=(0|(i=i+1|0)););e=w(g+e),t=w(u+t),H=w(H+w(T(w(w(e*e)+w(t*t))))),p[d+32>>2]=H,e=w(w($+g)+e),$=w(e*e),e=w(w(L+u)+t),u=w(H+w(T(w($+w(e*e))))),p[d+36>>2]=u,s=r,i=0}else d=v[h+136>>2];for(o=i,e=w(A*u);o=(i=o)+1|0,(t=p[(U=(i<<2)+d|0)>>2])>2],e=w(w(w(A-e)/w(t-e))+w(0|i))):e=w(e/t),Br(w(e*w(.10000000149011612)),c,a,P,E,_,z,W,j,O,k,!!(0|b)&Y>2]+(o<<2)>>2],!(!B|(0|C)<2))for(s=v[h+56>>2],r=1;p[(b=s+(r<<2)|0)>>2]=a*p[b>>2],(0|C)!=(0|(r=r+1|0)););if(v[R+12>>2]=0,yn(F,8,R+12|0),(0|C)<=0)break r;for(u=w(u*(U?a:w(1))),U=i-4|0,B=i-6|0,s=-1,r=0,b=0;;){t=p[v[h+56>>2]+(S<<2)>>2],u=w(u+t);n:{if(J)e=Cr(u,a),e=w(e+(ea){-3!=(0|s)&&Gf(k,d,B,4,F,0,2),me(w(u-a),F,0,O,b),s=-3;break n}i=r,e=u}for(N=v[k+76>>2];i=(r=i)+1|0,(c=p[(Z=N+(r<<2)|0)>>2])>2],e=w(w(A-e)/w(c-e))):e=w(e/c),(0|r)!=(0|s)&&(!J|(0|r)!=(0|o)?(Gf(k,d,m(r,6)+2|0,8,F,0,2),s=r):(Gf(k,d,U,4,F,0,2),Gf(k,d,0,4,F,4,2),s=o)),i=v[h+88>>2],Br(e,p[i>>2],p[i+4>>2],p[i+8>>2],p[i+12>>2],p[i+16>>2],p[i+20>>2],p[i+24>>2],p[i+28>>2],O,b,!!(0|S)&t>2],e=p[r+4>>2],a=p[r>>2],(W=p[x+56>>2])==w(0)?r=1==(0|G):(r=v[v[h+24>>2]+8>>2],W=w(W*(w(w(p[r+92>>2]*p[r+108>>2])-w(p[r+104>>2]*p[r+96>>2]))>w(0)?w(.01745329238474369):w(-.01745329238474369))),r=0),K)for(i=0,s=3;o=v[(k=i<<2)+v[h+20>>2]>>2],c=p[o+100>>2],p[o+100>>2]=w(w(a-c)*q)+c,c=p[o+112>>2],p[o+112>>2]=w(w(e-c)*q)+c,b=v[O+12>>2]+(s<<2)|0,c=p[b>>2],y=w(c-a),a=p[b+4>>2],e=w(a-e),2==(0|G)&&(t=p[k+v[h+120>>2]>>2])>=w(9999999747378752e-21)&&(t=w(w(w(w(w(T(w(w(y*y)+w(e*e))))/t)+w(-1))*M)+w(1)),p[o+92>>2]=t*p[o+92>>2],p[o+104>>2]=t*p[o+104>>2]),M>w(0)?(j=p[o+108>>2],t=p[o+104>>2],A=p[o+96>>2],I=p[o+92>>2],u=p[b-4>>2],G&&(u=p[b+8>>2],p[4+(k+v[h+56>>2]|0)>>2]>2]+24>>2],e=w(w(w(w(g*w(w(E*I)+w(t*P)))-e)*M)+a),a=w(w(w(w(g*w(w(P*I)-w(t*E)))-y)*M)+c)):(u=w(W+u),e=a,a=c),u>w(3.1415927410125732)?u=w(u+w(-6.2831854820251465)):u>2]=w(u*A)+w(j*c),p[o+104>>2]=w(u*I)+w(t*c),p[o+96>>2]=w(c*A)-w(j*u),p[o+92>>2]=w(c*I)-w(t*u)):(e=a,a=c),f[o+88|0]=0,s=s+3|0,(0|K)!=(0|(i=i+1|0)););}D=n+16|0},function(r){return l[140+(r|=0)|0]},function(r,n){n|=0,f[140+(r|=0)|0]=n},pu,la,function(r){return v[(r|=0)>>2]=9864,bo(r+24|0),0|Mt(r)},function(r){v[(r|=0)>>2]=9864,bo(r+24|0),at(Mt(r))},function(){return 20948},la,function(r){return v[(r|=0)>>2]=9888,vo(r+20|0),0|Ut(r)},function(r){v[(r|=0)>>2]=9888,vo(r+20|0),at(Ut(r))},function(){return 20960},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=0,b=w(0);r:if(n=v[v[n+100>>2]+(v[r+36>>2]<<2)>>2],0|da[v[v[n>>2]+16>>2]](n)){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return r=v[n+4>>2],p[n+36>>2]=p[r+68>>2],void(p[n+40>>2]=p[r+72>>2]);case 1:break n;default:break r}return r=v[n+4>>2],e=p[n+36>>2],p[n+36>>2]=w(w(p[r+68>>2]-e)*t)+e,e=p[n+40>>2],void(p[n+40>>2]=w(w(p[r+72>>2]-e)*t)+e)}if(f=f+(v[r+24>>2]<<2)|0,p[f-12>>2]<=i?(i=p[f-4>>2],e=p[f-8>>2]):(f=(c=(o=Pe(r+20|0,i,3))<<2)+v[r+32>>2]|0,e=p[f-8>>2],b=p[f-4>>2],a=i,i=p[f>>2],a=bn(r,((0|o)/3|0)-1|0,w(w(1)-w(w(a-i)/w(p[f-12>>2]-i)))),r=v[r+32>>2]+c|0,i=w(b+w(a*w(p[r+8>>2]-b))),e=w(e+w(a*w(p[r+4>>2]-e)))),!u)return a=e,r=v[n+4>>2],e=p[r+68>>2],p[n+36>>2]=w(w(a-e)*t)+e,e=p[r+72>>2],void(p[n+40>>2]=w(w(i-e)*t)+e);a=e,e=p[n+36>>2],p[n+36>>2]=w(w(a-e)*t)+e,e=p[n+40>>2],p[n+40>>2]=w(w(i-e)*t)+e}},function(r){return v[36+(r|=0)>>2]+218103808|0},la,Ft,function(r){Ft(r|=0),at(r)},function(){return 20972},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=0,c=w(0);r:if(n=v[v[n+100>>2]+(v[r+36>>2]<<2)>>2],0|da[v[v[n>>2]+16>>2]](n)){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return void(p[n+28>>2]=p[v[n+4>>2]+60>>2]);case 1:break n;default:break r}return e=p[n+28>>2],void(p[n+28>>2]=w(w(p[v[n+4>>2]+60>>2]-e)*t)+e)}if(f=f+(v[r+24>>2]<<2)|0,p[f-8>>2]<=i?e=p[f-4>>2]:(f=(a=(o=Pe(r+20|0,i,2))<<2)+v[r+32>>2]|0,e=p[f-4>>2],c=i,i=p[f>>2],e=w(e+w(bn(r,((0|o)/2|0)-1|0,w(w(1)-w(w(c-i)/w(p[f-8>>2]-i))))*w(p[4+(v[r+32>>2]+a|0)>>2]-e)))),!u)return i=e,e=p[v[n+4>>2]+60>>2],void(p[n+28>>2]=w(w(i-e)*t)+e);i=e,e=p[n+28>>2],p[n+28>>2]=w(w(i-e)*t)+e}},function(r){return v[36+(r|=0)>>2]+184549376|0},la,function(r){at(Ft(r|=0))},function(){return 20984},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=0,c=w(0);r:if(n=v[v[n+100>>2]+(v[r+36>>2]<<2)>>2],0|da[v[v[n>>2]+16>>2]](n)){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return void(p[n+32>>2]=p[v[n+4>>2]+64>>2]);case 1:break n;default:break r}return e=p[n+32>>2],void(p[n+32>>2]=w(w(p[v[n+4>>2]+64>>2]-e)*t)+e)}if(a=v[r+24>>2],o=v[2477],p[f+(a-o<<2)>>2]<=i?e=p[f+(a+v[2479]<<2)>>2]:(f=Pe(r+20|0,i,o),a=v[r+32>>2],e=p[a+(f+v[2479]<<2)>>2],c=i,i=p[a+(f<<2)>>2],e=w(e+w(bn(r,((0|f)/(0|o)|0)-1|0,w(w(1)-w(w(c-i)/w(p[a+(f+v[2478]<<2)>>2]-i))))*w(p[v[r+32>>2]+(f+v[2480]<<2)>>2]-e)))),!u)return i=e,e=p[v[n+4>>2]+64>>2],void(p[n+32>>2]=w(w(i-e)*t)+e);i=e,e=p[n+32>>2],p[n+32>>2]=w(w(i-e)*t)+e}},function(r){return v[36+(r|=0)>>2]+201326592|0},la,function(r){at(jt(r|=0))},function(){return 20996},function(r){var n;return r|=0,zf(n=Xf(32),No(r)),p[n+20>>2]=p[r+20>>2],p[n+24>>2]=p[r+24>>2],p[n+28>>2]=p[r+28>>2],0|n},ka,la,function(r){var n,e=0;return v[20+(r|=0)>>2]=10052,v[r>>2]=10028,lf(r+116|0),vo(r+100|0),vo(r+84|0),v[r+20>>2]=8664,(n=v[r+28>>2])&&(e=v[r+24>>2])&&da[0|n](e),0|jt(r)},function(r){var n,e=0;v[20+(r|=0)>>2]=10052,v[r>>2]=10028,lf(r+116|0),vo(r+100|0),vo(r+84|0),v[r+20>>2]=8664,(n=v[r+28>>2])&&(e=v[r+24>>2])&&da[0|n](e),at(jt(r))},function(){return 21008},function(r){r|=0;var n,e,i,f=0,t=w(0);return Lr(n=Xf(164),No(r)),p[n+68>>2]=p[r+68>>2],p[n+72>>2]=p[r+72>>2],p[n+60>>2]=p[r+60>>2],p[n+64>>2]=p[r+64>>2],p[n+76>>2]=p[r+76>>2],p[n+80>>2]=p[r+80>>2],e=v[r+24>>2],(i=v[n+28>>2])&&(!(f=v[n+24>>2])|(0|e)==(0|f)||da[0|i](f)),v[n+28>>2]=0,v[n+24>>2]=e,ee(n+116|0,r+116|0),p[n+32>>2]=p[r+32>>2],p[n+36>>2]=p[r+36>>2],p[n+44>>2]=p[r+44>>2],p[n+48>>2]=p[r+48>>2],p[n+40>>2]=p[r+40>>2],p[n+52>>2]=p[r+52>>2],t=p[r+56>>2],v[n+104>>2]=0,p[n+56>>2]=t,_i(n+100|0,r+100|0),v[n+88>>2]=0,_i(n+84|0,r+84|0),p[n+148>>2]=p[r+148>>2],p[n+152>>2]=p[r+152>>2],p[n+156>>2]=p[r+156>>2],p[n+160>>2]=p[r+160>>2],ci(n+144|0),0|n},function(r){var n,e;return v[(r|=0)>>2]=10052,v[(n=r-20|0)>>2]=10028,lf(r+96|0),vo(r+80|0),vo(r- -64|0),v[r>>2]=8664,(e=v[r+8>>2])&&(r=v[r+4>>2])&&da[0|e](r),0|jt(n)},function(r){var n,e;v[(r|=0)>>2]=10052,v[(n=r-20|0)>>2]=10028,lf(r+96|0),vo(r+80|0),vo(r- -64|0),v[r>>2]=8664,(e=v[r+8>>2])&&(r=v[r+4>>2])&&da[0|e](r),at(jt(n))},la,function(r){return v[(r|=0)>>2]=10068,vo(r+24|0),0|Ut(r)},function(r){v[(r|=0)>>2]=10068,vo(r+24|0),at(Ut(r))},function(){return 21020},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=0,c=w(0),b=0;r:if(n=v[v[n+20>>2]+(v[r+20>>2]<<2)>>2],l[n+117|0]){if(f=v[r+36>>2],p[f>>2]>i){n:switch(0|u){case 0:return void(p[n+40>>2]=p[v[n+4>>2]+36>>2]);case 1:break n;default:break r}return e=p[n+40>>2],i=w(p[v[n+4>>2]+36>>2]-e),a=+w(i/w(-360))+16384.499999999996,r=g(a)<2147483648?~~a:-2147483648,void(p[n+40>>2]=w(w(i-w(0|m(16384-r|0,360)))*t)+e)}if(f=f+(v[r+28>>2]<<2)|0,p[f-8>>2]<=i){i=p[f-4>>2];n:{e:switch(0|u){case 3:e=p[n+40>>2];break n;case 0:return void(p[n+40>>2]=w(i*t)+p[v[n+4>>2]+36>>2]);case 1:case 2:break e;default:break r}e=p[n+40>>2],i=w(i+w(p[v[n+4>>2]+36>>2]-e)),a=+w(i/w(-360))+16384.499999999996,r=g(a)<2147483648?~~a:-2147483648,i=w(i-w(0|m(16384-r|0,360)))}return void(p[n+40>>2]=w(i*t)+e)}f=(b=(o=Pe(r+24|0,i,2))<<2)+v[r+36>>2]|0,e=p[f-4>>2],c=i,i=p[f>>2],i=bn(r,(o>>1)-1|0,w(w(1)-w(w(c-i)/w(p[f-8>>2]-i)))),c=w(p[4+(v[r+36>>2]+b|0)>>2]-e),a=+w(c/w(-360))+16384.499999999996,r=g(a)<2147483648?~~a:-2147483648,i=w(w(w(c-w(0|m(16384-r|0,360)))*i)+e);n:{e:switch(0|u){case 3:e=p[n+40>>2];break n;case 0:return a=+w(i/w(-360))+16384.499999999996,r=g(a)<2147483648?~~a:-2147483648,void(p[n+40>>2]=w(w(i-w(0|m(16384-r|0,360)))*t)+p[v[n+4>>2]+36>>2]);case 1:case 2:break e;default:break r}e=p[n+40>>2],i=w(i+w(p[v[n+4>>2]+36>>2]-e))}a=+w(i/w(-360))+16384.499999999996,r=g(a)<2147483648?~~a:-2147483648,p[n+40>>2]=w(w(i-w(0|m(16384-r|0,360)))*t)+e}},$o,la,mt,Qo,function(){return 21032},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=w(0),b=0,k=w(0),s=w(0),h=0,d=w(0),y=0,m=w(0);r:{n=v[v[n+20>>2]+(v[r+36>>2]<<2)>>2];n:if(l[n+117|0]){if(f=v[r+32>>2],p[f>>2]>i){e:switch(0|u){case 0:return r=v[n+4>>2],p[n+44>>2]=p[r+40>>2],void(p[n+48>>2]=p[r+44>>2]);case 1:break e;default:break n}return r=v[n+4>>2],e=p[n+44>>2],p[n+44>>2]=w(w(p[r+40>>2]-e)*t)+e,e=p[n+48>>2],void(p[n+48>>2]=w(w(p[r+44>>2]-e)*t)+e)}if(b=v[r+24>>2],h=v[2721],p[f+(b-h<<2)>>2]<=i?(r=v[n+4>>2],c=p[r+44>>2],i=w(p[f+(b+v[2724]<<2)>>2]*c),a=p[r+40>>2],e=w(p[f+(b+v[2723]<<2)>>2]*a)):(f=Pe(r+20|0,i,h),b=v[r+32>>2],e=p[b+(f+v[2723]<<2)>>2],a=p[b+(f+v[2724]<<2)>>2],k=i,i=p[b+(f<<2)>>2],s=bn(r,((0|f)/(0|h)|0)-1|0,w(w(1)-w(w(k-i)/w(p[b+(f+v[2722]<<2)>>2]-i)))),b=v[n+4>>2],c=p[b+44>>2],r=v[r+32>>2],i=w(c*w(a+w(s*w(p[r+(f+v[2726]<<2)>>2]-a)))),a=p[b+40>>2],e=w(w(e+w(s*w(p[r+(f+v[2725]<<2)>>2]-e)))*a)),t==w(1))return 3==(0|u)?(p[n+44>>2]=p[n+44>>2]+w(e-a),void(p[n+48>>2]=p[n+48>>2]+w(i-c))):(p[n+48>>2]=i,void(p[n+44>>2]=e));if(1==(0|o)){e:switch(0|u){case 0:return y=n,m=w(w(w(w(w(g(e))*Bt(a))-a)*t)+a),p[y+44>>2]=m,y=n,m=w(w(w(w(w(g(i))*Bt(c))-c)*t)+c),void(p[y+48>>2]=m);case 1:case 2:return c=p[n+48>>2],a=p[n+44>>2],y=n,m=w(a+w(w(w(w(g(e))*Bt(a))-a)*t)),p[y+44>>2]=m,y=n,m=w(c+w(w(w(w(g(i))*Bt(c))-c)*t)),void(p[y+48>>2]=m);case 3:break e;default:break n}return c=p[n+48>>2],k=w(g(e)),e=p[n+44>>2],a=w(k*Bt(e)),p[n+44>>2]=e+w(w(a-p[v[n+4>>2]+40>>2])*t),y=n,m=w(c+w(w(w(w(g(i))*Bt(c))-p[v[n+4>>2]+44>>2])*t)),void(p[y+48>>2]=m)}e:switch(0|u){case 0:c=Bt(e),s=p[v[n+4>>2]+44>>2];break r;case 1:case 2:a=p[n+44>>2],c=Bt(e),s=p[n+48>>2];break r;case 3:break e;default:break n}c=Bt(e),a=Bt(i),r=v[n+4>>2],p[n+44>>2]=w(c*w(g(p[n+44>>2])))+w(w(e-w(c*w(g(p[r+40>>2]))))*t),p[n+48>>2]=w(a*w(g(p[n+48>>2])))+w(w(i-w(a*w(g(p[r+44>>2]))))*t)}return}d=Bt(i),k=e,e=w(c*w(g(a))),p[n+44>>2]=w(w(k-e)*t)+e,e=w(d*w(g(s))),p[n+48>>2]=w(w(i-e)*t)+e},function(r){return v[36+(r|=0)>>2]+33554432|0},la,Qo,function(){return 21044},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=0,b=w(0);r:if(n=v[v[n+20>>2]+(v[r+36>>2]<<2)>>2],l[n+117|0]){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return r=v[n+4>>2],p[n+52>>2]=p[r+48>>2],void(p[n+56>>2]=p[r+52>>2]);case 1:break n;default:break r}return r=v[n+4>>2],e=p[n+52>>2],p[n+52>>2]=w(w(p[r+48>>2]-e)*t)+e,e=p[n+56>>2],void(p[n+56>>2]=w(w(p[r+52>>2]-e)*t)+e)}o=v[r+24>>2],c=v[2721],p[f+(o-c<<2)>>2]<=i?(i=p[f+(o+v[2724]<<2)>>2],e=p[f+(o+v[2723]<<2)>>2]):(f=Pe(r+20|0,i,c),o=v[r+32>>2],e=p[o+(f+v[2723]<<2)>>2],b=p[o+(f+v[2724]<<2)>>2],a=i,i=p[o+(f<<2)>>2],a=bn(r,((0|f)/(0|c)|0)-1|0,w(w(1)-w(w(a-i)/w(p[o+(f+v[2722]<<2)>>2]-i)))),r=v[r+32>>2],i=w(b+w(a*w(p[r+(f+v[2726]<<2)>>2]-b))),e=w(e+w(a*w(p[r+(f+v[2725]<<2)>>2]-e))));n:switch(0|u){case 0:return r=v[n+4>>2],p[n+52>>2]=w(e*t)+p[r+48>>2],void(p[n+56>>2]=w(i*t)+p[r+52>>2]);case 1:case 2:return r=v[n+4>>2],a=w(e+p[r+48>>2]),e=p[n+52>>2],p[n+52>>2]=w(w(a-e)*t)+e,e=p[n+56>>2],void(p[n+56>>2]=w(w(w(i+p[r+52>>2])-e)*t)+e);case 3:break n;default:break r}p[n+52>>2]=w(e*t)+p[n+52>>2],p[n+56>>2]=w(i*t)+p[n+56>>2]}},function(r){return v[36+(r|=0)>>2]+50331648|0},Ge,function(r){Ge(r|=0),at(r)},Du,function(r){at(Du(r|=0))},Ou,function(r){at(Ou(r|=0))},Eu,function(r){at(Eu(r|=0))},Pu,function(r){at(Pu(r|=0))},Cu,function(r){at(Cu(r|=0))},la,bi,function(r){bi(r|=0),at(r)},ka,Zu,function(r){at(Zu(r|=0))},function(r){return v[(r|=0)>>2]=10296,Wu(r+36|0),Ku(r+20|0),Wu(r+4|0),0|r},function(r){v[(r|=0)>>2]=10296,Wu(r+36|0),Ku(r+20|0),Wu(r+4|0),at(r)},function(r){return v[(r|=0)>>2]=10312,vo(r+4|0),0|r},function(r){v[(r|=0)>>2]=10312,vo(r+4|0),at(r)},Wu,function(r){at(Wu(r|=0))},Ku,function(r){at(Ku(r|=0))},function(r){return v[(r|=0)>>2]=10360,vo(r+208|0),vo(r+192|0),lo(r+176|0),vo(r+160|0),vo(r+144|0),vo(r+128|0),Wi(r+4|0),0|r},function(r){v[(r|=0)>>2]=10360,vo(r+208|0),vo(r+192|0),lo(r+176|0),vo(r+160|0),vo(r+144|0),vo(r+128|0),Wi(r+4|0),at(r)},Yu,function(r){at(Yu(r|=0))},Xu,function(r){at(Xu(r|=0))},ju,function(r){at(ju(r|=0))},et,function(r){at(et(r|=0))},nt,function(r){at(nt(r|=0))},kn,function(r){kn(r|=0),at(r)},Nu,function(r){at(Nu(r|=0))},Bu,function(r){at(Bu(r|=0))},Ju,function(r){at(Ju(r|=0))},xu,function(r){at(xu(r|=0))},_u,function(r){at(_u(r|=0))},Mu,function(r){at(Mu(r|=0))},Lu,function(r){at(Lu(r|=0))},Hu,function(r){at(Hu(r|=0))},$i,function(r){$i(r|=0),at(r)},function(r){return v[(r|=0)>>2]=10616,vo(r+20|0),Fu(r+4|0),0|r},function(r){v[(r|=0)>>2]=10616,vo(r+20|0),Fu(r+4|0),at(r)},Fu,function(r){at(Fu(r|=0))},function(r){return v[(r|=0)>>2]=10648,qu(r+4|0),0|r},function(r){v[(r|=0)>>2]=10648,qu(r+4|0),at(r)},rn,function(r){rn(r|=0),at(r)},qu,function(r){at(qu(r|=0))},se,function(r){at(se(r|=0))},Vu,function(r){at(Vu(r|=0))},function(r){return v[(r|=0)>>2]=10728,vo(r+68|0),0|r},function(r){v[(r|=0)>>2]=10728,vo(r+68|0),at(r)},function(r){return v[(r|=0)>>2]=10744,lf(r+68|0),lf(r+8|0),0|r},function(r){v[(r|=0)>>2]=10744,lf(r+68|0),lf(r+8|0),at(r)},lf,function(r){lf(r|=0),at(r)},la,Yo,va,function(){return 21080},la,function(r){return v[(r|=0)>>2]=10804,so(r+8|0),0|r},function(r){v[(r|=0)>>2]=10804,so(r+8|0),at(r)},function(){return 21092},function(r){r|=0;var n=w(0),e=0,i=0,t=w(0),u=0,o=w(0),a=w(0),c=0,b=0,k=w(0),s=w(0),h=w(0),y=w(0),F=w(0),A=w(0),$=w(0),I=w(0),C=w(0),P=w(0),E=w(0),O=w(0),R=w(0),S=w(0),W=0,G=0,U=0,j=w(0);if(i=v[r+4>>2],b=l[i+84|0],l[i+85|0]){if(b){if(k=p[r+40>>2],s=p[r+36>>2],h=p[r+32>>2],a=p[r+28>>2],u=v[r+24>>2],l[u+88|0]||Fr(u),v[r+12>>2])for(;i=v[v[r+20>>2]+(c<<2)>>2],l[i+88|0]||Fr(i),o=p[i+68>>2],o=a!=w(0)?w(w(w(p[u+68>>2]+p[v[r+4>>2]+60>>2])*a)+o):o,$=p[i+64>>2],I=p[i+60>>2],h!=w(0)&&(b=v[r+4>>2],$=w(w(w(p[u+64>>2]+p[b+68>>2])*h)+$),I=w(w(w(p[u+60>>2]+p[b+64>>2])*h)+I)),n=p[i+76>>2],t=p[i+72>>2],s!=w(0)&&(t=t>w(9999999747378752e-21)?w(t*w(w(w(w(p[u+72>>2]+w(-1))+p[v[r+4>>2]+72>>2])*s)+w(1))):t,n>w(9999999747378752e-21)&&(n=w(n*w(w(w(w(p[u+76>>2]+w(-1))+p[v[r+4>>2]+76>>2])*s)+w(1))))),C=p[i+84>>2],y=p[i+80>>2],k!=w(0)&&(C=w(w(w(p[u+84>>2]+p[v[r+4>>2]+80>>2])*k)+C)),cr(i,I,$,o,t,n,y,C),(c=c+1|0)>>>0>2];);return}if(y=p[r+40>>2],k=p[r+36>>2],a=p[r+32>>2],C=p[r+28>>2],b=v[r+24>>2],l[b+88|0]||Fr(b),v[r+12>>2])for(;u=v[v[r+20>>2]+(c<<2)>>2],l[u+88|0]||Fr(u),s=p[u+68>>2],C!=w(0)&&(n=w(w(p[b+68>>2]-s)+p[v[r+4>>2]+60>>2]),G=+w(n/w(-360))+16384.499999999996,i=g(G)<2147483648?~~G:-2147483648,s=w(w(w(n-w(0|m(16384-i|0,360)))*C)+s)),h=p[u+64>>2],o=p[u+60>>2],a!=w(0)&&(i=v[r+4>>2],h=w(w(w(w(p[b+64>>2]-h)+p[i+68>>2])*a)+h),o=w(w(w(w(p[b+60>>2]-o)+p[i+64>>2])*a)+o)),n=p[u+76>>2],t=p[u+72>>2],k!=w(0)&&(t=t>w(9999999747378752e-21)?w(w(w(w(w(p[b+72>>2]-t)+p[v[r+4>>2]+72>>2])*k)+t)/t):t,n>w(9999999747378752e-21)&&(n=w(w(w(w(w(p[b+76>>2]-n)+p[v[r+4>>2]+76>>2])*k)+n)/n))),I=p[u+84>>2],y!=w(0)&&($=w(w(p[b+84>>2]-I)+p[v[r+4>>2]+80>>2]),G=+w($/w(-360))+16384.499999999996,i=g(G)<2147483648?~~G:-2147483648,p[u+56>>2]=w(w($-w(0|m(16384-i|0,360)))*y)+p[u+56>>2]),cr(u,o,h,s,t,n,p[u+80>>2],I),(c=c+1|0)>>>0>2];);}else if(b){if(D=u=D-16|0,v[r+12>>2])for(i=v[r+4>>2],c=v[r+24>>2],F=p[c+92>>2],P=p[c+108>>2],A=p[c+104>>2],E=p[c+96>>2],n=w(w(F*P)-w(A*E))>w(0)?w(.01745329238474369):w(-.01745329238474369),C=w(p[i+80>>2]*n),I=w(p[i+60>>2]*n),R=p[r+40>>2],S=p[r+36>>2],s=p[r+32>>2],b=(h=p[r+28>>2])!=w(0),$=w(w(T(w(w(E*E)+w(P*P))))+w(-1)),o=w(w(T(w(w(F*F)+w(A*A))))+w(-1));;){e=v[v[r+20>>2]+(W<<2)>>2],h!=w(0)&&(k=p[e+108>>2],a=p[e+104>>2],y=p[e+96>>2],t=p[e+92>>2],(n=w(I+Pr(A,F)))>w(3.1415927410125732)?n=w(n+w(-6.2831854820251465)):n>2]=w(n*y)+w(k*O),p[e+104>>2]=w(n*t)+w(a*O),p[e+96>>2]=w(O*y)-w(k*n),p[e+92>>2]=w(O*t)-w(a*n)),i=b,s!=w(0)&&(i=v[r+4>>2],Zi(c,p[i+64>>2],p[i+68>>2],u+12|0,u+8|0),p[e+100>>2]=w(p[u+12>>2]*s)+p[e+100>>2],p[e+112>>2]=w(p[u+8>>2]*s)+p[e+112>>2],i=1);r:{n:{e:{if(!(S>w(0))){if(R>w(0))break e;if(i)break n;break r}if(i=v[r+4>>2],n=w(w(w(o+p[i+72>>2])*S)+w(1)),p[e+92>>2]=p[e+92>>2]*n,p[e+104>>2]=n*p[e+104>>2],n=w(w(w($+p[i+76>>2])*S)+w(1)),p[e+96>>2]=p[e+96>>2]*n,p[e+108>>2]=n*p[e+108>>2],!(R>w(0)))break n}(n=w(Pr(P,E)-Pr(A,F)))>w(3.1415927410125732)?n=w(n+w(-6.2831854820251465)):n>2],n=p[e+96>>2],t=w(t+Pr(y,n)),n=w(T(w(w(n*n)+w(y*y)))),U=e,j=w(Wr(t)*n),p[U+108>>2]=j,U=e,j=w(Rr(t)*n),p[U+96>>2]=j}f[e+88|0]=0}if(!((W=W+1|0)>>>0>2]))break}D=u+16|0}else{if(D=u=D-16|0,v[r+12>>2])for(i=v[r+4>>2],c=v[r+24>>2],F=p[c+92>>2],P=p[c+108>>2],A=p[c+104>>2],E=p[c+96>>2],n=w(w(F*P)-w(A*E))>w(0)?w(.01745329238474369):w(-.01745329238474369),y=w(p[i+80>>2]*n),C=w(p[i+60>>2]*n),R=p[r+40>>2],S=p[r+36>>2],s=p[r+32>>2],b=(h=p[r+28>>2])!=w(0),I=w(T(w(w(E*E)+w(P*P)))),$=w(T(w(w(F*F)+w(A*A))));;){e=v[v[r+20>>2]+(W<<2)>>2],h!=w(0)&&(k=p[e+108>>2],a=p[e+96>>2],n=Pr(A,F),o=p[e+104>>2],t=p[e+92>>2],(n=w(C+w(n-Pr(o,t))))>w(3.1415927410125732)?n=w(n+w(-6.2831854820251465)):n>2]=w(n*a)+w(k*O),p[e+104>>2]=w(n*t)+w(o*O),p[e+96>>2]=w(O*a)-w(k*n),p[e+92>>2]=w(O*t)-w(o*n)),i=b,s!=w(0)&&(i=v[r+4>>2],Zi(c,p[i+64>>2],p[i+68>>2],u+12|0,u+8|0),n=p[e+100>>2],p[e+100>>2]=w(w(p[u+12>>2]-n)*s)+n,n=p[e+112>>2],p[e+112>>2]=w(w(p[u+8>>2]-n)*s)+n,i=1);r:{n:{e:{i:{if(S>w(0)){if(o=p[e+92>>2],t=p[e+104>>2],(n=w(T(w(w(o*o)+w(t*t)))))>w(9999999747378752e-21)&&(n=w(w(w(w(w($-n)+p[v[r+4>>2]+72>>2])*S)+n)/n)),k=w(t*n),p[e+104>>2]=k,t=w(o*n),p[e+92>>2]=t,a=p[e+96>>2],o=p[e+108>>2],(n=w(T(w(w(a*a)+w(o*o)))))>w(9999999747378752e-21)&&(n=w(w(w(w(w(I-n)+p[v[r+4>>2]+76>>2])*S)+n)/n)),o=w(o*n),p[e+108>>2]=o,n=w(a*n),p[e+96>>2]=n,R>w(0))break i;break n}if(!(R>w(0)))break e;t=p[e+92>>2],k=p[e+104>>2],o=p[e+108>>2],n=p[e+96>>2]}a=Pr(o,n),(t=w(w(Pr(P,E)-Pr(A,F))-w(a-Pr(k,t))))>w(3.1415927410125732)?t=w(t+w(-6.2831854820251465)):t>2]=j,U=e,j=w(o*Rr(n)),p[U+96>>2]=j;break n}if(!i)break r}f[e+88|0]=0}if(!((W=W+1|0)>>>0>2]))break}D=u+16|0}},So,ko,pu,la,function(r){return v[(r|=0)>>2]=10840,bo(r+24|0),0|Mt(r)},function(r){v[(r|=0)>>2]=10840,bo(r+24|0),at(Mt(r))},function(){return 21104},la,function(r){return v[(r|=0)>>2]=10864,vo(r+20|0),0|Ut(r)},function(r){v[(r|=0)>>2]=10864,vo(r+20|0),at(Ut(r))},function(){return 21116},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=w(0),b=w(0),k=0,s=w(0);r:if(n=v[v[n+84>>2]+(v[r+36>>2]<<2)>>2],0|da[v[v[n>>2]+16>>2]](n)){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return r=v[n+4>>2],p[n+28>>2]=p[r+44>>2],p[n+32>>2]=p[r+48>>2],p[n+36>>2]=p[r+52>>2],void(p[n+40>>2]=p[r+56>>2]);case 1:break n;default:break r}return r=v[n+4>>2],e=p[n+28>>2],p[n+28>>2]=w(w(p[r+44>>2]-e)*t)+e,e=p[n+32>>2],p[n+32>>2]=w(w(p[r+48>>2]-e)*t)+e,e=p[n+36>>2],p[n+36>>2]=w(w(p[r+52>>2]-e)*t)+e,e=p[n+40>>2],void(p[n+40>>2]=w(w(p[r+56>>2]-e)*t)+e)}if(f=f+(v[r+24>>2]<<2)|0,p[f-20>>2]<=i?(i=p[f-4>>2],e=p[f-8>>2],c=p[f-12>>2],a=p[f-16>>2]):(f=(k=(o=Pe(r+20|0,i,5))<<2)+v[r+32>>2]|0,b=p[f-16>>2],c=p[f-12>>2],e=p[f-8>>2],s=p[f-4>>2],a=i,i=p[f>>2],a=bn(r,((0|o)/5|0)-1|0,w(w(1)-w(w(a-i)/w(p[f-20>>2]-i)))),r=v[r+32>>2]+k|0,i=w(s+w(a*w(p[r+16>>2]-s))),e=w(e+w(a*w(p[r+12>>2]-e))),c=w(c+w(a*w(p[r+8>>2]-c))),a=w(b+w(a*w(p[r+4>>2]-b)))),!u)return b=a,r=v[n+4>>2],a=p[r+44>>2],p[n+28>>2]=w(w(b-a)*t)+a,a=p[r+48>>2],p[n+32>>2]=w(w(c-a)*t)+a,a=e,e=p[r+52>>2],p[n+36>>2]=w(w(a-e)*t)+e,e=p[r+56>>2],void(p[n+40>>2]=w(w(i-e)*t)+e);b=a,a=p[n+28>>2],p[n+28>>2]=w(w(b-a)*t)+a,a=p[n+32>>2],p[n+32>>2]=w(w(c-a)*t)+a,a=e,e=p[n+36>>2],p[n+36>>2]=w(w(a-e)*t)+e,e=p[n+40>>2],p[n+40>>2]=w(w(i-e)*t)+e}},function(r){return v[36+(r|=0)>>2]+167772160|0},la,function(r){mt(r|=0),at(r)},function(){return 21128},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=w(0),c=0,b=w(0);r:if(n=v[v[n+20>>2]+(v[r+36>>2]<<2)>>2],l[n+117|0]){if(f=v[r+32>>2],p[f>>2]>i){n:switch(0|u){case 0:return r=v[n+4>>2],p[n+32>>2]=p[r+28>>2],void(p[n+36>>2]=p[r+32>>2]);case 1:break n;default:break r}return r=v[n+4>>2],e=p[n+32>>2],p[n+32>>2]=w(w(p[r+28>>2]-e)*t)+e,e=p[n+36>>2],void(p[n+36>>2]=w(w(p[r+32>>2]-e)*t)+e)}f=f+(v[r+24>>2]<<2)|0,p[f-12>>2]<=i?(i=p[f-4>>2],e=p[f-8>>2]):(f=(c=(o=Pe(r+20|0,i,3))<<2)+v[r+32>>2]|0,e=p[f-8>>2],b=p[f-4>>2],a=i,i=p[f>>2],a=bn(r,((0|o)/3|0)-1|0,w(w(1)-w(w(a-i)/w(p[f-12>>2]-i)))),r=v[r+32>>2]+c|0,i=w(b+w(a*w(p[r+8>>2]-b))),e=w(e+w(a*w(p[r+4>>2]-e))));n:switch(0|u){case 0:return r=v[n+4>>2],p[n+32>>2]=w(e*t)+p[r+28>>2],void(p[n+36>>2]=w(i*t)+p[r+32>>2]);case 1:case 2:return r=v[n+4>>2],a=w(e+p[r+28>>2]),e=p[n+32>>2],p[n+32>>2]=w(w(a-e)*t)+e,e=p[n+36>>2],void(p[n+36>>2]=w(w(w(i+p[r+32>>2])-e)*t)+e);case 3:break n;default:break r}p[n+32>>2]=w(e*t)+p[n+32>>2],p[n+36>>2]=w(i*t)+p[n+36>>2]}},function(r){return v[36+(r|=0)>>2]+16777216|0},Wi,function(r){Wi(r|=0),at(r)},la,function(r){return v[(r|=0)>>2]=10964,vo(r+20|0),0|Ut(r)},function(r){v[(r|=0)>>2]=10964,vo(r+20|0),at(Ut(r))},function(){return 21140},function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t=w(t),u|=0,o|=0;var a=0,c=w(0),b=w(0),k=w(0),s=w(0),l=w(0),h=w(0),d=0,y=0,m=0,g=0,F=w(0);r:if(n=v[v[n+36>>2]+(v[r+36>>2]<<2)>>2],f=v[n+8>>2],0|da[v[v[f>>2]+16>>2]](f)){if(d=n+36|0,y=n+16|0,f=Ko(v[n+4>>2]),o=fa(v[n+4>>2]),a=v[r+32>>2],p[a>>2]>i){n:switch(0|u){case 0:return p[n+20>>2]=p[f+4>>2],p[n+24>>2]=p[f+8>>2],p[n+28>>2]=p[f+12>>2],p[n+32>>2]=p[f+16>>2],ci(y),p[n+40>>2]=p[o+4>>2],p[n+44>>2]=p[o+8>>2],p[n+48>>2]=p[o+12>>2],p[n+52>>2]=p[o+16>>2],void ci(d);case 1:break n;default:break r}return e=p[n+20>>2],p[n+20>>2]=w(w(e-p[f+4>>2])*t)+e,e=p[n+24>>2],p[n+24>>2]=w(w(e-p[f+8>>2])*t)+e,e=p[n+28>>2],p[n+28>>2]=w(w(e-p[f+12>>2])*t)+e,e=p[n+32>>2],p[n+32>>2]=w(w(e-p[f+16>>2])*t)+e,e=p[n+40>>2],p[n+40>>2]=w(w(e-p[o+4>>2])*t)+e,e=p[n+44>>2],p[n+44>>2]=w(w(e-p[o+8>>2])*t)+e,e=p[n+48>>2],void(p[n+48>>2]=w(w(e-p[o+12>>2])*t)+e)}if(a=a+(v[r+24>>2]<<2)|0,p[a-32>>2]<=i?(i=p[a-4>>2],b=p[a-8>>2],k=p[a-12>>2],c=p[a-16>>2],s=p[a-20>>2],l=p[a-24>>2],e=p[a-28>>2]):(a=(g=(m=Pe(r+20|0,i,8))<<2)+v[r+32>>2]|0,h=p[a-28>>2],l=p[a-24>>2],s=p[a-20>>2],c=p[a-16>>2],k=p[a-12>>2],b=p[a-8>>2],F=p[a-4>>2],e=p[a>>2],e=bn(r,(m>>>3|0)-1|0,w(w(1)-w(w(i-e)/w(p[a-32>>2]-e)))),r=v[r+32>>2]+g|0,i=w(F+w(e*w(p[r+28>>2]-F))),b=w(b+w(e*w(p[r+24>>2]-b))),k=w(k+w(e*w(p[r+20>>2]-k))),c=w(c+w(e*w(p[r+16>>2]-c))),s=w(s+w(e*w(p[r+12>>2]-s))),l=w(l+w(e*w(p[r+8>>2]-l))),e=w(h+w(e*w(p[r+4>>2]-h)))),t==w(1))return p[n+32>>2]=c,p[n+28>>2]=s,p[n+24>>2]=l,p[n+20>>2]=e,ci(y),v[n+52>>2]=1065353216,p[n+48>>2]=i,p[n+44>>2]=b,p[n+40>>2]=k,void ci(d);u||(p[n+20>>2]=p[f+4>>2],p[n+24>>2]=p[f+8>>2],p[n+28>>2]=p[f+12>>2],p[n+32>>2]=p[f+16>>2],ci(y),p[n+40>>2]=p[o+4>>2],p[n+44>>2]=p[o+8>>2],p[n+48>>2]=p[o+12>>2],p[n+52>>2]=p[o+16>>2],ci(d)),h=p[n+32>>2],p[n+32>>2]=h+w(w(c-h)*t),c=p[n+28>>2],p[n+28>>2]=c+w(w(s-c)*t),c=p[n+24>>2],p[n+24>>2]=c+w(w(l-c)*t),c=p[n+20>>2],p[n+20>>2]=c+w(w(e-c)*t),ci(y),p[n+52>>2]=p[n+52>>2]+w(0),e=p[n+48>>2],p[n+48>>2]=e+w(w(i-e)*t),e=p[n+44>>2],p[n+44>>2]=e+w(w(b-e)*t),e=p[n+40>>2],p[n+40>>2]=e+w(w(k-e)*t),ci(d)}},function(r){return v[36+(r|=0)>>2]+234881024|0},la,Yo,va,function(){return 21152},la,va,function(){return 21164},la,la,la,ka,function(){return 21192},ta,function(r,n,e){r|=0,n|=0,e|=0;var i=w(0),f=w(0),t=w(0),u=0,o=w(0);f=p[r+8>>2],i=p[r+4>>2],t=w(-i),u=n,o=w(ne(t,i,w(w(i-i)*w(.5)))+p[n>>2]),p[u>>2]=o,u=e,o=w(ne(t,f,w(w(f-i)*w(.5)))+p[e>>2]),p[u>>2]=o},la,ka,function(){return 21204},function(r,n){n|=0,p[20+(r|=0)>>2]=p[n+172>>2]+p[r+4>>2],p[r+24>>2]=p[n+176>>2]+p[r+8>>2]},function(r,n,e){r|=0,n|=0,e|=0;var i=w(0),f=w(0),t=w(0),u=w(0),o=0;t=w(p[n>>2]-p[r+20>>2]),u=w(p[e>>2]-p[r+24>>2]),(i=w(T(w(w(t*t)+w(u*u)))))<(f=p[r+12>>2])&&(o=v[r+28>>2],f=Wr(i=w(da[v[v[o>>2]+8>>2]](o,w(0),p[r+16>>2],w(w(f-i)/f)))),i=Rr(i),p[n>>2]=p[r+20>>2]+w(w(i*t)-w(u*f)),p[e>>2]=w(w(f*t)+w(u*i))+p[r+24>>2])},la,uu,uf,function(r){uf(r|=0),or(r)},Yo,ka,function(r,n){r|=0;var e=0,i=0,f=0,t=0,u=0,o=0,a=0,c=0;r:{if(lu(0|da[v[v[(n|=0)>>2]+8>>2]](n),21008)){r=v[r+8>>2],i=v[n+24>>2],f=Tt(12),e=-1;n:if(u=v[r+8>>2])for(o=v[r+16>>2],i=v[i+4>>2],r=0;;){if((0|i)==v[o+(r<<2)>>2]){e=r;break n}if((0|u)==(0|(r=r+1|0)))break}for(te(f,4,20568,6,e),i=v[n+112>>2],u=v[v[f+4>>2]>>2],r=0,e=0;o=u+m(r,24)|0,t=e<<2,p[o+12>>2]=p[t+i>>2],p[o+16>>2]=p[i+(4|t)>>2],e=e+2|0,4!=(0|(r=r+1|0)););(e=v[n+28>>2])&&(!(r=v[n+24>>2])|(0|r)==(0|f)||da[0|e](r)),v[n+24>>2]=f,r=n+28|0}else{if(!lu(0|da[v[v[n>>2]+8>>2]](n),20912))break r;i=v[n+68>>2],r=v[r+8>>2],f=Tt(12),u=v[n+52>>2]>>>1|0,o=v[n+140>>2],t=v[n+148>>2],e=-1;n:if(a=v[r+8>>2])for(c=v[r+16>>2],i=v[i+4>>2],r=0;;){if((0|i)==v[(r<<2)+c>>2]){e=r;break n}if((0|a)==(0|(r=r+1|0)))break}if(te(f,u,t,o,e),r=v[n+52>>2])for(u=v[v[f+4>>2]>>2],o=r-1>>>1|0,i=v[n+116>>2],e=0,r=0;t=u+m(r,24)|0,a=e<<2,p[t+12>>2]=p[a+i>>2],p[t+16>>2]=p[i+(4|a)>>2],e=e+2|0,t=(0|r)==(0|o),r=r+1|0,!t;);(e=v[n+72>>2])&&(!(r=v[n+68>>2])|(0|r)==(0|f)||da[0|e](r)),v[n+68>>2]=f,r=n+72|0}v[r>>2]=385}},Iu,function(r){at(Iu(r|=0))},function(r,n,e,i){n|=0,e|=0,i|=0,r=v[8+(r|=0)>>2],v[5369]=e,v[5145]=n,v[5370]=i,(r=v[r+36>>2])&&(v[5368]=r,q())},function(r,n,e,i){n|=0,e|=0,i|=0,(r=v[8+(r|=0)>>2])&&(v[e+8>>2]&&(r=v[r+40>>2],v[5145]=n,v[5368]=r,v[5369]=e,v[5370]=i,N()),3==(0|n)&&(r=v[e+8>>2])&&((n=v[e+12>>2])&&da[0|n](r),v[e+8>>2]=0,v[e+12>>2]=0))},$u,function(r){at($u(r|=0))},Tu,function(r){at(Tu(r|=0))},ka,function(){return 21285},uu,yo,function(){return 0|xf(11192)},un,tf,Go,wf,function(r,n){return n|=0,v[12+(r|=0)>>2]+m(n,20)|0},function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),r=0|da[0|i](n,e),n=Tt(20),v[n+16>>2]=v[r+16>>2],e=v[r+12>>2],v[n+8>>2]=v[r+8>>2],v[n+12>>2]=e,e=v[r+4>>2],v[n>>2]=v[r>>2],v[n+4>>2]=e,0|n},function(){return 21291},uu,yo,function(){return 0|xf(8712)},yn,function(r,n,e,i){var f,t;r|=0,n|=0,e|=0,i=w(i),D=f=D-16|0,n=((t=v[r+4>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,p[f+12>>2]=i,da[0|r](n,e,f+12|0),D=f+16|0},Go,wf,St,function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),w(p[da[0|i](n,e)>>2])},function(r,n,e){n|=0,e|=0,p[v[12+(r|=0)>>2]+(n<<2)>>2]=p[e>>2]},function(){return 21296},uu,yo,function(){return 0|xf(9400)},function(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<4,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(;xn(v[r+12>>2]+(i<<4)|0,e),(i=i+1|0)>>>0>2];);},tf,Go,wf,Et,function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),r=0|da[0|i](n,e),0|xn(Xf(16),r)},cf,function(){return 21299},uu,yo,function(){return 0|xf(8680)},mn,hi,Go,wf,St,ef,ot,function(){return 21302},uu,yo,function(){return 0|xf(11176)},mn,hi,Go,wf,St,ef,ot,function(){return 21306},uu,yo,function(){return 0|xf(9444)},function(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<4,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(;Jn(v[r+12>>2]+(i<<4)|0,e),(i=i+1|0)>>>0>2];);},tf,Go,wf,Et,function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),r=0|da[0|i](n,e),0|Jn(Xf(16),r)},cf,function(){return 21309},uu,yo,function(){return 0|xf(10632)},function(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<2,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(n=v[r+12>>2];v[n+(i<<2)>>2]=v[e>>2],(i=i+1|0)>>>0>2];);},hi,Go,wf,St,ef,ot,function(){return 21312},uu,yo,function(){return 0|xf(9788)},pn,function(r,n,e,i){var f,t;n|=0,e|=0,i|=0,D=f=D-16|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,s[f+14>>1]=i,da[0|r](n,e,f+14|0),D=f+16|0},Go,wf,function(r,n){return n|=0,v[12+(r|=0)>>2]+(n<<1)|0},function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),h[da[0|i](n,e)>>1]},function(r,n,e){n|=0,e|=0,s[v[12+(r|=0)>>2]+(n<<1)>>1]=h[e>>1]},function(){return 21316},uu,yo,function(){return 0|xf(9148)},function(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],m(n,12),8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(;Re(v[r+12>>2]+m(i,12)|0,e),(i=i+1|0)>>>0>2];);},Ne,Go,wf,function(r,n){return n|=0,v[12+(r|=0)>>2]+m(n,12)|0},function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),e=0|da[0|i](n,e),n=Y((r=v[e+4>>2])+4|0),v[n>>2]=r,Ff(n+4|0,v[e+8>>2],r),0|n},function(r,n,e){n|=0,e|=0,ee(v[12+(r|=0)>>2]+m(n,12)|0,e)},function(){return 21319},uu,yo,function(){return 0|xf(9196)},Fn,hi,Go,wf,St,ef,function(){return 21322},uu,yo,function(){return 0|xf(9612)},Fn,hi,Go,wf,St,ef,function(){return 21326},uu,yo,function(){return 0|xf(10472)},Fn,hi,Go,wf,St,ef,function(){return 21330},uu,yo,function(){return 0|xf(10552)},Fn,hi,Go,wf,St,ef,function(){return 21333},uu,yo,function(){return 0|xf(10568)},Fn,hi,Go,wf,St,ef,function(){return 21336},uu,yo,function(){return 0|xf(10712)},Fn,hi,Go,wf,St,ef,function(){return 21339},uu,yo,function(){return 0|xf(10168)},Fn,hi,Go,wf,St,ef,function(){return 21343},uu,yo,function(){return 0|xf(10488)},Fn,hi,Go,wf,St,ef,function(){return 21347},uu,yo,function(){return 0|xf(10504)},Fn,hi,Go,wf,St,ef,function(){return 21351},uu,yo,function(){return 0|xf(8760)},Fn,hi,Go,wf,St,ef,function(){return 21355},uu,yo,function(){return 0|xf(10520)},Fn,hi,Go,wf,St,ef,function(){return 21359},uu,yo,function(){return 0|xf(10184)},Fn,hi,Go,wf,St,ef,function(){return 21362},uu,yo,function(){return 0|xf(10536)},Fn,hi,Go,wf,St,ef,function(){return 21365},uu,yo,function(){return 0|xf(10200)},Fn,hi,Go,wf,St,ef,function(){return 21368},uu,yo,function(){return 0|xf(10216)},Fn,hi,Go,wf,St,ef,function(){return 21371},uu,yo,function(){return 0|xf(1048)},Fn,hi,Go,wf,St,ef,ot,function(){return 21374},uu,yo,function(){return 0|xf(8696)},Fn,hi,Go,wf,St,ef,function(){return 21378},uu,yo,function(){return 0|xf(10232)},Fn,hi,Go,wf,St,ef,function(){return 21381},uu,yo,function(){return 0|xf(12864)},Fn,hi,Go,wf,St,ef,function(){return 21385},uu,yo,function(){return 0|xf(12928)},function(r,n,e){r|=0,n|=0,e|=0;var i=0,f=w(0),t=0,u=0,o=0;if(i=v[r+4>>2],v[r+4>>2]=n,d[r+8>>2]>>0&&(f=w(w(n>>>0)*w(1.75)),n=(n=w(g(f))>>0<=8?8:n,v[r+8>>2]=n,t=v[5208],u=r,o=0|da[v[v[t>>2]+16>>2]](t,v[r+12>>2],n<<4,8524,85),v[u+12>>2]=o,n=v[r+4>>2]),n>>>0>i>>>0)for(;Ro(v[r+12>>2]+(i<<4)|0,e),(i=i+1|0)>>>0>2];);},tf,Go,wf,Et,function(r,n,e){n|=0,e|=0;var i=0;return i=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(i=v[i+v[n>>2]>>2]),r=0|da[0|i](n,e),0|Ro(Xf(16),r)},function(){return 21388},qo,yo,function(){var r;return r=Tt(8),v[r>>2]=0,v[r+4>>2]=0,0|r},Qi,function(r,n){return r|=0,n|=0,0|ft(Tt(8),p[r>>2],p[n>>2])},Lt,Rt,ft,function(r,n,e,i){r|=0,n|=0,e=w(e),i=w(i);var f=0;return f=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),r=0|da[0|f](n,e,i),n=Tt(8),f=v[r+4>>2],v[n>>2]=v[r>>2],v[n+4>>2]=f,0|n},function(r){r|=0;var n=w(0),e=w(0);return n=p[r>>2],e=w(n*n),n=p[r+4>>2],w(w(T(w(e+w(n*n)))))},kf,function(r){r|=0;var n=w(0),e=w(0),i=w(0);return n=p[r>>2],e=p[r+4>>2],i=w(w(1)/w(T(w(w(n*n)+w(e*e))))),p[r+4>>2]=e*i,p[r>>2]=n*i,0|r},function(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),r=0|da[0|e](n),n=Tt(8),e=v[r+4>>2],v[n>>2]=v[r>>2],v[n+4>>2]=e,0|n},function(){return 21391},uu,yo,function(){var r;return r=Xf(20),v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=9308,v[r+12>>2]=0,v[r+16>>2]=0,0|r},function(r,n,e,i,f){var t;return r|=0,n=w(n),e=w(e),i=w(i),f=w(f),D=t=D-16|0,p[t+12>>2]=n,p[t+8>>2]=e,p[t+4>>2]=i,p[t>>2]=f,r=0|da[0|r](t+12|0,t+8|0,t+4|0,t),D=t+16|0,0|r},function(r,n,e,i){r|=0,n|=0,e|=0,i|=0;var f,t=w(0),u=w(0),o=w(0);return f=Xf(20),t=p[r>>2],u=p[n>>2],o=p[e>>2],p[f+16>>2]=p[i>>2],p[f+12>>2]=o,p[f+8>>2]=u,p[f+4>>2]=t,v[f>>2]=9308,ci(f),0|f},function(r,n,e,i,f){return r|=0,n=w(n),e=w(e),i=w(i),f=w(f),p[r+16>>2]=f,p[r+12>>2]=i,p[r+8>>2]=e,p[r+4>>2]=n,ci(r),0|r},function(r,n,e,i,f,t){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t);var u=0;return u=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),n=0|da[0|u](n,e,i,f,t),r=Xf(20),v[r>>2]=9308,u=v[n+8>>2],v[r+4>>2]=v[n+4>>2],v[r+8>>2]=u,u=v[n+16>>2],v[r+12>>2]=v[n+12>>2],v[r+16>>2]=u,0|r},function(r,n,e,i,f){return r|=0,n=w(n),e=w(e),i=w(i),f=w(f),p[r+4>>2]=p[r+4>>2]+n,p[r+8>>2]=p[r+8>>2]+e,p[r+12>>2]=p[r+12>>2]+i,p[r+16>>2]=p[r+16>>2]+f,ci(r),0|r},ci,function(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),n=0|da[0|e](n),r=Xf(20),v[r>>2]=9308,e=v[n+8>>2],v[r+4>>2]=v[n+4>>2],v[r+8>>2]=e,e=v[n+16>>2],v[r+12>>2]=v[n+12>>2],v[r+16>>2]=e,0|r},Lt,Rt,wt,Nt,nf,function(){return 21394},uu,yo,function(){var r;return r=Tt(12),v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=8664,0|r},lt,uu,vf,function(r){return r|=0,0|rt(Xf(24),r)},No,ti,Dt,_t,nu,Jt,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|Ve(Xf(60),r)},Ko,Dt,_t,Dt,_t,nu,Jt,Lt,Rt,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|Yf(Xf(76),r)},Ko,Dt,_t,Dt,_t,Dt,_t,Dt,_t,Lt,Rt,function(){return 21400},uu,yo,function(){var r;return r=Xf(68),v[r+40>>2]=0,v[r+44>>2]=0,v[r+36>>2]=10328,v[r+32>>2]=0,v[r+24>>2]=0,v[r+28>>2]=0,v[r+20>>2]=10344,v[r+16>>2]=0,v[r+8>>2]=0,v[r+12>>2]=0,v[r+4>>2]=10328,v[r>>2]=10296,v[r+48>>2]=0,v[r+52>>2]=0,v[r+56>>2]=0,v[r+60>>2]=0,v[r- -64>>2]=0,0|r},function(r,n,e){r|=0,n|=0,e|=0;var i,f=0,t=0,u=0,o=w(0),a=0,c=w(0),b=w(0),k=w(0),s=w(0),l=0,h=0,y=0,m=0,g=0;if(D=i=D-16|0,l=v[n+28>>2],v[r+24>>2]=0,f=v[r+40>>2])for(a=r+4|0;Sn(a,v[r+48>>2]+(t<<2)|0),(0|f)!=(0|(t=t+1|0)););if(v[r+40>>2]=0,l)for(m=r+36|0,g=r+20|0,t=0;a=v[v[n+36>>2]+(t<<2)>>2],f=v[a+8>>2],0|da[v[v[f>>2]+16>>2]](f)&&(f=v[a+60>>2])&&Tf(0|da[v[v[f>>2]+8>>2]](f),20724)&&(v[i+12>>2]=f,Sn(g,i+12|0),v[i+8>>2]=0,(f=v[r+8>>2])?(u=f-1|0,f=v[v[r+16>>2]+(u<<2)>>2],v[r+8>>2]=u):(f=Xf(24),v[f+4>>2]=8712,v[f>>2]=10312,v[f+8>>2]=0,v[f+12>>2]=0,v[f+16>>2]=0,v[f+20>>2]=0,ca(f+4|0,16)),v[i+8>>2]=f,Sn(m,i+8|0),u=v[i+8>>2],f=v[i+12>>2],h=v[f+52>>2],v[u+20>>2]=h,y=u+4|0,d[u+8>>2]>>0&&(v[i+4>>2]=0,yn(y,h,i+4|0),f=v[i+12>>2]),kr(f,a,0,v[f+52>>2],v[y+12>>2],0,2)),(0|l)!=(0|(t=t+1|0)););if(e){if(n=0,t=v[r+40>>2])for(l=v[r+48>>2],k=w(34028234663852886e22),s=w(11754943508222875e-54),c=w(11754943508222875e-54),b=w(34028234663852886e22);;){if(e=v[l+(n<<2)>>2],(0|(a=v[e+20>>2]))>0)for(f=v[e+16>>2],e=0;k=(o=p[(u=e<<2)+f>>2])s?s:o,b=(o=p[f+(4|u)>>2])c?c:o,(0|a)>(0|(e=e+2|0)););if((0|t)==(0|(n=n+1|0)))break}else c=w(11754943508222875e-54),b=w(34028234663852886e22),k=w(34028234663852886e22),s=w(11754943508222875e-54);p[r+64>>2]=b,p[r+60>>2]=k,p[r+56>>2]=c,p[r+52>>2]=s}else v[r+60>>2]=2139095039,v[r+64>>2]=2139095039,v[r+52>>2]=8388608,v[r+56>>2]=8388608;D=i+16|0},tf,function(r,n,e){r|=0,n=w(n),e=w(e);var i=0;return!(p[r+56>>2]<=e)|!(p[r+52>>2]<=n)|!(p[r+60>>2]>=n)||(i=p[r+64>>2]>=e),0|i},function(r,n,e,i){r|=0,n|=0,e=w(e),i=w(i);var f=0;return f=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),0|da[0|f](n,e,i)},function(r,n,e,i,f){r|=0,n=w(n),e=w(e),i=w(i),f=w(f);var t=w(0),u=w(0),o=w(0),a=w(0),c=0;return(t=p[r+52>>2])>=n&i<=t|(u=p[r+56>>2])>=e&f<=u|(o=p[r+60>>2])<=n&i>=o|(a=p[r+64>>2])<=e&f>=a||(c=1,i=w(w(f-e)/w(i-n)),(f=w(w(i*w(t-n))+e))>u&fu&ft&ft&n>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),0|da[0|u](n,e,i,f,t)},function(r,n){n|=0;var e=0;return!(p[56+(r|=0)>>2]>2])|!(p[r+52>>2]>2])|!(p[r+60>>2]>p[n+52>>2])||(e=p[r+64>>2]>p[n+56>>2]),0|e},function(r,n,e){e|=0;var i,f,t,u=0,o=0,a=0,c=0,b=0;if(D=i=D-80|0,f=(u=n|=0)+((n=v[4+(r|=0)>>2])>>1)|0,r=v[r>>2],r=1&n?v[v[f>>2]+r>>2]:r,v[i+12>>2]=10296,t=Po(i+16|0,e+4|0),v[(n=i+32|0)>>2]=10344,v[n+4>>2]=v[e+24>>2],u=v[e+28>>2],v[n+12>>2]=0,v[n+8>>2]=u,u&&(o=v[5208],c=n,b=0|da[v[v[o>>2]+12>>2]](o,u<<2,8524,206),v[c+12>>2]=b,o=v[n+4>>2]))for(u=0;v[(a=u<<2)+v[n+12>>2]>>2]=v[v[e+32>>2]+a>>2],(0|o)!=(0|(u=u+1|0)););return u=Po(i+48|0,e+36|0),o=v[e+64>>2],v[i+72>>2]=v[e+60>>2],v[i+76>>2]=o,o=v[e+56>>2],v[i+64>>2]=v[e+52>>2],v[i+68>>2]=o,r=0|da[0|r](f,i+12|0),v[i+12>>2]=10296,Wu(u),Ku(n),Wu(t),D=i+80|0,0|r},function(r,n,e){r|=0,n=w(n),e=w(e);var i,f=w(0),t=0,u=w(0),o=0,a=0,c=0,b=0,k=0,s=0,l=0;r:{if(i=v[r+40>>2])for(s=r,l=v[r+48>>2];;){if(a=0,r=v[(o<<2)+l>>2],(0|(c=v[r+20>>2]))>0)for(t=c-2|0,b=v[r+16>>2],r=0;!((f=p[(4|(k=r<<2))+b>>2])>2])>=e)&(!(e<=f)|!(e>u))||(u=w(w(e-f)/w(u-f)),f=p[b+k>>2],w(w(u*w(p[t>>2]-f))+f)(0|(r=r+2|0)););if(r=v[v[s+32>>2]+(o<<2)>>2],1&a)break r;if((0|i)==(0|(o=o+1|0)))break}r=0}return 0|r},function(r,n,e,i,f){r|=0,n=w(n),e=w(e),i=w(i),f=w(f);var t,u=0,o=w(0),a=w(0),c=0,b=w(0),k=w(0),s=0,l=w(0),h=0,d=0,y=w(0),m=w(0),g=w(0),F=w(0),A=w(0),T=w(0),$=0,I=w(0);b=n,k=e;r:{if(t=v[r+40>>2])for($=v[r+48>>2];;){u=v[(s<<2)+$>>2];n:{if(h=v[u+20>>2])for(y=w(w(b*f)-w(k*i)),m=w(-w(k-f)),d=v[u+16>>2],n=p[(u=d+(h<<2)|0)-8>>2],e=p[u-4>>2],g=w(b-i),I=w(-g),u=0;;){if(l=e,o=n,n=p[(c=u<<2)+d>>2],a=w(o-n),e=p[(4|c)+d>>2],F=w(w(o*e)-w(n*l)),A=w(l-e),T=w(w(g*A)+w(a*m)),!(!((a=w(w(w(y*a)+w(F*I))/T))>=o&n>=a)&(!(n<=a)|!(o>=a))|!(a>=b&i>=a)&(!(i<=a)|!(a<=b))||!((o=w(w(w(y*A)+w(F*m))/T))>=l&e>=o)&(!(e<=o)|!(o<=l)))){if(c=1,o>=k&f>=o)break n;if(f<=o&&o<=k)break n}if(!(h>>>0>(u=u+2|0)>>>0))break}c=0}if(u=v[v[r+32>>2]+(s<<2)>>2],c)break r;if((0|t)==(0|(s=s+1|0)))break}u=0}return 0|u},function(r){return w(w(p[60+(r|=0)>>2]-p[r+52>>2]))},kf,function(r){return w(w(p[64+(r|=0)>>2]-p[r+56>>2]))},function(){return 21404},uu,gf,function(r,n){return r|=0,n|=0,0|Vi(Xf(40),p[r>>2],n)},Go,Kt,Dt,_t,Lt,Rt,mf,sf,function(){return 21406},uu,vf,function(r){return r|=0,0|rf(Xf(56),r)},No,ti,Dt,_t,Lt,Rt,mf,sf,lt,uu,No,ti,lt,Yo,Yo,uu,go,wf,Mo,Jo,Dt,_t,Dt,_t,Gf,function(r,n,e,i,f,t,u,o){n|=0,e|=0,i|=0,f|=0,t|=0,u|=0,o|=0;var a=0;a=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(a=v[a+v[n>>2]>>2]),da[0|a](n,e,i,f,t,u,o)},Yi,yf,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|su(Xf(64),r)},ti,wf,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|dt(Xf(68),r)},function(r){return v[64+(r|=0)>>2]},function(r,n){n|=0,v[64+(r|=0)>>2]=n},wf,yf,wf,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|Mr(Xf(236),r)},mf,sf,function(r){return 120+(r|=0)|0},jo,function(r){return 136+(r|=0)|0},function(r){return 0|ra(r|=0)},Kt,Lt,Rt,Dt,_t,function(r){return 152+(r|=0)|0},sr,If,function(r){return v[100+(r|=0)>>2]},wf,zn,yf,wf,xr,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|xi(Xf(84),r)},Uo,nu,Jt,wf,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|zf(Xf(32),r)},Lt,Rt,function(r,n,e,i){var f;r|=0,n|=0,e=w(e),i=w(i),D=f=D-16|0,p[f+12>>2]=e,p[f+8>>2]=i,Zi(n,p[r+20>>2],p[r+24>>2],f+12|0,f+8|0),D=f+16|0},function(r,n){r|=0,n|=0;var e=w(0),i=w(0),f=w(0),t=w(0);return f=p[n+96>>2],i=Wr(e=w(p[r+28>>2]*w(.01745329238474369))),t=p[n+92>>2],e=Rr(e),w(w(Pr(w(w(e*p[n+104>>2])+w(i*p[n+108>>2])),w(w(e*t)+w(i*f)))*w(57.2957763671875)))},ff,wf,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|Lr(Xf(164),r)},Lt,Rt,function(r){return 0|ia(r|=0)},Kt,mf,sf,xo,Zn,function(r,n,e,i,f,t,u){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),u|=0;var o=0;o=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(o=v[o+v[n>>2]>>2]),da[0|o](n,e,i,f,t,u)},Ho,zr,If,function(r,n,e,i,f){i|=0,f|=0,Zr(r|=0,n|=0,v[12+(e|=0)>>2],i,f)},function(r,n,e,i,f,t){n|=0,e|=0,i|=0,f|=0,t|=0;var u=0;u=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),da[0|u](n,e,i,f,t)},wf,lt,uu,je,je,je,je,be,be,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|vt(Xf(8),v[r>>2])},be,be,je,je,je,je,function(){return 21411},uu,vf,function(r){return r|=0,0|Be(Xf(68),r)},function(r,n){Re(r|=0,16+(n|=0)|0)},Dt,_t,Dt,_t,Dt,_t,function(){return 21414},uu,function(r,n){Re(r|=0,8+(n|=0)|0)},Dt,_t,nu,Jt,function(){return 21417},uu,function(){return 21420},uu,function(r,n,e,i){var t;return r|=0,e|=0,i|=0,D=t=D-32|0,n=Ae(t+20|0,4+(n|=0)|0,v[n>>2],0),v[t+16>>2]=e,f[t+15|0]=i,r=0|da[0|r](n,t+16|0,t+15|0),lf(n),D=t+32|0,0|r},function(r,n,e){var i,t,u,o,a;return r|=0,n|=0,e|=0,i=Xf(40),a=l[0|e],D=t=D-16|0,v[i+36>>2]=v[n>>2],v[i+32>>2]=0,v[i+24>>2]=0,v[i+28>>2]=0,v[i+20>>2]=8984,v[i+16>>2]=0,v[i+8>>2]=0,v[i+12>>2]=0,v[i+4>>2]=8968,v[i>>2]=8840,u=t+4|0,e=Di(n=v[r+8>>2],47),n=qi(e=gu(u,o=(n=Di(n,92))>>>0>>0?e:n,0),r),lf(e),e=v[5208],n=(n=n+o|0)?n-v[r+8>>2]|0:0,e=Ff(0|da[v[v[e>>2]+12>>2]](e,n+1|0,8524,54),v[r+8>>2],n),f[n+e|0]=0,n=v[5208],(n=0|da[v[v[n>>2]+24>>2]](n,r,u))&&fr(i,n,v[t+4>>2],e,a),r=v[5208],da[v[v[r>>2]+20>>2]](r,n,8524,63),r=v[5208],da[v[v[r>>2]+20>>2]](r,e,8524,64),D=t+16|0,0|i},Ye,ze,wt,Yo,Yo,Nt,Pf,function(r){var n;return r|=0,n=Tt(8),v[n+4>>2]=v[r>>2],v[n>>2]=9692,0|n},wt,Yo,Yo,Nt,Pf,function(r){var n;return r|=0,n=Tt(8),v[n+4>>2]=v[r>>2],v[n>>2]=9720,0|n},function(){return 21399},uu,function(r,n,e,i){var f;return r|=0,n|=0,e|=0,i|=0,D=f=D-16|0,v[f+12>>2]=n,n=Ae(f,e+4|0,v[e>>2],0),r=0|da[0|r](f+12|0,n,i),lf(n),D=f+16|0,0|r},function(r,n,e){return r|=0,n|=0,e|=0,0|Bn(Xf(84),v[r>>2],n,e)},Go,wf,Bo,ti,$o,Kt,function(r){return 0|Ko(r|=0)},Kt,function(r){return 0|fa(r|=0)},Dt,_t,lt,uu,If,wf,wf,yf,lt,Yo,Yo,uu,At,function(r,n){return r|=0,n|=0,0|en(Xf(48),r,n)},Go,Kt,Bo,Dt,_t,Dt,_t,nu,Jt,Lt,Rt,function(r,n,e,i,f,t,u,o){r|=0,n|=0,e=w(e),i=w(i),f|=0,t|=0,u|=0,o=w(o),da[0|r](n,e,i,f,t,u,o)},gr,function(r,n,e,i,f,t,u,o,a){r|=0,n|=0,e|=0,i=w(i),f=w(f),t|=0,u|=0,o=w(o),a=w(a),da[0|r](n,e,i,f,t,u,o,a)},ur,lt,Yo,Yo,uu,At,function(r,n){return r|=0,n|=0,0|Ar(Xf(144),r,n)},Go,Kt,Bo,Dt,_t,Lt,Rt,lt,Yo,Yo,uu,vf,function(r){return r|=0,0|Zf(Xf(88),r)},Ko,function(r){return v[40+(r|=0)>>2]},wf,function(r){return w(p[44+(r|=0)>>2])},kf,function(r){return w(p[48+(r|=0)>>2])},function(r){return w(p[52+(r|=0)>>2])},function(r){return w(p[56+(r|=0)>>2])},Gu,function(r){return w(p[64+(r|=0)>>2])},function(r){return w(p[68+(r|=0)>>2])},function(r){return w(p[72+(r|=0)>>2])},function(r){return w(p[76+(r|=0)>>2])},function(r){return w(p[80+(r|=0)>>2])},function(r){return l[84+(r|=0)|0]},wf,function(r){return l[85+(r|=0)|0]},lt,Yo,Yo,uu,At,function(r,n){return r|=0,n|=0,0|fn(Xf(48),r,n)},Go,Kt,Bo,To,wf,Lt,Rt,lt,Yo,Yo,uu,function(r,n,e,i){var f;return r|=0,n|=0,e|=0,i|=0,D=f=D-16|0,v[f+12>>2]=i,r=0|da[0|r](n,e,f+12|0),D=f+16|0,0|r},function(r,n,e){return r|=0,n|=0,e|=0,0|ye(Xf(120),r,n,v[e>>2])},Go,Kt,Wo,Kt,Ao,wf,_o,Lt,Rt,nu,Jt,Of,If,cr,function(r,n,e,i,f,t,u,o,a){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),u=w(u),o=w(o),a=w(a);var c=0;c=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(c=v[c+v[n>>2]>>2]),da[0|c](n,e,i,f,t,u,o,a)},Ke,function(r){return w(w(Pr(p[104+(r|=0)>>2],p[r+92>>2])*w(57.2957763671875)))},kf,function(r){return w(w(Pr(p[108+(r|=0)>>2],p[r+96>>2])*w(57.2957763671875)))},function(r){r|=0;var n=w(0),e=w(0);return n=p[r+92>>2],e=w(n*n),n=p[r+104>>2],w(w(T(w(e+w(n*n)))))},function(r){r|=0;var n=w(0),e=w(0);return n=p[r+96>>2],e=w(n*n),n=p[r+108>>2],w(w(T(w(e+w(n*n)))))},function(r,n){r|=0,n|=0;var e,i=w(0),f=w(0),t=w(0),u=w(0),o=w(0),a=w(0),c=w(0);D=e=D-16|0,u=p[r+92>>2],i=p[r+108>>2],o=p[r+104>>2],f=p[r+96>>2],t=w(w(1)/w(w(u*i)-w(o*f))),a=i,i=w(p[n>>2]-p[r+100>>2]),c=f,f=w(p[n+4>>2]-p[r+112>>2]),p[e+12>>2]=w(w(a*i)*t)-w(t*w(c*f)),p[e+8>>2]=w(w(u*f)*t)-w(t*w(o*i)),p[n>>2]=p[e+12>>2],p[n+4>>2]=p[e+8>>2],D=e+16|0},function(r,n){var e;D=e=D-16|0,Zi(r|=0,p[(n|=0)>>2],p[n+4>>2],e+12|0,e+8|0),p[n>>2]=p[e+12>>2],p[n+4>>2]=p[e+8>>2],D=e+16|0},function(r,n){r|=0,n=w(n);var e=w(0),i=w(0),f=w(0);return i=p[r+96>>2],n=Wr(e=w(n*w(.01745329238474369))),f=p[r+108>>2],e=Rr(e),w(w(w(w(Pr(w(w(n*p[r+92>>2])-w(e*p[r+104>>2])),w(w(f*e)-w(n*i)))*w(57.2957763671875))+p[r+40>>2])-p[r+52>>2]))},nf,function(r,n){r|=0,n=w(n);var e=w(0),i=w(0),f=w(0);return i=p[r+96>>2],n=Wr(e=w(w(n-w(p[r+40>>2]-p[r+52>>2]))*w(.01745329238474369))),f=p[r+92>>2],e=Rr(e),w(w(Pr(w(w(e*p[r+104>>2])+w(n*p[r+108>>2])),w(w(e*f)+w(n*i)))*w(57.2957763671875)))},function(r,n){r|=0,n=w(n);var e=w(0),i=w(0),t=w(0),u=w(0),o=w(0);f[r+88|0]=0,i=p[r+108>>2],n=Rr(e=w(n*w(.01745329238474369))),t=p[r+96>>2],e=Wr(e),p[r+108>>2]=w(t*e)+w(n*i),u=p[r+92>>2],o=p[r+104>>2],p[r+104>>2]=w(e*u)+w(n*o),p[r+96>>2]=w(n*t)-w(i*e),p[r+92>>2]=w(n*u)-w(o*e)},df,function(){return 21398},uu,ai,function(r,n,e){return r|=0,n|=0,e|=0,0|Xn(Xf(64),v[r>>2],n,v[e>>2])},Go,wf,Bo,ti,Dt,_t,Lt,Rt,Dt,_t,nu,Jt,function(){return 21408},uu,At,function(r,n){return r|=0,n|=0,0|Tn(Xf(84),r,n)},Go,Kt,Wo,Kt,_o,Kt,Jo,Lo,Ao,go,wf,af,yf,function(r,n){r|=0,n=w(n),p[r+64>>2]=p[v[r+12>>2]+160>>2]-n},df,function(r){return w(w(p[v[12+(r|=0)>>2]+160>>2]-p[r+64>>2]))},kf,En,If,function(){return 21409},uu,vf,function(r){return r|=0,0|ge(Xf(68),r)},No,ti,Jo,function(r){return 52+(r|=0)|0},yt,function(r,n,e,i,f){n|=0,e|=0,i|=0,f|=0;var t,u=0;D=t=D-16|0,n=((u=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&u?v[v[n>>2]+r>>2]:r,u=n,n=Ae(t+4|0,i+4|0,v[i>>2],0),da[0|r](u,e,n,f),lf(n),D=t+16|0},function(r,n){r|=0;var e=0,i=0,f=0,t=0,u=0,o=0,a=0,c=0;if(i=v[40+(n|=0)>>2])for(c=r+36|0;;){t=v[n+48>>2]+(f<<2)|0;r:{if(u=v[r+40>>2]){if(e=0,o=v[t>>2],a=v[r+48>>2],(0|o)==v[a>>2])break r;for(;(0|u)!=(0|(e=e+1|0))&(0|o)!=v[a+(e<<2)>>2];);if(e>>>0>>0)break r}Sn(c,t),i=v[n+40>>2]}if(!((f=f+1|0)>>>0>>0))break}if(i=v[n+56>>2])for(c=r+52|0,f=0;;){t=v[n+64>>2]+(f<<2)|0;r:{if(u=v[r+56>>2]){if(e=0,o=v[t>>2],a=v[r+64>>2],(0|o)==v[a>>2])break r;for(;(0|u)!=(0|(e=e+1|0))&(0|o)!=v[a+(e<<2)>>2];);if(e>>>0>>0)break r}Sn(c,t),i=v[n+56>>2]}if(!((f=f+1|0)>>>0>>0))break}r:if(i=v[n+24>>2])for(u=r+16|0,r=0,e=0;;){if(t=v[n+32>>2],d[4+(t+(e<<4)|0)>>2]<=r>>>0){n:{e:{for(;;){if((0|i)==(0|(e=e+1|0)))break e;if(v[4+(t+(e<<4)|0)>>2])break}r=e;break n}r=i}if(f=r,i=e>>>0>=i>>>0,r=0,e=f,i)break r}if(f=v[12+(t+(e<<4)|0)>>2]+m(r,20)|0,vr(u,v[f>>2],f+4|0,v[f+16>>2]),r=r+1|0,!((i=v[n+24>>2])>>>0>e>>>0))break}},yf,function(r,n){r|=0;var e=0,i=0,f=0,t=0,u=0,o=0,a=0,c=0;if(f=v[40+(n|=0)>>2])for(c=r+36|0;;){u=v[n+48>>2]+(e<<2)|0;r:{if(t=v[r+40>>2]){if(i=0,o=v[u>>2],a=v[r+48>>2],(0|o)==v[a>>2])break r;for(;(0|t)!=(0|(i=i+1|0))&(0|o)!=v[a+(i<<2)>>2];);if(i>>>0>>0)break r}Sn(c,u),f=v[n+40>>2]}if(!(f>>>0>(e=e+1|0)>>>0))break}if(f=v[n+56>>2])for(c=r+52|0,e=0;;){u=v[n+64>>2]+(e<<2)|0;r:{if(t=v[r+56>>2]){if(i=0,o=v[u>>2],a=v[r+64>>2],(0|o)==v[a>>2])break r;for(;(0|t)!=(0|(i=i+1|0))&(0|o)!=v[a+(i<<2)>>2];);if(i>>>0>>0)break r}Sn(c,u),f=v[n+56>>2]}if(!(f>>>0>(e=e+1|0)>>>0))break}r:if(e=v[n+24>>2])for(u=r+16|0,f=0,i=0;;){if(t=v[n+32>>2],d[4+(t+(i<<4)|0)>>2]<=f>>>0){n:{e:{for(;;){if((0|(i=i+1|0))==(0|e))break e;if(v[4+(t+(i<<4)|0)>>2])break}r=i;break n}r=e}if(e=e>>>0<=i>>>0,f=0,i=r,e)break r}if(r=v[12+(t+(i<<4)|0)>>2]+m(f,20)|0,e=v[r+16>>2],t=lu(0|da[v[v[e>>2]+8>>2]](e),20912),e=v[r+16>>2],f=f+1|0,vr(u,o=v[r>>2],a=r+4|0,r=t?xr(e):0|da[v[v[e>>2]+12>>2]](e)),!(i>>>0<(e=v[n+24>>2])>>>0))break}},function(r,n,e){n|=0,e|=0;var i,f=0,t=0,u=0,o=0;D=i=D-16|0,v[12+(r|=0)>>2]=0,v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=9148,xt(i+4|0,n),n=v[i+8>>2],t=v[i+4>>2];r:if(!(n>>>0>=(f=v[t+4>>2])>>>0))for(;;){if(u=v[i+12>>2],o=v[t+12>>2],u>>>0>=d[4+(o+(n<<4)|0)>>2]){for(;;){if((0|f)==(0|(n=n+1|0)))break r;if(v[4+((n<<4)+o|0)>>2])break}if(v[i+8>>2]=n,u=0,n>>>0>=f>>>0)break r}if(f=v[12+((n<<4)+o|0)>>2],v[i+12>>2]=u+1,f=f+m(u,20)|0,v[f>>2]==(0|e)&&(wn(r,f+4|0),t=v[i+4>>2],n=v[i+8>>2]),!((f=v[t+4>>2])>>>0>n>>>0))break}D=i+16|0},gt,je,function(r,n){n|=0;var e,i=0,f=0,t=0;D=e=D-16|0,v[12+(r|=0)>>2]=0,v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=12864,xt(e+4|0,n),n=v[e+8>>2],i=v[e+4>>2];r:if(!(n>>>0>=(f=v[i+4>>2])>>>0))for(;;){if(t=v[e+12>>2],i=v[i+12>>2],t>>>0>=d[4+(i+(n<<4)|0)>>2]){for(;;){if((0|f)==(0|(n=n+1|0)))break r;if(v[4+(i+(n<<4)|0)>>2])break}if(v[e+8>>2]=n,t=0,n>>>0>=f>>>0)break r}if(n=v[12+(i+(n<<4)|0)>>2],v[e+12>>2]=t+1,v[e>>2]=n+m(t,20),Sn(r,e),n=v[e+8>>2],i=v[e+4>>2],!(n>>>0<(f=v[i+4>>2])>>>0))break}D=e+16|0},function(r,n,e){n|=0,e|=0;var i=0,f=0,t=0,u=0,o=0;r:if(!(d[24+(r|=0)>>2]<=n>>>0)&&(i=v[r+32>>2]+(n<<4)|0,v[i+4>>2])){for(;;){if(!qi(4+(v[i+12>>2]+m(f,20)|0)|0,e)){if((f=f+1|0)>>>0>2])continue;break r}break}if(!((0|f)<0)){if(Sf(v[16+(v[12+((e=n<<4)+v[r+32>>2]|0)>>2]+m(f,20)|0)>>2]),D=n=D-32|0,r=e+v[r+32>>2]|0,e=v[r+4>>2]-1|0,v[r+4>>2]=e,e>>>0>f>>>0)for(o=n+16|0;i=(e=m(f,20))+v[r+12>>2]|0,v[n+12>>2]=v[i>>2],u=Re(o,i+4|0),v[n+28>>2]=v[i+16>>2],i=e+(t=v[r+12>>2])|0,e=t+(t=e+20|0)|0,v[i>>2]=v[e>>2],ee(i+4|0,e+4|0),v[i+16>>2]=v[e+16>>2],e=v[r+12>>2]+t|0,v[e>>2]=v[n+12>>2],ee(e+4|0,u),v[e+16>>2]=v[n+28>>2],lf(u),(e=v[r+4>>2])>>>0>(f=f+1|0)>>>0;);lf(4+(v[r+12>>2]+m(e,20)|0)|0),D=n+32|0}}},Ne,function(r,n,e){n|=0,e|=0;var i,f=0,t=0,u=0,o=0;D=i=D-16|0,v[12+(r|=0)>>2]=0,v[r+4>>2]=0,v[r+8>>2]=0,v[r>>2]=12864,xt(i+4|0,n),n=v[i+8>>2],t=v[i+4>>2];r:if(!(n>>>0>=(f=v[t+4>>2])>>>0))for(;;){if(u=v[i+12>>2],o=v[t+12>>2],u>>>0>=d[4+(o+(n<<4)|0)>>2]){for(;;){if((0|f)==(0|(n=n+1|0)))break r;if(v[4+((n<<4)+o|0)>>2])break}if(v[i+8>>2]=n,u=0,n>>>0>=f>>>0)break r}if(f=v[12+((n<<4)+o|0)>>2],v[i+12>>2]=u+1,f=f+m(u,20)|0,v[f>>2]==(0|e)&&(v[i>>2]=f,Sn(r,i),t=v[i+4>>2],n=v[i+8>>2]),!((f=v[t+4>>2])>>>0>n>>>0))break}D=i+16|0},function(){return 21427},function(r){(r|=0)&&(lf(r+4|0),or(r))},ai,function(r,n,e){var i;return r|=0,n|=0,e|=0,i=Tt(20),e=v[e>>2],v[i>>2]=v[r>>2],Re(i+4|0,n),v[i+16>>2]=e,0|i},Dt,_t,function(r,n){Re(r|=0,4+(n|=0)|0)},Io,function(){return 21430},uu,yo,function(){return 0|Ir(Xf(232))},function(r){return 160+(r|=0)|0},Kt,function(r){return 176+(r|=0)|0},Kt,function(r){return 192+(r|=0)|0},Q,function(r,n,e,i){n|=0,e|=0,i|=0;var f=0;return f=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),0|da[0|f](n,e,i)},gi,yf,bf,If,yu,wf,function(){return 21433},uu,yo,function(){return 0|Hr(Xf(232))},mf,sf,_o,function(r){return 32+(r|=0)|0},function(r){return 48+(r|=0)|0},Dt,_t,Lo,xo,Ho,function(r){return 116+(r|=0)|0},function(r){return 132+(r|=0)|0},Lt,Rt,ru,ze,Xt,ze,ou,ze,eu,iu,ze,Qt,ze,xe,ze,Vt,ze,Zt,ze,Yt,ze,function(r,n){n|=0;var e,i=0;r:{if(e=v[136+(r|=0)>>2])for(;;){if(qi(No(v[v[r+144>>2]+(i<<2)>>2]),n))break r;if((0|e)==(0|(i=i+1|0)))break}i=-1}return 0|i},function(){return 21436},uu,function(r,n,e,i){var f;return r|=0,n|=0,e|=0,i=w(i),D=f=D-16|0,n=Ae(f+4|0,n+4|0,v[n>>2],0),v[f>>2]=e,r=0|da[0|r](n,f,i),R(v[f>>2]),lf(n),D=f+16|0,0|r},function(r,n,e){r|=0,n|=0,e=w(e);var i,f=0,t=0,u=0,o=0,a=0,c=0,b=0;if(D=i=D-32|0,f=v[n>>2],t=0|M(4667),u=0|U(0|f,0|t),R(0|t),o=+G(0|u,21305,0|(t=i+12|0)),W(v[i+12>>2]),R(0|u),v[i+24>>2]=0,v[i+16>>2]=0,v[i+20>>2]=0,v[i+12>>2]=1048,v[i+28>>2]=0,Fn(f=t,t=o<4294967296&o>=0?~~o>>>0:0,i+28|0),v[i+8>>2]=0,t)for(;D=u=D-16|0,f=v[n>>2],v[u+8>>2]=v[i+8>>2],a=f,f=0|L(21305,u+8|0),c=i,b=0|U(0|a,0|f),v[c+4>>2]=b,R(0|f),D=u+16|0,o=+G(v[i+4>>2],7868,i+28|0),W(v[i+28>>2]),a=v[i+24>>2]+(v[i+8>>2]<<2)|0,f=o<4294967296&o>=0?~~o>>>0:0,v[a>>2]=f,R(v[i+4>>2]),u=v[i+8>>2]+1|0,v[i+8>>2]=u,u>>>0>>0;);return n=r,r=i+12|0,n=Kr(Xf(48),n,r,e),fo(r),D=i+32|0,0|n},Jo,ti,No,wi,of,Lt,Rt,lt,uu,wf,lt,Yo,Yo,uu,function(r){return 1+(d[8+(r|=0)>>2]/19|0)|0},wf,function(r,n){n|=0,v[v[16+(r|=0)>>2]+m(n,76)>>2]=0},yf,ct,_r,function(r,n,e,i,f,t,u){r|=0,n|=0,e|=0,i=w(i),f=w(f),t=w(t),u=w(u);var o=0;o=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(o=v[o+v[n>>2]>>2]),da[0|o](n,e,i,f,t,u)},bn,function(r,n,e,i){r|=0,n|=0,e|=0,i=w(i);var f=0;return f=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),w(w(da[0|f](n,e,i)))},function(r,n){return n|=0,w(p[v[16+(r|=0)>>2]+m(n,76)>>2])},ff,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Ue(Xf(40),v[r>>2])},function(r){return v[(r|=0)>>2]},Af,function(r,n,e,i,f,t){r|=0,n|=0,e|=0,i=w(i),f=w(f),t=w(t);var u=0;u=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),da[0|u](n,e,i,f,t)},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|cu(Xf(40),v[r>>2])},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|bu(Xf(40),v[r>>2])},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Qe(Xf(40),v[r>>2])},Dt,_t,Ko,Mf,Ni,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Xe(Xf(40),v[r>>2])},Dt,_t,Ko,Ri,li,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Le(Xf(40),v[r>>2])},function(r){return v[36+(r|=0)>>2]},Uu,wf,yf,Oe,function(r,n,e,i,f,t,u,o,a,c,b){r|=0,n|=0,e|=0,i=w(i),f=w(f),t=w(t),u=w(u),o=w(o),a=w(a),c=w(c),b=w(b);var k=0;k=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(k=v[k+v[n>>2]>>2]),da[0|k](n,e,i,f,t,u,o,a,c,b)},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|sn(Xf(40),v[r>>2])},Dt,_t,Bo,Ko,function(r,n){n|=0;var e=0;return e=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(e=v[e+v[n>>2]>>2]),r=0|da[0|e](n),0|Hn(Xf(16),r)},Ao,wf,Wf,function(r,n,e,i,f){r|=0,n|=0,e|=0,i=w(i),f|=0;var t,u=0;D=t=D-16|0,n=((u=v[r+4>>2])>>1)+n|0,r=v[r>>2],r=1&u?v[v[n>>2]+r>>2]:r,u=n,n=Ae(t+4|0,f+4|0,v[f>>2],0),da[0|r](u,e,i,n),lf(n),D=t+16|0},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Or(Xf(60),v[r>>2])},Dt,_t,Dt,_t,Ko,zo,function(r,n,e,i){r|=0,n|=0,e=w(e);var f,t=0,u=0,o=0,a=0,c=0,b=0,k=0;if(D=f=D-32|0,o=v[(i|=0)>>2],t=0|M(4667),u=0|U(0|o,0|t),R(0|t),a=+G(0|u,21305,0|(t=f+12|0)),W(v[f+12>>2]),R(0|u),v[f+24>>2]=0,v[f+16>>2]=0,v[f+20>>2]=0,v[f+12>>2]=8712,v[f+28>>2]=0,yn(o=t,t=a<4294967296&a>=0?~~a>>>0:0,f+28|0),v[f+8>>2]=0,t)for(;D=u=D-16|0,o=v[i>>2],v[u+8>>2]=v[f+8>>2],c=o,o=0|L(21295,u+8|0),b=f,k=0|U(0|c,0|o),v[b+4>>2]=k,R(0|o),D=u+16|0,a=+G(v[f+4>>2],21294,f+28|0),W(v[f+28>>2]),p[v[f+24>>2]+(v[f+8>>2]<<2)>>2]=a,R(v[f+4>>2]),u=v[f+8>>2]+1|0,v[f+8>>2]=u,u>>>0>>0;);_f(i=r,n,e,r=f+12|0),vo(r),D=f+32|0},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|le(Xf(36),v[r>>2])},No,Mo,Wo,wf,Hf,tf,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Ur(Xf(36),v[r>>2])},No,Wo,wf,Mo,$e,function(r,n,e,i,f){r|=0,n|=0,e|=0,i=w(i),f|=0;var t=0;t=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(t=v[t+v[n>>2]>>2]),da[0|t](n,e,i,f)},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|Co(Xf(40),v[r>>2])},ei,function(r,n,e,i,f,t,u,o,a){r|=0,n|=0,e|=0,i=w(i),f=w(f),t=w(t),u|=0,o|=0,a|=0;var c=0;c=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(c=v[c+v[n>>2]>>2]),da[0|c](n,e,i,f,t,u,o,a)},lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|mo(Xf(40),v[r>>2])},Si,li,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|ni(Xf(40),v[r>>2])},Lf,Ni,lt,Yo,Yo,uu,Pf,function(r){return r|=0,0|wo(Xf(40),v[r>>2])},function(){return 21439},uu,yo,function(){return 0|on(Xf(172))},Io,wf,$o,wf,To,function(r){return v[28+(r|=0)>>2]},function(r){return v[32+(r|=0)>>2]},wf,nu,Jt,Lt,Rt,Gu,function(r,n){r|=0,n=w(n),p[r+64>>2]=n,p[r+60>>2]=n},kf,df,Dt,_t,function(r){r|=0;var n=w(0),e=w(0);n=p[r+52>>2];r:{if(l[r+36|0]){if((e=w(p[r+56>>2]-n))==w(0))break r;return w(w(n+Cr(p[r+72>>2],e)))}n=(n=w(p[r+72>>2]+n))<(e=p[r+56>>2])?n:e}return w(n)},kf,function(r){return p[72+(r|=0)>>2]>=w(p[r+56>>2]-p[r+52>>2])|0},wf,function(r){v[152+(r|=0)>>2]=0},If,function(){return 21441},uu,Pf,function(r){return r|=0,0|Ef(Xf(24),v[r>>2])},Lt,Rt,Go,wf,Pi,pe,function(r,n,e,i){var f;r|=0,n|=0,e|=0,i=w(i),D=f=D-16|0,p[f+12>>2]=i,Ot(f,n,e),$n(r+12|0,f,f+12|0),D=f+16|0},function(r,n,e,i,f){r|=0,n|=0,e|=0,i|=0,f=w(f);var t=0;t=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(t=v[t+v[n>>2]>>2]),da[0|t](n,e,i,f)},Un,function(r,n,e,i){n|=0,e|=0,i|=0;var f=0;return f=v[(r|=0)>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),w(w(da[0|f](n,e,i)))},function(){return 21444},uu,Pf,function(r){return r|=0,0|an(Xf(104),v[r>>2])},Io,wf,zo,function(r){return w(p[100+(r|=0)>>2])},function(r,n){r|=0,n=w(n),p[r+100>>2]=n},kf,df,Tr,df,ir,of,Je,If,qn,yf,function(r,n,e,i){return e|=0,i|=0,0|Nn(r|=0,n|=0,xe(v[v[r+16>>2]+4>>2],e),i)},function(r,n,e,i,f){n|=0,e|=0,i|=0,f|=0;var t,u=0;return D=t=D-16|0,n=((u=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&u?v[v[n>>2]+r>>2]:r,u=n,n=Ae(t+4|0,i+4|0,v[i>>2],0),r=0|da[0|r](u,e,n,f),lf(n),D=t+16|0,0|r},function(r,n,e,i){return 0|Nn(r|=0,n|=0,e|=0,i|=0)},function(r,n,e,i,f){return r|=0,n|=0,e|=0,i|=0,f=w(f),0|tn(r,n,xe(v[v[r+16>>2]+4>>2],e),i,f)},function(r,n,e,i,f,t){r|=0,n|=0,e|=0,i|=0,f|=0,t=w(t);var u,o=0;return D=u=D-16|0,n=((o=v[r+4>>2])>>1)+n|0,r=v[r>>2],r=1&o?v[v[n>>2]+r>>2]:r,o=n,n=Ae(u+4|0,i+4|0,v[i>>2],0),r=0|da[0|r](o,e,n,f,t),lf(n),D=u+16|0,0|r},tn,function(r,n,e,i,f,t){r|=0,n|=0,e|=0,i|=0,f|=0,t=w(t);var u=0;return u=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),0|da[0|u](n,e,i,f,t)},function(r,n,e){return r|=0,n|=0,e=w(e),qe(),r=Nn(r,n,20612,0),p[r+84>>2]=e,p[r+100>>2]=e,0|r},function(r,n,e,i){r|=0,n|=0,e|=0,i=w(i);var f=0;return f=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(f=v[f+v[n>>2]>>2]),0|da[0|f](n,e,i)},function(r,n,e,i){return r|=0,n|=0,e=w(e),i=w(i),qe(),r=tn(r,n,20612,0,w(i-(i<=w(0)?e:w(0)))),p[r+84>>2]=e,p[r+100>>2]=e,0|r},function(r,n,e,i,f){r|=0,n|=0,e|=0,i=w(i),f=w(f);var t=0;return t=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(t=v[t+v[n>>2]>>2]),0|da[0|t](n,e,i,f)},function(r,n){r|=0,n=w(n);var e,i,t=0,u=0;if(t=v[r+72>>2],i=l[t+28|0],f[t+28|0]=1,e=v[r+44>>2]){for(t=0;v[v[r+52>>2]+(t<<2)>>2]&&(qe(),u=Nn(r,t,20612,0),p[u+84>>2]=n,p[u+100>>2]=n),(0|e)!=(0|(t=t+1|0)););t=v[r+72>>2]}f[t+28|0]=i,pr(t)},function(r,n){return n|=0,0|(d[44+(r|=0)>>2]>n>>>0?v[v[r+52>>2]+(n<<2)>>2]:0)},of,function(r){f[v[72+(r|=0)>>2]+28|0]=1},function(r){f[v[72+(r|=0)>>2]+28|0]=0},function(){return 21403},uu,Pf,function(r){return r|=0,0|br(Xf(180),v[r>>2])},Go,wf,Bo,Ko,zo,function(r){return 56+(r|=0)|0},function(r){return 72+(r|=0)|0},function(r){return 88+(r|=0)|0},jo,function(r){return v[136+(r|=0)>>2]},wf,function(r){return 0|na(r|=0)},Kt,Lt,Rt,rr,If,ln,Do,Sr,ue,function(r){return v[12+(r|=0)>>2]?v[v[r+20>>2]>>2]:0},wf,ku,ze,function(r,n){return 0|Ci(8+(r|=0)|0,n|=0)},ze,tu,ze,function(r,n){return 0|Ci(24+(r|=0)|0,n|=0)},fu,ii,Gr,yf,function(r,n,e){return n|=0,e|=0,0|Fi(r|=0,eu(v[r+4>>2],n),e)},function(r,n,e,i){n|=0,e|=0,i|=0;var f,t=0;return D=f=D-32|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,t=n,n=Ae(f+20|0,e+4|0,v[e>>2],0),e=Ae(f+8|0,i+4|0,v[i>>2],0),r=0|da[0|r](t,n,e),lf(e),lf(n),D=f+32|0,0|r},Fi,je,function(r,n,e){n|=0,e|=0;var i,f=0,t=0;if(i=v[28+(r|=0)>>2])for(;;){if(t=v[v[r+36>>2]+(f<<2)>>2],qi(Bo(v[t+4>>2]),n))return void af(t,r=v[e+4>>2]?Fi(r,f,e):0);if((0|i)==(0|(f=f+1|0)))break}},function(r,n,e,i){n|=0,e|=0,i|=0;var f,t=0;D=f=D-32|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,t=n,n=Ae(f+20|0,e+4|0,v[e>>2],0),e=Ae(f+8|0,i+4|0,v[i>>2],0),da[0|r](t,n,e),lf(e),lf(n),D=f+32|0},function(r,n){n|=0;var e=0,i=0,f=0;r:if(i=v[60+(r|=0)>>2]){for(;;){if(f=v[v[r+68>>2]+(e<<2)>>2],!qi(No(v[f+4>>2]),n)){if((0|i)!=(0|(e=e+1|0)))continue;break r}break}return 0|f}return 0},ze,function(r,n){n|=0;var e=0,i=0,f=0;r:if(i=v[76+(r|=0)>>2]){for(;;){if(f=v[v[r+84>>2]+(e<<2)>>2],!qi(No(v[f+4>>2]),n)){if((0|i)!=(0|(e=e+1|0)))continue;break r}break}return 0|f}return 0},ze,function(r,n){n|=0;var e=0,i=0,f=0;r:if(i=v[92+(r|=0)>>2]){for(;;){if(f=v[v[r+100>>2]+(e<<2)>>2],!qi(No(v[f+4>>2]),n)){if((0|i)!=(0|(e=e+1|0)))continue;break r}break}return 0|f}return 0},ze,Gt,df,lt,uu,yf,Xi,If,lt,Yo,Yo,uu,Qi,function(r,n){r|=0,n|=0;var e,i=w(0);return e=Xf(12),i=p[r>>2],p[e+8>>2]=p[n>>2],p[e+4>>2]=i,v[e>>2]=11048,0|e},Lt,Rt,yf,Xi,If,lt,Yo,Yo,uu,gf,function(r,n){r|=0,n|=0;var e,i=w(0);return e=Xf(32),i=p[r>>2],v[e+28>>2]=n,v[e+24>>2]=0,v[e+16>>2]=0,v[e+20>>2]=0,p[e+12>>2]=i,v[e+4>>2]=0,v[e+8>>2]=0,v[e>>2]=11080,0|e},yf,Xi,If,Lt,Rt,function(r){return w(p[16+(r|=0)>>2])},function(r,n){r|=0,n=w(n),p[r+16>>2]=n*w(.01745329238474369)},kf,df,function(){return 21449},function(r){(r|=0)&&or(Iu(r))},Dt,_t,Yo,wf,function(){return 21290},qo,Dt,_t,function(){return 21454},function(r){(r|=0)&&or(ce(r))},yo,function(){var r,n,e;return r=Tt(92),v[r+4>>2]=1065353216,s[r>>1]=256,Bf(r+8|0,0,40),v[r+84>>2]=0,v[r+88>>2]=0,v[r+80>>2]=11208,v[r+76>>2]=0,v[r+68>>2]=0,v[r+72>>2]=0,v[r+64>>2]=11192,v[r+56>>2]=1065353216,v[r+60>>2]=1065353216,v[r+48>>2]=1065353216,v[r+52>>2]=1065353216,n=Tt(36),D=e=D-16|0,v[n+4>>2]=0,v[n+8>>2]=0,v[n>>2]=11176,v[n+12>>2]=0,v[n+16>>2]=0,v[n+20>>2]=0,v[n+24>>2]=0,v[n+28>>2]=0,v[n+32>>2]=0,v[e+12>>2]=0,mn(n,6,e+12|0),D=e+16|0,v[r+32>>2]=n,0|r},nu,Jt,Lt,Rt,function(r,n){n|=0;var e,i=0,f=0,t=0,u=0;return(i=v[24+(r|=0)>>2])&&da[v[v[i>>2]+4>>2]](i),(i=v[r+20>>2])&&da[v[v[i>>2]+4>>2]](i),(i=v[r+16>>2])&&da[v[v[i>>2]+4>>2]](i),(i=v[r+8>>2])&&da[v[v[i>>2]+4>>2]](i),v[r+12>>2]=n,t=r,u=br(Xf(180),v[r+12>>2]),v[t+8>>2]=u,t=r,u=Ef(Xf(24),v[r+12>>2]),v[t+16>>2]=u,t=r,u=an(Xf(104),v[r+16>>2]),v[t+20>>2]=u,t=r,u=Ir(Xf(232)),v[t+24>>2]=u,Do(v[r+8>>2]),ln(v[r+8>>2]),n=i=v[r+20>>2],(e=v[i+12>>2])&&(!(f=v[i+8>>2])|(0|r)==(0|f)||(da[0|e](f),n=v[r+20>>2])),v[i+12>>2]=0,v[i+8>>2]=r,v[n+96>>2]=0,v[n+92>>2]=393,v[r+8>>2]},of,function(r,n,e,i){r|=0,n=w(n),e|=0,i|=0;var f=0,t=0;if(f=v[r+8>>2]){if(f=xe(v[f+4>>2],e),e=v[r+20>>2],!f)return Je(e),Do(v[r+8>>2]),0;t=Nn(e,t=n=w(0)?~~n>>>0:0,f,i),ir(v[r+20>>2],v[r+8>>2]),ln(v[r+8>>2])}return 0|t},function(r,n,e,i,f){r|=0,n|=0,e=w(e),i|=0,f|=0;var t,u=0;return D=t=D-16|0,n=((u=v[r+4>>2])>>1)+n|0,r=v[r>>2],r=1&u?v[v[n>>2]+r>>2]:r,u=n,n=Ae(t+4|0,i+4|0,v[i>>2],0),r=0|da[0|r](u,e,n,f),lf(n),D=t+16|0,0|r},function(r,n){var e;n|=0,(e=v[8+(r|=0)>>2])&&(fu(e,n),ue(v[r+8>>2]))},ii,function(r,n){var e;r|=0,n=w(n),(e=v[r+8>>2])&&(Gt(e,n=w(p[r+4>>2]*n)),Tr(v[r+20>>2],n),ir(v[r+20>>2],v[r+8>>2]))},df,function(r){r|=0;var n,e,i,f=0,t=0,u=0,o=0,a=0,c=0,b=0,k=0,d=0,y=0,g=w(0),F=w(0),A=0,T=0,$=0,I=0,C=0,P=0,E=w(0),O=w(0),R=w(0),S=0,W=0,G=w(0),U=w(0),j=w(0);if(l[r+46|0]&&(v[r+68>>2]=0),ln(v[r+8>>2]),v[5305]=v[5304],v[5307]=v[5306],o=v[r+32>>2],D=f=D-16|0,v[f+12>>2]=0,mn(o,0,f+12|0),v[o+16>>2]=0,v[o+20>>2]=0,D=f+16|0,v[v[r+32>>2]+32>>2]=l[r+44|0]?28:24,D=o=D-48|0,e=v[r+8>>2],i=v[e+44>>2],t=l[r+44|0],f=v[5313],v[o+40>>2]=v[5312],v[o+44>>2]=f,f=v[5311],v[o+32>>2]=v[5310],v[o+36>>2]=f,f=v[5309],v[o+24>>2]=v[5308],v[o+28>>2]=f,(f=v[r+28>>2])?(da[v[v[f>>2]+12>>2]](f,e),f=v[r+8>>2]):f=e,n=na(f),i)for(P=(C=t?28:24)>>>2|0,W=r- -64|0;;){y=v[v[e+52>>2]+(S<<2)>>2],b=v[y+8>>2];r:if(0|da[v[v[b>>2]+16>>2]](b))if(v[y+60>>2]){F=p[r+60>>2],E=p[r+56>>2],g=p[r+52>>2],O=p[r+48>>2];n:{e:{i:{f:{t:{if(t=v[y+60>>2],lu(f=0|da[v[v[t>>2]+8>>2]](t),21008)){if(f=v[t+24>>2],u=v[f+4>>2],I=(c=v[u+12>>2])<<1,k=v[u+8>>2],a=v[5305],d=v[5307],!l[r+44|0])break t;if(u=0,(0|k)<=0)break e;for(;A=v[v[f+4>>2]>>2]+m(u,24)|0,$=v[A+16>>2],T=a+m(u,28)|0,v[T+12>>2]=v[A+12>>2],v[T+16>>2]=$,(0|k)!=(0|(u=u+1|0)););break e}if(lu(f,20912)){if(f=v[t+68>>2],u=v[f+4>>2],c=(b=v[u+12>>2])<<1,k=v[u+8>>2],a=v[5305],I=v[5307],!l[r+44|0])break f;if(u=0,(0|k)<=0)break i;for(;T=v[v[f+4>>2]>>2]+m(u,24)|0,A=v[T+16>>2],d=a+m(u,28)|0,v[d+12>>2]=v[T+12>>2],v[d+16>>2]=A,(0|k)!=(0|(u=u+1|0)););break i}if(u=lu(f,20736),f=v[r+24>>2],u){Q(f,y,t);break r}gi(f,y);break r}Ff(a,v[v[f+4>>2]>>2],m(k,C));break e}Ff(a,v[v[f+4>>2]>>2],m(k,C))}u=Ff(I,v[v[f+4>>2]+4>>2],c),kr(t,y,0,v[t+52>>2],a,0,P),v[o+36>>2]=b,v[o+32>>2]=k,v[o+28>>2]=u,v[o+24>>2]=a,I=1,t=ra(t);break n}u=Ff(d,v[v[f+4>>2]+4>>2],I),I=0,Zr(t,b,a,0,P),v[o+36>>2]=c,v[o+32>>2]=k,v[o+28>>2]=u,v[o+24>>2]=a,t=ia(t)}G=p[t+12>>2],U=p[t+4>>2],R=p[t+8>>2],j=p[t+16>>2],v[o+44>>2]=v[f+8>>2],f=(F=w(w(F*j)*w(w(p[n+16>>2]*w(255))*p[y+32>>2])))=w(0)?~~F>>>0:0,F=l[r+45|0]?w(f>>>0):w(255),R=w(g*R),u=(t=(g=w(F*w(R*w(p[n+8>>2]*p[y+24>>2]))))=w(0)?~~g>>>0:0)<<8,O=w(O*U),k=u+((t=(g=w(w(O*w(p[n+4>>2]*p[y+20>>2]))*F))=w(0)?~~g>>>0:0)+(f<<24)|0)|0,E=w(E*G),a=(f=(g=w(F*w(E*w(p[n+12>>2]*p[y+28>>2]))))=w(0)?~~g>>>0:0)<<16,f=0,t=0,u=0,l[y+56|0]&&(f=(g=w(F*w(E*w(p[n+12>>2]*p[y+48>>2]))))=w(0)?~~g>>>0:0,t=(g=w(F*w(R*w(p[n+8>>2]*p[y+44>>2]))))=w(0)?~~g>>>0:0,u=(F=w(F*w(O*w(p[n+4>>2]*p[y+40>>2]))))=w(0)?~~F>>>0:0),k=a+k|0,b=l[r+45|0],d=l[r+44|0],c=yu(v[r+24>>2]),a=v[o+24>>2];n:if(d){if(b=(u+((t<<8)+(f<<16)|0)|0)+(b?-16777216:0)|0,c){if(nr(v[r+24>>2],a,v[o+28>>2],v[o+36>>2],a+12|0,P),f=v[r+24>>2],!(u=v[f+180>>2])){gi(f,y);break r}if(c=v[5305],a=v[5307],t=(d=v[f+164>>2])>>1,v[o+32>>2]=t,v[o+28>>2]=a,v[o+24>>2]=c,v[o+36>>2]=u,Ff(a,v[f+188>>2],u<<1),a=v[f+204>>2],c=v[f+172>>2],T=v[o+24>>2],v[r+28>>2]){if((0|d)<2)break n;for(A=(0|t)<=1?1:t,u=0,f=0;t=T+m(f,28)|0,d=u<<2,p[t>>2]=p[d+c>>2],$=4|d,p[t+4>>2]=p[$+c>>2],p[t+12>>2]=p[a+d>>2],p[t+16>>2]=p[a+$>>2],d=v[r+28>>2],da[v[v[d>>2]+16>>2]](d,t,t+4|0),v[t+24>>2]=b,v[t+20>>2]=k,u=u+2|0,(0|A)!=(0|(f=f+1|0)););break n}if((0|d)<2)break n;for(A=(0|t)<=1?1:t,u=0,f=0;t=T+m(f,28)|0,d=u<<2,p[t>>2]=p[d+c>>2],$=4|d,p[t+4>>2]=p[$+c>>2],p[t+12>>2]=p[a+d>>2],F=p[a+$>>2],v[t+24>>2]=b,v[t+20>>2]=k,p[t+16>>2]=F,u=u+2|0,(0|A)!=(0|(f=f+1|0)););}else if(u=v[o+32>>2],v[r+28>>2]){if(t=0,!u)break n;for(;c=v[r+28>>2],f=a+m(t,28)|0,da[v[v[c>>2]+16>>2]](c,f,f+4|0),v[f+24>>2]=b,v[f+20>>2]=k,(0|u)!=(0|(t=t+1|0)););}else if(f=0,u)for(;t=a+m(f,28)|0,v[t+24>>2]=b,v[t+20>>2]=k,(0|u)!=(0|(f=f+1|0)););}else{if(c){if(nr(v[r+24>>2],a,v[o+28>>2],v[o+36>>2],a+12|0,P),f=v[r+24>>2],!(u=v[f+180>>2])){gi(f,y);break r}if(b=v[5305],a=v[5307],t=(c=v[f+164>>2])>>1,v[o+32>>2]=t,v[o+28>>2]=a,v[o+24>>2]=b,v[o+36>>2]=u,Ff(a,v[f+188>>2],u<<1),a=v[f+204>>2],b=v[f+172>>2],d=v[o+24>>2],v[r+28>>2]){if((0|c)<2)break n;for(T=(0|t)<=1?1:t,f=0,u=0;t=d+m(f,24)|0,c=u<<2,p[t>>2]=p[c+b>>2],A=4|c,p[t+4>>2]=p[A+b>>2],p[t+12>>2]=p[a+c>>2],p[t+16>>2]=p[a+A>>2],c=v[r+28>>2],da[v[v[c>>2]+16>>2]](c,t,t+4|0),v[t+20>>2]=k,u=u+2|0,(0|T)!=(0|(f=f+1|0)););break n}if((0|c)<2)break n;for(T=(0|t)<=1?1:t,f=0,u=0;t=d+m(f,24)|0,c=u<<2,p[t>>2]=p[c+b>>2],A=4|c,p[t+4>>2]=p[A+b>>2],p[t+12>>2]=p[a+c>>2],F=p[a+A>>2],v[t+20>>2]=k,p[t+16>>2]=F,u=u+2|0,(0|T)!=(0|(f=f+1|0)););break n}if(t=v[o+32>>2],v[r+28>>2]){if(f=0,!t)break n;for(;b=v[r+28>>2],u=a+m(f,24)|0,da[v[v[b>>2]+16>>2]](b,u,u+4|0),v[u+20>>2]=k,(0|t)!=(0|(f=f+1|0)););break n}if(f=0,!t)break n;for(;v[20+(a+m(f,24)|0)>>2]=k,(0|t)!=(0|(f=f+1|0)););}v[5305]=v[5305]+m(v[o+32>>2],C),v[5307]=v[5307]+(v[o+36>>2]<<1),l[r+46|0]&&(f=v[r+68>>2],v[o+16>>2]=0,v[o+8>>2]=0,v[o+12>>2]=0,v[o>>2]=0,v[o+4>>2]=0,un(W,f+1|0,o),f=v[r+76>>2]+m(f,20)|0,v[f>>2]=I,t=v[r+32>>2],v[f+4>>2]=v[t+16>>2],v[f+8>>2]=v[o+32>>2],v[f+12>>2]=v[t+20>>2],v[f+16>>2]=v[o+36>>2]),v[o+40>>2]=v[v[y+4>>2]+80>>2];n:if(l[r+47|0]&&(u=f=v[r+84>>2],f)){for(;;){if(v[u+4>>2]!=(0|y)){if(u=v[u+12>>2])continue;break n}break}e:{i:{for(;;){if(v[f+4>>2]==(0|y))break i;if(!(f=v[f+12>>2]))break}f=0;break e}f=v[f+8>>2]}v[o+44>>2]=f}if(D=k=D-16|0,f=v[r+32>>2],!(t=v[f+4>>2])||(u=v[f+12>>2],v[(a=u+(t<<2)|0)-8>>2]!=v[o+40>>2]|v[a-4>>2]!=v[o+44>>2])?(v[k+12>>2]=0,mn(f,t+6|0,k+12|0),u=v[f+12>>2]+(t<<2)|0,v[u>>2]=v[o+24>>2],t=v[o+28>>2],v[u+4>>2]=t,v[u+8>>2]=v[o+32>>2],v[u+12>>2]=v[o+36>>2],v[u+16>>2]=v[o+40>>2],v[u+20>>2]=v[o+44>>2]):(v[(u=(t=u+(t<<2)|0)-16|0)>>2]=v[u>>2]+v[o+32>>2],v[(t=t-12|0)>>2]=v[t>>2]+v[o+36>>2],t=v[o+28>>2]),a=v[o+36>>2])for(b=v[f+16>>2],u=0;s[(c=(u<<1)+t|0)>>1]=b+h[c>>1],(0|a)!=(0|(u=u+1|0)););if(t=v[o+32>>2])for(b=v[f+32>>2]>>>2|0,c=v[o+24>>2],u=0;v[8+(c+(m(u,b)<<2)|0)>>2]=0,(0|t)!=(0|(u=u+1|0)););v[f+16>>2]=t+v[f+16>>2],v[f+20>>2]=a+v[f+20>>2],D=k+16|0,gi(v[r+24>>2],y)}else gi(v[r+24>>2],y);if((0|(S=S+1|0))==(0|i))break}return bf(v[r+24>>2]),(f=v[r+28>>2])&&da[v[v[f>>2]+20>>2]](f),D=o+48|0,o=v[5304],f=v[r+32>>2],v[f+28>>2]=v[5306],v[f+24>>2]=o,v[r+32>>2]},wf,function(r,n){n|=0,f[45+(r|=0)|0]=n},yf,ko,function(r,n,e,i,f){r|=0,n=w(n),e=w(e),i=w(i),f=w(f),p[r+60>>2]=f,p[r+56>>2]=i,p[r+52>>2]=e,p[r+48>>2]=n},function(r,n,e,i,f,t){r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t);var u=0;u=v[r>>2],n=((r=v[r+4>>2])>>1)+n|0,1&r&&(u=v[u+v[n>>2]>>2]),da[0|u](n,e,i,f,t)},zu,yf,zu,yf,function(r){v[28+(r|=0)>>2]=0},If,$o,wf,function(r,n,e,i){r|=0,n|=0,e|=0,i=w(i),Pi(v[r+16>>2],n,e,i)},pe,Uu,yf,function(r,n,e){r|=0,n|=0,v[8+(e|=0)>>2]||(v[r+40>>2]=n,v[e+12>>2]=0,v[e+8>>2]=r,v[e+168>>2]=0,v[e+164>>2]=394)},tf,function(r,n){n|=0,f[46+(r|=0)|0]=n},Uo,function(r,n,e,i,t){r|=0,n|=0,e|=0,i|=0,t|=0;var u=w(0),o=w(0),a=0,c=0;if((r=v[r+8>>2])&&(r=tu(r,n))&&(n=v[r+60>>2]))if(t&&af(r,n=0|da[v[v[n>>2]+12>>2]](n)),lu(0|da[v[v[n>>2]+8>>2]](n),21008))for(u=w(e>>>0),p[n+68>>2]=u,o=w(i>>>0),p[n+72>>2]=o,p[n+76>>2]=u,p[n+80>>2]=o,p[n+52>>2]=u,p[n+56>>2]=o,r=0,Zn(n,w(0),w(0),w(1),w(1),0),zr(n),i=v[n+24>>2],t&&(i=Rf(i),(t=v[n+28>>2])&&(!(e=v[n+24>>2])|(0|e)==(0|i)||da[0|t](e)),v[n+28>>2]=0,v[n+24>>2]=i),e=v[n+112>>2],i=v[v[i+4>>2]>>2],n=0;t=i+m(r,24)|0,a=n<<2,p[t+12>>2]=p[a+e>>2],p[t+16>>2]=p[e+(4|a)>>2],n=n+2|0,4!=(0|(r=r+1|0)););else if(lu(0|da[v[v[n>>2]+8>>2]](n),20912)&&(u=w(e>>>0),p[n+84>>2]=u,o=w(i>>>0),p[n+88>>2]=o,p[n+92>>2]=u,p[n+96>>2]=o,p[n+196>>2]=u,p[n+200>>2]=o,p[n+180>>2]=0,p[n+184>>2]=0,p[n+188>>2]=1,p[n+192>>2]=1,f[n+228|0]=1,v[n+232>>2]=0,sr(n),r=v[n+68>>2],t&&(r=Rf(r),(i=v[n+72>>2])&&(!(e=v[n+68>>2])|(0|r)==(0|e)||da[0|i](e)),v[n+72>>2]=0,v[n+68>>2]=r),e=v[n+52>>2]))for(i=v[v[r+4>>2]>>2],t=e-1>>>1|0,e=v[n+116>>2],n=0,r=0;a=i+m(r,24)|0,c=n<<2,p[a+12>>2]=p[e+c>>2],p[a+16>>2]=p[e+(4|c)>>2],n=n+2|0,a=(0|r)!=(0|t),r=r+1|0,a;);},function(r,n,e,i,f,t){n|=0,e|=0,i|=0,f|=0,t|=0;var u,o=0;D=u=D-16|0,n=((o=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&o?v[v[n>>2]+r>>2]:r,o=n,n=Ae(u+4|0,e+4|0,v[e>>2],0),da[0|r](o,n,i,f,t),lf(n),D=u+16|0},function(r){ce(r|=0),or(r)},function(r,n,e){var i;if(r|=0,n|=0,e|=0,D=i=D-16|0,v[i+12>>2]=e,(e=v[r+8>>2])&&(n=tu(e,n),v[i+8>>2]=n,n)){f[r+47|0]=1;r:{n:{if(n=v[r+84>>2])for(e=v[i+8>>2];;){if((0|e)==v[n+4>>2])break n;if(!(n=v[n+12>>2]))break}n=Xf(20),v[n+12>>2]=0,v[n+16>>2]=0,v[n>>2]=11224,v[n+4>>2]=v[i+8>>2],v[n+8>>2]=v[i+12>>2],(e=v[r+84>>2])&&(v[e+16>>2]=n,v[n+12>>2]=e),v[r+84>>2]=n,v[r+88>>2]=v[r+88>>2]+1;break r}v[n+4>>2]=e,v[n+8>>2]=v[i+12>>2]}}D=i+16|0},function(r,n,e,i){n|=0,e|=0,i|=0;var f,t=0;D=f=D-16|0,n=((t=v[4+(r|=0)>>2])>>1)+n|0,r=v[r>>2],r=1&t?v[v[n>>2]+r>>2]:r,t=n,n=Ae(f+4|0,e+4|0,v[e>>2],0),da[0|r](t,n,i),lf(n),D=f+16|0},function(r,n,e,i){var f;r|=0,n|=0,e|=0,i=w(i),D=f=D-16|0,r=v[r>>2],p[f+12>>2]=i,da[0|r](n,e,f+12|0),D=f+16|0},bt,hf,hf,bt,hf,function(r,n,e,i){var f;n|=0,e|=0,i|=0,D=f=D-16|0,r=v[(r|=0)>>2],s[f+14>>1]=i,da[0|r](n,e,f+14|0),D=f+16|0},function(r,n,e,i){var f,t;n|=0,e|=0,i|=0,D=f=D-16|0,r=v[(r|=0)>>2],t=n,n=Ae(f+4|0,i+4|0,v[i>>2],0),da[0|r](t,e,n),lf(n),D=f+16|0},hf,Kt,Kt,function(r,n,e,i){return r|=0,n|=0,e=w(e),i=w(i),0|da[v[r>>2]](n,e,i)},function(r,n,e,i,f,t){return r|=0,n|=0,e=w(e),i=w(i),f=w(f),t=w(t),0|da[v[r>>2]](n,e,i,f,t)},Kt,Kt,Kt,Kt,Kt,function(r,n,e,i,f){r|=0,n|=0,e|=0,i=w(i),f=w(f),da[v[r>>2]](n,e,i,f)},Kt,Ti,Ti,Kt,Kt,Kt,Kt,Kt,function(r,n,e){n|=0,e|=0,da[v[(r|=0)>>2]](n,e)},Kt,Kt,Kt,Kt,function(r,n,e){var i;return n|=0,e|=0,D=i=D-16|0,da[v[(r|=0)>>2]](i,n,e),r=Hn(Xf(16),i),ae(i),D=i+16|0,0|r},function(r,n){var e;return n|=0,D=e=D-16|0,da[v[(r|=0)>>2]](e,n),r=Ro(Xf(16),e),Ru(e),D=e+16|0,0|r},function(r,n,e){var i;return n|=0,e|=0,D=i=D-16|0,da[v[(r|=0)>>2]](i,n,e),r=Ro(Xf(16),i),Ru(i),D=i+16|0,0|r},Ti,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,function(r,n,e,i,f){var t;r|=0,n|=0,e|=0,i=w(i),f|=0,D=t=D-16|0,r=v[r>>2],v[t+12>>2]=f,da[0|r](n,e,i,t+12|0),R(v[t+12>>2]),D=t+16|0},Kt,Kt,Kt,Kt,Kt,function(r,n,e,i,f){return n|=0,e|=0,i|=0,f|=0,0|da[v[(r|=0)>>2]](n,e,i,f)},Kt,Kt,Kt,Kt,Kt,Kt,function(r,n,e,i){r|=0,n|=0,e=w(e),i=w(i),da[v[r>>2]](n,e,i)},Kt,function(){return 21457},qo,function(r){da[0|(r|=0)]()},function(){var r=0,n=0;r=Tt(4),v[r>>2]=9520,v[r>>2]=16928,v[5208]=r,v[5304]||(n=Y(3669960),v[5304]=n,r=Y(1048560),v[5305]=n,v[5306]=r,v[5307]=r)},function(){var r=0;(r=v[5208])&&da[v[v[r>>2]+4>>2]](r),(r=v[5371])&&(or(r),v[5371]=0),v[5372]=0,or(v[5304]),v[5304]=0,or(v[5306]),v[5306]=0},function(r,n){return n|=0,0|da[0|(r|=0)](n)},function(r){r|=0;var n=0;r:{if(n=v[5371]){if(d[5372]>=r>>>0)break r;or(n)}n=Tt(r),v[5372]=r,v[5371]=n}return 0|n},vf,function(r){r|=0;var n=0,e=0;r:if(n=v[5366]){for(;;){if(!qi(n+4|0,r)){if(n=v[n+20>>2])continue;break r}break}if(n=v[5366]){for(;;){if(!qi(n+4|0,r)){if(n=v[n+20>>2])continue;break r}break}e=v[n+16>>2]}}return 0|e},function(r,n,e){var i;return r|=0,e|=0,D=i=D-32|0,n=Ae(i+20|0,4+(n|=0)|0,v[n>>2],0),e=Ae(i+8|0,e+4|0,v[e>>2],0),r=0|da[0|r](n,e),lf(e),lf(n),D=i+32|0,0|r},function(r,n){r|=0,n|=0;var e,i,t,u,o=0,a=0,c=0,b=0,k=0,h=0,y=0,g=0,F=0,A=w(0),T=0,$=0,I=0,C=w(0),P=0,E=0,O=0,R=0,S=0,W=0,G=0,U=0,j=0,H=0,L=0,M=w(0),_=0,z=w(0),x=0;D=u=D-48|0,n=oi(Xf(40),v[n+8>>2],v[n+4>>2]),n=pt(Xf(12),n),f[28+(i=u+4|0)|0]=0,v[i+4>>2]=n,v[i+20>>2]=0,v[i+24>>2]=1065353216,v[i+12>>2]=0,v[i+16>>2]=0,v[i+8>>2]=10280,v[i>>2]=10600,ht(n=i+32|0),v[i+24>>2]=1065353216,r=v[r+8>>2],D=e=D-32|0,ke(n,8524),v[i+12>>2]=0,t=He(Tt(32),r),b=Hr(Xf(232)),(r=In(t,3809))&&(ke(b+176|0,Ct(r,4799,0)),ke(b+164|0,Ct(r,5340,0)),_=b,z=Pt(r,1374,w(0)),p[_+148>>2]=z,_=b,z=Pt(r,1200,w(0)),p[_+152>>2]=z,_=b,z=Pt(r,4705,w(0)),p[_+156>>2]=z,_=b,z=Pt(r,2166,w(0)),p[_+160>>2]=z,_=b,z=Pt(r,2596,w(30)),p[_+204>>2]=z,ke(b+220|0,Ct(r,3787,0)),ke(b+208|0,Ct(r,2857,0))),n=In(t,2745),r=v[n+12>>2],v[e+20>>2]=0,Fn(b+16|0,r,e+20|0);r:{n:{if(r=v[n+4>>2])for(;;){if(k=0,(o=Ct(r,1817,0))&&(k=ru(b,n=gu(e+20|0,o,0)),lf(n),!k))break n;n=Xn(n=Xf(64),T,o=gu(e+20|0,Ct(r,5744,0),0),k),lf(o),_=n,z=w(Pt(r,4667,w(0))*p[i+24>>2]),p[_+24>>2]=z,_=n,z=w(Pt(r,1374,w(0))*p[i+24>>2]),p[_+28>>2]=z,_=n,z=w(Pt(r,1200,w(0))*p[i+24>>2]),p[_+32>>2]=z,_=n,z=Pt(r,4027,w(0)),p[_+36>>2]=z,_=n,z=Pt(r,6697,w(1)),p[_+40>>2]=z,_=n,z=Pt(r,6604,w(1)),p[_+44>>2]=z,_=n,z=Pt(r,6671,w(0)),p[_+48>>2]=z,_=n,z=Pt(r,6565,w(0)),p[_+52>>2]=z,a=Ct(r,4434,4552),v[n+56>>2]=0;e:if(ri(a,4552)){if(o=1,ri(a,4237)&&(o=2,ri(a,3983)&&(o=3,ri(a,5827)))){if(ri(a,4006))break e;o=4}v[n+56>>2]=o}if(_=n,x=Ce(r),f[_+60|0]=x,v[v[b+28>>2]+(T<<2)>>2]=n,T=T+1|0,!(r=v[r>>2]))break}e:{if((o=In(t,2422))&&(ca(n=b+32|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),r=v[o+4>>2]))for(T=0;;){if(a=ru(b,n=gu(e+20|0,o=Ct(r,5314,0),0)),lf(n),!a)break e;n=Bn(n=Xf(84),T,o=gu(e+20|0,Ct(r,5744,0),0),a),lf(o),(a=Ct(r,3491,0))&&(_=o=Ko(n),z=de(a,0),p[_+4>>2]=z,_=o,z=de(a,1),p[_+8>>2]=z,_=o,z=de(a,2),p[_+12>>2]=z,_=o,z=de(a,3),p[_+16>>2]=z),(a=Ct(r,4578,0))&&(_=o=fa(n),z=de(a,0),p[_+4>>2]=z,_=o,z=de(a,1),p[_+8>>2]=z,A=de(a,2),v[o+16>>2]=1065353216,p[o+12>>2]=A,oa(n)),(o=In(r,1824))&&(ee(n+68|0,o=gu(e+20|0,v[o+16>>2],0)),lf(o));i:if(o=In(r,6086)){if(a=1,ri(o=v[o+16>>2],4945)&&(a=2,ri(o,1187))){if(ri(o,4427))break i;a=3}v[n+80>>2]=a}if(v[v[b+44>>2]+(T<<2)>>2]=n,T=T+1|0,!(r=v[r>>2]))break}if((o=In(t,4583))&&(ca(n=b+100|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),n=v[o+4>>2]))for(;;){g=Ve(o=Xf(60),r=gu(a=e+20|0,Ct(n,5744,0),0)),lf(r),ea(g,$t(n,3604,0)),ua(g,Ce(n)),o=g+24|0,$=In(n,2745),ca(o,v[$+12>>2]),r=v[$+12>>2],v[e+20>>2]=0,Fn(o,r,a);i:if(r=v[$+4>>2]){for(k=0;;){if(a=ru(b,$=gu(e+20|0,v[r+16>>2],0)),v[(o=k<<2)+v[g+36>>2]>>2]=a,lf($),v[o+v[g+36>>2]>>2]){if(k=k+1|0,r=v[r>>2])continue;break i}break}da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8488,0),r=gu(e+8|0,v[r+16>>2],0)),lf(r),lf(n);break r}if(_=g,x=ru(b,r=gu(e+20|0,o=Ct(n,2229,0),0)),v[_+40>>2]=x,lf(r),!v[g+40>>2]){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8393,0),r=gu(e+8|0,o,0)),lf(r),lf(n);break r}if(_=g,z=Pt(n,1214,w(1)),p[_+52>>2]=z,_=g,z=w(Pt(n,2573,w(0))*p[i+24>>2]),p[_+56>>2]=z,_=g,x=$t(n,4932,1)?1:-1,v[_+44>>2]=x,_=g,x=!!(0|$t(n,2564,0)),f[_+48|0]=x,_=g,x=!!(0|$t(n,4804,0)),f[_+49|0]=x,_=g,x=!!(0|$t(n,4465,0)),f[_+50|0]=x,v[v[b+112>>2]+(I<<2)>>2]=g,I=I+1|0,!(n=v[n>>2]))break}if((o=In(t,4434))&&(ca(n=b+116|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),n=v[o+4>>2]))for(I=0;;){g=Zf(o=Xf(88),r=gu(a=e+20|0,Ct(n,5744,0),0)),lf(r),ea(g,$t(n,3604,0)),ua(g,Ce(n)),o=g+24|0,$=In(n,2745),ca(o,v[$+12>>2]),r=v[$+12>>2],v[e+20>>2]=0,Fn(o,r,a);i:if(k=v[$+4>>2]){for(T=0;;){if(o=ru(b,a=gu(e+20|0,v[k+16>>2],0)),v[(r=T<<2)+v[g+36>>2]>>2]=o,lf(a),v[r+v[g+36>>2]>>2]){if(T=T+1|0,k=v[k>>2])continue;break i}break}b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8439,0),r=gu(e+8|0,v[k+16>>2],0)),lf(r),lf(n);break r}if(_=g,x=ru(b,r=gu(e+20|0,o=Ct(n,2229,0),0)),v[_+40>>2]=x,lf(r),!v[g+40>>2]){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8393,0),r=gu(e+8|0,o,0)),lf(r),lf(n);break r}if(_=g,x=!!(0|$t(n,4559,0)),f[_+85|0]=x,_=g,x=!!(0|$t(n,4970,0)),f[_+84|0]=x,_=g,z=Pt(n,4027,w(0)),p[_+60>>2]=z,_=g,z=w(Pt(n,1374,w(0))*p[i+24>>2]),p[_+64>>2]=z,_=g,z=w(Pt(n,1200,w(0))*p[i+24>>2]),p[_+68>>2]=z,_=g,z=Pt(n,6697,w(0)),p[_+72>>2]=z,_=g,z=Pt(n,6604,w(0)),p[_+76>>2]=z,_=g,z=Pt(n,6565,w(0)),p[_+80>>2]=z,_=g,z=Pt(n,1252,w(1)),p[_+44>>2]=z,_=g,z=Pt(n,1262,w(1)),p[_+48>>2]=z,_=g,z=Pt(n,1275,w(1)),p[_+52>>2]=z,_=g,z=Pt(n,1243,w(1)),p[_+56>>2]=z,v[v[b+128>>2]+(I<<2)>>2]=g,I=I+1|0,!(n=v[n>>2]))break}if((o=In(t,4720))&&(ca(n=b+132|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),n=v[o+4>>2]))for(I=0;;){r=Yf(r=Xf(76),o=gu($=e+20|0,Ct(n,5744,0),0)),lf(o),ea(r,$t(n,3604,0)),ua(r,Ce(n)),a=r+24|0,g=In(n,2745),ca(a,v[g+12>>2]),o=v[g+12>>2],v[e+20>>2]=0,Fn(a,o,$);i:if(k=v[g+4>>2]){for(T=0;;){if(a=ru(b,$=gu(e+20|0,v[k+16>>2],0)),v[(o=T<<2)+v[r+36>>2]>>2]=a,lf($),v[o+v[r+36>>2]>>2]){if(T=T+1|0,k=v[k>>2])continue;break i}break}b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8466,0),r=gu(e+8|0,v[k+16>>2],0)),lf(r),lf(n);break r}if(_=r,x=ou(b,o=gu(e+20|0,a=Ct(n,2229,0),0)),v[_+40>>2]=x,lf(o),!v[r+40>>2]){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8094,0),r=gu(e+8|0,a,0)),lf(r),lf(n);break r}i:{if(ri(o=Ct(n,5893,2084),6244)){if(ri(o,2084))break i;o=1}else o=0;v[r+44>>2]=o}a=0;i:{if(ri(o=Ct(n,5974,4667),4667)&&(a=1,ri(o,6244))){if(ri(o,2084))break i;a=2}v[r+48>>2]=a}a=0;i:{if(ri(o=Ct(n,6005,2076),2076)&&(a=1,ri(o,4409))){if(ri(o,5835))break i;a=2}v[r+52>>2]=a}if(_=r,z=Pt(n,4027,w(0)),p[_+56>>2]=z,A=Pt(n,3919,w(0)),p[r+60>>2]=A,v[r+44>>2]||(p[r+60>>2]=A*p[i+24>>2]),A=Pt(n,4892,w(0)),p[r+64>>2]=A,d[r+48>>2]<=1&&(p[r+64>>2]=A*p[i+24>>2]),_=r,z=Pt(n,1252,w(1)),p[_+68>>2]=z,_=r,z=Pt(n,1262,w(1)),p[_+72>>2]=z,v[v[b+144>>2]+(I<<2)>>2]=r,I=I+1|0,!(n=v[n>>2]))break}if(G=i+8|0,(o=In(t,2668))&&(ca(n=b+48|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),h=v[o+4>>2]))for(;;){if(k=Ct(h,5744,8524),l[0|k]||(k=v[h+28>>2]),P=ge(n=Xf(68),r=gu(e+20|0,k,0)),lf(r),(r=In(h,2745))&&(r=v[r+4>>2]))for(o=P+36|0;;){if(a=ru(b,n=gu(e+20|0,v[r+16>>2],0)),lf(n),v[e+4>>2]=a,!a){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8417,0),r=gu(e+8|0,v[r+16>>2],0)),lf(r),lf(n);break r}if(Sn(o,e+4|0),!(r=v[r>>2]))break}if((r=In(h,4583))&&(r=v[r+4>>2]))for(o=P+52|0;;){if(a=Vt(b,n=gu(e+20|0,v[r+16>>2],0)),lf(n),!a){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8234,0),r=gu(e+8|0,v[r+16>>2],0)),lf(r),lf(n);break r}if(v[e+20>>2]=a,Sn(o,e+20|0),!(r=v[r>>2]))break}if((r=In(h,4434))&&(r=v[r+4>>2]))for(o=P+52|0;;){if(a=Zt(b,n=gu(e+20|0,v[r+16>>2],0)),lf(n),!a){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8135,0),r=gu(e+8|0,v[r+16>>2],0)),lf(r),lf(n);break r}if(v[e+20>>2]=a,Sn(o,e+20|0),!(r=v[r>>2]))break}if((r=In(h,4720))&&(r=v[r+4>>2]))for(o=P+52|0;;){if(a=Yt(b,n=gu(e+20|0,v[r+16>>2],0)),lf(n),!a){b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8173,0),r=gu(e+8|0,v[r+16>>2],0)),lf(r),lf(n);break r}if(v[e+20>>2]=a,Sn(o,e+20|0),!(r=v[r>>2]))break}if(v[v[b+60>>2]+(E<<2)>>2]=P,ri(k,2138)||(v[b+64>>2]=P),r=In(h,2529),y=v[(r||h)+4>>2])for(;;){if(I=ou(b,r=gu(e+20|0,v[y+28>>2],0)),lf(r),r=v[y+4>>2])for(;;){n=Ct(r,5744,g=v[r+28>>2]),$=Ct(r,4720,n);i:{f:{t:{u:{o:{a:{c:{if(ri(o=Ct(r,5177,4298),4298)){if(!ri(o,4752))break c;if(!ri(o,4746))break c;if(!ri(o,1202))break a;if(!ri(o,4720))break o;if(!ri(o,4855))break t;if(!ri(o,1645))break u;b&&da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8033,0),r=gu(e+8|0,o,0)),lf(r),lf(n);break r}if(a=v[i+4>>2],o=gu(e+20|0,n,0),n=gu(e+8|0,$,0),k=0|da[v[v[a>>2]+12>>2]](a,P,o,n),lf(n),lf(o),!k)break i;ke(k+116|0,$),_=k,z=w(Pt(r,1374,w(0))*p[i+24>>2]),p[_+32>>2]=z,_=k,z=w(Pt(r,1200,w(0))*p[i+24>>2]),p[_+36>>2]=z,_=k,z=Pt(r,6697,w(1)),p[_+44>>2]=z,_=k,z=Pt(r,6604,w(1)),p[_+48>>2]=z,_=k,z=Pt(r,4027,w(0)),p[_+40>>2]=z,_=k,z=w(Pt(r,4705,w(32))*p[i+24>>2]),p[_+52>>2]=z,_=k,z=w(Pt(r,2166,w(32))*p[i+24>>2]),p[_+56>>2]=z,(n=Ct(r,3491,0))&&(A=de(n,0),_=ia(k),z=A,p[_+4>>2]=z,A=de(n,1),_=ia(k),z=A,p[_+8>>2]=z,A=de(n,2),_=ia(k),z=A,p[_+12>>2]=z,A=de(n,3),_=ia(k),z=A,p[_+16>>2]=z),zr(k),n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k);break f}if(a=v[i+4>>2],o=gu(e+20|0,n,0),n=gu(e+8|0,$,0),k=0|da[v[v[a>>2]+16>>2]](a,P,o,n),lf(n),lf(o),!k)break i;if(ke(k+168|0,$),(n=Ct(r,3491,0))&&(A=de(n,0),_=ra(k),z=A,p[_+4>>2]=z,A=de(n,1),_=ra(k),z=A,p[_+8>>2]=z,A=de(n,2),_=ra(k),z=A,p[_+12>>2]=z,A=de(n,3),_=ra(k),z=A,p[_+16>>2]=z),_=k,z=w(Pt(r,4705,w(32))*p[i+24>>2]),p[_+196>>2]=z,_=k,z=w(Pt(r,2166,w(32))*p[i+24>>2]),p[_+200>>2]=z,!(o=In(r,1817))){if(o=k+136|0,a=In(r,2802),ba(o,v[a+12>>2]),n=v[a+12>>2],s[e+20>>1]=0,pn(o,n,e+20|0),T=v[a+4>>2])for(o=v[k+148>>2],n=0;s[o+(n<<1)>>1]=v[T+20>>2],n=n+1|0,T=v[T>>2];);if(o=k+120|0,n=In(r,2398),ca(o,a=v[n+12>>2]),v[e+20>>2]=0,yn(o,a,e+20|0),T=v[n+4>>2])for(o=v[k+132>>2],n=0;p[o+(n<<2)>>2]=p[T+24>>2],n=n+1|0,T=v[T>>2];);if(dr(i,r,k,a),sr(k),_=k,x=$t(r,4506,0),v[_+224>>2]=x,(a=In(r,2842))&&(ba(o=k+152|0,v[a+12>>2]),n=v[a+12>>2],s[e+20>>1]=0,pn(o,n,e+20|0),T=v[a+4>>2]))for(o=v[k+164>>2],n=0;s[o+(n<<1)>>1]=v[T+20>>2],n=n+1|0,T=v[T>>2];);n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k);break f}n=$t(r,4473,1),n=Cf(c=Xf(40),k,$=gu(e+20|0,Ct(r,4352,0),0),F=v[I+4>>2],o=gu(a=e+8|0,v[o+16>>2],0),!!(0|n)),lf(o),lf($),v[e+8>>2]=n,Sn(G,a);break f}o=v[i+4>>2],n=gu(e+20|0,n,0),k=0|da[v[v[o>>2]+20>>2]](o,P,n),lf(n),dr(i,r,k,$t(r,1605,0)<<1),n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k);break f}if(o=v[i+4>>2],n=gu(a=e+20|0,n,0),k=0|da[v[v[o>>2]+24>>2]](o,P,n),lf(n),_=k,x=!!(0|$t(r,6250,0)),f[_+80|0]=x,_=k,x=!!(0|$t(r,6289,1)),f[_+81|0]=x,dr(i,r,k,(n=$t(r,1605,0))<<1),ca(o=k- -64|0,n=(0|n)/3|0),v[e+20>>2]=0,yn(o,n,a),T=v[In(r,2705)+4>>2])for(o=v[k+76>>2],n=0;p[o+(n<<2)>>2]=p[T+24>>2]*p[i+24>>2],n=n+1|0,T=v[T>>2];);n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k);break f}o=v[i+4>>2],n=gu(e+20|0,n,0),k=0|da[v[v[o>>2]+28>>2]](o,P,n),lf(n),_=k,z=w(Pt(r,1374,w(0))*p[i+24>>2]),p[_+20>>2]=z,_=k,z=w(Pt(r,1200,w(0))*p[i+24>>2]),p[_+24>>2]=z,_=k,z=Pt(r,4027,w(0)),p[_+28>>2]=z,n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k);break f}o=v[i+4>>2],n=gu(e+20|0,n,0),k=0|da[v[v[o>>2]+32>>2]](o,P,n),lf(n),(n=Ct(r,6113,0))&&(_=k,x=ou(b,n=gu(e+20|0,n,0)),v[_+64>>2]=x,lf(n)),dr(i,r,k,$t(r,1605,0)<<1),n=v[i+4>>2],da[v[v[n>>2]+36>>2]](n,k)}yt(P,o=v[I+4>>2],n=gu(e+20|0,g,0),k),lf(n)}if(!(r=v[r>>2]))break}if(!(y=v[y>>2]))break}if(E=E+1|0,!(h=v[h>>2]))break}if((0|(n=v[i+12>>2]))>0)for(k=0;a=v[v[i+20>>2]+(k<<2)>>2],(r=v[a+12>>2]?iu(b,a+8|0):v[b+64>>2])&&(o=gt(r,v[a+20>>2],a+24|0))&&(r=v[a+4>>2],v[r+56>>2]=l[a+36|0]?o:r,zn(r,o),sr(v[a+4>>2]),r=v[i+4>>2],da[v[v[r>>2]+36>>2]](r,v[a+4>>2])),(0|n)!=(0|(k=k+1|0)););if(Pn(G),v[i+12>>2]=0,(o=In(t,2512))&&(ca(n=b+68|0,v[o+12>>2]),r=v[o+12>>2],v[e+20>>2]=0,Fn(n,r,e+20|0),r=v[o+4>>2]))for(T=0;o=rf(o=Xf(56),n=gu(e+20|0,v[r+28>>2],0)),lf(n),_=o,x=$t(r,1776,0),v[_+16>>2]=x,_=o,z=Pt(r,2334,w(0)),p[_+20>>2]=z,ke(o+24|0,Ct(r,4831,0)),ke(o+36|0,n=Ct(r,3787,0)),n&&(_=o,z=Pt(r,5652,w(1)),p[_+48>>2]=z,_=o,z=Pt(r,6078,w(0)),p[_+52>>2]=z),v[v[b+80>>2]+(T<<2)>>2]=o,T=T+1|0,r=v[r>>2];);if((o=In(t,2624))&&(ca(n=b+84|0,v[o+12>>2]),r=v[o+12>>2],k=0,v[e+20>>2]=0,Fn(n,r,e+20|0),r=v[o+4>>2]))for(;;){A=w(0),D=c=D-80|0,v[c+76>>2]=0,v[c+68>>2]=0,v[c+72>>2]=0,v[c+64>>2]=1048,U=In(r,2745),n=In(r,2422),o=r,T=In(r,4583),P=In(r,4434),(R=In(r,4720))||(R=In(o,2724)),G=In(o,4473),j=In(o,3610),L=In(o,2512),j||(j=In(o,3600));i:{f:{if(n&&(F=v[n+4>>2]))for(I=v[2413],g=v[2317],$=v[2738];;){if(S=eu(b,r=gu(c+48|0,v[F+28>>2],0)),lf(r),-1==(0|S)){Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,8118,0),r=gu(c+32|0,v[F+28>>2],0)),lf(r),lf(n);break i}if(y=v[F+4>>2])for(;;){if(ri(r=v[y+28>>2],1824))if(ri(r,3491)){if(ri(r,3506))break f;if(W=Le(Xf(40),v[y+12>>2]),v[W+36>>2]=S,n=0,r=v[y+4>>2])for(;O=Ct(r,2160,0),a=Ct(r,4578,0),Oe(W,n,Pt(r,5659,w(0)),de(O,0),de(O,1),de(O,2),de(O,3),de(a,0),de(a,1),de(a,2)),_e(r,W,n),n=n+1|0,r=v[r>>2];);v[c+48>>2]=W,Sn(c- -64|0,c+48|0),n=m($,v[y+12>>2]-1|0),r=W+32|0}else{if(O=Xe(Xf(40),v[y+12>>2]),v[O+20>>2]=S,n=0,r=v[y+4>>2])for(;a=Ct(r,3491,0),Ri(O,n,Pt(r,5659,w(0)),de(a,0),de(a,1),de(a,2),de(a,3)),_e(r,O,n),n=n+1|0,r=v[r>>2];);v[c+48>>2]=O,Sn(c- -64|0,c+48|0),n=m(g,v[y+12>>2]-1|0),r=O+36|0}else{if(O=sn(Xf(40),v[y+12>>2]),v[O+4>>2]=S,h=0,r=v[y+4>>2])for(;a=c+48|0,n=In(r,5744),n=gu(a,n=(0|I)!=v[n+8>>2]?v[n+16>>2]:8524,0),Wf(O,h,Pt(r,5659,w(0)),n),lf(n),h=h+1|0,r=v[r>>2];);v[c+48>>2]=O,Sn(c- -64|0,c+48|0),n=v[y+12>>2]-1|0,r=O+20|0}if(A=A>(C=p[v[r>>2]+(n<<2)>>2])?A:C,!(y=v[y>>2]))break}if(!(F=v[F>>2]))break}t:{if(U&&(y=v[U+4>>2]))for(a=v[2721];;){if(g=Xt(b,r=gu(c+48|0,v[y+28>>2],0)),lf(r),-1==(0|g)){Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,8508,0),r=gu(c+32|0,v[y+28>>2],0)),lf(r),lf(n);break i}if(F=v[y+4>>2])for(;;){if(ri(r=v[F+28>>2],5052)){if(n=ri(r,5821),$=ri(r,5077),(r=ri(r,3732))&&!(!n|!$))break t;if(C=p[i+24>>2],n?$?(M=w(0),n=0,r||(n=bu(Xf(40),v[F+12>>2]))):(M=w(0),n=Ue(Xf(40),v[F+12>>2])):(M=w(1),n=cu(Xf(40),v[F+12>>2])),v[n+36>>2]=g,r=v[F+4>>2])for(C=$?w(1):C,h=0;Af(n,h,Pt(r,5659,w(0)),w(C*Pt(r,1374,M)),w(C*Pt(r,1200,M))),_e(r,n,h),h=h+1|0,r=v[r>>2];);v[c+48>>2]=n,Sn(c- -64|0,c+48|0),h=m(a,v[F+12>>2]-1|0),r=n+32|0}else{if(n=Qe(Xf(40),v[F+12>>2]),v[n+20>>2]=g,h=0,r=v[F+4>>2])for(;Mf(n,h,Pt(r,5659,w(0)),Pt(r,5791,w(0))),_e(r,n,h),h=h+1|0,r=v[r>>2];);v[c+48>>2]=n,Sn(c- -64|0,c+48|0),h=(v[F+12>>2]<<1)-2|0,r=n+36|0}if(A=A>(C=p[v[r>>2]+(h<<2)>>2])?A:C,!(F=v[F>>2]))break}if(!(y=v[y>>2]))break}if(T&&(y=v[T+4>>2]))for(g=v[2405];;){$=Vt(b,r=gu(c+48|0,v[y+28>>2],0)),lf(r),I=Co(Xf(40),v[y+12>>2]);u:if(a=v[b+104>>2])for(n=v[b+112>>2],r=0;;){if((0|$)==v[n+(r<<2)>>2]){v[I+36>>2]=r;break u}if((0|a)==(0|(r=r+1|0)))break}if(h=0,r=v[y+4>>2])for(;ei(I,h,Pt(r,5659,w(0)),Pt(r,1214,w(1)),w(Pt(r,2573,w(0))*p[i+24>>2]),$t(r,4932,1)?1:-1,!!(0|$t(r,2564,0)),!!(0|$t(r,4804,0))),_e(r,I,h),h=h+1|0,r=v[r>>2];);if(v[c+48>>2]=I,Sn(c- -64|0,c+48|0),A=A>(C=p[v[I+32>>2]+(m(g,v[y+12>>2]-1|0)<<2)>>2])?A:C,!(y=v[y>>2]))break}if(P&&(y=v[P+4>>2]))for(g=v[2713];;){$=Zt(b,r=gu(c+48|0,v[y+28>>2],0)),lf(r),I=mo(Xf(40),v[y+12>>2]);u:if(a=v[b+120>>2])for(n=v[b+128>>2],r=0;;){if((0|$)==v[n+(r<<2)>>2]){v[I+36>>2]=r;break u}if((0|a)==(0|(r=r+1|0)))break}if(h=0,r=v[y+4>>2])for(;Si(I,h,Pt(r,5659,w(0)),Pt(r,1252,w(1)),Pt(r,1262,w(1)),Pt(r,1275,w(1)),Pt(r,1243,w(1))),_e(r,I,h),h=h+1|0,r=v[r>>2];);if(v[c+48>>2]=I,Sn(c- -64|0,c+48|0),A=A>(C=p[v[I+32>>2]+(m(g,v[y+12>>2]-1|0)<<2)>>2])?A:C,!(y=v[y>>2]))break}u:{if(R&&(E=v[R+4>>2]))for($=v[2477],a=v[2469];;){if(I=Yt(b,r=gu(c+48|0,v[E+28>>2],0)),lf(r),!I)break u;o:{if(n=v[b+136>>2])for(r=v[b+144>>2],y=0;;){if((0|I)==v[r+(y<<2)>>2])break o;if((0|n)==(0|(y=y+1|0)))break}y=0}if(F=v[E+4>>2])for(;;){if(ri(g=v[F+28>>2],3919)&&ri(g,4892)){if(!ri(g,1214)){if(n=wo(Xf(40),v[F+12>>2]),v[n+36>>2]=y,h=0,r=v[F+4>>2])for(;Af(n,h,Pt(r,5659,w(0)),Pt(r,1252,w(1)),Pt(r,1262,w(1))),_e(r,n,h),h=h+1|0,r=v[r>>2];);v[c+48>>2]=n,Sn(c- -64|0,c+48|0),A=A>(C=p[v[n+32>>2]+(m(a,v[F+12>>2]-1|0)<<2)>>2])?A:C}}else{if(r=ri(g,4892),P=Xf(40),n=v[F+12>>2],r?(ni(P,n),n=!v[I+44>>2]):(Wt(P,n),n=d[I+48>>2]<2),C=p[i+24>>2],v[P+36>>2]=y,r=v[F+4>>2])for(C=n?C:w(1),h=0;Lf(P,h,Pt(r,5659,w(0)),w(C*Pt(r,g,w(0)))),_e(r,P,h),h=h+1|0,r=v[r>>2];);v[c+48>>2]=P,Sn(c- -64|0,c+48|0),A=A>(C=p[v[P+32>>2]+(m($,v[F+12>>2]-1|0)<<2)>>2])?A:C}if(!(F=v[F>>2]))break}if(!(E=v[E>>2]))break}if(G&&(R=v[G+4>>2]))for(;;){if(T=iu(b,r=gu(c+48|0,v[R+28>>2],0)),lf(r),S=v[R+4>>2])for(;;){if(O=eu(b,r=gu(c+48|0,v[S+28>>2],0)),lf(r),n=v[S+4>>2])for(;;){if(H=gt(T,O,r=gu(c+48|0,v[n+28>>2],0)),lf(r),H){if(r=v[H+40>>2],W=(U=v[H+24>>2])?(r>>>0)/3<<1:r,F=Or(Xf(60),v[n+12>>2]),v[F+56>>2]=H,v[F+20>>2]=O,y=v[n+4>>2])for(P=H+36|0,E=0,G=!!(0|U)|(0|W)<=0;;){r=In(y,2872),v[c+60>>2]=0,v[c+52>>2]=0,v[c+56>>2]=0,v[c+48>>2]=8712;o:if(r){h=$t(y,2183,0),v[c+32>>2]=0,yn(c+48|0,W,c+32|0),r=v[r+4>>2];a:if(p[i+24>>2]!=w(1)){if(r)for(a=v[c+60>>2];p[a+(h<<2)>>2]=p[r+24>>2]*p[i+24>>2],h=h+1|0,r=v[r>>2];);}else{if(!r)break a;for(a=v[c+60>>2];p[a+(h<<2)>>2]=p[r+24>>2],h=h+1|0,r=v[r>>2];);}if(!G)for(I=v[H+48>>2],r=0,g=v[c+60>>2];p[(a=g+($=r<<2)|0)>>2]=p[$+I>>2]+p[a>>2],(0|W)!=(0|(r=r+1|0)););}else{if(U){v[c+32>>2]=0,yn(c+48|0,W,c+32|0);break o}_i(c+48|0,P)}if(r=c+48|0,_f(F,E,Pt(y,5659,w(0)),r),_e(y,F,E),E=E+1|0,vo(r),!(y=v[y>>2]))break}v[c+48>>2]=F,Sn(c- -64|0,c+48|0),A=A>(C=p[(v[F+36>>2]+(v[n+12>>2]<<2)|0)-4>>2])?A:C}else Pn(c- -64|0);if(!(n=v[n>>2]))break}if(!(S=v[S>>2]))break}if(!(R=v[R>>2]))break}if(j){if(I=Ur(Xf(36),v[j+12>>2]),y=v[j+4>>2])for(E=0;;){if(v[c+60>>2]=0,v[c+52>>2]=0,v[c+56>>2]=0,v[c+48>>2]=8680,a=In(y,2556)){v[c+44>>2]=0,v[c+36>>2]=0,v[c+40>>2]=0,v[c+32>>2]=8680,(0|(r=v[b+36>>2]))!=(0|(n=v[a+12>>2]))?(n=r-n|0,v[c+40>>2]=n,r=v[5208],_=c,x=0|da[v[v[r>>2]+16>>2]](r,0,n<<2,8524,97),v[_+44>>2]=x,r=v[a+12>>2],n=v[b+36>>2]):n=r,v[c+20>>2]=0,mn(c+32|0,n-r|0,c+20|0),(r=v[b+36>>2])>>>0>d[c+56>>2]&&(v[c+56>>2]=r,n=v[5208],_=c,x=0|da[v[v[n>>2]+16>>2]](n,v[c+60>>2],r<<2,8524,97),v[_+60>>2]=x,r=v[b+36>>2]),v[c+20>>2]=0,mn(c+48|0,r,c+20|0),(0|(r=v[b+36>>2]))>0&&Bf(v[c+60>>2],255,r<<2),r=0,h=0;o:if(F=v[a+4>>2]){for(;;){if(n=eu(b,a=gu(c+20|0,Ct(F,1528,0),0)),lf(a),-1!=(0|n)){if((0|r)!=(0|n)){for(a=v[c+44>>2];v[a+(h<<2)>>2]=r,h=h+1|0,(0|n)!=(0|(r=r+1|0)););r=n}if(n=$t(F,2183,0),v[v[c+60>>2]+(r+n<<2)>>2]=r,r=r+1|0,F=v[F>>2])continue;break o}break}Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+20|0,8118,0),r=gu(c+8|0,Ct(F,1528,0),0)),lf(r),lf(n),Qu(c+32|0),Qu(c+48|0);break i}if((n=v[b+36>>2])>>>0>r>>>0)for(a=v[c+44>>2];v[a+(h<<2)>>2]=r,h=h+1|0,(0|n)!=(0|(r=r+1|0)););if((0|n)>0)for(g=v[c+44>>2],$=v[c+60>>2];-1==v[(a=$+((r=n-1|0)<<2)|0)>>2]&&(h=h-1|0,v[a>>2]=v[g+(h<<2)>>2]),a=n>>>0>1,n=r,a;);Qu(c+32|0)}if(r=c+48|0,$e(I,E,Pt(y,5659,w(0)),r),E=E+1|0,Qu(r),!(y=v[y>>2]))break}v[c+48>>2]=I,Sn(c- -64|0,c+48|0),A=A>(C=p[(v[I+16>>2]+(v[j+12>>2]<<2)|0)-4>>2])?A:C}o:{if(L){if(a=le(Xf(36),v[L+12>>2]),r=v[L+4>>2])for(F=0;;){if($=Qt(b,n=gu(c+48|0,Ct(r,5744,0),0)),lf(n),!$)break o;if(_=n=Vi(Xf(40),Pt(r,5659,w(0)),$),x=$t(r,1776,v[$+16>>2]),v[_+12>>2]=x,_=n,z=Pt(r,2334,p[$+20>>2]),p[_+16>>2]=z,ke(n+20|0,Ct(r,4831,v[$+32>>2])),v[$+40>>2]&&(_=n,z=Pt(r,5652,w(1)),p[_+32>>2]=z,_=n,z=Pt(r,6078,w(0)),p[_+36>>2]=z),Hf(a,F,n),F=F+1|0,!(r=v[r>>2]))break}v[c+48>>2]=a,Sn(c- -64|0,c+48|0),A=A>(C=p[(v[a+16>>2]+(v[L+12>>2]<<2)|0)-4>>2])?A:C}h=Kr(n=Xf(48),r=gu(c+48|0,v[o+28>>2],0),c- -64|0,A),lf(r);break i}Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,8265,0),r=gu(c+32|0,Ct(r,5744,0),0)),lf(r),lf(n);break i}Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,8206,0),r=gu(c+32|0,v[E+28>>2],0)),lf(r),lf(n);break i}Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,8059,0),r=gu(c+32|0,v[F+28>>2],0)),lf(r),lf(n);break i}Pn(c- -64|0),h=0,Vn(i,0,n=gu(c+48|0,7998,0),r=gu(c+32|0,v[y+28>>2],0)),lf(r),lf(n)}if(fo(c- -64|0),D=c+80|0,h&&(v[v[b+96>>2]+(k<<2)>>2]=h,k=k+1|0),!(r=v[o>>2]))break}or(we(t));break r}da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8347,0),r=gu(e+8|0,o,0)),lf(r),lf(n);break r}da[v[v[b>>2]+4>>2]](b),b=0,Vn(i,t,n=gu(e+20|0,8369,0),r=gu(e+8|0,o,0)),lf(r),lf(n)}return D=e+32|0,$i(i),D=u+48|0,0|b},function(r,n,e){var i,f;return r|=0,D=i=D-16|0,f=n|=0,n=Ae(i+4|0,4+(e|=0)|0,v[e>>2],0),r=0|da[0|r](f,n),lf(n),D=i+16|0,0|r},function(r,n){r|=0,n|=0;var e,i,t,o,a=0,c=0,b=0,s=0,h=0,y=0,g=0,F=w(0),A=0,T=0,$=0,I=0,C=w(0),P=0,E=0,O=0,R=0,S=0,W=0,G=0,U=0,j=0,H=0,L=0,M=0,_=0,z=0,x=0,J=0,K=w(0),B=0,N=0,q=0,V=0,Z=0;D=o=D-48|0,n=oi(Xf(40),v[n+8>>2],v[n+4>>2]),V=t=o+4|0,Z=pt(Xf(12),n),v[V+4>>2]=Z,v[t+20>>2]=0,v[t+12>>2]=0,v[t+16>>2]=0,v[t+8>>2]=10280,v[t>>2]=10248,ht(t+24|0),f[t+40|0]=0,v[t+36>>2]=1065353216,v[t+36>>2]=1065353216,n=v[5371],D=i=D-16|0,e=Xf(12),v[e+8>>2]=r+n,v[e+4>>2]=n,v[e>>2]=10264,v[t+12>>2]=0,Ai((g=Hr(Xf(232)))+176|0,mi(e)),Ai(r=g+164|0,mi(e)),r=qi(n=gu(i+4|0,6888,0),r),lf(n);r:if(r)da[v[v[e>>2]+4>>2]](e),g&&da[v[v[g>>2]+4>>2]](g),fe(t,6942,8524),g=0;else{if(r=v[e+4>>2],v[e+4>>2]=r+1,n=l[0|r],v[e+4>>2]=r+2,a=l[r+1|0],v[e+4>>2]=r+3,c=l[r+2|0],v[e+4>>2]=r+4,v[g+148>>2]=l[r+3|0]|(c|a<<8|n<<16)<<8,v[e+4>>2]=r+5,n=l[r+4|0],v[e+4>>2]=r+6,a=l[r+5|0],v[e+4>>2]=r+7,c=l[r+6|0],v[e+4>>2]=r+8,v[g+152>>2]=l[r+7|0]|(c|a<<8|n<<16)<<8,v[e+4>>2]=r+9,n=l[r+8|0],v[e+4>>2]=r+10,a=l[r+9|0],v[e+4>>2]=r+11,c=l[r+10|0],v[e+4>>2]=r+12,v[g+156>>2]=l[r+11|0]|(c|a<<8|n<<16)<<8,v[e+4>>2]=r+13,n=l[r+12|0],v[e+4>>2]=r+14,a=l[r+13|0],v[e+4>>2]=r+15,c=l[r+14|0],v[e+4>>2]=r+16,v[g+160>>2]=l[r+15|0]|(c|a<<8|n<<16)<<8,v[e+4>>2]=r+17,(s=l[r+16|0])&&(v[e+4>>2]=r+18,n=l[r+17|0],v[e+4>>2]=r+19,a=l[r+18|0],v[e+4>>2]=r+20,c=l[r+19|0],v[e+4>>2]=r+21,v[g+204>>2]=l[r+20|0]|(c|a<<8|n<<16)<<8,Ai(g+208|0,mi(e)),Ai(g+220|0,mi(e))),(0|(r=Wn(e,1)))>0)for(n=g+188|0;V=i,Z=mi(e),v[V+4>>2]=Z,Sn(n,i+4|0),(0|r)!=(0|(y=y+1|0)););if(a=Wn(e,1),v[i+4>>2]=0,Fn(g+16|0,a,i+4|0),(0|a)>0)for(c=0;n=mi(e),c?(r=Wn(e,1),r=v[v[g+28>>2]+(r<<2)>>2]):r=0,n=Xn(h=Xf(64),c,b=gu(i+4|0,n,1),r),lf(b),r=v[e+4>>2],v[e+4>>2]=r+1,b=l[0|r],v[e+4>>2]=r+2,y=l[r+1|0],v[e+4>>2]=r+3,h=l[r+2|0],v[e+4>>2]=r+4,v[n+36>>2]=l[r+3|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=r+5,b=l[r+4|0],v[e+4>>2]=r+6,y=l[r+5|0],v[e+4>>2]=r+7,h=l[r+6|0],v[e+4>>2]=r+8,F=p[t+36>>2],p[n+28>>2]=F*(u(2,l[r+7|0]|(h|y<<8|b<<16)<<8),k()),v[e+4>>2]=r+9,b=l[r+8|0],v[e+4>>2]=r+10,y=l[r+9|0],v[e+4>>2]=r+11,h=l[r+10|0],v[e+4>>2]=r+12,p[n+32>>2]=F*(u(2,l[r+11|0]|(h|y<<8|b<<16)<<8),k()),v[e+4>>2]=r+13,b=l[r+12|0],v[e+4>>2]=r+14,y=l[r+13|0],v[e+4>>2]=r+15,h=l[r+14|0],v[e+4>>2]=r+16,v[n+40>>2]=l[r+15|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=r+17,b=l[r+16|0],v[e+4>>2]=r+18,y=l[r+17|0],v[e+4>>2]=r+19,h=l[r+18|0],v[e+4>>2]=r+20,v[n+44>>2]=l[r+19|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=r+21,b=l[r+20|0],v[e+4>>2]=r+22,y=l[r+21|0],v[e+4>>2]=r+23,h=l[r+22|0],v[e+4>>2]=r+24,v[n+48>>2]=l[r+23|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=r+25,b=l[r+24|0],v[e+4>>2]=r+26,y=l[r+25|0],v[e+4>>2]=r+27,h=l[r+26|0],v[e+4>>2]=r+28,v[n+52>>2]=l[r+27|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=r+29,b=l[r+28|0],v[e+4>>2]=r+30,y=l[r+29|0],v[e+4>>2]=r+31,h=l[r+30|0],v[e+4>>2]=r+32,p[n+24>>2]=F*(u(2,l[r+31|0]|(h|y<<8|b<<16)<<8),k()),V=n,Z=Wn(e,1),v[V+56>>2]=Z,r=v[e+4>>2],v[e+4>>2]=r+1,f[n+60|0]=0!=l[0|r],s&&(v[e+4>>2]=r+5),v[v[g+28>>2]+(c<<2)>>2]=n,(0|a)!=(0|(c=c+1|0)););if(b=Wn(e,1),v[i+4>>2]=0,Fn(g+32|0,b,i+4|0),(0|b)>0)for(r=0;n=mi(e),a=Wn(e,1),a=v[v[g+28>>2]+(a<<2)>>2],a=Bn(c=Xf(84),r,n=gu(i+4|0,n,1),a),lf(n),c=Ko(a),n=v[e+4>>2],v[e+4>>2]=n+1,p[c+4>>2]=w(l[0|n])/w(255),v[e+4>>2]=n+2,p[c+8>>2]=w(l[n+1|0])/w(255),v[e+4>>2]=n+3,p[c+12>>2]=w(l[n+2|0])/w(255),v[e+4>>2]=n+4,p[c+16>>2]=w(l[n+3|0])/w(255),v[e+4>>2]=n+5,c=l[n+4|0],v[e+4>>2]=n+6,y=l[n+5|0],v[e+4>>2]=n+7,h=l[n+6|0],v[e+4>>2]=n+8,255==(c&y)&255==(h&l[n+7|0])||(n=fa(a),v[n+16>>2]=1065353216,p[n+12>>2]=w(h>>>0)/w(255),p[n+8>>2]=w(y>>>0)/w(255),p[n+4>>2]=w(c>>>0)/w(255),ci(n),oa(a)),ke(c=a+68|0,n=(n=Wn(e,1))?v[(v[g+200>>2]+(n<<2)|0)-4>>2]:0),V=a,Z=Wn(e,1),v[V+80>>2]=Z,v[v[g+44>>2]+(r<<2)>>2]=a,(0|b)!=(0|(r=r+1|0)););if(c=Wn(e,1),v[i+4>>2]=0,Fn(g+100|0,c,i+4|0),(0|c)>0)for(r=0;;){if(n=mi(e),a=Ve(a=Xf(60),n=gu(b=i+4|0,n,1)),lf(n),ea(a,Wn(e,1)),n=v[e+4>>2],v[e+4>>2]=n+1,ua(a,0!=l[0|n]),n=Wn(e,1),v[i+4>>2]=0,Fn(a+24|0,n,b),(0|n)>0)for(y=0;b=Wn(e,1),v[v[a+36>>2]+(y<<2)>>2]=v[v[g+28>>2]+(b<<2)>>2],(0|n)!=(0|(y=y+1|0)););if(n=Wn(e,1),v[a+40>>2]=v[v[g+28>>2]+(n<<2)>>2],n=v[e+4>>2],v[e+4>>2]=n+1,b=l[0|n],v[e+4>>2]=n+2,y=l[n+1|0],v[e+4>>2]=n+3,h=l[n+2|0],v[e+4>>2]=n+4,v[a+52>>2]=l[n+3|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+5,b=l[n+4|0],v[e+4>>2]=n+6,y=l[n+5|0],v[e+4>>2]=n+7,h=l[n+6|0],v[e+4>>2]=n+8,p[a+56>>2]=p[t+36>>2]*(u(2,l[n+7|0]|(h|y<<8|b<<16)<<8),k()),v[e+4>>2]=n+9,v[a+44>>2]=f[n+8|0],v[e+4>>2]=n+10,f[a+48|0]=0!=l[n+9|0],v[e+4>>2]=n+11,f[a+49|0]=0!=l[n+10|0],v[e+4>>2]=n+12,f[a+50|0]=0!=l[n+11|0],v[v[g+112>>2]+(r<<2)>>2]=a,(0|c)==(0|(r=r+1|0)))break}if(c=Wn(e,1),v[i+4>>2]=0,Fn(g+116|0,c,i+4|0),(0|c)>0)for(r=0;;){if(n=mi(e),a=Zf(a=Xf(88),n=gu(b=i+4|0,n,1)),lf(n),ea(a,Wn(e,1)),n=v[e+4>>2],v[e+4>>2]=n+1,ua(a,0!=l[0|n]),n=Wn(e,1),v[i+4>>2]=0,Fn(a+24|0,n,b),(0|n)>0)for(y=0;b=Wn(e,1),v[v[a+36>>2]+(y<<2)>>2]=v[v[g+28>>2]+(b<<2)>>2],(0|n)!=(0|(y=y+1|0)););if(n=Wn(e,1),v[a+40>>2]=v[v[g+28>>2]+(n<<2)>>2],n=v[e+4>>2],v[e+4>>2]=n+1,f[a+85|0]=0!=l[0|n],v[e+4>>2]=n+2,f[a+84|0]=0!=l[n+1|0],v[e+4>>2]=n+3,b=l[n+2|0],v[e+4>>2]=n+4,y=l[n+3|0],v[e+4>>2]=n+5,h=l[n+4|0],v[e+4>>2]=n+6,v[a+60>>2]=l[n+5|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+7,b=l[n+6|0],v[e+4>>2]=n+8,y=l[n+7|0],v[e+4>>2]=n+9,h=l[n+8|0],v[e+4>>2]=n+10,F=p[t+36>>2],p[a+64>>2]=F*(u(2,l[n+9|0]|(h|y<<8|b<<16)<<8),k()),v[e+4>>2]=n+11,b=l[n+10|0],v[e+4>>2]=n+12,y=l[n+11|0],v[e+4>>2]=n+13,h=l[n+12|0],v[e+4>>2]=n+14,p[a+68>>2]=F*(u(2,l[n+13|0]|(h|y<<8|b<<16)<<8),k()),v[e+4>>2]=n+15,b=l[n+14|0],v[e+4>>2]=n+16,y=l[n+15|0],v[e+4>>2]=n+17,h=l[n+16|0],v[e+4>>2]=n+18,v[a+72>>2]=l[n+17|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+19,b=l[n+18|0],v[e+4>>2]=n+20,y=l[n+19|0],v[e+4>>2]=n+21,h=l[n+20|0],v[e+4>>2]=n+22,v[a+76>>2]=l[n+21|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+23,b=l[n+22|0],v[e+4>>2]=n+24,y=l[n+23|0],v[e+4>>2]=n+25,h=l[n+24|0],v[e+4>>2]=n+26,v[a+80>>2]=l[n+25|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+27,b=l[n+26|0],v[e+4>>2]=n+28,y=l[n+27|0],v[e+4>>2]=n+29,h=l[n+28|0],v[e+4>>2]=n+30,v[a+44>>2]=l[n+29|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+31,b=l[n+30|0],v[e+4>>2]=n+32,y=l[n+31|0],v[e+4>>2]=n+33,h=l[n+32|0],v[e+4>>2]=n+34,v[a+48>>2]=l[n+33|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+35,b=l[n+34|0],v[e+4>>2]=n+36,y=l[n+35|0],v[e+4>>2]=n+37,h=l[n+36|0],v[e+4>>2]=n+38,v[a+52>>2]=l[n+37|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+39,b=l[n+38|0],v[e+4>>2]=n+40,y=l[n+39|0],v[e+4>>2]=n+41,h=l[n+40|0],v[e+4>>2]=n+42,v[a+56>>2]=l[n+41|0]|(h|y<<8|b<<16)<<8,v[v[g+128>>2]+(r<<2)>>2]=a,(0|c)==(0|(r=r+1|0)))break}if(c=Wn(e,1),v[i+4>>2]=0,Fn(g+132|0,c,i+4|0),(0|c)>0)for(r=0;;){if(n=mi(e),a=Yf(a=Xf(76),n=gu(b=i+4|0,n,1)),lf(n),ea(a,Wn(e,1)),n=v[e+4>>2],v[e+4>>2]=n+1,ua(a,0!=l[0|n]),n=Wn(e,1),v[i+4>>2]=0,Fn(a+24|0,n,b),(0|n)>0)for(y=0;b=Wn(e,1),v[v[a+36>>2]+(y<<2)>>2]=v[v[g+28>>2]+(b<<2)>>2],(0|n)!=(0|(y=y+1|0)););if(n=Wn(e,1),v[a+40>>2]=v[v[g+44>>2]+(n<<2)>>2],V=a,Z=Wn(e,1),v[V+44>>2]=Z,V=a,Z=Wn(e,1),v[V+48>>2]=Z,V=a,Z=Wn(e,1),v[V+52>>2]=Z,n=v[e+4>>2],v[e+4>>2]=n+1,b=l[0|n],v[e+4>>2]=n+2,y=l[n+1|0],v[e+4>>2]=n+3,h=l[n+2|0],v[e+4>>2]=n+4,v[a+56>>2]=l[n+3|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+5,b=l[n+4|0],v[e+4>>2]=n+6,y=l[n+5|0],v[e+4>>2]=n+7,h=l[n+6|0],v[e+4>>2]=n+8,b=l[n+7|0]|(h|y<<8|b<<16)<<8,v[a+60>>2]=b,v[a+44>>2]||(p[a+60>>2]=p[t+36>>2]*(u(2,b),k())),v[e+4>>2]=n+9,b=l[n+8|0],v[e+4>>2]=n+10,y=l[n+9|0],v[e+4>>2]=n+11,h=l[n+10|0],v[e+4>>2]=n+12,b=l[n+11|0]|(h|y<<8|b<<16)<<8,v[a+64>>2]=b,d[a+48>>2]<=1&&(p[a+64>>2]=p[t+36>>2]*(u(2,b),k())),v[e+4>>2]=n+13,b=l[n+12|0],v[e+4>>2]=n+14,y=l[n+13|0],v[e+4>>2]=n+15,h=l[n+14|0],v[e+4>>2]=n+16,v[a+68>>2]=l[n+15|0]|(h|y<<8|b<<16)<<8,v[e+4>>2]=n+17,b=l[n+16|0],v[e+4>>2]=n+18,y=l[n+17|0],v[e+4>>2]=n+19,h=l[n+18|0],v[e+4>>2]=n+20,v[a+72>>2]=l[n+19|0]|(h|y<<8|b<<16)<<8,v[v[g+144>>2]+(r<<2)>>2]=a,(0|c)==(0|(r=r+1|0)))break}if(r=X(t,e,1,g,!!(0|s)),v[i>>2]=r,r&&(v[g+64>>2]=r,Sn(g+48|0,i)),r=Wn(e,1))for(n=g+48|0,y=0;V=i,Z=X(t,e,0,g,!!(0|s)),v[V+4>>2]=Z,Sn(n,i+4|0),(0|r)!=(0|(y=y+1|0)););if((0|(s=v[t+12>>2]))>0)for(r=0;;){if(a=v[v[t+20>>2]+(r<<2)>>2],!(n=v[a+12>>2]?iu(g,a+8|0):v[g+64>>2])){da[v[v[e>>2]+4>>2]](e),g&&da[v[v[g>>2]+4>>2]](g),fe(t,8306,v[a+16>>2]),g=0;break r}if(!(n=gt(n,v[a+20>>2],a+24|0))){da[v[v[e>>2]+4>>2]](e),g&&da[v[v[g>>2]+4>>2]](g),fe(t,8323,v[a+32>>2]),g=0;break r}if(c=v[a+4>>2],v[c+56>>2]=l[a+36|0]?n:c,zn(c,n),sr(v[a+4>>2]),n=v[t+4>>2],da[v[v[n>>2]+36>>2]](n,v[a+4>>2]),(0|s)==(0|(r=r+1|0)))break}if(Pn(t+8|0),v[t+12>>2]=0,a=Wn(e,1),v[i+4>>2]=0,Fn(g+68|0,a,i+4|0),(0|a)>0)for(c=0;r=(r=Wn(e,1))?v[(v[g+200>>2]+(r<<2)|0)-4>>2]:0,n=rf(n=Xf(56),r=gu(i+4|0,r,0)),lf(r),V=n,Z=Wn(e,0),v[V+16>>2]=Z,r=v[e+4>>2],v[e+4>>2]=r+1,s=l[0|r],v[e+4>>2]=r+2,b=l[r+1|0],v[e+4>>2]=r+3,y=l[r+2|0],v[e+4>>2]=r+4,v[n+20>>2]=l[r+3|0]|(y|b<<8|s<<16)<<8,Ai(n+24|0,mi(e)),Ai(n+36|0,mi(e)),v[n+40>>2]&&(r=v[e+4>>2],v[e+4>>2]=r+1,s=l[0|r],v[e+4>>2]=r+2,b=l[r+1|0],v[e+4>>2]=r+3,y=l[r+2|0],v[e+4>>2]=r+4,v[n+48>>2]=l[r+3|0]|(y|b<<8|s<<16)<<8,v[e+4>>2]=r+5,s=l[r+4|0],v[e+4>>2]=r+6,b=l[r+5|0],v[e+4>>2]=r+7,y=l[r+6|0],v[e+4>>2]=r+8,v[n+52>>2]=l[r+7|0]|(y|b<<8|s<<16)<<8),v[v[g+80>>2]+(c<<2)>>2]=n,(0|a)!=(0|(c=c+1|0)););if(B=Wn(e,1),v[i+4>>2]=0,Fn(g+84|0,B,i+4|0),(0|B)>0)for(y=0;;){N=gu(i+4|0,mi(e),1),b=0,C=w(0),D=s=D+-64|0,v[s+60>>2]=0,v[s+52>>2]=0,v[s+56>>2]=0,v[s+48>>2]=1048,K=p[t+36>>2];n:{e:if(!((0|($=Wn(e,1)))<=0))for(j=v[2317],O=v[2738],A=1;;){if(T=Wn(e,1),h=0,(0|(W=Wn(e,1)))>0)for(;;){r=v[e+4>>2],v[e+4>>2]=r+1,r=l[0|r],a=Wn(e,1);i:{f:{t:{u:{switch(0|r){case 0:if(r=sn(Xf(40),a),v[r+4>>2]=T,n=0,(0|a)<=0)break f;for(;c=v[e+4>>2],v[e+4>>2]=c+1,P=l[0|c],v[e+4>>2]=c+2,E=l[c+1|0],v[e+4>>2]=c+3,I=l[c+2|0],v[e+4>>2]=c+4,u(2,l[c+3|0]|(I|E<<8|P<<16)<<8),Wf(r,n,F=k(),c=gu(I=s+32|0,c=(c=Wn(e,1))?v[(v[g+200>>2]+(c<<2)|0)-4>>2]:0,0)),lf(c),(0|a)!=(0|(n=n+1|0)););break f;case 1:if(c=Xe(Xf(40),a),v[c+20>>2]=T,P=a-1|0,n=0,(0|a)<=0)break t;for(;r=v[e+4>>2],v[e+4>>2]=r+1,E=l[0|r],v[e+4>>2]=r+2,I=l[r+1|0],v[e+4>>2]=r+3,S=l[r+2|0],v[e+4>>2]=r+4,R=l[r+3|0],v[e+4>>2]=r+5,U=l[r+4|0],v[e+4>>2]=r+6,G=l[r+5|0],v[e+4>>2]=r+7,H=l[r+6|0],v[e+4>>2]=r+8,Ri(c,n,(u(2,R|(S|I<<8|E<<16)<<8),k()),w(w(U>>>0)/w(255)),w(w(G>>>0)/w(255)),w(w(H>>>0)/w(255)),w(w(l[r+7|0])/w(255))),(0|n)<(0|P)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););break t;case 2:if(c=Le(Xf(40),a),v[c+36>>2]=T,P=a-1|0,n=0,(0|a)<=0)break u;for(;r=v[e+4>>2],v[e+4>>2]=r+1,E=l[0|r],v[e+4>>2]=r+2,I=l[r+1|0],v[e+4>>2]=r+3,S=l[r+2|0],v[e+4>>2]=r+4,R=l[r+3|0],v[e+4>>2]=r+5,U=l[r+4|0],v[e+4>>2]=r+6,G=l[r+5|0],v[e+4>>2]=r+7,H=l[r+6|0],v[e+4>>2]=r+8,M=l[r+7|0],v[e+4>>2]=r+10,_=l[r+9|0],v[e+4>>2]=r+11,L=l[r+10|0],v[e+4>>2]=r+12,Oe(c,n,(u(2,R|(S|I<<8|E<<16)<<8),k()),w(w(U>>>0)/w(255)),w(w(G>>>0)/w(255)),w(w(H>>>0)/w(255)),w(w(M>>>0)/w(255)),w(w(_>>>0)/w(255)),w(w(L>>>0)/w(255)),w(w(l[r+11|0])/w(255))),(0|n)<(0|P)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););break u}if(Pn(s+48|0),fe(t,7998,v[v[v[g+44>>2]+(T<<2)>>2]+16>>2]),r=0,1&A)break n;break e}v[s+32>>2]=c,n=c+32|0,Sn(s+48|0,s+32|0),r=m(P,O);break i}v[s+32>>2]=c,n=c+36|0,Sn(s+48|0,s+32|0),r=m(P,j);break i}v[s+32>>2]=r,n=r+20|0,Sn(s+48|0,s+32|0),r=a-1|0}if(C=(F=p[v[n>>2]+(r<<2)>>2])(0|(b=b+1|0)),(0|b)==(0|$))break}e:if(!((0|($=Wn(e,1)))<=0))for(b=0,j=v[2721],A=1;;){if(T=Wn(e,1),h=0,(0|(O=Wn(e,1)))>0)for(;;){r=v[e+4>>2],v[e+4>>2]=r+1,r=l[0|r],a=Wn(e,1);i:{f:{t:{u:{o:switch(0|r){case 0:if(c=Qe(Xf(40),a),v[c+20>>2]=T,(0|a)>0)for(P=a-1|0,n=0;r=v[e+4>>2],v[e+4>>2]=r+1,W=l[0|r],v[e+4>>2]=r+2,E=l[r+1|0],v[e+4>>2]=r+3,I=l[r+2|0],v[e+4>>2]=r+4,S=l[r+3|0],v[e+4>>2]=r+5,R=l[r+4|0],v[e+4>>2]=r+6,U=l[r+5|0],v[e+4>>2]=r+7,G=l[r+6|0],v[e+4>>2]=r+8,Mf(c,n,(u(2,S|(I|E<<8|W<<16)<<8),k()),(u(2,l[r+7|0]|(G|U<<8|R<<16)<<8),k())),(0|n)<(0|P)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););v[s+32>>2]=c,n=(a<<1)-2|0,Sn(s+48|0,s+32|0),r=c+36|0;break i;case 2:c=cu(Xf(40),a),F=w(1);break u;case 3:c=bu(Xf(40),a),F=w(1);break u;case 1:break o;default:break t}c=Ue(Xf(40),a),F=K}if(v[c+36>>2]=T,P=a-1|0,n=0,(0|a)<=0)break f;for(;r=v[e+4>>2],v[e+4>>2]=r+1,W=l[0|r],v[e+4>>2]=r+2,E=l[r+1|0],v[e+4>>2]=r+3,I=l[r+2|0],v[e+4>>2]=r+4,S=l[r+3|0],v[e+4>>2]=r+5,R=l[r+4|0],v[e+4>>2]=r+6,U=l[r+5|0],v[e+4>>2]=r+7,G=l[r+6|0],v[e+4>>2]=r+8,H=l[r+7|0],v[e+4>>2]=r+9,M=l[r+8|0],v[e+4>>2]=r+10,_=l[r+9|0],v[e+4>>2]=r+11,L=l[r+10|0],v[e+4>>2]=r+12,Af(c,n,(u(2,S|(I|E<<8|W<<16)<<8),k()),w(F*(u(2,H|(G|U<<8|R<<16)<<8),k())),w(F*(u(2,l[r+11|0]|(L|_<<8|M<<16)<<8),k()))),(0|n)<(0|P)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););break f}if(Pn(s+48|0),fe(t,8059,v[v[v[g+28>>2]+(T<<2)>>2]+16>>2]),r=0,1&A)break n;break e}n=m(P,j),v[s+32>>2]=c,Sn(s+48|0,s+32|0),r=c+32|0}if(C=(F=p[v[r>>2]+(n<<2)>>2])(0|(b=b+1|0)),(0|b)==(0|$))break}if((0|(A=Wn(e,1)))>0)for(T=v[2405],h=0;;){if(r=Wn(e,1),a=Wn(e,1),c=Co(Xf(40),a),v[c+36>>2]=r,b=a-1|0,n=0,(0|a)>0)for(;r=v[e+4>>2],v[e+4>>2]=r+1,$=l[0|r],v[e+4>>2]=r+2,P=l[r+1|0],v[e+4>>2]=r+3,j=l[r+2|0],v[e+4>>2]=r+4,O=l[r+3|0],v[e+4>>2]=r+5,W=l[r+4|0],v[e+4>>2]=r+6,E=l[r+5|0],v[e+4>>2]=r+7,I=l[r+6|0],v[e+4>>2]=r+8,S=l[r+7|0],v[e+4>>2]=r+9,R=l[r+8|0],v[e+4>>2]=r+10,U=l[r+9|0],v[e+4>>2]=r+11,G=l[r+10|0],v[e+4>>2]=r+12,F=p[t+36>>2],H=l[r+11|0],v[e+4>>2]=r+13,M=f[r+12|0],v[e+4>>2]=r+14,_=l[r+13|0],v[e+4>>2]=r+15,ei(c,n,(u(2,O|(j|P<<8|$<<16)<<8),k()),(u(2,S|(I|E<<8|W<<16)<<8),k()),w(F*(u(2,H|(G|U<<8|R<<16)<<8),k())),M,!!(0|_),0!=l[r+14|0]),(0|n)<(0|b)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););if(v[s+32>>2]=c,Sn(s+48|0,s+32|0),C=(F=p[v[c+32>>2]+(m(b,T)<<2)>>2])0)for(T=v[2713],c=0;;){if(r=Wn(e,1),a=Wn(e,1),b=mo(Xf(40),a),v[b+36>>2]=r,h=a-1|0,n=0,(0|a)>0)for(;r=v[e+4>>2],v[e+4>>2]=r+1,$=l[0|r],v[e+4>>2]=r+2,P=l[r+1|0],v[e+4>>2]=r+3,j=l[r+2|0],v[e+4>>2]=r+4,O=l[r+3|0],v[e+4>>2]=r+5,W=l[r+4|0],v[e+4>>2]=r+6,E=l[r+5|0],v[e+4>>2]=r+7,I=l[r+6|0],v[e+4>>2]=r+8,S=l[r+7|0],v[e+4>>2]=r+9,R=l[r+8|0],v[e+4>>2]=r+10,U=l[r+9|0],v[e+4>>2]=r+11,G=l[r+10|0],v[e+4>>2]=r+12,H=l[r+11|0],v[e+4>>2]=r+13,M=l[r+12|0],v[e+4>>2]=r+14,_=l[r+13|0],v[e+4>>2]=r+15,L=l[r+14|0],v[e+4>>2]=r+16,z=l[r+15|0],v[e+4>>2]=r+17,x=l[r+16|0],v[e+4>>2]=r+18,J=l[r+17|0],v[e+4>>2]=r+19,q=l[r+18|0],v[e+4>>2]=r+20,Si(b,n,(u(2,O|(j|P<<8|$<<16)<<8),k()),(u(2,S|(I|E<<8|W<<16)<<8),k()),(u(2,H|(G|U<<8|R<<16)<<8),k()),(u(2,z|(L|_<<8|M<<16)<<8),k()),(u(2,l[r+19|0]|(J<<8|x<<16|q)<<8),k())),(0|n)<(0|h)&&jr(e,n,b),(0|a)!=(0|(n=n+1|0)););if(v[s+32>>2]=b,Sn(s+48|0,s+32|0),C=(F=p[v[b+32>>2]+(m(h,T)<<2)>>2])0)for(A=0,j=v[2477],O=v[2469];;){if(b=Wn(e,1),T=v[v[g+144>>2]+(b<<2)>>2],(0|(W=Wn(e,1)))>0)for(h=0;;){r=v[e+4>>2],v[e+4>>2]=r+1,r=f[0|r],a=Wn(e,1);e:{i:switch(0|r){case 0:case 1:if(c=Xf(40),1!=(0|r)?(ni(c,a),r=!v[T+44>>2]):(Wt(c,a),r=d[T+48>>2]<2),v[c+36>>2]=b,$=a-1|0,n=0,(0|a)>0)for(F=r?K:w(1);r=v[e+4>>2],v[e+4>>2]=r+1,E=l[0|r],v[e+4>>2]=r+2,I=l[r+1|0],v[e+4>>2]=r+3,S=l[r+2|0],v[e+4>>2]=r+4,R=l[r+3|0],v[e+4>>2]=r+5,U=l[r+4|0],v[e+4>>2]=r+6,G=l[r+5|0],v[e+4>>2]=r+7,H=l[r+6|0],v[e+4>>2]=r+8,Lf(c,n,(u(2,R|(S|I<<8|E<<16)<<8),k()),w(F*(u(2,l[r+7|0]|(H|G<<8|U<<16)<<8),k()))),(0|n)<(0|$)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););v[s+32>>2]=c,Sn(s+48|0,s+32|0),C=(F=p[v[c+32>>2]+(m($,j)<<2)>>2])>2]=b,$=a-1|0,n=0,(0|a)>0)for(;r=v[e+4>>2],v[e+4>>2]=r+1,E=l[0|r],v[e+4>>2]=r+2,I=l[r+1|0],v[e+4>>2]=r+3,S=l[r+2|0],v[e+4>>2]=r+4,R=l[r+3|0],v[e+4>>2]=r+5,U=l[r+4|0],v[e+4>>2]=r+6,G=l[r+5|0],v[e+4>>2]=r+7,H=l[r+6|0],v[e+4>>2]=r+8,M=l[r+7|0],v[e+4>>2]=r+9,_=l[r+8|0],v[e+4>>2]=r+10,L=l[r+9|0],v[e+4>>2]=r+11,z=l[r+10|0],v[e+4>>2]=r+12,Af(c,n,(u(2,R|(S|I<<8|E<<16)<<8),k()),(u(2,M|(H|G<<8|U<<16)<<8),k()),(u(2,l[r+11|0]|(z|L<<8|_<<16)<<8),k())),(0|n)<(0|$)&&jr(e,n,c),(0|a)!=(0|(n=n+1|0)););v[s+32>>2]=c,Sn(s+48|0,s+32|0),C=(F=p[v[c+32>>2]+(m($,O)<<2)>>2])>2]+(r<<2)>>2],A=0,(0|(G=Wn(e,1)))>0)for(;;){if(h=0,S=Wn(e,1),(0|(H=Wn(e,1)))>0)for(;;){if(r=0,(n=Wn(e,1))&&(r=v[(v[g+200>>2]+(n<<2)|0)-4>>2]),T=gt(U,S,n=gu(s+32|0,r,0)),lf(n),!T){if(Pn(s+48|0),fe(t,8283,r),r=0,I)break n;break e}if(r=v[T+40>>2],P=(R=v[T+24>>2])?(r>>>0)/3<<1:r,j=Wn(e,1),$=Or(Xf(60),j),v[$+56>>2]=T,v[$+20>>2]=S,j)for(M=T+36|0,_=P<<2,W=j-1|0,b=0;;){r=v[e+4>>2],v[e+4>>2]=r+1,n=l[0|r],v[e+4>>2]=r+2,a=l[r+1|0],v[e+4>>2]=r+3,O=l[r+2|0],v[e+4>>2]=r+4,r=l[r+3|0],v[s+44>>2]=0,v[s+36>>2]=0,v[s+40>>2]=0,v[s+32>>2]=8712,u(2,r|(O|a<<8|n<<16)<<8),F=k();i:if(r=Wn(e,1)){v[s+16>>2]=0,yn(s+32|0,P,s+16|0),O=r+(n=Wn(e,1))|0;f:if(K==w(1)){if(!(n>>>0>=O>>>0))for(r=v[e+4>>2],L=v[s+44>>2];v[e+4>>2]=r+1,z=l[0|r],v[e+4>>2]=r+2,x=l[r+1|0],v[e+4>>2]=r+3,J=l[r+2|0],a=r+4|0,v[e+4>>2]=a,v[L+(n<<2)>>2]=l[r+3|0]|(J|x<<8|z<<16)<<8,r=a,(0|O)!=(0|(n=n+1|0)););}else{if(n>>>0>=O>>>0)break f;for(r=v[e+4>>2],L=v[s+44>>2];v[e+4>>2]=r+1,z=l[0|r],v[e+4>>2]=r+2,x=l[r+1|0],v[e+4>>2]=r+3,J=l[r+2|0],a=r+4|0,v[e+4>>2]=a,p[L+(n<<2)>>2]=K*(u(2,l[r+3|0]|(J|x<<8|z<<16)<<8),k()),r=a,(0|O)!=(0|(n=n+1|0)););}if(!R&&(n=v[s+36>>2]))for(a=v[T+48>>2],r=0,O=v[s+44>>2];p[(z=(L=r<<2)+O|0)>>2]=p[a+L>>2]+p[z>>2],(0|n)!=(0|(r=r+1|0)););}else{if(R){if(v[s+16>>2]=0,yn(s+32|0,P,s+16|0),!P)break i;Bf(v[s+44>>2],0,_);break i}v[s+36>>2]=0,_i(s+32|0,M)}if(_f($,b,F,s+32|0),b>>>0>>0&&jr(e,b,$),vo(s+32|0),(0|j)==(0|(b=b+1|0)))break}else W=-1;if(v[s+32>>2]=$,Sn(s+48|0,s+32|0),C=(F=p[v[$+36>>2]+(W<<2)>>2])(0|(c=c+1|0)),(0|c)==(0|E))break}if(A=Wn(e,1)){for(T=Ur(Xf(36),A),P=(a=v[g+36>>2])<<2,b=0;;){if(r=v[e+4>>2],v[e+4>>2]=r+1,j=l[0|r],v[e+4>>2]=r+2,O=l[r+1|0],v[e+4>>2]=r+3,W=l[r+2|0],v[e+4>>2]=r+4,E=l[r+3|0],$=Wn(e,1),v[s+44>>2]=0,v[s+36>>2]=0,v[s+40>>2]=0,v[s+32>>2]=8680,v[s+16>>2]=0,mn(s+32|0,a,s+16|0),(I=(0|a)<=0)||Bf(v[s+44>>2],255,P),r=0,v[s+28>>2]=0,v[s+20>>2]=0,v[s+24>>2]=0,v[s+16>>2]=8680,v[s+12>>2]=0,mn(s+16|0,a-$|0,s+12|0),n=0,$)for(h=0,S=v[s+44>>2],R=v[s+28>>2];;){if((0|(c=Wn(e,1)))!=(0|r)){for(;v[R+(n<<2)>>2]=r,n=n+1|0,(0|c)!=(0|(r=r+1|0)););r=c}if(V=S+(Wn(e,1)+r<<2)|0,Z=r,v[V>>2]=Z,r=r+1|0,(0|$)==(0|(h=h+1|0)))break}if(r>>>0>>0)for(c=v[s+28>>2];v[c+(n<<2)>>2]=r,n=n+1|0,(0|a)!=(0|(r=r+1|0)););if(!I)for(h=v[s+28>>2],$=v[s+44>>2],r=a;-1==v[(I=$+((c=r-1|0)<<2)|0)>>2]&&(n=n-1|0,v[I>>2]=v[h+(n<<2)>>2]),I=r>>>0>1,r=c,I;);if(r=s+32|0,$e(T,b,(u(2,E|(W|O<<8|j<<16)<<8),k()),r),Qu(s+16|0),Qu(r),(0|A)==(0|(b=b+1|0)))break}v[s+32>>2]=T,Sn(s+48|0,s+32|0),C=(F=p[(v[T+16>>2]+(A<<2)|0)-4>>2])0){for(c=le(Xf(36),a),b=0;r=v[e+4>>2],v[e+4>>2]=r+1,n=l[0|r],v[e+4>>2]=r+2,A=l[r+1|0],v[e+4>>2]=r+3,T=l[r+2|0],v[e+4>>2]=r+4,r=l[r+3|0],h=Wn(e,1),h=v[v[g+80>>2]+(h<<2)>>2],V=n=Vi(Xf(40),(u(2,r|(T|A<<8|n<<16)<<8),k()),h),Z=Wn(e,0),v[V+12>>2]=Z,r=v[e+4>>2],v[e+4>>2]=r+1,A=l[0|r],v[e+4>>2]=r+2,T=l[r+1|0],v[e+4>>2]=r+3,$=l[r+2|0],v[e+4>>2]=r+4,v[n+16>>2]=l[r+3|0]|($|T<<8|A<<16)<<8,v[e+4>>2]=r+5,ee(T=n+20|0,A=gu(A=s+32|0,r=($=l[r+4|0])?mi(e):v[h+32>>2],0)),lf(A),$&&(A=v[5208],da[v[v[A>>2]+20>>2]](A,r,8524,1028)),v[h+40>>2]&&(r=v[e+4>>2],v[e+4>>2]=r+1,h=l[0|r],v[e+4>>2]=r+2,A=l[r+1|0],v[e+4>>2]=r+3,T=l[r+2|0],v[e+4>>2]=r+4,v[n+32>>2]=l[r+3|0]|(T|A<<8|h<<16)<<8,v[e+4>>2]=r+5,h=l[r+4|0],v[e+4>>2]=r+6,A=l[r+5|0],v[e+4>>2]=r+7,T=l[r+6|0],v[e+4>>2]=r+8,v[n+36>>2]=l[r+7|0]|(T|A<<8|h<<16)<<8),Hf(c,b,n),(0|a)!=(0|(b=b+1|0)););v[s+32>>2]=c,Sn(s+48|0,s+32|0),C=(F=p[(v[c+16>>2]+(a<<2)|0)-4>>2])>2]+4>>2]](e),g&&da[v[v[g>>2]+4>>2]](g),lf(N),g=0;break r}if(v[v[g+96>>2]+(y<<2)>>2]=r,lf(N),(0|B)==(0|(y=y+1|0)))break}da[v[v[e>>2]+4>>2]](e)}return D=i+16|0,bi(t),D=o+48|0,0|g},function(r,n,e){var i,f;r|=0,D=i=D-16|0,f=n|=0,n=Ae(i+4|0,4+(e|=0)|0,v[e>>2],0),da[0|r](f,n),lf(n),D=i+16|0},function(r,n){r|=0,n|=0;var e,i=0;D=e=D-16|0,v[e+12>>2]=r;r:{if(r=v[5366])for(;;){if(qi(r+4|0,n))break r;if(!(r=v[r+20>>2]))break}n:{e:{if(r=v[5366])for(;;){if(qi(i=r+4|0,n))break e;if(!(r=v[r+20>>2]))break}r=Xf(28),v[r>>2]=16912,i=ht(r+4|0),v[r+20>>2]=0,v[r+24>>2]=0,ee(i,n),v[r+16>>2]=v[e+12>>2],(n=v[5366])&&(v[n+24>>2]=r,v[r+20>>2]=n),v[5366]=r,v[5367]=v[5367]+1;break n}ee(i,n),v[r+16>>2]=v[e+12>>2]}}D=e+16|0},function(r,n){var e;r|=0,D=e=D-16|0,n=Ae(e+4|0,4+(n|=0)|0,v[n>>2],0),da[0|r](n),lf(n),D=e+16|0},function(r){r|=0;var n=0,e=0;r:if(n=v[5366]){for(;;){if(!qi(n+4|0,r)){if(n=v[n+20>>2])continue;break r}break}n:if(n=v[5366]){for(;;){if(!qi(n+4|0,r)){if(n=v[n+20>>2])continue;break n}break}(n=v[n+16>>2])&&da[v[v[n>>2]+4>>2]](n)}n:if(n=v[5366]){for(;;){if(!qi(n+4|0,r)){if(n=v[n+20>>2])continue;break n}break}r=v[n+24>>2],e=v[n+20>>2],v[(r?r+20:21464)>>2]=e,e&&(v[e+24>>2]=r),da[v[v[n>>2]+4>>2]](n),v[5367]=v[5367]-1}}},function(r,n){n|=0,da[0|(r|=0)](n)},uu,yo,function(){return v[5368]},yo,function(){return v[5145]},function(){return v[5369]},yo,function(){return v[5370]},Z,Dr,Ru,function(r){at(Ru(r|=0))},Au,function(r){at(Au(r|=0))},function(){Su(21460)},Su,function(r){at(Su(r|=0))},function(r){return v[(r|=0)>>2]=16912,lf(r+4|0),0|r},function(r){v[(r|=0)>>2]=16912,lf(r+4|0),at(r)},Yo,sa,function(r,n){return(n|=0)?0|Y(n):0},function(r,n){return r|=0,(n|=0)?(!(r=Y(n))|!(3&l[r-4|0])||Bf(r,0,n),0|r):0},function(r,n,e,i,f){r|=0,n|=0,i|=0,f|=0;var t=0,u=0,o=0,a=0,c=0,b=0,k=0,s=0,l=0,h=0;if(!(e|=0))return or(n),0;if(n)if(e>>>0>=4294967232)v[5373]=48,f=0;else{t=e>>>0<11?16:e+11&-8,r=0,f=-8&(a=v[4+(i=n-8|0)>>2]);r:if(3&a){u=i+f|0;n:if(f>>>0>=t>>>0){if((r=f-t|0)>>>0<16)break n;v[i+4>>2]=1&a|t|2,v[4+(f=i+t|0)>>2]=3|r,v[u+4>>2]=1|v[u+4>>2],ar(f,r)}else if(v[5380]!=(0|u))if(v[5379]!=(0|u)){if(2&(o=v[u+4>>2]))break r;if((c=f+(-8&o)|0)>>>0>>0)break r;k=c-t|0;e:if(o>>>0<=255){if((0|(r=v[u+12>>2]))==(0|(f=v[u+8>>2]))){l=21496,h=v[5374]&Qf(o>>>3|0),v[l>>2]=h;break e}v[f+12>>2]=r,v[r+8>>2]=f}else{b=v[u+24>>2];i:if((0|u)==(0|(f=v[u+12>>2]))){f:{if(!(o=v[(r=u+20|0)>>2])){if(!(o=v[u+16>>2]))break f;r=u+16|0}for(;s=r,(o=v[(r=(f=o)+20|0)>>2])||(r=f+16|0,o=v[f+16>>2]););v[s>>2]=0;break i}f=0}else r=v[u+8>>2],v[r+12>>2]=f,v[f+8>>2]=r;if(b){r=v[u+28>>2];i:{if(v[(o=21800+(r<<2)|0)>>2]==(0|u)){if(v[o>>2]=f,f)break i;l=21500,h=v[5375]&Qf(r),v[l>>2]=h;break e}if(v[(v[b+16>>2]==(0|u)?16:20)+b>>2]=f,!f)break e}v[f+24>>2]=b,(r=v[u+16>>2])&&(v[f+16>>2]=r,v[r+24>>2]=f),(r=v[u+20>>2])&&(v[f+20>>2]=r,v[r+24>>2]=f)}}k>>>0<=15?(v[i+4>>2]=1&a|c|2,v[4+(r=i+c|0)>>2]=1|v[r+4>>2]):(v[i+4>>2]=1&a|t|2,v[4+(r=i+t|0)>>2]=3|k,v[4+(f=i+c|0)>>2]=1|v[f+4>>2],ar(r,k))}else{if((f=f+v[5376]|0)>>>0>>0)break r;(r=f-t|0)>>>0>=16?(v[i+4>>2]=1&a|t|2,v[4+(o=i+t|0)>>2]=1|r,v[(f=i+f|0)>>2]=r,v[f+4>>2]=-2&v[f+4>>2]):(v[i+4>>2]=f|1&a|2,v[4+(r=i+f|0)>>2]=1|v[r+4>>2],r=0),v[5379]=o,v[5376]=r}else{if((f=f+v[5377]|0)>>>0<=t>>>0)break r;v[i+4>>2]=1&a|t|2,f=f-t|0,v[4+(r=i+t|0)>>2]=1|f,v[5377]=f,v[5380]=r}r=i}else{if(t>>>0<256)break r;if(f>>>0>=t+4>>>0&&(r=i,f-t>>>0<=v[5494]<<1>>>0))break r;r=0}f=r+8|0,r||(f=0,(i=Y(e))&&(Ff(i,n,(r=(3&(r=v[n-4>>2])?-4:-8)+(-8&r)|0)>>>0>>0?r:e),or(n),f=i))}else f=Y(e);return 0|f},function(r,n){or(n|=0)},function(){return 0},An],ha.set=function(r,n){this[r]=n},ha.get=function(r){return this[r]},ha);function pa(){return i.byteLength/65536|0}return{y:function(){It(20664,3633,20688),Ht(20676,2025),Ht(20688,3638),It(20700,5435,21080),It(20712,5335,21152),It(20724,1838,21164),It(20736,2e3,21164),It(20748,5469,20784),It(20760,1732,21152),Ht(20772,6384),It(20784,5591,21080),It(20796,5546,20784),It(20808,5483,21080),It(20820,5421,21080),It(20836,1711,21152),It(20848,6363,20772),It(20860,5400,20784),Ht(20876,4276),It(20888,4253,20876),It(20900,4270,20876),It(20912,1982,21164),It(20924,1964,21164),It(20936,1728,21152),It(20948,6380,20772),It(20960,5346,20784),It(20972,5515,20784),It(20984,5561,20972),It(20996,1880,20676),It(21008,1927,20676),It(21020,5605,20784),It(21032,5638,21128),It(21044,5501,21128),Ht(21080,5643),It(21092,1687,21152),It(21104,6339,20772),It(21116,5372,20784),It(21128,5620,20784),It(21140,5466,20784),Ht(21152,5804),It(21164,1860,20676),Ht(21180,2278),It(21192,2254,21180),It(21204,2273,21180),v[5314]=1701,v[5315]=0,Z(),mu(21256),v[5316]=1702,v[5317]=0,Dr(),mu(21264),v[5366]=0,v[5367]=0,v[5365]=16896,v[5499]=1719,v[5500]=0,An(),v[5500]=v[5498],v[5498]=21996},z:da,A:Y,B:or,C:function(r){r|=0;var n,e=0,i=0,t=0,u=0;for(D=n=D-32|0,v[n+16>>2]=v[4336],e=v[4335],v[n+8>>2]=v[4334],v[n+12>>2]=e,e=v[4333],v[n>>2]=v[4332],v[n+4>>2]=e,i=7,t=2,u=1;(u&=!(i=r>>>((e=i)<<2)&15)&!!(0|e))||(f[n+t|0]=l[i+17296|0],t=t+1|0),i=e-1|0,e;);return f[n+t|0]=0,r=(e=Y(r=Qn(n)+1|0))?Ff(e,n,r):0,D=n+32|0,0|r},D:function(){var r=0;if(r=v[5498])for(;da[v[r>>2]](),r=v[r+4>>2];);}}}(r)}(r)}function s(r){return{then:function(n){n({instance:new k(r)})}}}Object.assign(e,u),u=null,e.wasmBinary&&(c=e.wasmBinary),e.noExitRuntime;var v=Error,l={};c=[],"object"!=typeof l&&H("no native wasm support detected");var h,d,p,y,m,w,g,F,A,T=!1;function $(){var r=h.buffer;e.HEAP8=d=new Int8Array(r),e.HEAP16=y=new Int16Array(r),e.HEAP32=w=new Int32Array(r),e.HEAPU8=p=new Uint8Array(r),e.HEAPU16=m=new Uint16Array(r),e.HEAPU32=g=new Uint32Array(r),e.HEAPF32=F=new Float32Array(r),e.HEAPF64=A=new Float64Array(r)}var I=e.INITIAL_MEMORY||33554432;65536<=I||H("INITIAL_MEMORY should be larger than STACK_SIZE, was "+I+"! (STACK_SIZE=65536)"),h=e.wasmMemory?e.wasmMemory:new function(){this.buffer=new ArrayBuffer(I/65536*65536)},$(),I=h.buffer.byteLength;var C,P=[],E=[],O=[];function R(){var r=e.preRun.shift();P.unshift(r)}var S,W=0,G=null;function U(){W++,e.monitorRunDependencies&&e.monitorRunDependencies(W)}function j(){if(W--,e.monitorRunDependencies&&e.monitorRunDependencies(W),0==W&&G){var r=G;G=null,r()}}function H(r){throw e.onAbort&&e.onAbort(r),b(r="Aborted("+r+")"),T=!0,r=new v(r+". Build with -sASSERTIONS for more info."),f(r),r}function L(r){return r.startsWith("data:application/octet-stream;base64,")}function M(r){try{if(r==S&&c)return new Uint8Array(c);throw"both async and sync fetching of the wasm failed"}catch(r){H(r)}}function _(r){return c||"function"!=typeof fetch?Promise.resolve().then((()=>M(r))):fetch(r,{credentials:"same-origin"}).then((n=>{if(!n.ok)throw"failed to load wasm binary file at '"+r+"'";return n.arrayBuffer()})).catch((()=>M(r)))}function z(r,n,e){return _(r).then((()=>s(n))).then((r=>r)).then(e,(r=>{b("failed to asynchronously prepare wasm: "+r),H(r)}))}function x(r,n){var e=S;return c||"function"!=typeof l.instantiateStreaming||L(e)||"function"!=typeof fetch?z(e,r,n):fetch(e,{credentials:"same-origin"}).then((i=>l.instantiateStreaming(i,r).then(n,(function(i){return b("wasm streaming compile failed: "+i),b("falling back to ArrayBuffer instantiation"),z(e,r,n)}))))}L(S="spine.wasm")||(S=a(S));var J="spine.js.mem";function K(){L(J)||(J=a(J)),U();var r=r=>{r.byteLength&&(r=new Uint8Array(r)),p.set(r,1024),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,j()},n=()=>{t(r,(()=>{f(Error("could not load memory initializer "+J))}))};if(e.memoryInitializerRequest){var i=()=>{var i=e.memoryInitializerRequest,f=i.response;200!==i.status&&0!==i.status?(console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+i.status+", retrying "+J),n()):r(f)};e.memoryInitializerRequest.response?setTimeout(i,0):e.memoryInitializerRequest.addEventListener("load",i)}else n()}function B(r){for(;0=n?`_${r}`:r}function Q(r,n){return r=X(r),{[r]:function(){return n.apply(this,arguments)}}[r]}function rr(r){var n=Error,e=Q(r,(function(n){this.name=r,this.message=n,void 0!==(n=Error(n).stack)&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},e}var nr=void 0;function er(r){throw new nr(r)}var ir=void 0;function fr(r){throw new ir(r)}function tr(r,n,e){function i(n){(n=e(n)).length!==r.length&&fr("Mismatched type converter count");for(var i=0;i{Z.hasOwnProperty(r)?f[n]=Z[r]:(t.push(r),V.hasOwnProperty(r)||(V[r]=[]),V[r].push((()=>{f[n]=Z[r],++u===t.length&&i(f)})))})),0===t.length&&i(f)}function ur(r,n){if(!("argPackAdvance"in n))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=n.name;if(r||er(`type "${e}" must have a positive integer typeid pointer`),Z.hasOwnProperty(r)){if({}.qa)return;er(`Cannot register type '${e}' twice`)}Z[r]=n,delete Y[r],V.hasOwnProperty(r)&&(n=V[r],delete V[r],n.forEach((r=>r())))}function or(r){er(r.F.I.G.name+" instance already deleted")}var ar=!1;function cr(){}function br(r){--r.count.value,0===r.count.value&&(r.L?r.M.S(r.L):r.I.G.S(r.H))}function kr(r,n,e){return n===e?r:void 0===e.J||null===(r=kr(r,n,e.J))?null:e.ha(r)}var sr={},vr=[];function lr(){for(;vr.length;){var r=vr.pop();r.F.U=!1,r.delete()}}var hr=void 0,dr={};function pr(r,n){for(void 0===n&&er("ptr should not be undefined");r.J;)n=r.W(n),r=r.J;return dr[n]}function yr(r,n){return n.I&&n.H||fr("makeClassHandle requires ptr and ptrType"),!!n.M!=!!n.L&&fr("Both smartPtrType and smartPtr must be specified"),n.count={value:1},mr(Object.create(r,{F:{value:n}}))}function mr(r){return"undefined"==typeof FinalizationRegistry?(mr=r=>r,r):(ar=new FinalizationRegistry((r=>{br(r.F)})),cr=r=>{ar.unregister(r)},(mr=r=>{var n=r.F;return n.L&&ar.register(r,{F:n},r),r})(r))}function wr(){}function gr(r,n,e){if(void 0===r[n].K){var i=r[n];r[n]=function(){return r[n].K.hasOwnProperty(arguments.length)||er(`Function '${e}' called with an invalid number of arguments (${arguments.length}) - expects one of (${r[n].K})!`),r[n].K[arguments.length].apply(this,arguments)},r[n].K=[],r[n].K[i.T]=i}}function Fr(r,n){e.hasOwnProperty(r)?(er(`Cannot register public name '${r}' twice`),gr(e,r,r),e.hasOwnProperty(void 0)&&er("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),e[r].K[void 0]=n):e[r]=n}function Ar(r,n,e,i,f,t,u,o){this.name=r,this.constructor=n,this.P=e,this.S=i,this.J=f,this.ia=t,this.W=u,this.ha=o,this.la=[]}function Tr(r,n,e){for(;n!==e;)n.W||er(`Expected null or instance of ${e.name}, got an instance of ${n.name}`),r=n.W(r),n=n.J;return r}function $r(r,n){return null===n?(this.$&&er(`null is not a valid ${this.name}`),0):(n.F||er(`Cannot pass "${Kr(n)}" as a ${this.name}`),n.F.H||er(`Cannot pass deleted object as a pointer of type ${this.name}`),Tr(n.F.H,n.F.I.G,this.G))}function Ir(r,n){if(null===n){if(this.$&&er(`null is not a valid ${this.name}`),this.Z){var e=this.ma();return null!==r&&r.push(this.S,e),e}return 0}if(n.F||er(`Cannot pass "${Kr(n)}" as a ${this.name}`),n.F.H||er(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.Y&&n.F.I.Y&&er(`Cannot convert argument of type ${n.F.M?n.F.M.name:n.F.I.name} to parameter type ${this.name}`),e=Tr(n.F.H,n.F.I.G,this.G),this.Z)switch(void 0===n.F.L&&er("Passing raw pointer to smart pointer is illegal"),this.pa){case 0:n.F.M===this?e=n.F.L:er(`Cannot convert argument of type ${n.F.M?n.F.M.name:n.F.I.name} to parameter type ${this.name}`);break;case 1:e=n.F.L;break;case 2:if(n.F.M===this)e=n.F.L;else{var i=n.clone();e=this.na(e,Jr((function(){i.delete()}))),null!==r&&r.push(this.S,e)}break;default:er("Unsupporting sharing policy")}return e}function Cr(r,n){return null===n?(this.$&&er(`null is not a valid ${this.name}`),0):(n.F||er(`Cannot pass "${Kr(n)}" as a ${this.name}`),n.F.H||er(`Cannot pass deleted object as a pointer of type ${this.name}`),n.F.I.Y&&er(`Cannot convert argument of type ${n.F.I.name} to parameter type ${this.name}`),Tr(n.F.H,n.F.I.G,this.G))}function Pr(r){return this.fromWireType(w[r>>2])}function Er(r,n,e,i){this.name=r,this.G=n,this.$=e,this.Y=i,this.Z=!1,this.S=this.na=this.ma=this.da=this.pa=this.ka=void 0,void 0!==n.J?this.toWireType=Ir:(this.toWireType=i?$r:Cr,this.O=null)}function Or(r,n){e.hasOwnProperty(r)||fr("Replacing nonexistant public symbol"),e[r]=n,e[r].T=void 0}function Rr(r,n){var i=[];return function(){if(i.length=0,Object.assign(i,arguments),r.includes("j")){var f=e["dynCall_"+r];f=i&&i.length?f.apply(null,[n].concat(i)):f.call(null,n)}else f=C.get(n).apply(null,i);return f}}function Sr(r,n){var e=(r=D(r)).includes("j")?Rr(r,n):C.get(n);return"function"!=typeof e&&er(`unknown function pointer with signature ${r}: ${n}`),e}var Wr=void 0;function Gr(r){var n=D(r=tn(r));return fn(r),n}function Ur(r,n){var e=[],i={};throw n.forEach((function r(n){i[n]||Z[n]||(Y[n]?Y[n].forEach(r):(e.push(n),i[n]=!0))})),new Wr(`${r}: `+e.map(Gr).join([", "]))}function jr(r){for(;r.length;){var n=r.pop();r.pop()(n)}}function Hr(r,n,e,i,f){var t=n.length;2>t&&er("argTypes array size mismatch! Must at least get return value and 'this' types!");var u=null!==n[1]&&null!==e,o=!1;for(e=1;e>2]);return e}function Mr(r,n,e){return r instanceof Object||er(`${e} with invalid "this": ${r}`),r instanceof n.G.constructor||er(`${e} incompatible with "this" of type ${r.constructor.name}`),r.F.H||er(`cannot call emscripten binding method ${e} on deleted object`),Tr(r.F.H,r.F.I.G,n.G)}var _r=new function(){this.N=[void 0],this.aa=[],this.get=function(r){return this.N[r]},this.has=function(r){return void 0!==this.N[r]},this.ea=function(r){var n=this.aa.pop()||this.N.length;return this.N[n]=r,n},this.fa=function(r){this.N[r]=void 0,this.aa.push(r)}};function zr(r){r>=_r.ba&&0==--_r.get(r).oa&&_r.fa(r)}var xr=r=>(r||er("Cannot use deleted val. handle = "+r),_r.get(r).value),Jr=r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return _r.ea({oa:1,value:r})}};function Kr(r){if(null===r)return"null";var n=typeof r;return"object"===n||"array"===n||"function"===n?r.toString():""+r}function Br(r,n){switch(n){case 2:return function(r){return this.fromWireType(F[r>>2])};case 3:return function(r){return this.fromWireType(A[r>>3])};default:throw new TypeError("Unknown float type: "+r)}}function Nr(r,n,e){switch(n){case 0:return e?function(r){return d[r]}:function(r){return p[r]};case 1:return e?function(r){return y[r>>1]}:function(r){return m[r>>1]};case 2:return e?function(r){return w[r>>2]}:function(r){return g[r>>2]};default:throw new TypeError("Unknown integer type: "+r)}}var qr="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Dr(r,n){var e=Z[r];return void 0===e&&er(n+" has unknown type "+Gr(r)),e}var Vr={};function Zr(){var r=e.SpineWasmUtil,n=r.getCurrentListenerID(),i=r.getCurrentTrackEntry(),f=r.getCurrentEvent();r=r.getCurrentEventType(),globalThis.TrackEntryListeners.emitListener(n,i,f,r)}function Yr(){var r=e.SpineWasmUtil,n=r.getCurrentListenerID(),i=r.getCurrentEventType(),f=r.getCurrentTrackEntry();r=r.getCurrentEvent(),globalThis.TrackEntryListeners.emitTrackEntryListener(n,f,r,i)}e._spineListenerCallBackFromJS=Zr,e._spineTrackListenerCallback=Yr;for(var Xr=Array(256),Qr=0;256>Qr;++Qr)Xr[Qr]=String.fromCharCode(Qr);q=Xr,nr=e.BindingError=rr("BindingError"),ir=e.InternalError=rr("InternalError"),wr.prototype.isAliasOf=function(r){if(!(this instanceof wr&&r instanceof wr))return!1;var n=this.F.I.G,e=this.F.H,i=r.F.I.G;for(r=r.F.H;n.J;)e=n.W(e),n=n.J;for(;i.J;)r=i.W(r),i=i.J;return n===i&&e===r},wr.prototype.clone=function(){if(this.F.H||or(this),this.F.V)return this.F.count.value+=1,this;var r=mr,n=Object,e=n.create,i=Object.getPrototypeOf(this),f=this.F;return(r=r(e.call(n,i,{F:{value:{count:f.count,U:f.U,V:f.V,H:f.H,I:f.I,L:f.L,M:f.M}}}))).F.count.value+=1,r.F.U=!1,r},wr.prototype.delete=function(){this.F.H||or(this),this.F.U&&!this.F.V&&er("Object already scheduled for deletion"),cr(this),br(this.F),this.F.V||(this.F.L=void 0,this.F.H=void 0)},wr.prototype.isDeleted=function(){return!this.F.H},wr.prototype.deleteLater=function(){return this.F.H||or(this),this.F.U&&!this.F.V&&er("Object already scheduled for deletion"),vr.push(this),1===vr.length&&hr&&hr(lr),this.F.U=!0,this},e.getInheritedInstanceCount=function(){return Object.keys(dr).length},e.getLiveInheritedInstances=function(){var r,n=[];for(r in dr)dr.hasOwnProperty(r)&&n.push(dr[r]);return n},e.flushPendingDeletes=lr,e.setDelayFunction=function(r){hr=r,vr.length&&hr&&hr(lr)},Er.prototype.ja=function(r){return this.da&&(r=this.da(r)),r},Er.prototype.ca=function(r){this.S&&this.S(r)},Er.prototype.argPackAdvance=8,Er.prototype.readValueFromPointer=Pr,Er.prototype.deleteObject=function(r){null!==r&&r.delete()},Er.prototype.fromWireType=function(r){function n(){return this.Z?yr(this.G.P,{I:this.ka,H:e,M:this,L:r}):yr(this.G.P,{I:this,H:r})}var e=this.ja(r);if(!e)return this.ca(r),null;var i=pr(this.G,e);if(void 0!==i)return 0===i.F.count.value?(i.F.H=e,i.F.L=r,i.clone()):(i=i.clone(),this.ca(r),i);if(i=this.G.ia(e),!(i=sr[i]))return n.call(this);i=this.Y?i.ga:i.pointerType;var f=kr(e,this.G,i.G);return null===f?n.call(this):this.Z?yr(i.G.P,{I:i,H:f,M:this,L:r}):yr(i.G.P,{I:i,H:f})},Wr=e.UnboundTypeError=rr("UnboundTypeError"),_r.N.push({value:void 0},{value:null},{value:!0},{value:!1}),_r.ba=_r.N.length,e.count_emval_handles=function(){for(var r=0,n=_r.ba;n<_r.N.length;++n)void 0!==_r.N[n]&&++r;return r};var rn,nn={q:function(){},u:function(r,n,e,i,f){var t=N(e);ur(r,{name:n=D(n),fromWireType:function(r){return!!r},toWireType:function(r,n){return n?i:f},argPackAdvance:8,readValueFromPointer:function(r){if(1===e)var i=d;else if(2===e)i=y;else{if(4!==e)throw new TypeError("Unknown boolean type size: "+n);i=w}return this.fromWireType(i[r>>t])},O:null})},d:function(r,n,e,i,f,t,u,o,a,c,b,k,s){b=D(b),t=Sr(f,t),o&&(o=Sr(u,o)),c&&(c=Sr(a,c)),s=Sr(k,s);var v=X(b);Fr(v,(function(){Ur(`Cannot construct ${b} due to unbound types`,[i])})),tr([r,n,e],i?[i]:[],(function(n){if(n=n[0],i)var e=n.G,f=e.P;else f=wr.prototype;n=Q(v,(function(){if(Object.getPrototypeOf(this)!==u)throw new nr("Use 'new' to construct "+b);if(void 0===a.R)throw new nr(b+" has no accessible constructor");var r=a.R[arguments.length];if(void 0===r)throw new nr(`Tried to invoke ctor of ${b} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(a.R).toString()}) parameters instead!`);return r.apply(this,arguments)}));var u=Object.create(f,{constructor:{value:n}});n.prototype=u;var a=new Ar(b,n,u,s,e,t,o,c);a.J&&(void 0===a.J.X&&(a.J.X=[]),a.J.X.push(a)),e=new Er(b,a,!0,!1),f=new Er(b+"*",a,!1,!1);var k=new Er(b+" const*",a,!1,!0);return sr[r]={pointerType:f,ga:k},Or(v,n),[e,f,k]}))},g:function(r,n,e,i,f,t,u){var o=Lr(e,i);n=D(n),t=Sr(f,t),tr([],[r],(function(r){function i(){Ur(`Cannot call ${f} due to unbound types`,o)}var f=`${(r=r[0]).name}.${n}`;n.startsWith("@@")&&(n=Symbol[n.substring(2)]);var a=r.G.constructor;return void 0===a[n]?(i.T=e-1,a[n]=i):(gr(a,n,f),a[n].K[e-1]=i),tr([],o,(function(i){if(i=Hr(f,[i[0],null].concat(i.slice(1)),null,t,u),void 0===a[n].K?(i.T=e-1,a[n]=i):a[n].K[e-1]=i,r.G.X)for(const e of r.G.X)e.constructor.hasOwnProperty(n)||(e.constructor[n]=i);return[]})),[]}))},i:function(r,n,e,i,f,t,u,o){n=D(n),t=Sr(f,t),tr([],[r],(function(r){var f=`${(r=r[0]).name}.${n}`,a={get:function(){Ur(`Cannot access ${f} due to unbound types`,[e])},enumerable:!0,configurable:!0};return a.set=o?()=>{Ur(`Cannot access ${f} due to unbound types`,[e])}:()=>{er(`${f} is a read-only property`)},Object.defineProperty(r.G.constructor,n,a),tr([],[e],(function(e){e=e[0];var f={get:function(){return e.fromWireType(t(i))},enumerable:!0};return o&&(o=Sr(u,o),f.set=r=>{var n=[];o(i,e.toWireType(n,r)),jr(n)}),Object.defineProperty(r.G.constructor,n,f),[]})),[]}))},e:function(r,n,e,i,f,t){0{Ur(`Cannot construct ${r.name} due to unbound types`,u)},tr([],u,(function(i){return i.splice(1,0,null),r.G.R[n-1]=Hr(e,i,null,f,t),[]})),[]}))},b:function(r,n,e,i,f,t,u,o){var a=Lr(e,i);n=D(n),t=Sr(f,t),tr([],[r],(function(r){function i(){Ur(`Cannot call ${f} due to unbound types`,a)}var f=`${(r=r[0]).name}.${n}`;n.startsWith("@@")&&(n=Symbol[n.substring(2)]),o&&r.G.la.push(n);var c=r.G.P,b=c[n];return void 0===b||void 0===b.K&&b.className!==r.name&&b.T===e-2?(i.T=e-2,i.className=r.name,c[n]=i):(gr(c,n,f),c[n].K[e-2]=i),tr([],a,(function(i){return i=Hr(f,i,r,t,u),void 0===c[n].K?(i.T=e-2,c[n]=i):c[n].K[e-2]=i,[]})),[]}))},c:function(r,n,e,i,f,t,u,o,a,c){n=D(n),f=Sr(i,f),tr([],[r],(function(r){var i=`${(r=r[0]).name}.${n}`,b={get:function(){Ur(`Cannot access ${i} due to unbound types`,[e,u])},enumerable:!0,configurable:!0};return b.set=a?()=>{Ur(`Cannot access ${i} due to unbound types`,[e,u])}:()=>{er(i+" is a read-only property")},Object.defineProperty(r.G.P,n,b),tr([],a?[e,u]:[e],(function(e){var u=e[0],b={get:function(){var n=Mr(this,r,i+" getter");return u.fromWireType(f(t,n))},enumerable:!0};if(a){a=Sr(o,a);var k=e[1];b.set=function(n){var e=Mr(this,r,i+" setter"),f=[];a(c,e,k.toWireType(f,n)),jr(f)}}return Object.defineProperty(r.G.P,n,b),[]})),[]}))},t:function(r,n){ur(r,{name:n=D(n),fromWireType:function(r){var n=xr(r);return zr(r),n},toWireType:function(r,n){return Jr(n)},argPackAdvance:8,readValueFromPointer:Pr,O:null})},n:function(r,n,e){e=N(e),ur(r,{name:n=D(n),fromWireType:function(r){return r},toWireType:function(r,n){return n},argPackAdvance:8,readValueFromPointer:Br(n,e),O:null})},f:function(r,n,e,i,f){n=D(n),-1===f&&(f=4294967295),f=N(e);var t=r=>r;if(0===i){var u=32-8*e;t=r=>r<>>u}e=n.includes("unsigned")?function(r,n){return n>>>0}:function(r,n){return n},ur(r,{name:n,fromWireType:t,toWireType:e,argPackAdvance:8,readValueFromPointer:Nr(n,f,0!==i),O:null})},s:function(r,n){var e="std::string"===(n=D(n));ur(r,{name:n,fromWireType:function(r){var n=g[r>>2],i=r+4;if(e)for(var f=i,t=0;t<=n;++t){var u=i+t;if(t==n||0==p[u]){if(f){var o=f,a=p,c=o+(u-f);for(f=o;a[f]&&!(f>=c);)++f;if(16(b=224==(240&b)?(15&b)<<12|k<<6|s:(7&b)<<18|k<<12|s<<6|63&a[o++])?c+=String.fromCharCode(b):(b-=65536,c+=String.fromCharCode(55296|b>>10,56320|1023&b))}}else c+=String.fromCharCode(b)}o=c}}else o="";if(void 0===v)var v=o;else v+=String.fromCharCode(0),v+=o;f=u+1}}else{for(v=Array(n),t=0;t=u?f++:2047>=u?f+=2:55296<=u&&57343>=u?(f+=4,++i):f+=3}else f=n.length;if(u=(f=en(4+(i=f)+1))+4,g[f>>2]=i,e&&t){if(t=u,u=i+1,i=p,0=a&&(a=65536+((1023&a)<<10)|1023&n.charCodeAt(++o)),127>=a){if(t>=u)break;i[t++]=a}else{if(2047>=a){if(t+1>=u)break;i[t++]=192|a>>6}else{if(65535>=a){if(t+2>=u)break;i[t++]=224|a>>12}else{if(t+3>=u)break;i[t++]=240|a>>18,i[t++]=128|a>>12&63}i[t++]=128|a>>6&63}i[t++]=128|63&a}}i[t]=0}}else if(t)for(t=0;t>2]=f,n.toWireType(i,r)},h:zr,l:function(r,n){return r=xr(r),n=xr(n),Jr(r[n])},p:function(r){var n=Vr[r];return Jr(void 0===n?D(r):n)},j:function(r){jr(xr(r)),zr(r)},o:function(r,n){return r=(r=Dr(r,"_emval_take_value")).readValueFromPointer(n),Jr(r)},m:function(){H("")},r:function(r){var n=p.length;if(2147483648<(r>>>=0))return!1;for(var e=1;4>=e;e*=2){var i=n*(1+.2/e);i=Math.min(i,r+100663296);var f=Math;i=Math.max(r,i);r:{f=f.min.call(f,2147483648,i+(65536-i%65536)%65536)-h.buffer.byteLength+65535>>>16;try{h.grow(f),$();var t=1;break r}catch(r){}t=void 0}if(t)return!0}return!1},a:h,x:Zr,w:Yr};function en(){return(en=e.asm.A).apply(null,arguments)}function fn(){return(fn=e.asm.B).apply(null,arguments)}function tn(){return(tn=e.asm.C).apply(null,arguments)}function un(){function r(){if(!rn&&(rn=!0,e.calledRun=!0,!T)){if(B(E),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var r=e.postRun.shift();O.unshift(r)}B(O)}}if(!(0=t?"_"+n:n}function V(n,t){var e;return(e={},e[n=N(n)]=function(){return t.apply(this,arguments)},e)[n]}function D(n){var t=Error,e=V(n,(function(t){this.name=n,this.message=t,void 0!==(t=Error(t).stack)&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},e}var z=void 0;function B(n){throw new z(n)}var Z=void 0;function X(n){throw new Z(n)}function Y(n,t,e){function r(t){(t=e(t)).length!==n.length&&X("Mismatched type converter count");for(var r=0;r>2])}function Fn(n,t,e,r){this.name=n,this.G=t,this.$=e,this.Y=r,this.Z=!1,this.S=this.na=this.ma=this.da=this.pa=this.ka=void 0,void 0!==t.J?this.toWireType=gn:(this.toWireType=r?mn:bn,this.O=null)}function Tn(n,t){r.hasOwnProperty(n)||X("Replacing nonexistant public symbol"),r[n]=t,r[n].T=void 0}function Cn(n,t){var e=[];return function(){if(e.length=0,Object.assign(e,arguments),n.includes("j")){var i=r["dynCall_"+n];i=e&&e.length?i.apply(null,[t].concat(e)):i.call(null,t)}else i=F.get(t).apply(null,e);return i}}function Pn(n,t){var e=(n=M(n)).includes("j")?Cn(n,t):F.get(t);return"function"!=typeof e&&B("unknown function pointer with signature "+n+": "+t),e}var An=void 0;function kn(n){var t=M(n=Yn(n));return Xn(n),t}function Wn(n,t){var e=[],r={};throw t.forEach((function n(t){r[t]||x[t]||(K[t]?K[t].forEach(n):(e.push(t),r[t]=!0))})),new An(n+": "+e.map(kn).join([", "]))}function On(n){for(;n.length;){var t=n.pop();n.pop()(t)}}function In(n,t,e,r,i){var o=t.length;2>o&&B("argTypes array size mismatch! Must at least get return value and 'this' types!");var a=null!==t[1]&&null!==e,u=!1;for(e=1;e>2]);return e}function Sn(n,t,e){return n instanceof Object||B(e+' with invalid "this": '+n),n instanceof t.G.constructor||B(e+' incompatible with "this" of type '+n.constructor.name),n.F.H||B("cannot call emscripten binding method "+e+" on deleted object"),yn(n.F.H,n.F.I.G,t.G)}var Gn=new function(){this.N=[void 0],this.aa=[],this.get=function(n){return this.N[n]},this.has=function(n){return void 0!==this.N[n]},this.ea=function(n){var t=this.aa.pop()||this.N.length;return this.N[t]=n,t},this.fa=function(n){this.N[n]=void 0,this.aa.push(n)}};function Rn(n){n>=Gn.ba&&0==--Gn.get(n).oa&&Gn.fa(n)}var jn=function(n){return n||B("Cannot use deleted val. handle = "+n),Gn.get(n).value},Hn=function(n){switch(n){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Gn.ea({oa:1,value:n})}};function Un(n){if(null===n)return"null";var t=typeof n;return"object"===t||"array"===t||"function"===t?n.toString():""+n}function Ln(n,t){switch(t){case 2:return function(n){return this.fromWireType(m[n>>2])};case 3:return function(n){return this.fromWireType(g[n>>3])};default:throw new TypeError("Unknown float type: "+n)}}function _n(n,t,e){switch(t){case 0:return e?function(n){return l[n]}:function(n){return h[n]};case 1:return e?function(n){return p[n>>1]}:function(n){return d[n>>1]};case 2:return e?function(n){return v[n>>2]}:function(n){return y[n>>2]};default:throw new TypeError("Unknown integer type: "+n)}}var Mn="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Jn(n,t){var e=x[n];return void 0===e&&B(t+" has unknown type "+kn(n)),e}var xn={};function Kn(){var n=r.SpineWasmUtil,t=n.getCurrentListenerID(),e=n.getCurrentTrackEntry(),i=n.getCurrentEvent();n=n.getCurrentEventType(),globalThis.TrackEntryListeners.emitListener(t,e,i,n)}function Nn(){var n=r.SpineWasmUtil,t=n.getCurrentListenerID(),e=n.getCurrentEventType(),i=n.getCurrentTrackEntry();n=n.getCurrentEvent(),globalThis.TrackEntryListeners.emitTrackEntryListener(t,i,n,e)}r._spineListenerCallBackFromJS=Kn,r._spineTrackListenerCallback=Nn;for(var Vn=Array(256),Dn=0;256>Dn;++Dn)Vn[Dn]=String.fromCharCode(Dn);_=Vn,z=r.BindingError=D("BindingError"),Z=r.InternalError=D("InternalError"),hn.prototype.isAliasOf=function(n){if(!(this instanceof hn&&n instanceof hn))return!1;var t=this.F.I.G,e=this.F.H,r=n.F.I.G;for(n=n.F.H;t.J;)e=t.W(e),t=t.J;for(;r.J;)n=r.W(n),r=r.J;return t===r&&e===n},hn.prototype.clone=function(){if(this.F.H||q(this),this.F.V)return this.F.count.value+=1,this;var n=ln,t=Object,e=t.create,r=Object.getPrototypeOf(this),i=this.F;return(n=n(e.call(t,r,{F:{value:{count:i.count,U:i.U,V:i.V,H:i.H,I:i.I,L:i.L,M:i.M}}}))).F.count.value+=1,n.F.U=!1,n},hn.prototype.delete=function(){this.F.H||q(this),this.F.U&&!this.F.V&&B("Object already scheduled for deletion"),nn(this),tn(this.F),this.F.V||(this.F.L=void 0,this.F.H=void 0)},hn.prototype.isDeleted=function(){return!this.F.H},hn.prototype.deleteLater=function(){return this.F.H||q(this),this.F.U&&!this.F.V&&B("Object already scheduled for deletion"),on.push(this),1===on.length&&un&&un(an),this.F.U=!0,this},r.getInheritedInstanceCount=function(){return Object.keys(sn).length},r.getLiveInheritedInstances=function(){var n,t=[];for(n in sn)sn.hasOwnProperty(n)&&t.push(sn[n]);return t},r.flushPendingDeletes=an,r.setDelayFunction=function(n){un=n,on.length&&un&&un(an)},Fn.prototype.ja=function(n){return this.da&&(n=this.da(n)),n},Fn.prototype.ca=function(n){this.S&&this.S(n)},Fn.prototype.argPackAdvance=8,Fn.prototype.readValueFromPointer=wn,Fn.prototype.deleteObject=function(n){null!==n&&n.delete()},Fn.prototype.fromWireType=function(n){function t(){return this.Z?fn(this.G.P,{I:this.ka,H:e,M:this,L:n}):fn(this.G.P,{I:this,H:n})}var e=this.ja(n);if(!e)return this.ca(n),null;var r=cn(this.G,e);if(void 0!==r)return 0===r.F.count.value?(r.F.H=e,r.F.L=n,r.clone()):(r=r.clone(),this.ca(n),r);if(r=this.G.ia(e),!(r=rn[r]))return t.call(this);r=this.Y?r.ga:r.pointerType;var i=en(e,this.G,r.G);return null===i?t.call(this):this.Z?fn(r.G.P,{I:r,H:i,M:this,L:n}):fn(r.G.P,{I:r,H:i})},An=r.UnboundTypeError=D("UnboundTypeError"),Gn.N.push({value:void 0},{value:null},{value:!0},{value:!1}),Gn.ba=Gn.N.length,r.count_emval_handles=function(){for(var n=0,t=Gn.ba;t>o])},O:null})},c:function(n,t,e,r,i,o,a,u,s,c,f,l,h){f=M(f),o=Pn(i,o),u&&(u=Pn(a,u)),c&&(c=Pn(s,c)),h=Pn(l,h);var p=N(f);dn(p,(function(){Wn("Cannot construct "+f+" due to unbound types",[r])})),Y([n,t,e],r?[r]:[],(function(t){if(t=t[0],r)var e=t.G,i=e.P;else i=hn.prototype;t=V(p,(function(){if(Object.getPrototypeOf(this)!==a)throw new z("Use 'new' to construct "+f);if(void 0===s.R)throw new z(f+" has no accessible constructor");var n=s.R[arguments.length];if(void 0===n)throw new z("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(s.R).toString()+") parameters instead!");return n.apply(this,arguments)}));var a=Object.create(i,{constructor:{value:t}});t.prototype=a;var s=new vn(f,t,a,h,e,o,u,c);s.J&&(void 0===s.J.X&&(s.J.X=[]),s.J.X.push(s)),e=new Fn(f,s,!0,!1),i=new Fn(f+"*",s,!1,!1);var l=new Fn(f+" const*",s,!1,!0);return rn[n]={pointerType:i,ga:l},Tn(p,t),[e,i,l]}))},f:function(n,e,r,i,o,a,u){var s=En(r,i);e=M(e),a=Pn(o,a),Y([],[n],(function(n){function i(){Wn("Cannot call "+o+" due to unbound types",s)}var o=(n=n[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var c=n.G.constructor;return void 0===c[e]?(i.T=r-1,c[e]=i):(pn(c,e,o),c[e].K[r-1]=i),Y([],s,(function(i){if(i=In(o,[i[0],null].concat(i.slice(1)),null,a,u),void 0===c[e].K?(i.T=r-1,c[e]=i):c[e].K[r-1]=i,n.G.X)for(var s,f=t(n.G.X);!(s=f()).done;){var l=s.value;l.constructor.hasOwnProperty(e)||(l.constructor[e]=i)}return[]})),[]}))},h:function(n,t,e,r,i,o,a,u){t=M(t),o=Pn(i,o),Y([],[n],(function(n){var i=(n=n[0]).name+"."+t,s={get:function(){Wn("Cannot access "+i+" due to unbound types",[e])},enumerable:!0,configurable:!0};return s.set=u?function(){Wn("Cannot access "+i+" due to unbound types",[e])}:function(){B(i+" is a read-only property")},Object.defineProperty(n.G.constructor,t,s),Y([],[e],(function(e){e=e[0];var i={get:function(){return e.fromWireType(o(r))},enumerable:!0};return u&&(u=Pn(a,u),i.set=function(n){var t=[];u(r,e.toWireType(t,n)),On(t)}),Object.defineProperty(n.G.constructor,t,i),[]})),[]}))},d:function(n,t,e,r,i,o){0>>a}}e=t.includes("unsigned")?function(n,t){return t>>>0}:function(n,t){return t},$(n,{name:t,fromWireType:o,toWireType:e,argPackAdvance:8,readValueFromPointer:_n(t,i,0!==r),O:null})},r:function(n,t){var e="std::string"===(t=M(t));$(n,{name:t,fromWireType:function(n){var t=y[n>>2],r=n+4;if(e)for(var i=r,o=0;o<=t;++o){var a=r+o;if(o==t||0==h[a]){if(i){var u=i,s=h,c=u+(a-i);for(i=u;s[i]&&!(i>=c);)++i;if(16(f=224==(240&f)?(15&f)<<12|l<<6|p:(7&f)<<18|l<<12|p<<6|63&s[u++])?c+=String.fromCharCode(f):(f-=65536,c+=String.fromCharCode(55296|f>>10,56320|1023&f))}}else c+=String.fromCharCode(f)}u=c}}else u="";if(void 0===d)var d=u;else d+=String.fromCharCode(0),d+=u;i=a+1}}else{for(d=Array(t),o=0;o=a?i++:2047>=a?i+=2:55296<=a&&57343>=a?(i+=4,++r):i+=3}else i=t.length;if(a=(i=Zn(4+(r=i)+1))+4,y[i>>2]=r,e&&o){if(o=a,a=r+1,r=h,0=s&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++u)),127>=s){if(o>=a)break;r[o++]=s}else{if(2047>=s){if(o+1>=a)break;r[o++]=192|s>>6}else{if(65535>=s){if(o+2>=a)break;r[o++]=224|s>>12}else{if(o+3>=a)break;r[o++]=240|s>>18,r[o++]=128|s>>12&63}r[o++]=128|s>>6&63}r[o++]=128|63&s}}r[o]=0}}else if(o)for(o=0;o>2]=i,t.toWireType(r,n)},g:Rn,k:function(n,t){return n=jn(n),t=jn(t),Hn(n[t])},o:function(n){var t=xn[n];return Hn(void 0===t?M(n):t)},i:function(n){On(jn(n)),Rn(n)},n:function(n,t){return n=(n=Jn(n,"_emval_take_value")).readValueFromPointer(t),Hn(n)},l:function(){I("")},q:function(n){var t=h.length;if(2147483648<(n>>>=0))return!1;for(var e=1;4>=e;e*=2){var r=t*(1+.2/e);r=Math.min(r,n+100663296);var i=Math;r=Math.max(n,r);n:{i=i.min.call(i,2147483648,r+(65536-r%65536)%65536)-f.buffer.byteLength+65535>>>16;try{f.grow(i),w();var o=1;break n}catch(n){}o=void 0}if(o)return!0}return!1},w:Kn,v:Nn};function Zn(){return(Zn=r.asm.A).apply(null,arguments)}function Xn(){return(Xn=r.asm.B).apply(null,arguments)}function Yn(){return(Yn=r.asm.C).apply(null,arguments)}function $n(){function n(){if(!zn&&(zn=!0,r.calledRun=!0,!b)){if(U(C),i(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;){var n=r.postRun.shift();P.unshift(n)}U(P)}}if(!(0 + + + + + Cocos Creator | Yantar + + + + + + + + + + + + + + + + + +

Yantar

+ +
+
+ +
+
+
+ + + + + + + + + + + + + + diff --git a/code/index.js b/code/index.js new file mode 100644 index 0000000..2d66170 --- /dev/null +++ b/code/index.js @@ -0,0 +1,23 @@ +System.register(["./application.js"], function (_export, _context) { + "use strict"; + + var Application, application; + function topLevelImport(url) { + return System["import"](url); + } + return { + setters: [function (_applicationJs) { + Application = _applicationJs.Application; + }], + execute: function () { + application = new Application(); + topLevelImport('cc').then(function (engine) { + return application.init(engine); + }).then(function () { + return application.start(); + })["catch"](function (err) { + console.error(err); + }); + } + }; +}); \ No newline at end of file diff --git a/code/src/chunks/bundle.js b/code/src/chunks/bundle.js new file mode 100644 index 0000000..194d1f1 --- /dev/null +++ b/code/src/chunks/bundle.js @@ -0,0 +1,8 @@ +System.register([], function(_export, _context) { return { execute: function () { +System.register("chunks:///_virtual/env",[],(function(e){return{execute:function(){e("DEBUG",!1)}}})); + +System.register("chunks:///_virtual/rollupPluginModLoBabelHelpers.js",[],(function(t){return{execute:function(){function r(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function e(t,r){for(var e=0;et.length)&&(r=t.length);for(var e=0,n=new Array(r);e=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},extends:n,inheritsLoose:function(t,r){t.prototype=Object.create(r.prototype),t.prototype.constructor=t,o(t,r)},initializerDefineProperty:function(t,r,e,n){if(!e)return;Object.defineProperty(t,r,{enumerable:e.enumerable,configurable:e.configurable,writable:e.writable,value:e.initializer?e.initializer.call(n):void 0})},regeneratorRuntime:function(){ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ +t("regeneratorRuntime",(function(){return e}));var r,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof g?r:g,a=Object.create(o.prototype),u=new T(n||[]);return i(a,"_invoke",{value:P(t,e,u)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",y="executing",v="completed",d={};function g(){}function m(){}function b(){}var w={};f(w,u,(function(){return this}));var O=Object.getPrototypeOf,L=O&&O(O(z([])));L&&L!==n&&o.call(L,u)&&(w=L);var j=b.prototype=g.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function E(t,r){function e(n,i,a,u){var c=h(t[n],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function P(t,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=_(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=h(t,e,n);if("normal"===l.type){if(o=n.done?v:"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function _(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function k(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function z(t){if(t||""===t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),k(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;k(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:z(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},e},setPrototypeOf:o,toPrimitive:u,toPropertyKey:c,unsupportedIterableToArray:i})}}})); + +} }; }); \ No newline at end of file diff --git a/code/src/effect.bin b/code/src/effect.bin new file mode 100644 index 0000000..787deae Binary files /dev/null and b/code/src/effect.bin differ diff --git a/code/src/import-map.json b/code/src/import-map.json new file mode 100644 index 0000000..566b545 --- /dev/null +++ b/code/src/import-map.json @@ -0,0 +1 @@ +{"imports":{"cc":"./../cocos-js/cc.js"}} \ No newline at end of file diff --git a/code/src/polyfills.bundle.js b/code/src/polyfills.bundle.js new file mode 100644 index 0000000..04d8dac --- /dev/null +++ b/code/src/polyfills.bundle.js @@ -0,0 +1 @@ +!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t,r){return t(r={exports:{}},r.exports),r.exports}var n,e=r((function(r){!function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=0)}([function(t,r,n){t.exports=n(1)},function(t,r,n){n(2)({global:!0},{globalThis:n(3)})},function(t,r,n){var e=n(3),o=n(4).f,i=n(18),u=n(21),c=n(22),a=n(32),f=n(44);t.exports=function(t,r){var n,s,l,p,h,v=t.target,y=t.global,d=t.stat;if(n=y?e:d?e[v]||c(v,{}):(e[v]||{}).prototype)for(s in r){if(p=r[s],l=t.noTargetGet?(h=o(n,s))&&h.value:n[s],!f(y?s:v+(d?".":"#")+s,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;a(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),u(n,s,p,t)}}},function(r,n){var e=function(t){return t&&t.Math==Math&&t};r.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof t&&t)||Function("return this")()},function(t,r,n){var e=n(5),o=n(7),i=n(8),u=n(9),c=n(13),a=n(15),f=n(16),s=Object.getOwnPropertyDescriptor;r.f=e?s:function(t,r){if(t=u(t),r=c(r,!0),f)try{return s(t,r)}catch(t){}if(a(t,r))return i(!o.f.call(t,r),t[r])}},function(t,r,n){var e=n(6);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,r){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,r,n){var e={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!e.call({1:2},1);r.f=i?function(t){var r=o(this,t);return!!r&&r.enumerable}:e},function(t,r){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,n){var e=n(10),o=n(12);t.exports=function(t){return e(o(t))}},function(t,r,n){var e=n(6),o=n(11),i="".split;t.exports=e((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,r){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,r){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,r,n){var e=n(14);t.exports=function(t,r){if(!e(t))return t;var n,o;if(r&&"function"==typeof(n=t.toString)&&!e(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!e(o=n.call(t)))return o;if(!r&&"function"==typeof(n=t.toString)&&!e(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,r){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,r){var n={}.hasOwnProperty;t.exports=function(t,r){return n.call(t,r)}},function(t,r,n){var e=n(5),o=n(6),i=n(17);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,r,n){var e=n(3),o=n(14),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},function(t,r,n){var e=n(5),o=n(19),i=n(8);t.exports=e?function(t,r,n){return o.f(t,r,i(1,n))}:function(t,r,n){return t[r]=n,t}},function(t,r,n){var e=n(5),o=n(16),i=n(20),u=n(13),c=Object.defineProperty;r.f=e?c:function(t,r,n){if(i(t),r=u(r,!0),i(n),o)try{return c(t,r,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},function(t,r,n){var e=n(14);t.exports=function(t){if(!e(t))throw TypeError(String(t)+" is not an object");return t}},function(t,r,n){var e=n(3),o=n(18),i=n(15),u=n(22),c=n(23),a=n(25),f=a.get,s=a.enforce,l=String(String).split("String");(t.exports=function(t,r,n,c){var a=!!c&&!!c.unsafe,f=!!c&&!!c.enumerable,p=!!c&&!!c.noTargetGet;"function"==typeof n&&("string"!=typeof r||i(n,"name")||o(n,"name",r),s(n).source=l.join("string"==typeof r?r:"")),t!==e?(a?!p&&t[r]&&(f=!0):delete t[r],f?t[r]=n:o(t,r,n)):f?t[r]=n:u(r,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&f(this).source||c(this)}))},function(t,r,n){var e=n(3),o=n(18);t.exports=function(t,r){try{o(e,t,r)}catch(n){e[t]=r}return r}},function(t,r,n){var e=n(24),o=Function.toString;"function"!=typeof e.inspectSource&&(e.inspectSource=function(t){return o.call(t)}),t.exports=e.inspectSource},function(t,r,n){var e=n(3),o=n(22),i=e["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,r,n){var e,o,i,u=n(26),c=n(3),a=n(14),f=n(18),s=n(15),l=n(27),p=n(31),h=c.WeakMap;if(u){var v=new h,y=v.get,d=v.has,g=v.set;e=function(t,r){return g.call(v,t,r),r},o=function(t){return y.call(v,t)||{}},i=function(t){return d.call(v,t)}}else{var m=l("state");p[m]=!0,e=function(t,r){return f(t,m,r),r},o=function(t){return s(t,m)?t[m]:{}},i=function(t){return s(t,m)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!a(r)||(n=o(r)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},function(t,r,n){var e=n(3),o=n(23),i=e.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,r,n){var e=n(28),o=n(30),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,r,n){var e=n(29),o=n(24);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.6.5",mode:e?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,r){t.exports=!1},function(t,r){var n=0,e=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+e).toString(36)}},function(t,r){t.exports={}},function(t,r,n){var e=n(15),o=n(33),i=n(4),u=n(19);t.exports=function(t,r){for(var n=o(r),c=u.f,a=i.f,f=0;fa;)e(c,n=r[a++])&&(~i(f,n)||f.push(n));return f}},function(t,r,n){var e=n(9),o=n(39),i=n(41),u=function(t){return function(r,n,u){var c,a=e(r),f=o(a.length),s=i(u,f);if(t&&n!=n){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},function(t,r,n){var e=n(40),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,r){var n=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:n)(t)}},function(t,r,n){var e=n(40),o=Math.max,i=Math.min;t.exports=function(t,r){var n=e(t);return n<0?o(n+r,0):i(n,r)}},function(t,r){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,r){r.f=Object.getOwnPropertySymbols},function(t,r,n){var e=n(6),o=/#|\.prototype\./,i=function(t,r){var n=c[u(t)];return n==f||n!=a&&("function"==typeof r?e(r):!!r)},u=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},a=i.NATIVE="N",f=i.POLYFILL="P";t.exports=i}])}));(n=e)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")&&n.default;r((function(t){var r=function(t){var r=Object.prototype,n=r.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",i=e.asyncIterator||"@@asyncIterator",u=e.toStringTag||"@@toStringTag";function c(t,r,n,e){var o=r&&r.prototype instanceof s?r:s,i=Object.create(o.prototype),u=new O(e||[]);return i._invoke=function(t,r,n){var e="suspendedStart";return function(o,i){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===o)throw i;return _()}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var c=x(u,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===e)throw e="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);e="executing";var s=a(t,r,n);if("normal"===s.type){if(e=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(e="completed",n.method="throw",n.arg=s.arg)}}}(t,n,u),i}function a(t,r,n){try{return{type:"normal",arg:t.call(r,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function s(){}function l(){}function p(){}var h={};h[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(j([])));y&&y!==r&&n.call(y,o)&&(h=y);var d=p.prototype=s.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function m(t,r){var e;this._invoke=function(o,i){function u(){return new r((function(e,u){!function e(o,i,u,c){var f=a(t[o],t,i);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,u,c)}),(function(t){e("throw",t,u,c)})):r.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return e("throw",t,u,c)}))}c(f.arg)}(o,i,e,u)}))}return e=e?e.then(u,u):u()}}function x(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,x(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var e=a(n,t.iterator,r.arg);if("throw"===e.type)return r.method="throw",r.arg=e.arg,r.delegate=null,f;var o=e.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function b(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function w(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function j(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,i=function r(){for(;++e=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),a=n.call(i,"finallyLoc");if(c&&a){if(this.prev=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===t){var e=n.completion;if("throw"===e.type){var o=e.arg;w(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:j(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}}))})); diff --git a/code/src/settings.json b/code/src/settings.json new file mode 100644 index 0000000..f400085 --- /dev/null +++ b/code/src/settings.json @@ -0,0 +1 @@ +{"CocosEngine":"3.8.5","engine":{"debug":false,"platform":"web-desktop","customLayers":[],"sortingLayers":[],"macros":{},"builtinAssets":["60f7195c-ec2a-45eb-ba94-8955f60e81d0","1c02ae6f-4492-4915-b8f8-7492a3b1e4cd","810e96e4-e456-4468-9b59-f4e8f39732c0","efe8e2a3-eace-427b-b4f1-cb8a937ec77d","e9aa9a3e-5b2b-4ac7-a2c7-073de2b2b24f","8bbdbcdd-5cd4-4100-b6d5-b7c9625b6107","50f4348b-c883-4e2f-8f11-ce233b859fa1","fda095cb-831d-4601-ad94-846013963de8","f92806d7-1768-443f-afe8-12bcde84d0f0","dd3a144d-ab7f-41f0-82b8-2e43a090d496","f0416e68-0200-4b77-a926-4f9d16e494da","511d2633-09a7-4bdd-ac42-f778032124b3","5d45aa00-e064-4938-b314-4265f0c2258c","9361fd90-ba52-4f84-aa93-6e878fd576ca","970b0598-bcb0-4714-91fb-2e81440dccd8","bcd64cc6-2dd9-43f6-abbe-66318d332032","d930590d-bb92-4cc8-8bd1-23cd027f9edf","a3cd009f-0ab0-420d-9278-b9fdab939bbc","6a2d0734-bd9e-4ddf-946e-caa52498cb75","c27215d8-6835-4b68-bfbb-bdeac6100c04","b5d6115f-0370-4d7c-aad3-c194cc71cf98","d1346436-ac96-4271-b863-1f4fdead95b0","971bdb23-3ff6-43eb-b422-1c30165a3663","17debcc3-0a6b-4b8a-b00b-dc58b885581e","711ebe11-f673-4cd9-9a83-63c60ba54c5b","c0143906-9aed-447e-9436-2ae8512d1b6e","14da1725-c4c2-42b4-ab08-ee0aeb6898b3","081cab31-dccd-428e-8652-f2404cc81c47","78e0584a-4343-4727-8f37-e14e65c2a2db","ba21476f-2866-4f81-9c4d-6e359316e448","871c3b6c-7379-419d-bda3-794b239ab90d","1d08ef62-a503-4ce2-8b9a-46c90873f7d3"]},"animation":{"customJointTextureLayouts":[]},"assets":{"server":"","remoteBundles":[],"subpackages":[],"preloadBundles":[{"bundle":"main"}],"bundleVers":{},"preloadAssets":[],"projectBundles":["internal","main","3d_models","Materials"],"downloadMaxConcurrency":15},"plugins":{"jsList":[]},"scripting":{"scriptPackages":["../src/chunks/bundle.js"]},"launch":{"launchScene":"db://assets/Scenes/scene.scene"},"screen":{"exactFitScreen":false,"designResolution":{"width":1280,"height":720,"policy":4}},"rendering":{"renderPipeline":"","customPipeline":true,"effectSettingsPath":"src/effect.bin"},"splashScreen":{"displayRatio":1,"totalTime":2000,"logo":{"type":"default","base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAADICAYAAAA6CQlEAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAADg1SURBVHgB7V0HeFNl277TNOneLS0tLZuyN8gUEFERRcWFLBHZqIgDEUREQf0+/RFkKaAs16cCylC2svempYwW6KR77zb53+ctKUnOyWySDnJz9aI95yQ5Oec+z/vsB6jjcJHKljrBKRx2WAQOqOuQKMsdHBXnXWSy6W5wC4IdduiDXCp9ysVRpmQ/Ckaa065OTkPZZmfYYYcO+Dk7ysrukoZ+CtjPIi94+cAOO8TACHNRjTD8x1kmi2LS5km2WwI7jIYU9wFkDg5NGS96qW9jLPGHUvmc3MGhJ6TSSIVCkcI2K2GHXtwXhJFLJK6QSIaL7GLfX9LcQYmHZY5SpbNCEVMCFMAOnbhfxLE/W4buQP8DUsoux45yB8wtKSm5DDtEcV9IGIYCmYN0FPvfT88xdC1aOigwWC6RFpUqFRfY3wrYoYG674dRQYnzRh0nQWOlA5a5SB1/YX8Fww4N3D+EccBR4UadK7Ij03medXWUbXOTyTrCjkrcN4Rh1DgELSvIzc0F4yeOh4+vt+hr2MGdFUrlLmepfCTup4dLD+6biyAtLb3F/rumvi0/vwDNW7TAjp070a9/Pzg4iEkcST2JRLmBeYl/Yn+44z7H/aL0gpnLpTKJtDcTNW3Ut3t5euKF4cMx9KmhcHZ2xulTp1FWVqb9cmJSW0cHx65yRfl+Zk7l4j7F/SRmy5gIOaa9MepKFIqLiuAok2Hq66/j2zWr4O0tvkRJoHxE6Sjb7yqTdcV9ivtqXVYqy89qb7t5MwbZ2dmVfw8YOBD7DvyDRwc/yhzAopcnXKnEARZaGIf7MKxw3yxJbnJ5e6bFrmK/aqQ4lJaWYcBD/RHWsOG9Y93cMHjwYLavFJcuXhJbomSMKYNkkBaUKRWncR/5a+4HwkhcHB17KpXKbezXZmIHhIWGoWdvjVATky5SdH/gAWZB+eD82XMoYsuWFmRMvgyUOTi6lSnKD4OWvPsAdZ0wTkzfmCSBZA0jS4Cug+ROcjz+xBNwdHTU2E6kad+hA1q2DMftW7dx584d7ZfSmtWLeYbDmGf4X/Z7Eeo46jJhnF2lsiXMlzKH/e6q78DCgkI8PewZeDCLSRsSCXP9NmmCbt27IfJyBJKSkgSHsH8dmKRpyyTNXtTx4GWdJIwv4CmRypcrJXgVRij2BQUFGPjwQA09RvCefn7o+2BfJMTH4WbMTaZACzIhWrB4VXeZQrGnrA6b3XWOMB7sxpU4yjayp/4ZU14XEhKCXn16639vJoEe7NePzC2cP3ceCoVA120kcZAOkCoUOxlpslEHUacI4wZZx3Kp9E9Gli7a+0gf6cUU29ycbKbAFgte68T0mMeYZSSTy/V+Bjn3evftw453wsmTJ1FeVq59SH0HB+lAByZp2J4M1DHUGT+MMxz7KB2VaxhZmortnzBpIl6f/gZycvNFXx8ZcQU5OTkwBqTXvDL+VcycNZOb4Npgi1U7qaPsDyegGeoY6gRh3BwdBzo4SlYqIRGVLNPfehNvvfsOoqKuQFF+TyJ079EdnncV3fT0dERH34CxIAkzdtyr+GDeXPYeHoL9jDRt7pKmKeoQaj1hXKXSxxWQ/MZuUFvtfS4uLvhu7Xd4+913OXGOHT1euS+kQQgWLVmCtRvXwcXVlSuxBw8chCmQsXDCyNGjsZp9hrZJTrhLmk0uQCjqCBzFNrqRN1QmC0QNd30zpbOpUuKwkv0qKBlxd3fHD7/8hM5dKoROLlturkRG8t/JDh4z9mWEhYXxnwWffoLZs2bj0oWLTL8pZHqKC0xBz169sfybFZg2earAK8xI00HiKPvdGcp3pBJJbbGelJLS0qQ8IEV7hwZh3BydHlNKlPPYrz1QGyARF5A+Pj5YtnJ5JVkIiYmJiI+L47+HtwrnEWoVnn9xOHKyc/DNym/4/6YShjB4yBB9pOnuIJEcrE2hJ6VMrnSD5LBEWf5hXlnZv6rtKitJ7u7kxJ5U5SL2lRqghkNJ/3QUhLRt2xorV32Lbsytr44tmzbxJYdyXma88zZ69OypsZ/IRboI6SZB9evDHFBuzQNML9qze49YKIFnb5HCXEtAJ9qQnfBYudTRq1RRvo/9reCEcZbKX2R7F6KWQBdZmjdvhiXLl6JNu3aCfd+sWIHoG9Fo3749Ppw/n+sf2mjTti28vL3YPv2mtT40YHGpevUCcOTIEZSUlIgeU4tIo0JPZ4n0XImyPMqBKSpuLIr/DmoJFDrYQmT56OP5aNW6jej+KxGRnCRvzHgTrq7ikQK6ka6ubqgqnho2DHPmfsCUaeHSRmevVNa+erlyBwlxxMkh39GxKzv9WtEOQxdZwllw8NP/fI6+/fuL7k9LTUFCQgIeHvQwBjz0EKwNsphIR5o56z2e0acNTppaVmQpgbK1i0zW0VGplITRg6XzQAcHyL19IZU7obpQXlqGorQ7ovvCwkLxxaIv0bFTZ52vP37sOFyZg+2992fxzDpbgKTZqDFjkJOVjWVfL0WptiLM+CJl+pKzrz9qAsqLi1CSlcnOS2dqj7tUIWlEVpLO8ICjixvCX50B/659q40w5Gi7sua/SPp3p2CfKxP58xcu0EsWwonjxzFq9Cg0bmpbHxop0BOnTkF8Qjw2/fY7cwNoShUlexjbvjkf7mHV7xAmwqSfO4rrP6xAcUaa2CEyJhVdHHW9Aa3nbabNQYPBz6O6zEFa629t3YCkA7sE+0jsL/zsUzw0cKDB9yH/ypp1a6tF2aTQwZwPPkB6Wjr+2f+Phv5SXliAK98tQo//rofcs/q7j7iHNkUZO6dr65dCUVIseoxOT69LcCjqP1S93TAS9m1B5IrPBWYRLS8LP1+IZ557ziAJku8kYdBjj8A/IADVBV9/fyxdsRxdugoiF8i+FoEzH78GRVkpqh3sWoYNGQ65l6/OQ3QSxpFFZaVOpjuwLIWsaxcRsWwhFKVC03TS5El47oUXmU/FcGQjJTmFx3yqG5QasXTFMhaSEFbfpp07gVt/bEBNgMzDm11X3UkMNTKWVJKVhojlC1GSkyXY16dvH0xmeoHMSOW1VZs2ohHl6kBIg1DMnvMBPDy0gpVMgl5dt4QR5yhqOmocYUg0R61bjKwrFwT7WrZuha+XL+PBQmMhFhTUh7TUVFgTjz8xBDPeniEgfFlBPi783xzkxcXofX3hnVhmMSahulDjCBO/63fE/fW7YE339vFmkefvra6LTJk4CZEREbAWpIzAr06ciOEjhP2NChJjcXHRbGax6E4LTjqyF7F//4bqQo0iTPaNCESt/UpAFlJsv162FKEssmxNUPwnNjYOw59/AdevXYO1QN/nfWY5NWgQItiXcekMYn7/XudrMy6eQvzuzagu1BjClBcXInLlp8wHkK6xnYKFo18ejf428NDG3r6FosJCZGVmYdTwl1jsyfiEKlNB6RcrV6+Cp5eXxnalQoGYTeuRcfmU4DWl+bnIuh6B/IQ4pJ09jOpAjSHMrT83Iu38CcF2SsymBChb4Pq168jLy+O/JyXdwbtvvY2srCxYCx06dsT8T+bz5C51lGRl4NLieSjN08wjz4w4w/cRbu/4H6oDNYIwOdGRuP7TSoG/pX79+pj9wRz4+PrCFrh08SIvj1Xh3Nlz+Gb5cpSXW6+ocRjzJT0zTFjgkBNzlVlOi6De0ib9wnGUFxXy35OP7Udpju1zzKudMOSSjvjmM/blNROwyYqY/tYMtG7TFraAQlGOY0fvNXegrLxyFpbYuGEjDpmYumkKSJ+Zx6LsoaHCNKTYHb8j9fShivMrK0HqqXvLUDnTtxIO/AVbo9oJE/3bGrYeC7pwsCdvGF4a8ZJRzjlL4ObNm7h2tULRDagXgDnz5vDMvdycXHy24FMksmi3teDl7c1J4+au6S+ih+ny8gUoTkvmEidXy+RO3LuV6zy2RLUSJi82GjG/rhEsRcHB9TFh0iQeKbcVjh0+gvz8fK5PfDj/I0ycPAWLvl6M+sHBuH79On7cuBHWRN9+/TBq1Ghoh2LyYmMQt3cLky4HoCjWjO/kMTM892YUbIlqJUz0b6uZYqeZF02ONqohat6iOWwFCgju3rWb//7UsKfx5NCh/Pf+Awbgs88/Rf2gIPz5x59IT0+DtUAVDqNfeRkdOrTTPjlmNa3D7e2/CF5TkpmO5OP/wJaoNsJkRJxG/J6tgu39H+qPF14aztZ2251a3O3bXMFt3aY1Zr3/fuUySNKmHzPnFzMfkJRt2751G6yJ0NBQvDNrJk/bUEdxeioKk4XeXVqOEv/drtfRZ2lUC2GUTMGMWLFAEEIPDgnG62+8wWItnrAl9u/bB3cPd15poJ0ATqTp9kB3rFj1LSdM/l2z2xogBfjBB/vxThLGIu92DNIvnoStUC2ESdj/J7KiNLuz08UaziRLuw4dYEuQJXTyxAlGiG/QrHkLncdRgjiVx16NugJrgvS2iZMnc4XbGCjKyhC/90/YCjYnDHl0r63/WqDoBjE9Ydhzz5ocLKwqSktLMHPWLHQykLVHeHzIEDRpZn3dqknTphg/aYLRCV9pp4+wgGQybAGbE+bm5nXcta0OEvuTp01BWMNGsDWoaK1RkyZGH6+rw6al8cqrr/IaJ2NQzLy/iQe2wxawKWHKCvIQt3OTYDtZRC8MfxF23APFml6bPp1bTwbBpHX83m028cnYlDBJh3aiIElTupBHd/K0qXBzM73JNkWXy8vLUZtgyjn37NWLd8bSRstWwqqgfObUK0i6DWvDZoQpyclE9P/WcCVNHV27da30e5iCGBZJfnnECJ6zW5uw6++/MfPtt1CQn2/wWHqYZs6eBRfnezNNSa9ZtHgx/P01J/lQAlbKiX9hbdiMMHcO70J+/C2NbVSSOnmK8emWKsTHx2PS+AmIirqGwqLa1bgyLy8fv/3vd3w8f75YyzMBGjK97uFHB1X+HRoWirbt2+OJoU8Kjk06uAtKKwZKCTYhDFlGFI7XToxq374t+vR7EKaAosnvvDkDV1nch0R7YX7talqZkVaRAvrLjz/jzy1bDB5PEmXKtGmVeckP3V2inmBSWaIVRsiOvoK8+JuwJswiTFlBLvM8xht9fMrJA8iNEWawkUfXVOlC6QZHj1QkS5NJnJlRu9rIpd89X5Iuc2d/gPNnzxp8DfmAhjw5hCeT9exV0XWiS9euTNpoRrjL8vNYdNt6kXWC2YS5tmEJ99gaAmnut7f9xCOv6qjPAoxPDxsGU3Ds6BEsWbyk8m9q+56ZXbuaVWZmZFb+Tj313p7xFvJy9fcZIikz+uWX0bBRIxZrqpj3Ra4IsWUp+eh+KEqLYS2YvSSlnDyIhH+2GjyOJBHlqWpj5KiRxpmMqvcpLMS8ufNQUnyvToka9+Qa2ciwpiAhXlMyU5bf8qVLDb6OOpJPZdZkQL16ldv69O0rOC731nXksyi2tWA2YZQKJSKXf4bcWP15r3eO7BFIF6rLeWnkSJiC71etQlSk0C2fmmLdshBLgnSuVJEylrXfrcXtm7f0vpakzPMvvqixhFMDI+pFow5y4mVeOQdroUpKb3FWOi7+32wodZR5luZmIfGgsIj+iaFPaDwphpCdlYXly1ZU/k3tPVR5I6lptYcw1CM49+7yQ2UzvndTT6kT+apvvzH4eget3F9/f3907NRJ8yDmxOPmtZV60JhFmHJmqai8ihmXzyJm81rR47KuX0bezataWyVsORoFU7Bl8+bK5OxBjwzi9UlNmjbif99JtJ4fJifHsvpRdnYOiu8uqTQBjjp4qiTE1j+2mlylQDVO1M5e8DnXIlGcnQ5rwCzCKJlorSQw++XahmVMVxGmMCYf349SLQcVeSnJj2AsyMG1cX1F3fEDPXrgq6VfI4wpf1QuS1ZD8p1kPlHN0jh88GDl51oKGcxCIl3Mz88P4ydOQKfOXbDquzUsPuXFh3z9/MMPMBW9+vSBzFHT0ixMSWTxuluwBizihyEv4/kv3tMonC/OTEHqyUOCY19kprQpebrbt21DTHQMX4bW/7ChshHzsOeexzPPDkNaWprYWJoqgXw9s96did07d8GSuH3zJjenP/l0ARo1rgh4dmbm8bqNG3iUftOmLZWdPo0FVVa0bttaYxs90NlXL8EasJjjLv3CSV5bpAK1schP0IxtEFF69e5t9HtS6uRv//uVX8xvVn/L23yoIJfLMXvuXKYLeImNpKkSqOMmVUASUaOuWC7/5eLFixgzdgweHTxYYzuRZuy4schIT8fff5lWCeDGgpTtRSQ2JY1bo5eexQhDrL7+40rk3KrQWe4c28e3qaNNm9ZoEGp8U+yIS5dwhVlGr4x/BU1F8lACAgIwa/Zsi95Uwupvv+X/0zKxf+9eWALFxcV86Xx31ixRZ+X0GTN4s4Gtf/xpUkCVrKfuPR4QbM9lumNZoeF4lamwaGigJDsTF7+cxWukMyOEHszHHh8sbHWhBzu272A6T0tMmTpN5zFUQtt/QH9YCqS7XI2655Xe/Ptm5OdVvYE3keD1N6fr/P5UarLw04Xc7D510rSUy06dOwtampCEKcu1vFPT4rGkrKgIXPthqWA5cpQ5mlQfXVJSjKPMszvtjdcNVj6q9AFLQHtJiGM6hSoUURVQq9eg+sF6j+nATOTH2UNFFZimwMvLi1mNjTW2lTOJliOwUKsOixOGwgV3Du7hlXnqCA9vwbPijcXVqCi0atVK0LHbmiApcOa0plearJotmzYbFVmuKmipGj12rMAbbAiUbCW2ZGdfuwxLw2bpDTShVbtTgT5cvRKFkaNHmRQ+qCpu3YxhN0vlHpAwMV/RuOjE8RNMl7Jezxh1NGzYkN38ZsyDbXyOLvlj2rYTlhTn3IyyeO88mxGGRt+ZYk6HhASjbdt2sCUuX7pcOWSrR8/u+GDeh8wak3HTnaw1W4C8uT169mDnYZre1EGk2iI/MY6nxVoSNiEMicx27U27+R27dLVpqSzh4oWL3BSVsSd2zodzMfTppzGJOQip3+6eXXusWvmojsZNmpo8ICOkQQM4OWv2Ui68E4fywkJYEha9I+R5JTNP9b8KZOl4e5vWh9aWS5EKqmVn0KOPoEPHTtyimTptGjPdZ6GYKeE7d9imWwL5nUxt5EjHkwdZHaUsblWUYVmnpsUIQydLCiotO1Tmqk4Y6k8rd6q+1vPGoIRZFTdjbvHzf3fWzMrt5BgbN2ECfvjpR27mpyTbpv7HVFBbV7Hit9zYGFgSFiMMT1h+710ehSWoE4b8BDUdqSkp3CIi/aFJU2Er95atW2PpyhVISkxETQRJpaD6gYLtBRZO2bToktQ8PByvM7+JKtWUnlb6Iq3btEFNR2ZWFo8hkXNRV8UhSdEO2ukENQiNGjYWbCtMTbZovZLFtUpKjOpHw8BRIWX8A/yZ1Kn+PvqGkJWZwSd5qHJmayPE/Fw0BcaSKZtmEcZBJueKrTp4umReHm+6PH3Gm8znUhFVpnhPdSiwpoLKP1q0aIHgkBo/wVAnGoQJCVOak80IY7nSE/MII3XggwzUwecwlleIvk5dumDipIlcwpCSaCjJuSaAlqM2zPlFLoDaCl+2ZGo3MyjOTqt+CSN1doFEK11QwchSpJa7+/K4cXwCWlpaOn7+8UdYCuQnIRc+STSaqUg/VD1ArvuqhvMpQctaI3I0z7u08rzLeTKaZdIQKF6l3YyoNDeHPciW8/aa1VvD0cWdOdU0X0o3rFgto5+e1PkLPuGpB+u+X8tLSkxJbdAGXVjKfc3PL+Cfoz3ql54sJyc5+1w3vgRq9741BKmjFC1btoSlwYvtCov4eVMdFZFFnSCO7HMpt4f8KHSz6bzNJS1dc8oZUvcSU0xPUVLNS5JEKoODk+bkVbqBeVrdmaih4MLPP0M2c7d/t2qVWdo6ETE3Nw/x8YlISUnjF16bLKrPp33Jyan82IzMLJMChg1CQkx2LupDOftsyuFNTExi55TCrw0RXVualJXRg1CI1NQ0fiy9xtxAJxHPyclZsL0k13L5vWZbSY5ansgyFuQSqxHq3bcvhr/4Ijb9vhnXr5vWv59IkJqazi+mGEn0vY4KxhISkvjNMEbkt2zVmo8griros8ifk8RuPi3HJFGMBS1R6ekZnPSmfF8ViDBykeSssnzL6ZBmE8bJW3O4JT0pJAkEH0CeU+ZapySnZUuWVpZZGEJRUTG74Yn8yTR3jSc9gVrAE+EMZbGRJ1oqrVr3K5IMmUyyJSUlayzPpoKWXhXZTQHlHFGwVBtlRZaLJ5lNGLm3ZtyCbkhWVqbosZ6eXnyiax5bW69FGe4rSxZLhVSxTO8XIjJJKnOeWmNRrijn50yEsYQSWyFd03g/GWNB1QNi6Z+W7KFjPmG8hK27kvVk74cwhXfmnPexd/duPilWF+jLkVjWNVXeXFDTZloirEEaIkgKW0bIl2NJ0Lla5JwtmAxuNmFc/YME20i504eWrVrhqWeewR0dWf504UnpM1UUGwtSivnypLDcE0fnTPVG1jpnWtrI6qmK1NI1IdYcmC9hfIWBrvhYwy2zKIhXPyREdB/pLaTjWKM8QgW6sZkZlBxtmc/IyspmP9ZtCFBRMWn+TXeQWS5TwGwtz8lbmJh9h0kYWm4cDPhAxPwMdPso281UvYUy+jnJ2O/uzHHl7uFpMPGKPsfV1Zk7uqoCsoZIZzEEegBymQOtgJYs9tXd3dzh5uFhtL9FwU30bG4FmTWsw8FyzkjzCeMrnL2Yx5RLSmesFxgIU1HGTEpycBkCXfzLFy/i9MkTPEMuOSWZ6zvkaSanFxW4t2rdCl27d0e37g/AydlZ9D3S0jIQEuJksoNPhYpODBk6pSFNdrt44TwvGaEqgGwmiUopv1ZZ4WSkSogu3bqiOzvPtu3aG3zI8vMLmZ+olGf/6T6nMlEfjiW912YTxjVQuKxQaIDyRcwhDCmlhrT5UydOYPU3KxETozvHIzMzE9HR0di+bTv3nlIb9hdHjGDSRNNvRJZYenomC476mXVBaSkqFZmpTQrqzz9sxB+bt3CpoAv0YNFcyV9+/IkHaF+b/gZ69emr81y4fsd0mQB/uc5jyOcjtnTJqyhJ1WG2DiN1dmWmtaalVMj0gzgTSyQICoWSK6S6QBLkS+Yxfn/mTL1k0QaR8MeNP+CVUaNx+ZKw1ph8PEVmFPKXMLLlicwcuMEIMPnVV7F+7Tq9ZNEGFa/N/3Ae/rNwIXtf3X6qQuaf0ecFLqHQQ6nQUSh1tVxAtUr5MO6hTTX+JglBBeemgkSpLqWusLAAn33yCXb+vRPmIj09He+98zb+2PS7xhKisspMVYBp6Ja2rrXr77/w+tSpuHXrFswBEWHvnj14/513dZaY0GeWlur2HFN3rhIRh6HM3XLdy6tEGM8mwgbDEZdNL54i60hMF8hiy8v8uR/i8KFDqCqK2Wd8s2Il8zYv4cqqCmQ1meK+JzNX3d9CN5CWoC8+/4/em2ksrrBg7SfzPtKZEqLPg5zDFOv8fE3JJ3VmeprcGZZClQjj0VhYbXf16lWUm+hoEpMupAusX/s9zp45YzEzm95zx7Zt+HPzvbnPFRaM8Q43cturHGkkFXb+tYMve5ZEZGQkln/9tejyo8+8JpWAzk8dcncvZlab1qlUH6omYZq2FmzLzMjijZeNBd0wsSfz+NGjzCu8x+IlqnSzf9iwAWdO3ZsLXaFwG/4cVYqFChfOncX679eapQcZwj/79+PQgQOC7fqkYWaGMNgp8/KFg6MclkKVCOPVtBUctIJdpAzeuH7d2LfghNHWB0i52/rHHxpLhyVBN5iWpuS7JSNEWGMcY7xlx90lITMzA8uYFLDWXGsi9oZ16wTvr2/Zu31L6DilEI6DBUt8qkQYqbObYFmimxF9I9rYt+CE0ZYiF86fM7mDgamgrgw/Md1DtXySlWZo6VOlSvBGR7/8InqDLInY27exb89ujW36MgtviliQzgHBOnWY4sxUpJw6gOxo4+vGq1w14BMurOm9etX4Saf03RVqsR3yFO/etcsiCqQhHPz3Xz4xlkBEN7T8kXJOoDzlwwerrogbAhHj3337uRNQHbrOM1YkNONW/56/rJzFlKiP7+3tP+HUvMk4NO1ZXFoyD1In46ssqzz+zK99d9za+rPGtsiISD4b0c2ohGqlRjA1MTHB4h2ldIHM461/bEGL8HBOUNJRdHl+Vfm4hH1791q8TZouRMfEMCdfKhqEhlVuI7+V9mkWFRWKBn/JB5N06G+knz/Ju5rSgJCSrLvt9pkDsPGwl+EW0hDGouqE6fQA9zyqi0kSjdTcL5xFp00FLWdpqbYpeiccY8p1DnOyUe0UOQgpXiMG0rOINDTb4PDBA1YNkKqDSnipobU6YcQcvUR+8h5r4/r6Zbx1mVh6rLN/IBoNHWGSp7vKS5KTTz24a1XckSVx+sxpo16vKt5X4RpbzmzRvEcFutA3blQsS/p8HKr8HAo7xN6OhS0RFXVFg6BiAch0Rhb1OQYqlObnipKFrnuDQU/BvYFp3bssUPkogV8HYbXgoX8PGvkUSjRmVMfFmtZ21BI4ffLUXWutTOc5l94tBrt86aJVzGh9oPyh0ruErXjAhLft4sULJj1oLoHBaPj4i+LiSg8sUiob1OdhwbYL5y+wm2/4SaTzVRVf0UWxlpmqD1FXIitH6+kiDCW5E6Eunj8PW4NSKMruBmbFpu4SUU4cOwFjQekfTZ4fB9dg43UXFSxCGL/2DzB/jKatn8ii1mIBP8EJ8IL9Cg2OB8+KLZcdZiwowk6WCCmTYqgw/SnulIWMjEzYGmVqaQtiObsURoiIMN40dgtthAaPPAtzYBHCUEaXd0vN5sJ0kXf+9bdRy1KlomkpPZJJLamLC/NwGqfT0xNMUd4KH4f4MfQ96MbkGdmClSpDHdk5WLqLllhVQEpKCh+jow4aXBHWMEz0PZo8+wpkbsa3v1WHxaaKB/UaiIyLpzS2HT58GIksTBBioOJRVXzl7OwMuZP5bmzyajYdPhnBA4bAyS8QyrISZFw6jajV/0X29Uidr+MZbcyt3qCB/kJ8itUUGUjycqkXjHZvfQJf5m6gB6k0LxuJ+7fi6vdf8Ylp5oBqjVR6i1gC1aGDB3lfnq5du6J33z7o1LkTfLy9MWbUGMGxrkHBCH3sOZgLi9E/oHs//kSpIz0tHYcOHTT4Wrnckfs/qBukapaAqXBgUqrJi+PRaNhYThaChMVQ/Dr1QrdPv4NroP4eucV3E6V16YC0XaFU8FQMXZC5e6Dbwm/h36VvZR6tjAX/Gg4djY7vf2l2EJCuiaqEVkzCEEl27d2Db79bgzFjx/IMvq1bt4l4fiVoNnJylWJLFiMMZeD5tNHsNEVifMvmLQa1d7oYqoZ+oWbWX3uyuFaDR54TXQKohip0yAt6X+/sTHXNui+HyjpRt+i0EfbEcLg3ChfdF9CtH+p1N20gqgr1AoP4sk0Kr5hjsUWLcPgH3EuZpT6/f23fIchgdAttiNBB5ksXgsUI4+jihuB+NHRB8xElaynegLVEN8PVpWJZIq+rOSmTniymJffS3THcr5PuRkES5gdy9/C4SwiJ6Pk5OEjhzJZOZyfduSX+Xfvq+Qwpcz88AHNAk1z4NXJ1MZgETg/nryzOpW1w0HdsPeFdgXFiKiyqkfl36QPX+pq5vgUsqLdt21aDUoYy+OmiUEdrc2qc6Ybog74kay8m8l1c3fgTrIusMpkj3NlxHl66l0yJoWoJMxLO6Zza3+3BS50pDD1M5I/ZuGGjwOLz79Ibgb0eQVVhUcI4+wch8IF+gu07tu0QnXWoDrowzmxZCgoORuMmpnkfCTk3r6G8UHdecOZl3eN+aQYATZ/XNxKZdAfq6e+vZ+5B5qVTOvdRS/3MqAswFdQBI6BeIG9l4mQgTYHSQlZ8vZTrjuqQsKW25fi3LWKxWbZPr6MMIQ89ycLpml8s4nIEjh05ove19OR4eLjzi0LTUk1dlrJvROLO4Z2ibnAam3xrywadr20R3oKXo+i7IUQm0iOoEE8XbrMgbFGqeFAyk1mQqScMGwDaoJa19NkeRtQx0WCNf/b/K9ju360PvJsbPwVPHyzeFNGrZScekFQHKb9rVq3mJSD64Obmzi/OQwMfNrkTtoI5/C59NRe3/1jPorEVQTgls2gyLp7AyZljkJ8kngVIN4Ha2pOE0xV4JNB++unZpzdfnsRQlJaM42+NQPq5I5U9/ktyMhhZ1+Hi/73PfjfNi+3n74dHHn3sLmH0R/5pKt3SxV8LEsHk3j5oO3UuLAWL+WFUIGdZ/X6P8/F96k476uO/b88ePPeCbmuFgpA+Pl481WDw4Mew9vu1JkWFFex1UWu+QMymdXD28WU+kFwUp6fqbXcRzER+i/CW3AfkoKdCkIhFxzRv3oIPHL9xXXygZ8GdBJyaMwnOAYGQe3hxkhRlpDFCmx5/6tOnL5o0a8ZnQupTdul6fb96DWJitJs4M53whfEmBxj1weIShhDU62G4BGk6wUjp3bBuPU8P0AcqPqOloT+XMkEwFdQxsiglCVlXaYRgrMHeKD169eRtvmhyiSGRT8c4M1/T4CFD9B5Lsy8LEuPYOVxGAZNs5pAlOKQ+Hn/yCW4MkLKrD8ePHuGJ6NoPl3d4W+YDMm0+uCFYhTByTx80HjZG4AWj0tZ///lH72vpRvj5+fJ+eK+MG2dQ0asKiJBPDB3KlyIXF8OlGHQMLQ8PD3oETZpY7qnVBn3GSOalbdK0KXx9fPRKl8SEBHz80ceCRk1SZvW1mTYHMlfzQgC6YBXCEBo8/BTzjbTQ2EZSZtF/vzCYcE3Wkre3Jx5iN2bo00+ZV4BuAOQAoybUoWENmSfVw6gaazoPOi/KJKTyW0eZxVd0joEPD8TDjz7Ke+65uunucUzX8dMFC3A1Sjh5rfHTo+DTugssDasRRu7lx6WMREsvuB0bxxskGgLNQKRumK+8Oh59HjTPQ6oPdFMeeewxrsgaUijVQTXaJPUGDByIQYMGWbxNa9u2bTBxyhS+NPuw+JC+99+9cye2/blNsN09rDEjzBirjA+yGmEIpPz6dugu2L50ydcGS1Ec2IUKqOfPp3S8O+s9PtHNUpKma7dumPLa6/zGG1IotUHhAz+/imVi6htvoN+A/hYhDb1Hjx498OHHLHDp54967LvrC1XERN/Ah3M+EOgt1Ial1YSZ3CdmDUjlDtKO7Gyf1t7h5OuHhk9WTWEif4xbSCgSdv/J+/irQFr9lchIPPPss3qXAim7KSRlKJ+2d58+vLqAwvjmtvCim9KX+Xhmzn6fOeG8WTjAjUd1Tb3hpGOo6qm6s5tcxByGV69eMzvPl8z0Z5n1+PqMGbwNSFBQPb0mPvW3Gct0nFitkAsFN5s+Pw5hQ4brjXkZwi1mZZbmizRJUuJPqxKGQEzPuHIWBQmaXy6BKWskcjt30b/O0lNGlgKt1zT0inq/RF+P5nXESoXxN4j0lDEvj8H4KZO5v4fiMv5+fmb3hyHpRHm+xBEaVE5LCEnNIhMsIloyqD/w5GlT8ezzL1RMnmVk0afo08M26513cOjQYcG+wF4D0PLVd+DoXLX2HtVKGGK6R6NmSPznL0GvtZjoaPTr9yDvka8PRBq6IVQG6h9QD337P8hutj9vqUFlrrokDi0bFJci6TRz9mz07vtgZQjCnznFZFWoOVYFAylxnKLCNOKHehLTUpqaksqzB0XjZ0yYURgiOLg+RowchdemT0cr9lp6r8BA/ZKF3o+GsK9ZtUawT+buiQ7v/gduZqRdakMfYSRuUtlY9i3Xau/zbNoCfVdZbmRd9G+rcXXtYsF44l69e2HpiuVMX6ln8D0qCufzKnJc784aILPyZkw0rxKkAjPKfSVyUQyGmjWHhYVxBbryezFJQ2a7pfQhuonU445ykVVLUkZGOhLi4hF94wYS4uOYNMzly6ufvz+f59iseXOENAjhfYFJwnmxgCbpUvqWRnrvv7Zvx/TX3hB0GCVnaZd5XyOo96OwBP4Z0R8FySKecYXyFevYhSJo+MRLSGfxlOSj+zXagJ46eQpLFn2FufM/MuhzoQtKN5wCcdRxgaRLo8aN+Y8h0Hv7+lZYXpa0bIh45J2mcyLSUHWkL5PO9NNOZNKr+neh2QBezEx3khtOaDp54jjee2emaDtaSooK7DkItoDNCEMDLcLHvIHc6KvMfX6PvbQmb960GQ0bN8L4iRONupl080l0e3q683pnKtqn5Uo7YUgVH3J3d+X6gTX8OQQ6Z/ICk2OPqg9ICqrOR31ZImlCCi6Rls7Hych01MjLlzFt8tTKEcnqCO7/GJqPmGqzCbw2IwzBq3lbNHtpAi4t/kjDoqCOD8u/XsYThR7s19+o96pIV5TzHxLpdHOoZYfqfSkuxNM+zVRqzQERsmIEjStfMtXPh54D1fmYIuGoGmDCuPFsuRWWwXq3bIf2by6waFtVQ7ANLdUQNuQlhD31kmA7NUd+87XpLHxges4I3QDV+BtSaOmHiGRLsmhD+3xIKupL0BIDXYv3353Jy4614VKvPjp/sBgyT9uOR7Q5YSgzrs3E2fDr0FWwj2qDJzLPrq2K8Wsyzp09iw/en81TXLVB1RFd5y9jFlEj2Bo2JwyBJrp1nr0Yrg2EdTOJCYl4ZczL9zVpTp86iVkz3+Nk0XYGOjIfUue5S1gkuiOqA9VCGIJzQH10n/8NnHyEPpiE+ASMfmmkRlux+wXUs2b82HG4EhEpIAs9aN0XfIuAzn1QXag2whA8GoejC3taZB7CxGpqJzZ29MvY+fdfFp27XFNBSvsvP/6I8eNeFS3HdWRBz06zvuBlydWJaiUMwa9jT3Ses4iLWm2QJ/e1ydOwcvly1GWQJFn4ySd8GRKrrKRr0+XDJaj/4GCTuy1YGtVOGEK97gPwwKerRWcwkaPq808/Z3oNC7bdvoW6BCIKtY9/7ulnsObb1SLNAJhzL6wJen65nl+jmoAaQRiCb7vu6P7Jt3CuJx6W37dnH5575lls/u03Qc+32ggKpm5i3+WFYc9xb7c2yPz2atkW7d9aUG0KrhhqDGEIPm27oucXG+DZTHwc8J2kO5gxfQYT3TN5eoSiFuo2JFXiYm9j4fyP8fabb/G29tqgcp2A7g+i03vVr7Now+rRalNB5a7BbK2m+p6CpFgoRSLRVyKvYM+uXbyvfnBICC8wqw3IZrEmGlzxyUcf45/94rnN5Kdq9PRItJnyPlyDzJ/zXRVUa3qDOSDzMaBrX0hdXJEXd1N0jC4FHo8fO8aDchTEoyJ+udxyHa8tiYKCfOzfux8ffvABfvn5F531WXIvH7YEfYwmz4+3ePK2KdBHGJvGkkyBo6s7mr4wAd4t2uHGTyuReuao4Bhaki5duIR3mGjv3qM7xo4bh169e/P0hpoACqwePXIYq79dhRPHT/ABGbrg16Eb2r35MTwatkBNRo0lDIGSr/w79eL+mvg9m3Fzy0YU3kkQHEcK5KEDh3DqxCn06NUDAwc+jEGPPsKXq+rA9atXcYxJvx1bt+PM2TOiI2lUkHt682R5kirUAaOmw2YJVFWHEkXpKbj+wzLEbv+f3lHGFOSrF1gPjw1+jFcGdO7Smfd/sSaSEhJw5PBh7N61G6eYh5oK9hR6UkjJCgrsMxAtx73DTOdmFq8+qAr0JVDVIsJUQFFehuRje3Bt3RLkxBgegkG5J1Sw9giTOD179eKplIFBQVW+QSTVom9c5/GeA8ydf5ItOdQnt9wIy80tJAzNRk5Bg4eeqnK/FmugThFGhdK8HMTu+hUxv37PLKpko15DksfTy5MryO07tEd4eDhCGoQyAgXy2iQPpjyTJHJl/5cx/YOUVRpaQfk6WUxixCcmIvbWLW6lRUZEII2ZxPl5+UZXC5CPqfHQEQgdMhxOXn6oqagRKZqWBiU9N312PBoNGYE40m9+X8ctKn2gpKaM9Az+I5Y2YB1ImA7WjOspDR5+GlInyw3srA7UWsKoQMNKGz05CmGDX0Dy8X9w45dvkB11yaQSFGuAaoQCuvRCo6dGMhdBP0iktf5Sc9SNbwHwzpD1+zzKf3JuXkHC3q2I27UJxRnpsBmYXuTTugNCBz+HoF6D4OTtj7qGOkMYdXg2bgXPCa14yWju7evIvHwGyScOICf6Ctd9qF9u1VImJGxpceIpB87+9eDLQhrkyvdp2VFvY8a6gDpJmHuQcEcY/VAucVlhHvJiY5AfF4OcW1G8f0x+YixKs7N4TxduqlNJr4pL0oqumhJqd+rkDJeAQJ4W6RbWGB5hzdn7NoULc98bashYl1DHCaMJKnXxDm/Pf9RdeorSYpTmZqKU5g3QkM27Ph6JkwxSmZwr2I6unjYr5ajJuK8IowtUpuHkG4Sa5xGpebA/MnaYBJ2EUZbX/TxaO4SomJqr+97rJEwp83IW3NHf8t2Ouoci5uEty8/WuV8nYagT5bXv/48PmLTj/gA1wI5cuQCl+brvuV6lN2H/XyhMTkRgjwFVGpliR81HeUkR0s4cRdqFk3qP028lsfUs4/I5/mOHHQS7lWSHSbATxg6TYCeMHSbBThg7TIJRoQGaaurt48OHJHh4ekBmZm7HufMXBG3F1N/fx5d9hqurSemTND44Kyubl27QiGBjkt+oqsDXz4e3X3Wjz4PpiI2LQ0qKcGgYddGkzp3UB5iulZMJnToVNOqYmbRZmVm8wK1cT96yCpRF6MOuHU2V9fRwZ9+laqmnN6Jj9A6bN3jnKZ1x/KQJeLDfgwhr1LhKXZ36dO+J+Ph73ZSIGAMeGoBxE8ajQ8eOvOu3OaAocxy7gft27cJXXy1BrkgvOAJ1rXz8icF4eexYtGrbtkrlKMsWL8aX//1SY5ufnx8mTJ7IB15QxYK5PfWo4O3smTNYuWwZTp7Q3fKkTbs2mD7jTXTr/gBvCG0JUMnO77/+qnO/XsLQsOyVa1ahbbt2sAaGPTsMn33xX8irOLGE5jnSDKNxkyahRatWmDJxEiONZvEb3bw3334TU19/jRPH0qCnfMNPG9lNrPrkM2oTS7MMevTsyW7gDOzYvkNwTPPmzbB2wwbUCwyELaHzEaCn/705s6xGFmrZPvfjj6pMFm3QIIuJkycJJGGPnj0w5TXrkIUwe+4ci5BFHS5sufzgo3kI1CIFrdiff/mFzclC0EkYqlfu1996LSZoiaPxLtYADYzQHpg++IkhfL23Bkh6Pfb447AGaJRhMyZN1EFT5Dp1sfxoG2Og8wqSAqqrO3dJcTHKFYYVMm0o1F7TPDxcxzEK9v5FMCaFu2KsnrBAjbp/0+Q0qNUwN2wYJvoepFiWlOif3yQG9QbL1DBal/5VWlpi9DANJ7mTYFwyfcfmLVrgyOF7Q1apk7iYfsSvHfsu5g7JIJTdnVWpCzoJI5PLRa2V9d9/jz+3bGGKpunpD4mJiZW/iy1F1Ab+qy+/5BNLjDF3pExiPP/iixg+coTGdk9moUi10iadRAaU0zCJRV98gcT4BJiKeLXXuLgIS0fopu3662+sWbWK1zgZAl1rUpQX/udzbjGqw91N8/2pG7o2iMBffP45Tp84WSXC3LgRrXe/yTL6+zXf4fat27AGaJzLpt82mdT3xZuRQ5swxlon506fxt87/q7SBdaF4qIi/PzjDzh96rTRr4mMjMSI0aP4kAt9kIp8v/y8PGzfug1JiUmwJky2+8rLrJtYZWqToHKl+edTXl5mFbJUvr+Jc53oXIqLzOuuRa8t1VP0bynYPb12mAQ7YewwCXbC2GES7ISpIyBz3FFu/oQ5Y2GvS6qFKBRpfUam9mtvvI5tW/4wKmhJULJ/eXn5PIiazQK4CiMMCDthaiHiYoXVHA7M7zTq5Zf5jykg6yqDRcapweSSRYtw7aqB8dCwo9aBRh7H3baML4wchjSLcsiTT+Ln335DaGgDvcfbCVMLQUvOvLlzkZWZAUuCiPP6m9P1zt60E6aWgvr+Tps4Gf/u28e8u4koLbGM045GNqtP4dWGXYepxThy5CjOnj2HBg1C4O3ra1JyG0mRoU8P5QPW1RHEIuFyme4aNDthajloou716zdgDkgyaRPGEOnsS9J9DBrhbCrshLHDJNgJY4dJsBPGDpNgJ0yNgqRGzRwQg8mEadehrdW+VEBAAILqG58JT+fRpGkTmIvm4S2tNpyLUlDbtm9v0rUKDKyHZi3CYQvQefXs2QOmQqdZTZ20Kc6g/YVXrFrFYw+lZiROT3jlVVy6dLni/UUCXU2bNcOh48f4+xvTR1fu5CxawFVYUMACaZoBOLHsty7duuHU+bPIoObPJmbeUTrkgo8X3H1vYbCP0kTfmzMHk6ZONSqLjo738fOHTKRSskQrJ7h3n974v8WLUBVQzravn7DxNCX4K6H72uskTF5uLotgZsLbR/OGqGIP5sBJbWKaWACNIGNOo8Cg+qgK7txJEgyzunPnjuixJAmC6gfDVHj73hsukc4IR5UB2mUsdK0sUZEYH6c5KMLZ2Zk52KwzCyqWxaj0DWHVuSRlZWfh9EnrTaY/eOAgn1hmDZw6cRI5Odlan3fAakNFi4tLcPTQIVgDaWlpuHjBVoM0gMPse1Cqgy7oJEwhc+qs/nY1H/diDcTejsWKr5danDS3bsZg5fIV7H01l6B/9//DlpGtViPNfz//D5KSLJuxzysPNm5k73sHtgDN0F79zSqU6cmn0TkklECu44jLlxHAliAPL08uCqui8P76889IVLuoVyIjkJ6axpY4P7i6uUJu5rApIkFqSgoOHTyI6a+9zsmojSK2RJ05dRr5bKmlAj0aLCqtQiVkZEQkdu/cVfl3Cvv8w+zz6zHFnbo2uLq4mN05nHQwujZLFy/BhnXrBQ9VkyZN8NQzz8ASoMqJZLZc7929Gx/P+wg3b+oZIaTEnzoHbKmDAlVUTVgvqB6cRQrCjMXRw0dQyJ4adRAByToKoQCajw9vl2EqCtiam8z0lvi4BI2KRDGQckm1ysEhwfBkFpKDmQ/ArZu3EB0tLPpyZLGYZi2asYcggF0r0x8AynpLTUlFHCN9to4uFNQkoUPHDrAE6NrR+EEqzDNYoalQjmGEkb/EFqYNsAci7dCPMqWi/BkHiRQXmazJgh126IMSaQqZLMIhr6QkSqmU/As77NAHCfYUFRXdIq2sXC5Rfsr+L4AddoiAaXnZpRJ8zn5VcjU+q7T0PKQOT7E9cbDDDjUwssRIlA5PMmMi8u7fGnB3k8nGs/+fZLtq7pxcO2wAZSojx+a80tJ17I9K1+//A1xB8vOOSuDYAAAAAElFTkSuQmCC"},"background":{"type":"default","color":{"x":0.01568627450980392,"y":0.03529411764705882,"z":0.0392156862745098,"w":0.00392156862745098}},"watermarkLocation":"default","autoFit":true},"physics":{"physicsEngine":"physics-ammo","gravity":{"x":0,"y":-10,"z":0},"allowSleep":true,"sleepThreshold":0.1,"autoSimulation":true,"fixedTimeStep":0.0166667,"maxSubSteps":1,"defaultMaterial":"ba21476f-2866-4f81-9c4d-6e359316e448"}} \ No newline at end of file diff --git a/code/src/system.bundle.js b/code/src/system.bundle.js new file mode 100644 index 0000000..f56a7b7 --- /dev/null +++ b/code/src/system.bundle.js @@ -0,0 +1 @@ +!function(){"use strict";function e(e,t){return(t||"")+" (SystemJS https://git.io/JvFET#"+e+")"}var t,n="undefined"!=typeof Symbol,r="undefined"!=typeof self,i="undefined"!=typeof document,o=r?self:global;if(i){var s=document.querySelector("base[href]");s&&(t=s.href)}if(!t&&"undefined"!=typeof location){var u=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==u&&(t=t.slice(0,u+1))}var c=/\\/g;function a(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(c,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){var n,r=t.slice(0,t.indexOf(":")+1);if(n="/"===t[r.length+1]?"file:"!==r?(n=t.slice(r.length+2)).slice(n.indexOf("/")+1):t.slice(8):t.slice(r.length+("/"===t[r.length])),"/"===e[0])return t.slice(0,t.length-n.length-1)+e;for(var i=n.slice(0,n.lastIndexOf("/")+1)+e,o=[],s=-1,u=0;un.length&&"/"!==r[r.length-1]))return r+e.slice(n.length);p("W2",n,r)}}function p(t,n,r,i){console.warn(e(t,[r,n].join(", ")))}function d(e,t,n){for(var r=e.scopes,i=n&&h(n,r);i;){var o=v(t,r[i]);if(o)return o;i=h(i.slice(0,i.lastIndexOf("/")),r)}return v(t,e.imports)||-1!==t.indexOf(":")&&t}var m=n&&Symbol.toStringTag,g=n?Symbol():"@";function y(){this[g]={}}var S,w=y.prototype;function b(t,n,r){var i=t[g][n];if(i)return i;var o=[],s=Object.create(null);m&&Object.defineProperty(s,m,{value:"Module"});var u=Promise.resolve().then((function(){return t.instantiate(n,r)})).then((function(r){if(!r)throw Error(e(2,n));var u=r[1]((function(e,t){i.h=!0;var n=!1;if("string"==typeof e)e in s&&s[e]===t||(s[e]=t,n=!0);else{for(var r in e){t=e[r];r in s&&s[r]===t||(s[r]=t,n=!0)}e.__esModule&&(s.__esModule=e.__esModule)}if(n)for(var u=0;ut.resolve(e()).then((()=>n))),(n=>t.resolve(e()).then((()=>{throw n}))))};function j(e,t,n){if(n[t.id])return t.E;if(n[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}const r=t.e;var i;if(t.e=null,t.d.forEach((function(r){try{var o=j(e,r,n);o&&(i=i||[]).push(o)}catch(e){throw t.er=e,e}})),i)return t.E=x.call(Promise.all(i).then(s),(function(){t.E=null}));var o=s();if(o)return t.E=x.call(o,(function(){t.E=null}));function s(){try{var e=r.call(O);if(e)return e=e.then((function(){t.C=t.n}),(function(e){throw t.er=e,e}));t.C=t.n,t.L=t.I=void 0}catch(e){throw t.er=e,e}}}o.System=new y;const P="undefined"!=typeof $global?$global:"function"==typeof getApp?getApp().GameGlobal:void 0;(void 0!==P?P.System:System).constructor.prototype.instantiate=function(e,t){throw new Error(`Unable to instantiate ${e} from ${t}`)};var R="undefined"!=typeof Symbol&&Symbol.toStringTag;w.get=function(e){var t=this[g][e];if(t&&null===t.e&&!t.E)return t.er?null:t.n},w.set=function(e,t){var n;R&&"Module"===t[R]?n=t:(n=Object.assign(Object.create(null),t),R&&Object.defineProperty(n,R,{value:"Module"}));var r=Promise.resolve(n),i=this[g][e]||(this[g][e]={id:e,i:[],h:!1,d:[],e:null,er:void 0,E:void 0});return!i.e&&!i.E&&(Object.assign(i,{n:n,I:void 0,L:void 0,C:r}),n)},w.has=function(e){return!!this[g][e]},w.delete=function(e){var t=this[g],n=t[e];if(!n||n.p&&null!==n.p.e||n.E)return!1;var r=n.i;return n.d&&n.d.forEach((function(e){var t=e.i.indexOf(n);-1!==t&&e.i.splice(t,1)})),delete t[e],function(){var n=t[e];if(!n||!r||null!==n.e||n.E)return!1;r.forEach((function(e){n.i.push(e),e(n.n)})),r=null}};var M="undefined"!=typeof Symbol&&Symbol.iterator;w.entries=function(){var e,t,n=this,r=Object.keys(n[g]),i=0,o={next:function(){for(;void 0!==(t=r[i++])&&void 0===(e=n.get(t)););return{done:void 0===t,value:void 0!==t&&[t,e]}}};return o[M]=function(){return this},o};var C,L,A=Promise.resolve(),I={imports:{},scopes:{},depcache:{},integrity:{}},W=i;function T(){[].forEach.call(document.querySelectorAll("script"),(function(n){if(!n.sp)if("systemjs-module"===n.type){if(n.sp=!0,!n.src)return;System.import("import:"===n.src.slice(0,7)?n.src.slice(7):f(n.src,t)).catch((function(e){if(e.message.indexOf("https://git.io/JvFET#3")>-1){var t=document.createEvent("Event");t.initEvent("error",!1,!1),n.dispatchEvent(t)}return Promise.reject(e)}))}else if("systemjs-importmap"===n.type){n.sp=!0;var r=n.src?fetch(n.src,{integrity:n.integrity}).then((function(e){if(!e.ok)throw Error(e.status);return e.text()})).catch((function(t){return t.message=e("W4",n.src)+"\n"+t.message,console.warn(t),"{}"})):n.innerHTML;A=A.then((function(){return r})).then((function(r){!function(t,n,r){var i={};try{i=JSON.parse(n)}catch(t){console.warn(Error(e("W5")))}!function(e,t,n){var r;for(r in e.imports&&l(e.imports,n.imports,t,n,null),e.scopes||{}){var i=f(r,t);l(e.scopes[r],n.scopes[i]||(n.scopes[i]={}),t,n,i)}for(r in e.depcache||{})n.depcache[f(r,t)]=e.depcache[r];for(r in e.integrity||{})n.integrity[f(r,t)]=e.integrity[r]}(i,r,t)}(I,r,n.src||t)}))}}))}if(w.prepareImport=function(e){return(W||e)&&(T(),W=!1),A},i&&(T(),window.addEventListener("DOMContentLoaded",T)),i){window.addEventListener("error",(function(e){J=e.filename,_=e.error}));var $=location.origin}w.createScript=function(e){var t=document.createElement("script");t.async=!0,e.indexOf($+"/")&&(t.crossOrigin="anonymous");var n=I.integrity[e];return n&&(t.integrity=n),t.src=e,t};var J,_,N={},F=w.register;w.register=function(e,t){if(i&&"loading"===document.readyState&&"string"!=typeof e){var n=document.querySelectorAll("script[src]"),r=n[n.length-1];if(r){r.src,C=e;var o=this;L=setTimeout((function(){N[r.src]=[e,t],o.import(r.src)}))}}else C=void 0;return F.call(this,e,t)},w.instantiate=function(t,n){var r=N[t];if(r)return delete N[t],r;var i=this;return new Promise((function(r,o){var s=w.createScript(t);s.addEventListener("error",(function(){o(Error(e(3,[t,n].join(", "))))})),s.addEventListener("load",(function(){if(document.head.removeChild(s),J===t)o(_);else{var e=i.getRegister();e&&e[0]===C&&clearTimeout(L),r(e)}})),document.head.appendChild(s)}))},w.shouldFetch=function(){return!1},"undefined"!=typeof fetch&&(w.fetch=fetch);var k=w.instantiate,B=/^(text|application)\/(x-)?javascript(;|$)/;w.instantiate=function(t,n){var r=this;return this.shouldFetch(t)?this.fetch(t,{credentials:"same-origin",integrity:I.integrity[t]}).then((function(i){if(!i.ok)throw Error(e(7,[i.status,i.statusText,t,n].join(", ")));var o=i.headers.get("content-type");if(!o||!B.test(o))throw Error(e(4,o));return i.text().then((function(e){return e.indexOf("//# sourceURL=")<0&&(e+="\n//# sourceURL="+t),(0,eval)(e),r.getRegister()}))})):k.apply(this,arguments)},w.resolve=function(n,r){return d(I,a(n,r=r||t)||n,r)||function(t,n){throw Error(e(8,[t,n].join(", ")))}(n,r)};var q=w.instantiate;w.instantiate=function(e,t){var n=I.depcache[e];if(n)for(var r=0;r